imgtools/romtools/rofsbuild/rofsbuild.cpp
changeset 698 e3ee96a3961c
parent 694 c3fbb20e86f0
child 708 0757c2976f96
equal deleted inserted replaced
697:818fe0ed324b 698:e3ee96a3961c
    46 #define _alloca alloca
    46 #define _alloca alloca
    47 #endif
    47 #endif
    48 
    48 
    49 static const TInt RofsbuildMajorVersion=2;
    49 static const TInt RofsbuildMajorVersion=2;
    50 static const TInt RofsbuildMinorVersion=17;
    50 static const TInt RofsbuildMinorVersion=17;
    51 static const TInt RofsbuildPatchVersion=0;
    51 static const TInt RofsbuildPatchVersion=1;
    52 static TBool SizeSummary=EFalse;
    52 static TBool SizeSummary=EFalse;
    53 static TPrintType SizeWhere=EAlways;
    53 static TPrintType SizeWhere=EAlways;
    54 
    54 
    55 static TInt gHeaderType=1;			// EPOC header
    55 static TInt gHeaderType=1;			// EPOC header
    56 static TInt MAXIMUM_THREADS = 128;
    56 static TInt MAXIMUM_THREADS = 128;
   164 				if(argv[i][5]) {
   164 				if(argv[i][5]) {
   165 					gSmrImage = ETrue;
   165 					gSmrImage = ETrue;
   166 					gSmrFileName.assign(&argv[i][5]);
   166 					gSmrFileName.assign(&argv[i][5]);
   167 				}
   167 				}
   168 				else {
   168 				else {
   169 					Print (EError, "SMR obey file is missing\n");
   169 					printf ("ERROR: SMR obey file is missing\n");
   170 				}
   170 				}
   171 			} else if (stricmp(argv[i], "-K") == 0) {
   171 			} else if (stricmp(argv[i], "-K") == 0) {
   172 				gKeepGoing = ETrue;
   172 				gKeepGoing = ETrue;
   173 			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
   173 			}else if (stricmp(argv[i], "-SYMBOLS") == 0) {
   174 				gGenSymbols = ETrue;
   174 				gGenSymbols = ETrue;
   243 			else if(strnicmp(argv[i], "-OBY-CHARSET=", 13) == 0)
   243 			else if(strnicmp(argv[i], "-OBY-CHARSET=", 13) == 0)
   244 			{
   244 			{
   245 				if((stricmp(&argv[i][13], "UTF8")==0) || (stricmp(&argv[i][13], "UTF-8")==0))
   245 				if((stricmp(&argv[i][13], "UTF8")==0) || (stricmp(&argv[i][13], "UTF-8")==0))
   246 					gIsOBYUTF8 = ETrue;
   246 					gIsOBYUTF8 = ETrue;
   247 				else
   247 				else
   248 					Print(EError, "Invalid encoding %s, default system internal encoding will be used.\n", &argv[i][13]);
   248 					printf("ERROR: Invalid encoding %s, default system internal encoding will be used.\n", &argv[i][13]);
   249 			}
   249 			}
   250 			else if (stricmp(argv[i], "-UNCOMPRESS") == 0) {
   250 			else if (stricmp(argv[i], "-UNCOMPRESS") == 0) {
   251 				gCompress = ECompressionUncompress;
   251 				gCompress = ECompressionUncompress;
   252 			}
   252 			}
   253 			else if( stricmp(argv[i], "-COMPRESSIONMETHOD") == 0 ) {
   253 			else if( stricmp(argv[i], "-COMPRESSIONMETHOD") == 0 ) {
   254 				// next argument should a be method
   254 				// next argument should a be method
   255 				if( (i+1) >= argc || argv[i+1][0] == '-') {
   255 				if( (i+1) >= argc || argv[i+1][0] == '-') {
   256 					Print (EError, "Missing compression method! Set it to default (no compression)!");
   256 					printf("ERROR: Missing compression method! Set it to default (no compression)!");
   257 					gCompressionMethod = 0;
   257 					gCompressionMethod = 0;
   258 				}
   258 				}
   259 				else {
   259 				else {
   260 					i++;					
   260 					i++;					
   261 					if( stricmp(argv[i], "NONE") == 0) {
   261 					if( stricmp(argv[i], "NONE") == 0) {
   269 					else if( stricmp(argv[i], "BYTEPAIR") == 0) {
   269 					else if( stricmp(argv[i], "BYTEPAIR") == 0) {
   270 						gCompress = ECompressionCompress;
   270 						gCompress = ECompressionCompress;
   271 						gCompressionMethod = KUidCompressionBytePair;	
   271 						gCompressionMethod = KUidCompressionBytePair;	
   272 					}
   272 					}
   273 					else {
   273 					else {
   274 						Print (EError, "Unknown compression method! Set it to default (no compression)!");
   274 						printf("ERROR: Unknown compression method! Set it to default (no compression)!");
   275 						gCompress = ECompressionUnknown;
   275 						gCompress = ECompressionUnknown;
   276 						gCompressionMethod = 0;		
   276 						gCompressionMethod = 0;		
   277 					}
   277 					}
   278 				}
   278 				}
   279 
   279 
   281 			else if (stricmp(argv[i], "-COREIMAGE") == 0) {
   281 			else if (stricmp(argv[i], "-COREIMAGE") == 0) {
   282 				
   282 				
   283 				gUseCoreImage = ETrue;
   283 				gUseCoreImage = ETrue;
   284 				// next argument should be image filename
   284 				// next argument should be image filename
   285 				if ((i+1 >= argc) || argv[i+1][0] == '-')
   285 				if ((i+1 >= argc) || argv[i+1][0] == '-')
   286 					Print (EError, "Missing image file name");
   286 					printf("ERROR: Missing image file name");
   287 				else {
   287 				else {
   288 					i++;
   288 					i++;
   289 					gImageFilename.assign(argv[i]);
   289 					gImageFilename.assign(argv[i]);
   290 				}
   290 				}
   291 			}
   291 			}
   293 				if(argv[i][11])	{
   293 				if(argv[i][11])	{
   294 					gDriveImage = ETrue; 
   294 					gDriveImage = ETrue; 
   295 					gDriveFilename.assign(&argv[i][11]);	
   295 					gDriveFilename.assign(&argv[i][11]);	
   296 				}
   296 				}
   297 				else {
   297 				else {
   298 					Print (EError, "Drive obey file is missing\n"); 
   298 					printf("ERROR: Drive obey file is missing\n"); 
   299 				}
   299 				}
   300 			}
   300 			}
   301 			else if (argv[i][1] == '?') {
   301 			else if (argv[i][1] == '?') {
   302 				reallyHelp = ETrue;
   302 				reallyHelp = ETrue;
   303 			}
   303 			}
   305 				gEnableStdPathWarning = ETrue;						
   305 				gEnableStdPathWarning = ETrue;						
   306 			}
   306 			}
   307 			else if( stricmp(argv[i], "-LOGLEVEL") == 0) {
   307 			else if( stricmp(argv[i], "-LOGLEVEL") == 0) {
   308 				// next argument should a be loglevel
   308 				// next argument should a be loglevel
   309 				if( (i+1) >= argc || argv[i+1][0] == '-') {
   309 				if( (i+1) >= argc || argv[i+1][0] == '-') {
   310 					Print (EError, "Missing loglevel!");
   310 					printf ("ERROR: Missing loglevel!");
   311 					gLogLevel = DEFAULT_LOG_LEVEL;
   311 					gLogLevel = DEFAULT_LOG_LEVEL;
   312 				}
   312 				}
   313 				else {
   313 				else {
   314 					i++;
   314 					i++;
   315 					if (strcmp(argv[i], "2") == 0)
   315 					if (strcmp(argv[i], "2") == 0)
   317 					if (strcmp(argv[i], "1") == 0)
   317 					if (strcmp(argv[i], "1") == 0)
   318 						gLogLevel = LOG_LEVEL_FILE_DETAILS;
   318 						gLogLevel = LOG_LEVEL_FILE_DETAILS;
   319 					else if (strcmp(argv[i], "0") == 0)
   319 					else if (strcmp(argv[i], "0") == 0)
   320 						gLogLevel = DEFAULT_LOG_LEVEL;
   320 						gLogLevel = DEFAULT_LOG_LEVEL;
   321 					else
   321 					else
   322 						Print(EError, "Only loglevel 0, 1 or 2 is allowed!");
   322 						printf("ERROR: Only loglevel 0, 1 or 2 is allowed!");
   323 				}
   323 				}
   324 			}
   324 			}
   325 			else if( stricmp(argv[i], "-LOGLEVEL2") == 0)
   325 			else if( stricmp(argv[i], "-LOGLEVEL2") == 0)
   326 				gLogLevel = (LOG_LEVEL_FILE_DETAILS | LOG_LEVEL_FILE_ATTRIBUTES);
   326 				gLogLevel = (LOG_LEVEL_FILE_DETAILS | LOG_LEVEL_FILE_ATTRIBUTES);
   327 			else if( stricmp(argv[i], "-LOGLEVEL1") == 0)
   327 			else if( stricmp(argv[i], "-LOGLEVEL1") == 0)
   336 			else if (strnicmp(argv[i], "-loginput=", 10) == 0) {
   336 			else if (strnicmp(argv[i], "-loginput=", 10) == 0) {
   337 				loginput = argv[i] + 10;
   337 				loginput = argv[i] + 10;
   338 			}
   338 			}
   339 			else {
   339 			else {
   340 #ifdef WIN32
   340 #ifdef WIN32
   341 				Print (EWarning, "Unrecognised option %s\n",argv[i]);
   341 				printf ("WARNING: Unrecognised option %s\n",argv[i]);
   342 #else
   342 #else
   343 				if(0 == access(argv[i],R_OK)){
   343 				if(0 == access(argv[i],R_OK)){
   344 					filename.assign(argv[i]);
   344 					filename.assign(argv[i]);
   345 				}
   345 				}
   346 				else {
   346 				else {
   347 					Print (EWarning, "Unrecognised option %s\n",argv[i]);
   347 					printf("WARNING: Unrecognised option %s\n",argv[i]);
   348 				}
   348 				}
   349 #endif				
   349 #endif				
   350 
   350 
   351 			}
   351 			}
   352 		}
   352 		}
   357 
   357 
   358 	if (paramFileFlag)
   358 	if (paramFileFlag)
   359 		return;
   359 		return;
   360 	if(gGenSymbols && gGenBsymbols)
   360 	if(gGenSymbols && gGenBsymbols)
   361 	{
   361 	{
   362 		Print(EWarning, "Options symbols and bsymbols cannot be used at the same time, the common symbols file will be created this time!\n");
   362 		printf("WARNING: Options symbols and bsymbols cannot be used at the same time, the common symbols file will be created this time!\n");
   363 		gGenBsymbols = EFalse;
   363 		gGenBsymbols = EFalse;
   364 	}
   364 	}
   365 
   365 
   366 	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
   366 	if((gDriveImage == EFalse) && (gSmrImage ==  EFalse) && 
   367 		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
   367 		(filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){
   369 			if (reallyHelp) {
   369 			if (reallyHelp) {
   370 				ObeyFileReader::KeywordHelp();
   370 				ObeyFileReader::KeywordHelp();
   371 				Print (EAlways, ReallyHelpText);
   371 				Print (EAlways, ReallyHelpText);
   372 			}
   372 			}
   373 			else if (filename.empty()){
   373 			else if (filename.empty()){
   374 				Print(EAlways, "Obey filename is missing\n");
   374 				printf("WARNING: Obey filename is missing\n");
   375 			}
   375 			}
   376 	}	
   376 	}	
   377 }
   377 }
   378 
   378 
   379 /**
   379 /**