void identifyposlits(int i,Sfma *f) { Sfmalist *fs; int j; switch(f->t) { case Spatom: if(!staticp(f->a[0])) return; for(j=0;j<f->a[1];j++) { if(f->a[j+2] == -1-i) { trueposlits[litcnt++] = f->a; printatom(f->a); return; } } return; case Sconj: fs = f->juncts; while(fs != NULL) { identifyposlits(i,fs->hd); fs = fs->tl; } return; default: return; } }
tree cxx_staticp (tree arg) { switch (TREE_CODE (arg)) { case BASELINK: return staticp (BASELINK_FUNCTIONS (arg)); default: break; } return NULL_TREE; }
int legalstaticbindingA(int i,int *a) { int j; atom *as; /* Go through the atoms in the initial state description, and check. */ as = Sinit; if(staticp(a[0]) == 0) return 1; while(*as != NULL) { /* Go through all initial state atoms. */ #ifdef DEBUG printf("Matching "); printSfma(f); printf(" against "); printatom(*as); printf(" with"); for(j=0;j<=i;j++) { printf(" #%i:%s",j,symbol(binding[j])); } printf("\n"); #endif if((*as)[0] == a[0]) { /* Same predicate. Binding OK? */ for(j=2;j<a[1]+2;j++) { /* Go through parameters. */ /* Is it unassigned or a match. */ if(assignedvar(a[j],i) && ((*as)[j] != binding[-1-a[j]])) { goto nextinitatom; /* Did not match. */ } } #ifdef DEBUG printf("MATCH!\n"); #endif return 1; } nextinitatom: as = as + 1; } #ifdef DEBUG printf("NO MATCH!\n"); #endif return 0; }
int occursinstatic(int i,Sfma *f) { Sfmalist *fs; int j; switch(f->t) { case Spatom: if(!staticp(f->a[0])) return 0; for(j=0;j<f->a[1];j++) { if(f->a[j+2] == -1-i) { return 1; } } return 0; case Sconj: fs = f->juncts; while(fs != NULL) { if(occursinstatic(i,fs->hd)) return 1; fs = fs->tl; } return 0; default: return 0; } }