00001 # include "parm.h"
00002
00003 # include "stree/ststructs.mh"
00004
00005 # include "is_local.h"
00006
00007 extern int indx_sconc, indx_pconc, indx_empty;
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 hasstring(sig,string)
00020 NODE * sig;
00021 NODE * string;
00022 {
00023 register NODE * p;
00024 register char * curr_char;
00025 boolean has_empty;
00026 NODE * const_node;
00027
00028 int i;
00029
00030 # ifdef DEBUG
00031 if (sig -> kind != TYPESIGNATURE) {
00032 dbgmsg("hasstring: bad type signature\n");
00033 abort();
00034 }
00035 # endif
00036
00037 switch(string -> kind) {
00038 case QSTR:
00039 if(!hascomp(sig, indx_sconc)) {
00040 return(FALSE);
00041 }
00042
00043 has_empty = FALSE;
00044 maplist(p, sig -> ts_clist, {
00045 if (p -> kind == TSCOMPONENT) {
00046 if (p -> tsc_id -> id_str_table_index == indx_empty) {
00047 if (is_const(p->tsc_signature,sig))
00048 has_empty = TRUE;
00049 }
00050 }
00051 });
00052 if (!has_empty) return(FALSE);
00053 break;
00054 case UQSTR:
00055 if(!hascomp(sig, indx_pconc)) {
00056 return(FALSE);
00057 }
00058 break;
00059 # ifdef DEBUG
00060 default:
00061 dbgmsg("hasstring: bad string\n");
00062 # endif
00063 }
00064
00065
00066 const_node = first(sig -> ts_clist);
00067 # ifdef DEBUG
00068 if(const_node -> kind != DEFCHARSIGS) {
00069 dbgmsg("hasstring: Unnormalized type signature\n");
00070 }
00071 # endif
00072 for (curr_char = string -> str_string; *curr_char != '\0'; curr_char++) {
00073
00074 unsigned word;
00075 int bitno;
00076 int wordno;
00077 unsigned * base = &(const_node -> dcs_0);
00078
00079 wordno = ((int) *curr_char) / WORDLENGTH;
00080 word = *(base + wordno);
00081 bitno = ((int) *curr_char) - wordno * WORDLENGTH;
00082
00083 if ( (((int) word) << bitno) >= 0) {
00084
00085 return(FALSE);
00086 }
00087 }
00088 return(TRUE);
00089 }
00090