int PP_Char( void ) { MACRO_TOKEN *mtok; MACRO_ENTRY *me; ppt_token token; if( *PPTokenPtr == '\0' ) { for( ; (mtok = PPTokenList) != NULL; ) { PPTokenList = mtok->next; PP_Free( mtok ); mtok = PPTokenList; if( mtok == NULL ) break; if( !IS_END_OF_MACRO( mtok ) ) { PPTokenPtr = mtok->data; return( *PPTokenPtr++ ); } DeleteNestedMacro(); } for( ;; ) { for( ;; ) { if( PP_ScanNextToken( &token ) == EOF ) return( EOF ); if( token != PPT_COMMENT ) break; if( PPFlags & PPFLAG_KEEP_COMMENTS ) break; if( PPSavedChar == '\0' ) { PPTokenPtr = PPNextTokenPtr; return( '\n' ); } else { // replace comment with a space PPTokenPtr = PPNextTokenPtr; return( ' ' ); } } if( token != PPT_ID ) break; me = PP_MacroLookup( PPTokenPtr, strlen( PPTokenPtr ) ); if( me == NULL ) break; if( me->parmcount != PP_SPECIAL_MACRO && me->parmcount != 0 ) { if( PPSavedChar != '(' ) { break; } } DoMacroExpansion( me ); if( PPTokenList != NULL ) { PPTokenPtr = PPTokenList->data; break; } } } return( *PPTokenPtr++ ); }
int PP_Char( void ) { MACRO_TOKEN *mtok; MACRO_ENTRY *me; char token; if( *PPTokenPtr == '\0' ) { for( ;; ) { mtok = PPTokenList; if( mtok == NULL ) break; PPTokenList = mtok->next; PP_Free( mtok ); mtok = PPTokenList; if( mtok == NULL ) break; if( mtok->token == PPT_NULL && mtok->data[0] == 'Z' ) { DeleteNestedMacro(); continue; } PPTokenPtr = mtok->data; return( *PPTokenPtr++ ); } for( ;; ) { for( ;; ) { if( PP_ScanNextToken( &token ) == EOF ) return( EOF ); if( token != PPT_COMMENT ) break; if( PPFlags & PPFLAG_KEEP_COMMENTS ) break; if( PPSavedChar == '\0' ) { PPTokenPtr = PPCharPtr; return( '\n' ); } else { // replace comment with a space PPTokenPtr = PPCharPtr; return( ' ' ); } } if( token != PPT_ID ) break; me = PP_MacroLookup( PPTokenPtr ); if( me == NULL ) break; if( me->parmcount != PP_SPECIAL_MACRO && me->parmcount != 0) { if( PPSavedChar != '(' ) { break; } } DoMacroExpansion( me ); if( PPTokenList != NULL ) { /* 08-feb-93 */ PPTokenPtr = PPTokenList->data; break; } } } return( *PPTokenPtr++ ); }
MACRO_ENTRY *PP_ScanMacroLookup( const char *ptr ) { const char *macro_name; MACRO_ENTRY *me; while( *ptr == ' ' || *ptr == '\t' ) ++ptr; macro_name = ptr; ptr = PP_ScanName( macro_name ); me = PP_MacroLookup( macro_name, ptr - macro_name ); PPNextTokenPtr = ptr; return( me ); }
MACRO_ENTRY *PP_ScanMacroLookup( char *ptr ) { char *macro_name; MACRO_ENTRY *me; char c; while( *ptr == ' ' || *ptr == '\t' ) ++ptr; macro_name = ptr; ptr = PP_ScanName( ptr ); c = *ptr; *ptr = '\0'; me = PP_MacroLookup( macro_name ); *ptr = c; PPCharPtr = ptr; return( me ); }