/*************************************************************** * setCurrentSyntax: * clearCurrentSyntax: ***************************************************************/ static void setCurrentSyntax( int flag /* <r> T==>newVerb F==>newSyntax only */ ,struct cduVerb *v /* <r> addr of new syntax struct */ ) { int i,k; struct cduVerb *oldSyntax; struct cduParam *oldPrms; struct cduValue *val,*oldval; oldSyntax = currentSyntax; currentSyntax = v; if (flag || v->vrbA_parameters) { numParams = initEntityTable(v->vrbA_parameters,&cmdParam); oldPrms = currentParameters; currentParameters = v->vrbA_parameters; if ((k=paramId) > numParams) { fprintf(stderr, "\nsetCurrentSyntax: *WARN* paramId=%d numParams=%d\n\n", paramId,numParams); #ifdef vms lib$signal(SS$_DEBUG); #endif k = numParams; } for (i=0 ; i<k ; i++) { /* Copy val_dsc and status for each param ... */ val = currentParameters[i].prmA_value; oldval = oldPrms[i].prmA_value; str_copy_dx(&val->val_dsc,&oldval->val_dsc); currentParameters[i].prmL_status = oldPrms[i].prmL_status; } } if (flag || v->vrbA_qualifiers) { numQualifiers = initEntityTable(v->vrbA_qualifiers,&cmdQual); currentQualifiers = v->vrbA_qualifiers; } return; }
// . is "s" an HTML entity? (ascii representative of an iso char) // . return the 32-bit unicode char it represents // . returns 0 if none // . JAB: const-ness for optimizer... static const Entity *getTextEntity ( const char *s , int32_t len ) { if ( !initEntityTable()) return 0; // take the ; off, if any if ( s[len-1] == ';' ) len--; // compute the hash of the entity including &, but not ; int64_t h = hash64 ( s , len ); // get the entity index from table (stored in the score field) int32_t i = (int32_t) s_table.getScore(h); // return 0 if no match if ( i == 0 ) return NULL; // point to the utf8 char. these is 1 or 2 bytes it seems return s_entities+i-1; }
// . is "s" an HTML entity? (ascii representative of an iso char) // . return the 32-bit unicode char it represents // . returns 0 if none // . JAB: const-ness for optimizer... uint32_t getTextEntity ( const char *s , int32_t len ) { if ( !initEntityTable()) return 0; // take the ; off, if any if ( s[len-1] == ';' ) len--; // compute the hash of the entity including &, but not ; int64_t h = hash64 ( s , len ); // get the entity index from table (stored in the score field) int32_t i = (int32_t) s_table.getScore ( &h ); // return 0 if no match if ( i == 0 ) return 0; // point to the utf8 char. these is 1 or 2 bytes it seems char *p = (char *)s_entities[i-1].utf8; // encode into unicode uint32_t c = utf8Decode ( p ); // return that return c; }
// . is "s" an HTML entity? (ascii representative of an iso char) // . return the 32-bit unicode char it represents // . returns 0 if none // . JAB: const-ness for optimizer... uint32_t getTextEntity ( char *s , int32_t len ) { if ( !initEntityTable()) return 0; // take the ; off, if any if ( s[len-1] == ';' ) len--; // compute the hash of the entity including &, but not ; int64_t h = hash64 ( s , len ); // get the entity index from table (stored in the score field) int32_t i = (int32_t) s_table.getScore ( &h ); // return 0 if no match if ( i == 0 ) return 0; // point to the utf8 char. these is 1 or 2 bytes it seems char *p = (char *)s_entities[i-1].utf8; // encode into unicode uint32_t c = utf8Decode ( p ); // return that return c; // return the iso character //printf("Converted text entity \""); //for(int si=0;si<len;si++)putchar(s[si]); //printf("\" to 0x%x(%d)\"%c\"\n",s_entities[i-1].c,s_entities[i-1].c, // s_entities[i-1].c); //return (uint32_t)s_entities[i-1].c; }