Changeset 271 for trunk/idl-compiler/parser_c
- Timestamp:
- Mar 25, 2007, 8:32:59 PM (18 years ago)
- Location:
- trunk/idl-compiler/parser_c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/parser_c/classversion_parser.c
r267 r271 40 40 41 41 extern GScanner *gScanner; 42 extern PINTERFACE pCurInterface; 42 extern PPARSEINFO pParseInfo; 43 43 44 /* 44 45 Parse the class version. Note that the identifier is the current symbol.. … … 76 77 } 77 78 value=gScanner->value; 78 p CurInterface->ulMajor=value.v_int;79 pParseInfo->pCurInterface->ulMajor=value.v_int; 79 80 80 81 if(!matchNext(',')) … … 103 104 } 104 105 value=gScanner->value; 105 p CurInterface->ulMinor=value.v_int;106 pParseInfo->pCurInterface->ulMinor=value.v_int; 106 107 107 108 if(!matchNext(')')) -
trunk/idl-compiler/parser_c/instancevar_parser.c
r267 r271 40 40 41 41 extern GScanner *gScanner; 42 extern P INTERFACE pCurInterface;42 extern PPARSEINFO pParseInfo; 43 43 44 44 /* … … 122 122 exit(1); 123 123 } 124 if(!p CurInterface)124 if(!pParseInfo->pCurInterface) 125 125 { 126 126 g_message("Error: no interface for some reason"); 127 127 } 128 128 129 g_ptr_array_add(p CurInterface->pInstanceVarArray , (gpointer) pInstanceVar);129 g_ptr_array_add(pParseInfo->pCurInterface->pInstanceVarArray , (gpointer) pInstanceVar); 130 130 } -
trunk/idl-compiler/parser_c/interface_parser.c
r270 r271 41 41 42 42 extern GScanner *gScanner; 43 extern GTokenType curToken;44 extern PINTERFACE pCurInterface;45 43 /* The pointer array holding the interfaces we found */ 46 44 extern GPtrArray* pInterfaceArray; 47 extern P ARSEINFO parseInfo;45 extern PPARSEINFO pParseInfo; 48 46 49 47 static void registerInterface(void) … … 51 49 PSYMBOL pNewSymbol=g_malloc0(sizeof(SYMBOL)); 52 50 53 g_ptr_array_add(pInterfaceArray, (gpointer) pCurInterface); 51 if(!strcmp(pParseInfo->chrRootSourceFile, pParseInfo->pCurInterface->chrSourceFileName)) 52 pParseInfo->pCurInterface->fIsInRootFile=TRUE; 53 54 g_ptr_array_add(pInterfaceArray, (gpointer) pParseInfo->pCurInterface); 54 55 55 56 /* Any found interface is registered as a new type so it can be 56 57 used in other classes. */ 57 pNewSymbol->chrSymbolName=g_strdup(p CurInterface->chrName); /* We create a copy here because58 when cleaning up the symbol space59 the string will be freed. */58 pNewSymbol->chrSymbolName=g_strdup(pParseInfo->pCurInterface->chrName); /* We create a copy here because 59 when cleaning up the symbol space 60 the string will be freed. */ 60 61 pNewSymbol->uiKind=KIND_TYPESPEC; 61 62 pNewSymbol->uiSymbolToken=IDL_SYMBOL_REGINTERFACE; 62 g_tree_insert(p arseInfo.pSymbolTree, pNewSymbol, pNewSymbol->chrSymbolName);63 g_tree_insert(pParseInfo->pSymbolTree, pNewSymbol, pNewSymbol->chrSymbolName); 63 64 g_scanner_scope_add_symbol(gScanner, ID_SCOPE, pNewSymbol->chrSymbolName, 64 65 pNewSymbol); … … 68 69 pNewSymbol->uiKind=KIND_TYPESPEC; 69 70 pNewSymbol->uiSymbolToken=IDL_SYMBOL_REGINTERFACE; 70 pNewSymbol->chrSymbolName=g_strconcat("P", pCurInterface->chrName, NULL); 71 g_message("%s: %s", __FUNCTION__, pNewSymbol->chrSymbolName); 72 g_tree_insert(parseInfo.pSymbolTree, pNewSymbol, pNewSymbol->chrSymbolName); 71 pNewSymbol->chrSymbolName=g_strconcat("P", pParseInfo->pCurInterface->chrName, NULL); 72 g_tree_insert(pParseInfo->pSymbolTree, pNewSymbol, pNewSymbol->chrSymbolName); 73 73 g_scanner_scope_add_symbol(gScanner, ID_SCOPE, pNewSymbol->chrSymbolName, 74 74 pNewSymbol); 75 //g_message("%s: %s", __FUNCTION__, pNewSymbol->chrSymbolName); 75 76 } 76 77 … … 179 180 /* Save interface info */ 180 181 GTokenValue value=gScanner->value; 181 p CurInterface->chrName=g_strdup(value.v_identifier);182 pParseInfo->pCurInterface->chrName=g_strdup(value.v_identifier); 182 183 } 183 184 … … 247 248 exit(1); 248 249 } 249 p CurInterface->chrParent=g_strdup(pCurSymbol->chrSymbolName);250 pParseInfo->pCurInterface->chrParent=g_strdup(pCurSymbol->chrSymbolName); 250 251 251 252 /* Check if the parent interface is known. */ 252 if(!findInterfaceFromName(p CurInterface->chrParent))253 if(!findInterfaceFromName(pParseInfo->pCurInterface->chrParent)) 253 254 { 254 255 g_scanner_unexp_token(gScanner, … … 295 296 void parseInterface(GTokenType token) 296 297 { 297 p CurInterface=createInterfaceStruct();298 pParseInfo->pCurInterface=createInterfaceStruct(); 298 299 299 300 /* Get the interface name */ 300 301 parseIFace(token); 302 pParseInfo->pCurInterface->chrSourceFileName=g_strdup(pParseInfo->chrCurrentSourceFile); 303 301 304 /* It's save to register the interface right here even if the struct is almost empty. 302 305 If anything goes wrong later we will exit anyway. */ … … 305 308 if(matchNext(';')) 306 309 { 307 p CurInterface->fIsForwardDeclaration=TRUE;310 pParseInfo->pCurInterface->fIsForwardDeclaration=TRUE; 308 311 } 309 312 else if(matchNext(':')) -
trunk/idl-compiler/parser_c/lineinfo_parser.c
r267 r271 41 41 42 42 extern GScanner *gScanner; 43 extern P ARSEINFO parseInfo;43 extern PPARSEINFO pParseInfo; 44 44 45 45 /* … … 54 54 /* Line number */ 55 55 value=gScanner->value; 56 p arseInfo.uiLineCorrection=g_scanner_cur_line(gScanner)-value.v_int+1;56 pParseInfo->uiLineCorrection=g_scanner_cur_line(gScanner)-value.v_int+1; 57 57 58 58 if(!matchNext(G_TOKEN_STRING)) … … 69 69 } 70 70 71 value=gScanner->value; 72 73 /* Root source file? */ 74 if(!pParseInfo->chrRootSourceFile) 75 pParseInfo->chrRootSourceFile=g_strdup(value.v_string); 76 71 77 /* Current source file */ 72 if(p arseInfo.chrCurrentSourceFile)73 g_free(p arseInfo.chrCurrentSourceFile);78 if(pParseInfo->chrCurrentSourceFile) 79 g_free(pParseInfo->chrCurrentSourceFile); 74 80 75 value=gScanner->value; 76 parseInfo.chrCurrentSourceFile=g_strdup(value.v_string); 81 pParseInfo->chrCurrentSourceFile=g_strdup(value.v_string); 77 82 78 83 /* Trailing file include level info isn't used for now. Note that for the root -
trunk/idl-compiler/parser_c/method_parser.c
r269 r271 41 41 extern GScanner *gScanner; 42 42 extern GTokenType curToken; 43 extern P INTERFACE pCurInterface;43 extern PPARSEINFO pParseInfo; 44 44 45 45 /* In override_parser.c */ … … 180 180 pMethod->chrName=g_strdup(value.v_identifier); 181 181 182 /* Now check if the method was introduced by some parent */ 183 if((pif=findInterfaceForMethod(pCurInterface, pMethod->chrName))!=NULL) 182 /* Now check if the method was introduced by some parent. The interface struct contains 183 the parent name if any and the function will follow the chain of parents. */ 184 if((pif=findInterfaceForMethod(pParseInfo->pCurInterface, pMethod->chrName))!=NULL) 184 185 { 185 186 gchar* chrMessage; … … 226 227 exit(1); 227 228 } 228 g_ptr_array_add( p CurInterface->pMethodArray, (gpointer) pMethod);229 g_ptr_array_add( pParseInfo->pCurInterface->pMethodArray, (gpointer) pMethod); 229 230 return; 230 231 } … … 259 260 } 260 261 261 g_ptr_array_add( p CurInterface->pMethodArray, (gpointer) pMethod);262 g_ptr_array_add( pParseInfo->pCurInterface->pMethodArray, (gpointer) pMethod); 262 263 } -
trunk/idl-compiler/parser_c/override_parser.c
r267 r271 42 42 43 43 extern GScanner *gScanner; 44 extern PINTERFACE pCurInterface; 44 //extern PINTERFACE pCurInterface; 45 extern PPARSEINFO pParseInfo; 45 46 46 47 PINTERFACE findInterfaceForMethod(PINTERFACE pStartInterface, gchar* chrMethodName) … … 105 106 106 107 /* Now check if the method was introduced by some parent */ 107 if((pif=findInterfaceForMethod(p CurInterface, pOMethod->chrName))==NULL)108 if((pif=findInterfaceForMethod(pParseInfo->pCurInterface, pOMethod->chrName))==NULL) 108 109 { 109 110 … … 139 140 exit(1); 140 141 } 141 g_ptr_array_add(p CurInterface->pOverrideArray, (gpointer) pOMethod);142 g_ptr_array_add(pParseInfo->pCurInterface->pOverrideArray, (gpointer) pOMethod); 142 143 }
Note:
See TracChangeset
for help on using the changeset viewer.