Changeset 326 for trunk/idl-compiler
- Timestamp:
- Apr 9, 2008, 10:22:08 PM (17 years ago)
- Location:
- trunk/idl-compiler
- Files:
-
- 6 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/c-emitter_c/c_file_emitter.c
r295 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif 35 37 #include <stdlib.h> 36 38 #include <string.h> … … 79 81 80 82 /* Do return type */ 81 fprintf(fh, "NOM _Scope ");83 fprintf(fh, "NOMDLLEXPORT NOM_Scope "); 82 84 emitReturnType(pLocalPI, pif, pm); 83 85 … … 123 125 } 124 126 125 fprintf(fh, "NOM _Scope ");127 fprintf(fh, "NOMDLLEXPORT NOM_Scope "); 126 128 emitReturnType(pLocalPI, pif, pm); 127 129 fprintf(fh, " NOMLINK impl_%s_%s(%s* nomSelf,\n", pif->chrName, pom->chrName, pif->chrName); … … 167 169 168 170 //printInterface(pif); 169 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL HANDLE)171 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL) 170 172 { 171 173 emitCFileHeader(pLocalPI, pif); … … 173 175 emitOverridenMethods(pLocalPI, pif); 174 176 closeOutfile(pLocalPI->outFile); 177 pLocalPI->outFile = NULL; 175 178 } 176 179 g_free(chrTemp); -
trunk/idl-compiler/c/emitter.c
r290 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdlib.h> 36 39 #include <string.h> 37 40 38 #include <glib.h> 39 #include <glib/gprintf.h> 41 #include <glib.h> 42 #include <glib/gprintf.h> 40 43 41 44 #define INCL_FILE … … 86 89 for(b=0;b<pm->uiStar;b++) 87 90 fprintf(fh, "*"); 88 fprintf(fh, " %s,\n", pm->chrName); 91 fprintf(fh, " %s,\n", pm->chrName); 89 92 } 90 93 } … … 101 104 { 102 105 PMETHODPARAM pm=(PMETHODPARAM)g_ptr_array_index(pArray, a); 103 fprintf(fh, " %s,", pm->chrName); 106 fprintf(fh, " %s,", pm->chrName); 104 107 } 105 108 } -
trunk/idl-compiler/c/nom-idl-compiler.c
r310 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #define INCL_DOSPROCESS 35 #define INCL_DOS 36 #define INCL_DOSPROFILE 37 #define INCL_DOSERRORS 38 39 #include <os2.h> 34 #ifdef __OS2__ 35 # define INCL_DOSPROCESS 36 # define INCL_DOS 37 # define INCL_DOSPROFILE 38 # define INCL_DOSERRORS 39 # include <os2.h> 40 #endif /* __OS2__ */ 41 40 42 #include <stdio.h> 41 43 #include <stdlib.h> 42 44 #include <string.h> 43 45 44 #include <io.h> 46 #ifdef HAVE_IO_H 47 # include <io.h> 48 #endif 49 #ifdef HAVE_UNISTD_H 50 # include <unistd.h> 51 #endif 45 52 #include <fcntl.h> 46 #include <sys \stat.h>47 48 #include <glib.h> 53 #include <sys/stat.h> 54 55 #include <glib.h> 49 56 #include <glib/gprintf.h> 50 57 … … 60 67 61 68 /* Command line options */ 62 static GOptionEntry gOptionEntries[] = 69 static GOptionEntry gOptionEntries[] = 63 70 { 64 71 {"directory", 'd', 0, G_OPTION_ARG_FILENAME, &chrOutputDir, "Output directory", NULL}, … … 361 368 This is the root parse function. Here starts the fun. When a token is found in the 362 369 input stream which matches one of the known token types the respective parsing function 363 is called for further processing. In case of an error the parsing function in question 370 is called for further processing. In case of an error the parsing function in question 364 371 prints an error which describes the problem and exits the application. 365 372 … … 370 377 while(g_scanner_peek_next_token(gScanner) != G_TOKEN_EOF) { 371 378 GTokenType token; 379 GTokenValue value; 372 380 373 381 g_scanner_get_next_token(gScanner); 374 382 token=gScanner->token; 375 GTokenValuevalue=gScanner->value;376 383 value=gScanner->value; 384 377 385 switch(token) 378 386 { … … 468 476 filename\n\n"); 469 477 470 /* This prints the standard option help to screen. */ 478 /* This prints the standard option help to screen. */ 471 479 g_option_context_parse (gContext, &argc2, &argv2, &gError); 472 480 } … … 494 502 void funcMsgHandler(GScanner *gScanner, gchar *message, gboolean error) 495 503 { 496 g_printf("%s:%d: error: %s (%d %d)\n", parseInfo.chrCurrentSourceFile, 504 g_printf("%s:%d: error: %s (%d %d)\n", 505 parseInfo.chrCurrentSourceFile ? parseInfo.chrCurrentSourceFile : "<null>", /* glib doesn't check for NULL like printf. */ 497 506 g_scanner_cur_line(gScanner)-parseInfo.uiLineCorrection, message, 498 507 g_scanner_cur_line(gScanner), parseInfo.uiLineCorrection); … … 554 563 } 555 564 #endif 556 565 557 566 /*** Create output path name ****/ 558 567 if(g_path_is_absolute(chrOutputDir)) … … 572 581 else 573 582 fd=open(argv[1], O_RDONLY); 574 583 575 584 if(-1==fd) 576 585 { … … 600 609 while(pSymbols->chrSymbolName) 601 610 { 602 #warning !!! Create a copy here so it is the same as with new symbols added later. 611 #ifndef _MSC_VER 612 # warning !!! Create a copy here so it is the same as with new symbols added later. 613 #endif 603 614 g_scanner_scope_add_symbol(gScanner, ID_SCOPE, pSymbols->chrSymbolName, 604 615 pSymbols); -
trunk/idl-compiler/c/open_outfile.c
r319 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdlib.h> 36 39 #include <string.h> -
trunk/idl-compiler/c/printdata.c
r321 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif 35 37 #include <stdio.h> 36 38 #include <stdlib.h> 37 39 #include <string.h> 38 40 39 #include <io.h> 41 #ifdef HAVE_IO_H 42 # include <io.h> 43 #endif 44 #ifdef HAVE_UNISTD_H 45 # include <unistd.h> 46 #endif 40 47 #include <fcntl.h> 41 #include <sys \stat.h>48 #include <sys/stat.h> 42 49 43 50 #include <glib/gprintf.h> -
trunk/idl-compiler/c/token.c
r321 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #include <os2.h> 35 #ifdef __OS2__ 36 # include <os2.h> 37 #endif /* __OS2__ */ 38 36 39 #include <stdio.h> 37 40 #include "nom.h" -
trunk/idl-compiler/c/util.c
r292 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif 35 37 #include <stdlib.h> 36 38 #include <string.h> … … 62 64 return NULL; 63 65 64 while((pifParent=getParentInterface(pifParent))!=NULL HANDLE)66 while((pifParent=getParentInterface(pifParent))!=NULL) 65 67 { 66 68 int a; … … 100 102 return NULL; 101 103 102 while((pifParent=getParentInterface(pifParent))!=NULL HANDLE)104 while((pifParent=getParentInterface(pifParent))!=NULL) 103 105 { 104 106 int a; -
trunk/idl-compiler/h-emitter_c/h_file_emitter.c
r292 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdlib.h> 36 39 #include <string.h> … … 107 110 108 111 fprintf(fh, "/* Class data structure */\n"); 112 fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName); 113 fprintf(fh, "NOMDLLEXPORT\n"); 114 fprintf(fh, "#else\n"); 115 fprintf(fh, "NOMDLLIMPORT\n"); 116 fprintf(fh, "#endif\n"); 109 117 fprintf(fh, "NOMEXTERN struct %sClassDataStructure {\n", pif->chrName); 110 118 … … 116 124 fprintf(fh, " nomMToken %s;\n", pm->chrName); 117 125 } 118 fprintf(fh, "}%sClassData;\n\n", pif->chrName); 119 126 fprintf(fh, "} NOMDLINK %sClassData;\n\n", pif->chrName); 127 128 fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName); 129 fprintf(fh, "NOMDLLEXPORT\n"); 130 fprintf(fh, "#else\n"); 131 fprintf(fh, "NOMDLLIMPORT\n"); 132 fprintf(fh, "#endif\n"); 120 133 fprintf(fh, "NOMEXTERN struct %sCClassDataStructure {\n", pif->chrName); 121 134 fprintf(fh, " nomMethodTabs parentMtab;\n"); … … 132 145 if(strcmp(pif->chrName , "NOMObject")) 133 146 { 147 /* FIXME: why is this here too? it's already in nomtk.h... */ 134 148 fprintf(fh, "/* This function is used to check if a given object is valid and the\n"); 135 149 fprintf(fh, " object supports the method */\n"); … … 181 195 pif->chrName, pm->chrName); 182 196 /* Forward declaration of parameter test function */ 197 fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName); 198 fprintf(fh, "NOMDLLEXPORT\n"); 199 fprintf(fh, "#else\n"); 200 fprintf(fh, "NOMDLLIMPORT\n"); 201 fprintf(fh, "#endif\n"); 183 202 fprintf(fh, "NOMEXTERN gboolean NOMLINK parmCheckFunc_%s_%s(%s *nomSelf,\n", 184 203 pif->chrName, pm->chrName, pif->chrName); … … 266 285 267 286 fprintf(fh, "/*\n * Class creation function\n */\n"); 287 fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName); 288 fprintf(fh, "NOMDLLEXPORT\n"); 289 fprintf(fh, "#else\n"); 290 fprintf(fh, "NOMDLLIMPORT\n"); 291 fprintf(fh, "#endif\n"); 268 292 fprintf(fh, "NOMEXTERN NOMClass * NOMLINK %sNewClass(gulong clsMajorVersion, gulong clsMinorVersion);\n\n", 269 293 pif->chrName); … … 291 315 PINTERFACE pifParent=pif; 292 316 293 while((pifParent=getParentInterface(pifParent))!=NULL HANDLE)317 while((pifParent=getParentInterface(pifParent))!=NULL) 294 318 { 295 319 GPtrArray *pArray; … … 345 369 346 370 //printInterface(pif); 347 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL HANDLE)371 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL) 348 372 { 349 373 emitHFileHeader(pLocalPI, pif); … … 357 381 emitHFileFooter(pLocalPI, pif); 358 382 closeOutfile(pLocalPI->outFile); 383 pLocalPI->outFile = NULL; 359 384 } 360 385 g_free(chrTemp); -
trunk/idl-compiler/ih-emitter_c/ih_file_emitter.c
r293 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdlib.h> 36 39 #include <string.h> … … 80 83 fprintf(fh, " %s;\n", piv->chrName); 81 84 } 82 fprintf(fh, "}%sData;\n\n", pif->chrName); 85 #ifdef _MSC_VER 86 if(!a) 87 fprintf(fh, " int iDummy;\n"); /* HACK ALERT! */ 88 #endif 89 fprintf(fh, "} %sData;\n\n", pif->chrName); 83 90 } 84 91 … … 86 93 { 87 94 FILE* fh=pLocalPI->outFile; 88 GPtrArray *pArray=pif->pInstanceVarArray; ;95 GPtrArray *pArray=pif->pInstanceVarArray; 89 96 int a; 90 97 … … 116 123 117 124 fprintf(fh, "/*** Class data structures ***/\n"); 118 fprintf(fh, " struct %sClassDataStructure %sClassData = {0};\n", pif->chrName, pif->chrName );119 fprintf(fh, " staticstruct %sCClassDataStructure %sCClassData = {0};\n\n",125 fprintf(fh, "NOMDLLEXPORT struct %sClassDataStructure %sClassData = {0};\n", pif->chrName, pif->chrName ); 126 fprintf(fh, "NOMDLLEXPORT struct %sCClassDataStructure %sCClassData = {0};\n\n", 120 127 pif->chrName, pif->chrName); 121 128 } … … 126 133 NOMEXTERN gboolean NOMLINK objectCheckFunc_WPRootFolder(WPRootFolder *nomSelf, gchar* chrMethodName) 127 134 { 128 if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , WPRootFolderClassData.classObject, NULL HANDLE))135 if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , WPRootFolderClassData.classObject, NULL)) 129 136 { 130 137 nomPrintObjectPointerError(nomSelf, "WPRootFolder", chrMethodName); … … 170 177 fprintf(fh, "\",\n"); 171 178 } 179 #ifdef _MSC_VER 180 if(!a) 181 fprintf(fh, " NULL\n"); 182 #endif 172 183 } 173 184 … … 187 198 fprintf(fh, "#if !defined(_decl_impl_%s_%s_)\n", pif->chrName, pm->chrName); 188 199 fprintf(fh, "#define _decl_impl_%s_%s_ 1\n", pif->chrName, pm->chrName); 189 fprintf(fh, "NOM _Scope ");200 fprintf(fh, "NOMDLLEXPORT NOM_Scope "); 190 201 emitReturnType(pLocalPI, pif, pm); 191 202 fprintf(fh, " NOMLINK impl_%s_%s(%s *nomSelf,\n", pif->chrName, pm->chrName, pif->chrName); … … 238 249 } 239 250 240 fprintf(fh, "NOM _Scope ");251 fprintf(fh, "NOMDLLEXPORT NOM_Scope "); 241 252 emitReturnType(pLocalPI, pif, pm); 242 253 fprintf(fh, " NOMLINK impl_%s_%s(%s* nomSelf,\n", pif->chrName, pom->chrName, pif->chrName); … … 271 282 fprintf(fh, "static nomOverridenMethodDesc nomOverridenMethods%s[] = {\n", pif->chrName); 272 283 284 pArray=pif->pOverrideArray; 285 273 286 for(a=0;a<pArray->len;a++) 274 287 { … … 289 302 fprintf(fh, " },\n"); 290 303 } 291 fprintf(fh, "};\n\n"); 304 #ifdef _MSC_VER 305 if(!a) 306 fprintf(fh, " { NULL, NULL, NULL }\n"); 307 #endif 308 fprintf(fh, "};\n\n"); 292 309 } 293 310 … … 316 333 fprintf(fh, "},\n"); 317 334 } 335 #ifdef _MSC_VER 336 if(!a) 337 fprintf(fh, " { NULL, NULL, NULL, NULL, NULL }\n"); 338 #endif 318 339 fprintf(fh, "};\n\n"); 319 340 } … … 344 365 /* Emit the parents. We have to output them sorted beginning from the 345 366 leftmost parent. */ 346 while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULL HANDLE)367 while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULL) 347 368 { 348 369 g_ptr_array_add(pArray, (gpointer) pifParent); … … 372 393 PINTERFACE pifParent=pif; 373 394 374 while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULL HANDLE)395 while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULL) 375 396 ulRet++; 376 397 … … 498 519 } 499 520 fprintf(fh, "#include \"nomgc.h\"\n"); 521 fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName); 522 fprintf(fh, "NOMDLLEXPORT\n"); 523 fprintf(fh, "#else\n"); 524 fprintf(fh, "NOMDLLIMPORT\n"); 525 fprintf(fh, "#endif\n"); 500 526 fprintf(fh, "NOMClass* NOMLINK %sNewClass(gulong ulMajor, gulong ulMinor)\n", pif->chrName); 501 527 fprintf(fh, "{\n"); … … 516 542 fprintf(fh, " nomEndRegisterDLLWithGC(hReg);\n"); 517 543 fprintf(fh, " }\n"); 544 fprintf(fh, "#elif defined(_WIN32)\n"); 545 fprintf(fh, " /* FIXME: check this up with the GC. */\n"); 546 fprintf(fh, "#elif defined(__APPLE__)\n"); 547 fprintf(fh, "# warning FIXME: Check out GC/dylib.\n"); 548 fprintf(fh, "#elif defined(__linux__)\n"); 549 fprintf(fh, "# warning FIXME: Check out GC/so on linux.\n"); 518 550 fprintf(fh, "#else\n"); 519 551 fprintf(fh, "#error DLL must be registered with the garbage collector!\n"); … … 562 594 //printInterface(pif); 563 595 chrTemp=g_strconcat(pif->chrFileStem, ".ih", NULL); 564 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL HANDLE)596 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL) 565 597 { 566 598 emitIHFileHeader(pLocalPI, pif); -
trunk/idl-compiler/parser_c/classversion_parser.c
r271 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39 #include <stdlib.h> -
trunk/idl-compiler/parser_c/filestem_parser.c
r307 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39 #include <stdlib.h> -
trunk/idl-compiler/parser_c/hash_parser.c
r308 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39 #include <stdlib.h> … … 45 48 Current token is a '#'. 46 49 47 H:= '#' INT STRING INT // Line info from the preprocessor 50 H:= '#line' INT STRING INT // Line info from the preprocessor 51 H:= '#' INT STRING INT // Line info from the preprocessor (gcc short hand) 48 52 */ 49 53 void parseHash(void) 50 54 { 55 if (g_scanner_peek_next_token(gScanner) == G_TOKEN_IDENTIFIER 56 && !strcmp(gScanner->next_value.v_identifier, "line")) 57 getNextToken(); /* skip the line part. */ 51 58 52 59 if(matchNext(G_TOKEN_INT)) -
trunk/idl-compiler/parser_c/instancevar_parser.c
r271 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39 #include <stdlib.h> -
trunk/idl-compiler/parser_c/interface_parser.c
r309 r326 37 37 a specialized parser function in another source file is called from here. 38 38 */ 39 #include <os2.h> 39 #ifdef __OS2__ 40 # include <os2.h> 41 #endif /* __OS2__ */ 42 40 43 #include <stdlib.h> 41 44 #include <string.h> … … 292 295 { 293 296 PSYMBOL pCurSymbol; 297 GTokenValue value; 294 298 295 299 /* Parent interface */ … … 305 309 exit(1); 306 310 } 307 GTokenValuevalue=gScanner->value;311 value=gScanner->value; 308 312 /* Make sure it's the correct symbol */ 309 313 pCurSymbol=value.v_symbol; -
trunk/idl-compiler/parser_c/lineinfo_parser.c
r306 r326 39 39 */ 40 40 41 #include <os2.h> 41 #ifdef __OS2__ 42 # include <os2.h> 43 #endif /* __OS2__ */ 44 42 45 #include <stdio.h> 43 46 #include <stdlib.h> -
trunk/idl-compiler/parser_c/metaclass_parser.c
r320 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39 #include <stdlib.h> -
trunk/idl-compiler/parser_c/method_parser.c
r271 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdlib.h> 36 39 -
trunk/idl-compiler/parser_c/override_parser.c
r309 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39 #include <stdlib.h> -
trunk/idl-compiler/parser_c/typespec_parser.c
r269 r326 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 #include <os2.h> 34 #ifdef __OS2__ 35 # include <os2.h> 36 #endif /* __OS2__ */ 37 35 38 #include <stdio.h> 36 39
Note:
See TracChangeset
for help on using the changeset viewer.