Ignore:
Timestamp:
Apr 1, 2007, 3:50:13 PM (18 years ago)
Author:
cinc
Message:

Hunting bugs...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/idl-compiler/parser_c/interface_parser.c

    r289 r290  
    4747  PSYMBOL pNewSymbol=g_malloc0(sizeof(SYMBOL));
    4848
    49   // g_message("In %s for %s", __FUNCTION__, pParseInfo->pCurInterface->chrName);
     49  //g_message("In %s for %s", __FUNCTION__, pParseInfo->pCurInterface->chrName);
    5050
    5151  pParseInfo->pCurInterface->pSymbolIFace=pNewSymbol;
     
    8181static void deRegisterInterface(PINTERFACE pif)
    8282{
    83   //  g_message("In %s", __FUNCTION__);
     83  //g_message("In %s", __FUNCTION__);
    8484
    8585  /* Remove the interface from our list */
     
    193193static void parseIFace(GTokenType token)
    194194{
     195
    195196  if(matchNext(G_TOKEN_IDENTIFIER))
    196197    {
     
    200201    }
    201202  else
    202     if(matchNext(G_TOKEN_SYMBOL))
    203       {
    204         /* If the interface name is a symbol, it means the interface was
    205            already registered before. Maybe because of a forward statement.
    206            We will check that in the function which called us. */
    207        
    208         /* Check if it's one of our interface symbols */
    209         PSYMBOL pCurSymbol;
    210         GTokenValue value;
    211        
    212         value=gScanner->value;
    213         pCurSymbol=value.v_symbol;
    214         if(IDL_SYMBOL_REGINTERFACE!=pCurSymbol->uiSymbolToken)
    215           {
    216             //g_message("%s %d", pCurSymbol->chrSymbolName, pCurSymbol->uiKind);
    217             g_scanner_unexp_token(gScanner,
    218                                   G_TOKEN_SYMBOL,
    219                                   NULL,
    220                                   NULL,
    221                                   NULL,
    222                                   "Keyword 'interface' is not followed by a valid identifier.",
    223                                   TRUE); /* is_error */
    224             exit(1);
    225           }
    226        
    227         /* Save interface info */
    228         pParseInfo->pCurInterface->chrName=g_strdup(value.v_identifier);
     203    {
     204      if(matchNext(G_TOKEN_SYMBOL))
     205        {
     206          /* If the interface name is a symbol, it means the interface was
     207             already registered before. Maybe because of a forward statement.
     208             We will check that in the function which called us. */
     209         
     210          /* Check if it's one of our interface symbols */
     211          PSYMBOL pCurSymbol;
     212          GTokenValue value;
     213
     214          value=gScanner->value;
     215          pCurSymbol=value.v_symbol;
     216          if(IDL_SYMBOL_REGINTERFACE!=pCurSymbol->uiSymbolToken)
     217            {
     218              //g_message("%s %d", pCurSymbol->chrSymbolName, pCurSymbol->uiKind);
     219              g_scanner_unexp_token(gScanner,
     220                                    G_TOKEN_SYMBOL,
     221                                    NULL,
     222                                    NULL,
     223                                    NULL,
     224                                    "Keyword 'interface' is not followed by a valid identifier.",
     225                                    TRUE); /* is_error */
     226              exit(1);
     227            }
     228          /* Save interface info */
     229          pParseInfo->pCurInterface->chrName=g_strdup(pCurSymbol->chrSymbolName);
     230        }
     231      else{
     232        g_scanner_unexp_token(gScanner,
     233                              G_TOKEN_IDENTIFIER,
     234                              NULL,
     235                              NULL,
     236                              NULL,
     237                              "Keyword 'interface' must be followed by an identifier",
     238                              TRUE); /* is_error */
     239        exit(1);
    229240      }
    230     else{
    231       g_scanner_unexp_token(gScanner,
    232                             G_TOKEN_IDENTIFIER,
    233                             NULL,
    234                             NULL,
    235                             NULL,
    236                             "Keyword 'interface' must be followed by an identifier",
    237                             TRUE); /* is_error */
    238       exit(1);
    239241    }
    240242}
     
    378380    {
    379381      PINTERFACE pif;
     382      gchar *chrTemp=pParseInfo->pCurInterface->chrName;
    380383
    381384      /* Check if we already have a (maybe forward) declaration */
     
    401404            }
    402405        }
     406      pParseInfo->pCurInterface->chrName=chrTemp;
    403407      pParseInfo->pCurInterface->chrSourceFileName=g_strdup(pParseInfo->chrCurrentSourceFile);
    404408      /* It's save to register the interface right here even if the struct is almost empty.
Note: See TracChangeset for help on using the changeset viewer.