e32tools/elf2e32/source/parametermanager.cpp
changeset 590 360bd6b35136
parent 0 044383f39525
child 607 378360dbbdba
equal deleted inserted replaced
588:c7c26511138f 590:360bd6b35136
    23 
    23 
    24 #include "pl_common.h"
    24 #include "pl_common.h"
    25 #include "parametermanager.h"
    25 #include "parametermanager.h"
    26 #include "errorhandler.h"
    26 #include "errorhandler.h"
    27 #include <iostream>
    27 #include <iostream>
       
    28 #include <ctype.h>
    28 
    29 
    29 #include "h_utl.h"
    30 #include "h_utl.h"
    30 #include "h_ver.h"
    31 #include "h_ver.h"
    31 /**
    32 /**
    32 Constructor for the ParameterManager.
    33 Constructor for the ParameterManager.
   373 		"Call Entry Point",
   374 		"Call Entry Point",
   374 	},
   375 	},
   375 	{
   376 	{
   376 		"fpu",
   377 		"fpu",
   377 		(void *)ParameterManager::ParseFPU,
   378 		(void *)ParameterManager::ParseFPU,
   378 		"FPU type [softvfp|vfpv2]",
   379 		"FPU type [softvfp|vfpv2|vfpv3|vfpv3D16]",
   379 	},
   380 	},
   380 	{
   381 	{
   381         "codepaging",
   382         "codepaging",
   382 		(void *)ParameterManager::ParseCodePaging,
   383 		(void *)ParameterManager::ParseCodePaging,
   383 		"Code Paging Strategy [paged|unpaged|default]",
   384 		"Code Paging Strategy [paged|unpaged|default]",
  2239 	{
  2240 	{
  2240 
  2241 
  2241 		int q = 0;
  2242 		int q = 0;
  2242 		unsigned int ordinalnum = 0;
  2243 		unsigned int ordinalnum = 0;
  2243 		char *symbol = 0;
  2244 		char *symbol = 0;
  2244 
  2245 		int nq = aSysDefValues.find_first_not_of(" 	");
  2245 		int nq = aSysDefValues.find_first_of(",", q,sizeof(*p));
  2246 		if (nq && (nq != string::npos))
       
  2247 		{
       
  2248 			sysdeflength -= nq;
       
  2249 			aSysDefValues.erase(0, nq);
       
  2250 		}		
       
  2251 
       
  2252 		nq = aSysDefValues.find_first_of(",", q,sizeof(*p));
  2246 		if (nq && (nq != string::npos))
  2253 		if (nq && (nq != string::npos))
  2247 		{
  2254 		{
  2248 			int len = nq;
  2255 			int len = nq;
       
  2256 			while (*(p+len-1) == ' ' || *(p+len-1) == '	')
       
  2257 				len --;
  2249 			symbol = new char[len+1];
  2258 			symbol = new char[len+1];
  2250 			memcpy(symbol, p, len);
  2259 			memcpy(symbol, p, len);
  2251 			symbol[len] = 0;
  2260 			symbol[len] = 0;
  2252 			q = nq+1;
  2261 			q = nq+1;
       
  2262       while (*(p+q) == ' ' || *(p+q) == '	')
       
  2263       	q ++;
  2253 
  2264 
  2254 			char val = *(p+q);
  2265 			char val = *(p+q);
  2255 			if (!val || !isdigit(val))
  2266 			if (!val || !isdigit(val))
  2256 				throw ParameterParserError(SYSDEFERROR, "--sysdef");
  2267 				throw ParameterParserError(SYSDEFERROR, "--sysdef");
  2257 			ordinalnum = *(p+q) - '0';
  2268 			ordinalnum = *(p+q) - '0';
  2258 			aPM->SetSysDefs(ordinalnum, symbol, sysdefcount);
  2269 			aPM->SetSysDefs(ordinalnum, symbol, sysdefcount);
       
  2270       while (*(p+q+1) == ' ' || *(p+q+1) == '	')
       
  2271       	q ++;
  2259 
  2272 
  2260 			unsigned int separator = aSysDefValues.find(";", 0);
  2273 			unsigned int separator = aSysDefValues.find(";", 0);
  2261 
  2274 
  2262 			if (separator && (separator != string::npos))
  2275 			if (separator && (separator != string::npos))
  2263 			{
  2276 			{
  2563 {
  2576 {
  2564 	INITIALISE_PARAM_PARSER;
  2577 	INITIALISE_PARAM_PARSER;
  2565 
  2578 
  2566 	if (strnicmp(aValue, "softvfp", 7)==0)
  2579 	if (strnicmp(aValue, "softvfp", 7)==0)
  2567 		aPM->SetFPU(0);
  2580 		aPM->SetFPU(0);
  2568 	else if (strnicmp(aValue, "vfpv2", 5)==0)
  2581 	else if ((strnicmp(aValue, "vfpv2", 5)==0) || (strnicmp(aValue, "softvfp+vfpv2",13 )==0))
  2569 		aPM->SetFPU(1);
  2582 		aPM->SetFPU(1);
       
  2583 	else if (strnicmp(aValue,"vfpv3", 5)==0)
       
  2584 		aPM->SetFPU(2);
       
  2585 	else if (strnicmp(aValue,"vfpv3D16", 8)==0)
       
  2586 		aPM->SetFPU(3);
  2570 	else
  2587 	else
  2571 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
  2588 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
  2572 }
  2589 }
  2573 
  2590 
  2574 /**
  2591 /**