int Xcode_charmapString( DWORD * pdwInputString, int iInputSize, DWORD * pdwOutputString, int * piOutputSize ) { DWORD * pdwBlock; int len, i; int outputIndex = 0; *piOutputSize = 0; for ( i = 0; i < iInputSize; i++ ) { len = lookup_charmap( *(pdwInputString+i), &pdwBlock ); if ( len == -1 ) { *(pdwOutputString + outputIndex) = *(pdwInputString+i); len = 1; } else { memcpy( pdwOutputString + outputIndex, pdwBlock, len * sizeof(DWORD) ); } outputIndex += len; } *piOutputSize = outputIndex; if ( outputIndex == 0 ) return XCODE_NAMEPREP_MAPPEDOUT; return XCODE_SUCCESS; }
int get_symbol(void) { int c; while ((c = scanc()) != EOF) { if (escaped) { escaped = 0; if (c == '\n') continue; add_tok(get_escaped(c)); continue; } if (c == esc_char) { escaped = 1; continue; } if (c == '\n') { /* well that's strange! */ yyerror("unterminated symbolic name"); continue; } if (c == '>') { /* end of symbol */ /* * This restarts the token from the beginning * the next time we scan a character. (This * token is complete.) */ if (token == NULL) { yyerror("missing symbolic name"); return (T_NULL); } tokidx = 0; /* * A few symbols are handled as keywords outside * of the normal categories. */ if (category == T_END) { int i; for (i = 0; symwords[i].name != 0; i++) { if (strcmp(token, symwords[i].name) == 0) { last_kw = symwords[i].id; return (last_kw); } } } /* * Contextual rule: Only literal characters are * permitted in CHARMAP. Anywhere else the symbolic * forms are fine. */ if ((category != T_CHARMAP) && (lookup_charmap(token, &yylval.wc)) != -1) { return (T_CHAR); } if ((yylval.collsym = lookup_collsym(token)) != NULL) { return (T_COLLSYM); } if ((yylval.collelem = lookup_collelem(token)) != NULL) { return (T_COLLELEM); } /* its an undefined symbol */ yylval.token = strdup(token); token = NULL; toksz = 0; tokidx = 0; return (T_SYMBOL); } add_tok(c); } yyerror("unterminated symbolic name"); return (EOF); }