Changeset 76 in dev for BasicCompiler64
- Timestamp:
- Mar 21, 2007, 9:26:56 PM (18 years ago)
- Location:
- BasicCompiler64
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/BasicCompiler.vcproj
r75 r76 1258 1258 </Filter> 1259 1259 <Filter 1260 Name="Debug"1261 >1262 <File1263 RelativePath="VarList.cpp"1264 >1265 <FileConfiguration1266 Name="Debug|Win32"1267 >1268 <Tool1269 Name="VCCLCompilerTool"1270 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;JPN;$(NoInherit)"1271 UsePrecompiledHeader="0"1272 BrowseInformation="0"1273 />1274 </FileConfiguration>1275 <FileConfiguration1276 Name="Release|Win32"1277 >1278 <Tool1279 Name="VCCLCompilerTool"1280 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;JPN;$(NoInherit)"1281 UsePrecompiledHeader="0"1282 BrowseInformation="1"1283 />1284 </FileConfiguration>1285 <FileConfiguration1286 Name="English_Rel|Win32"1287 >1288 <Tool1289 Name="VCCLCompilerTool"1290 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;ENG;$(NoInherit)"1291 UsePrecompiledHeader="0"1292 />1293 </FileConfiguration>1294 <FileConfiguration1295 Name="Release2|Win32"1296 >1297 <Tool1298 Name="VCCLCompilerTool"1299 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;JPN;$(NoInherit)"1300 UsePrecompiledHeader="0"1301 BrowseInformation="0"1302 />1303 </FileConfiguration>1304 </File>1305 <File1306 RelativePath="WatchList.cpp"1307 >1308 <FileConfiguration1309 Name="Debug|Win32"1310 >1311 <Tool1312 Name="VCCLCompilerTool"1313 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;JPN;$(NoInherit)"1314 UsePrecompiledHeader="0"1315 BrowseInformation="0"1316 />1317 </FileConfiguration>1318 <FileConfiguration1319 Name="Release|Win32"1320 >1321 <Tool1322 Name="VCCLCompilerTool"1323 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;JPN;$(NoInherit)"1324 UsePrecompiledHeader="0"1325 BrowseInformation="1"1326 />1327 </FileConfiguration>1328 <FileConfiguration1329 Name="English_Rel|Win32"1330 >1331 <Tool1332 Name="VCCLCompilerTool"1333 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;ENG;$(NoInherit)"1334 UsePrecompiledHeader="0"1335 />1336 </FileConfiguration>1337 <FileConfiguration1338 Name="Release2|Win32"1339 >1340 <Tool1341 Name="VCCLCompilerTool"1342 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;JPN;$(NoInherit)"1343 UsePrecompiledHeader="0"1344 BrowseInformation="0"1345 />1346 </FileConfiguration>1347 </File>1348 </Filter>1349 <Filter1350 1260 Name="32及び64共通" 1351 1261 > … … 1384 1294 <File 1385 1295 RelativePath="..\BasicCompiler_Common\Object.cpp" 1296 > 1297 </File> 1298 <File 1299 RelativePath="..\BasicCompiler_Common\OldStatement.cpp" 1386 1300 > 1387 1301 </File> … … 1472 1386 RelativePath="..\BasicCompiler_Common\DebugSection.h" 1473 1387 > 1388 </File> 1389 <File 1390 RelativePath="..\BasicCompiler_Common\VarList.cpp" 1391 > 1392 </File> 1393 <File 1394 RelativePath="..\BasicCompiler_Common\WatchList.cpp" 1395 > 1396 <FileConfiguration 1397 Name="Debug|Win32" 1398 > 1399 <Tool 1400 Name="VCCLCompilerTool" 1401 ObjectFile="$(IntDir)\$(InputName)1.obj" 1402 XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" 1403 /> 1404 </FileConfiguration> 1405 <FileConfiguration 1406 Name="Release|Win32" 1407 > 1408 <Tool 1409 Name="VCCLCompilerTool" 1410 ObjectFile="$(IntDir)\$(InputName)1.obj" 1411 XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" 1412 /> 1413 </FileConfiguration> 1414 <FileConfiguration 1415 Name="English_Rel|Win32" 1416 > 1417 <Tool 1418 Name="VCCLCompilerTool" 1419 ObjectFile="$(IntDir)\$(InputName)1.obj" 1420 XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" 1421 /> 1422 </FileConfiguration> 1423 <FileConfiguration 1424 Name="Release2|Win32" 1425 > 1426 <Tool 1427 Name="VCCLCompilerTool" 1428 ObjectFile="$(IntDir)\$(InputName)1.obj" 1429 XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" 1430 /> 1431 </FileConfiguration> 1474 1432 </File> 1475 1433 </Filter> -
BasicCompiler64/Compile_Func.cpp
r75 r76 62 62 63 63 int reg=REG_RAX; 64 NumOpe(®,temporary,Type(),Type() ,NULL);64 NumOpe(®,temporary,Type(),Type()); 65 65 return; 66 66 } 67 68 67 69 68 int SubScripts[MAX_ARRAYDIM]; 70 69 RELATIVE_VAR RelativeVar; 71 70 if(!GetVarOffsetReadOnly(tempParm,&RelativeVar,type,SubScripts)) return; 72 73 71 74 72 if(type.GetBasicType()&FLAG_PTR){ -
BasicCompiler64/Compile_ProcOp.cpp
r75 r76 201 201 extern UserProc **ppSubHash; 202 202 extern BOOL bDebugCompile; 203 int i3,i4 ,BufferSize;203 int i3,i4; 204 204 char temporary[VN_SIZE]; 205 205 206 BufferSize=128;207 208 206 if( pUserProc->IsUsing() == false || pUserProc->IsCompiled() ) return; 207 208 if( pUserProc->localVars.size() ){ 209 SetError(); 210 return; 211 } 209 212 210 213 pUserProc->CompleteCompile(); … … 217 220 if(memcmp(pUserProc->GetName().c_str(),"_DebugSys_",10)==0){ 218 221 if(!bDebugCompile){ 219 pUserProc->localVars.clear();220 222 return; 221 223 } … … 231 233 //////////////////// 232 234 233 extern int MaxLocalVarNum;234 235 extern int AllLocalVarSize; 235 MaxLocalVarNum=0;236 236 AllLocalVarSize=0; 237 237 … … 247 247 248 248 pUserProc->endOpAddress=obp; 249 pUserProc->localVars.clear();250 249 return; 251 250 } … … 294 293 extern int AllLocalVarSize; 295 294 AllLocalVarSize=0; 296 pUserProc->localVars.clear();297 295 298 296 //ローカル変数アドレススケジュール -
BasicCompiler64/Compile_Statement.cpp
r75 r76 964 964 } 965 965 966 void Opcode_Input(const char *Parameter){967 extern int cp;968 int i2,i3,i4,i5;969 BOOL bFile;970 char temporary[VN_SIZE],temp2[VN_SIZE],buffer[VN_SIZE];971 972 if(Parameter[0]=='#'){973 bFile=1;974 for(i2=0,i3=1;;i2++,i3++){975 buffer[i2]=Parameter[i3];976 if(Parameter[i3]==','||Parameter[i3]=='\0') break;977 }978 buffer[i2+1]=0;979 i2=i3+1;980 }981 else{982 bFile=0;983 i2=0;984 buffer[0]=0;985 986 //表示用文字列パラメータをセット987 if(Parameter[0]=='\"'){988 buffer[0]='\"';989 for(i2=1;;i2++){990 if(Parameter[i2]=='\"'){991 buffer[i2]=0;992 break;993 }994 buffer[i2]=Parameter[i2];995 }996 if(Parameter[i2+1]==';') lstrcpy(buffer+i2,"? \"");997 else if(Parameter[i2+1]==',') lstrcpy(buffer+i2,"\"");998 else SetError(10,"Input",cp);999 i2+=2;1000 }1001 else if((Parameter[0]=='e'||Parameter[0]=='E')&&1002 (Parameter[1]=='x'||Parameter[1]=='X')&&1003 Parameter[2]=='\"'){1004 memcpy(buffer,Parameter,3);1005 for(i2=3;;i2++){1006 if(Parameter[i2]=='\"'){1007 buffer[i2]=0;1008 break;1009 }1010 buffer[i2]=Parameter[i2];1011 }1012 if(Parameter[i2+1]==';') lstrcpy(buffer+i2,"? \"");1013 else if(Parameter[i2+1]==',') lstrcpy(buffer+i2,"\"");1014 else SetError(10,"Input",cp);1015 i2+=2;1016 }1017 else{1018 lstrcpy(buffer,"\"? \"");1019 i2=0;1020 }1021 }1022 1023 //変数ポインタ、変数のタイプをセット1024 i4=0;1025 while(1){1026 for(i3=0;;i2++,i3++){1027 if(Parameter[i2]=='('){1028 i5=GetStringInPare(temporary+i3,Parameter+i2);1029 i2+=i5-1;1030 i3+=i5-1;1031 }1032 if(Parameter[i2]=='['){1033 i5=GetStringInBracket(temporary+i3,Parameter+i2);1034 i2+=i5-1;1035 i3+=i5-1;1036 }1037 if(Parameter[i2]==','){1038 temporary[i3]=0;1039 i2++;1040 break;1041 }1042 temporary[i3]=Parameter[i2];1043 if(Parameter[i2]=='\0') break;1044 }1045 if(temporary[0]=='\0'){1046 SetError(10,"Input",cp);1047 return;1048 }1049 1050 Type varType;1051 if( !GetVarType(temporary, varType, 1) ){1052 return;1053 }1054 1055 sprintf(temp2,"_System_InputDataPtr[%d]=VarPtr(%s)",i4,temporary);1056 OpcodeCalc(temp2);1057 1058 if(varType.IsLong()) varType.SetBasicType( DEF_DWORD );1059 else if(varType.IsInteger()) varType.SetBasicType( DEF_WORD );1060 else if(varType.IsObject()){1061 varType.SetBasicType( DEF_OBJECT );1062 if( varType.IsStringObject() ){1063 varType.SetBasicType( DEF_STRING );1064 }1065 }1066 sprintf(temp2,"_System_InputDataType[%d]=%d",i4,varType.GetBasicType());1067 OpcodeCalc(temp2);1068 1069 i4++;1070 if(Parameter[i2]=='\0') break;1071 }1072 sprintf(temp2,"_System_InputDataPtr[%d]=0",i4);1073 OpcodeCalc(temp2);1074 1075 UserProc *pUserProc;1076 if(bFile) pUserProc=GetSubHash("INPUT_FromFile");1077 else pUserProc=GetSubHash("INPUT_FromPrompt");1078 if(!pUserProc){1079 SetError(3,"Input",cp);1080 return;1081 }1082 Opcode_CallProc(buffer,pUserProc,0,"",0);1083 }1084 void Opcode_PrintUsing(const char *Parameter,char *buffer,BOOL bFile){1085 extern int cp;1086 int i2,i3,i4,i5;1087 char temporary[VN_SIZE],temp2[8192];1088 BOOL bReturnLine;1089 1090 char parms[8192];1091 lstrcpy( parms, Parameter );1092 1093 i2=lstrlen(parms);1094 if(parms[i2-1]==';'){1095 bReturnLine=0;1096 parms[i2-1]=0;1097 }1098 else bReturnLine=1;1099 1100 i3=lstrlen(buffer);1101 for(i2=0;;i2++,i3++){1102 if(parms[i2]==';'){1103 buffer[i3]=0;1104 break;1105 }1106 buffer[i3]=parms[i2];1107 if(parms[i2]=='\0') break;1108 }1109 if(parms[i2]==';') i2++;1110 1111 if(bReturnLine) lstrcat(buffer,"+Ex\"\\r\\n\"");1112 1113 //データポインタ、データのタイプをセット1114 i4=0;1115 while(1){1116 for(i3=0;;i2++,i3++){1117 if(parms[i2]=='\"'){1118 temporary[i3]=parms[i2];1119 for(i2++,i3++;;i2++,i3++){1120 temporary[i3]=parms[i2];1121 if(parms[i2]=='\"') break;1122 }1123 continue;1124 }1125 if(parms[i2]=='('){1126 i5=GetStringInPare(temporary+i3,parms+i2);1127 i2+=i5-1;1128 i3+=i5-1;1129 continue;1130 }1131 if(parms[i2]=='['){1132 i5=GetStringInBracket(temporary+i3,parms+i2);1133 i2+=i5-1;1134 i3+=i5-1;1135 continue;1136 }1137 if(parms[i2]==','){1138 temporary[i3]=0;1139 i2++;1140 break;1141 }1142 temporary[i3]=parms[i2];1143 if(parms[i2]=='\0') break;1144 }1145 if(temporary[0]=='\0'){1146 SetError(10,"Print",cp);1147 return;1148 }1149 1150 int iResult;1151 iResult=IsStrCalculation(temporary);1152 1153 if(iResult==1){1154 //文字列1155 sprintf(temp2,"_System_UsingStrData[%d]=%s",i4,temporary);1156 OpcodeCalc(temp2);1157 1158 sprintf(temp2,"_System_UsingDataType[%d]=%d",i4,DEF_STRING);1159 OpcodeCalc(temp2);1160 }1161 else if(iResult==0){1162 //数値1163 sprintf(temp2,"_System_UsingDblData[%d]=%s",i4,temporary);1164 OpcodeCalc(temp2);1165 1166 sprintf(temp2,"_System_UsingDataType[%d]=%d",i4,DEF_DOUBLE);1167 OpcodeCalc(temp2);1168 }1169 //else if(iResult==-1) エラー1170 1171 i4++;1172 if(parms[i2]=='\0') break;1173 }1174 sprintf(temp2,"_System_UsingDataType[%d]=-1",i4);1175 OpcodeCalc(temp2);1176 1177 UserProc *pUserProc;1178 if(bFile) pUserProc=GetSubHash("PRINTUSING_ToFile");1179 else pUserProc=GetSubHash("PRINTUSING_ToPrompt");1180 if(!pUserProc){1181 SetError(3,"Print",cp);1182 return;1183 }1184 Opcode_CallProc(buffer,pUserProc,0,"",0);1185 }1186 void Opcode_Print(const char *Parameter,BOOL bWrite){1187 int i2,i3,i4,sw;1188 char temporary[VN_SIZE],buffer[VN_SIZE];1189 BOOL bFile;1190 1191 if(Parameter[0]=='#'){1192 bFile=1;1193 for(i2=0,i3=1;;i2++,i3++){1194 buffer[i2]=Parameter[i3];1195 if(Parameter[i3]==','||Parameter[i3]=='\0') break;1196 }1197 buffer[i2+1]=0;1198 if(Parameter[i3]==',') i3++;1199 i2=i3;1200 }1201 else{1202 bFile=0;1203 i2=0;1204 buffer[0]=0;1205 }1206 if(Parameter[i2]==1&&Parameter[i2+1]==ESC_USING){1207 Opcode_PrintUsing(Parameter+i2+2,buffer,bFile);1208 return;1209 }1210 1211 lstrcat(buffer,"_System_DummyStr+");1212 1213 sw=1;1214 while(1){1215 for(i3=0;;i2++,i3++){1216 if(Parameter[i2]=='\"'){1217 temporary[i3]=Parameter[i2];1218 for(i2++,i3++;;i2++,i3++){1219 temporary[i3]=Parameter[i2];1220 if(Parameter[i2]=='\"') break;1221 }1222 continue;1223 }1224 if(Parameter[i2]=='('){1225 i4=GetStringInPare(temporary+i3,Parameter+i2);1226 i2+=i4-1;1227 i3+=i4-1;1228 continue;1229 }1230 if(Parameter[i2]=='['){1231 i4=GetStringInBracket(temporary+i3,Parameter+i2);1232 i2+=i4-1;1233 i3+=i4-1;1234 continue;1235 }1236 if(Parameter[i2]==','||Parameter[i2]==';'){1237 temporary[i3]=0;1238 break;1239 }1240 temporary[i3]=Parameter[i2];1241 if(Parameter[i2]=='\0') break;1242 }1243 1244 if(temporary[0]=='\0') lstrcat(buffer,"\"\"");1245 else{1246 int iResult;1247 iResult=IsStrCalculation(temporary);1248 if(iResult==-1){1249 //エラー1250 lstrcat(buffer,"\"\"");1251 }1252 else if(iResult){1253 //文字列1254 lstrcat(buffer,temporary);1255 }1256 else{1257 //数値1258 sprintf(buffer+lstrlen(buffer),"Str$(%s)",temporary);1259 }1260 }1261 1262 if(Parameter[i2]==','){1263 if(bWrite) lstrcat(buffer,"+\",\"+");1264 else lstrcat(buffer,"+\"\t\"+");1265 }1266 else if(Parameter[i2]==';'){1267 if(Parameter[i2+1]=='\0'){1268 sw=0;1269 break;1270 }1271 if(bWrite) lstrcat(buffer,"+\",\"+");1272 else lstrcat(buffer,"+\" \"+");1273 }1274 else if(Parameter[i2]=='\0') break;1275 1276 i2++;1277 }1278 1279 if(sw) lstrcat(buffer,"+Ex\"\\r\\n\"");1280 1281 UserProc *pUserProc;1282 if(bFile) pUserProc=GetSubHash("PRINT_ToFile");1283 else pUserProc=GetSubHash("PRINT_ToPrompt");1284 if(!pUserProc){1285 SetError(3,"Print",cp);1286 return;1287 }1288 Opcode_CallProc(buffer,pUserProc,0,"",0);1289 }1290 1291 1292 1293 966 1294 967 //////////// -
BasicCompiler64/Compile_Var.cpp
r75 r76 4 4 //変数 5 5 Variables globalVars; 6 int MaxGlobalVarNum;7 6 int AllGlobalVarSize; 8 7 int AllInitGlobalVarSize; 9 8 10 int MaxLocalVarNum;11 9 int AllLocalVarSize; 12 10 -
BasicCompiler64/MakePeHdr.cpp
r75 r76 264 264 obj_LexScopes.Init(obp); 265 265 266 267 ///////////////////////////////////////////////////////////////// 268 // デバッグコンパイル用のログを生成する 269 ///////////////////////////////////////////////////////////////// 270 #ifdef _DEBUG 271 { 272 ofstream ofs("middle_code.txt"); 273 ofs << basbuf << endl; 274 ofs.close(); 275 } 276 #endif 266 277 267 278 … … 1090 1101 delete pobj_GlobalVarSchedule; 1091 1102 1092 //グローバル変数情報を扱う構造体も初期バッファの有無による配置を行う1093 //(デバッグ情報で利用される)1094 foreach( Variable *pVar, globalVars ){1095 if(pVar->offset&0x80000000){1096 pVar->offset=(pVar->offset&0x7FFFFFFF)+AllInitGlobalVarSize;1097 }1098 }1099 1100 1103 1101 1104 //////////////////////////////// -
BasicCompiler64/NumOpe.cpp
r75 r76 2 2 #include "Opcode.h" 3 3 4 void NewStringObject(int reg, LPSTR lpszText){4 void NewStringObject(int reg, const char *str){ 5 5 /////////////////////////////////////////////////////// 6 6 // lpszTextを元にStringオブジェクトを生成し、 … … 14 14 ////////////////////////////////////////////////////// 15 15 16 char *parameter = (char *)malloc( lstrlen( lpszText) + 32 );17 sprintf( parameter, "\"%s\"%c%c*Char", lpszText, 1, ESC_AS );16 char *parameter = (char *)malloc( lstrlen( str ) + 32 ); 17 sprintf( parameter, "\"%s\"%c%c*Char", str, 1, ESC_AS ); 18 18 SetStringQuotes( parameter ); 19 19 … … 226 226 i3=lstrlen(term); 227 227 StrLiteral: 228 228 229 229 if( baseType.IsObject() ){ 230 230 if( baseType.IsStringObject() ){ … … 290 290 i4=GetStringInPare_RemovePare(temp2,term+i2+1); 291 291 292 int idProc;293 292 void *pInfo; 294 i dProc=GetProc(temporary,(void **)&pInfo);293 int idProc=GetProc(temporary,(void **)&pInfo); 295 294 296 295 Type resultType; … … 550 549 } 551 550 } 552 553 551 554 552 -
BasicCompiler64/Opcode.h
r75 r76 416 416 void OpcodeGosub(char *Parameter); 417 417 void OpcodeReturn(char *Parameter); 418 void Opcode_Input(const char *Parameter);419 void Opcode_Print(const char *Parameter,BOOL bWrite);420 void OpcodeCallPtr(char *Parameter);421 418 void OpcodeSetPtrData(char *Parameter,int type); 422 419 -
BasicCompiler64/OperatorProc.cpp
r75 r76 42 42 BOOL bTwoTerm=1; 43 43 if(idCalc==CALC_AS) bTwoTerm=0; 44 45 46 int i;47 44 48 45 … … 79 76 } 80 77 81 for(i =0;i<(int)params.size();i++){78 for(int i=0;i<(int)params.size();i++){ 82 79 CheckDifferentType( 83 80 pUserProc->Params()[i]->GetBasicType(),
Note:
See TracChangeset
for help on using the changeset viewer.