l_read(ftnint *number, char *ptr, ftnlen len, ftnint type) #endif { #define Ptr ((flex *)ptr) int i,n,ch; doublereal *yy; real *xx; for(i=0;i<*number;i++) { if(f__lquit) return(0); if(l_eof) err(f__elist->ciend, EOF, "list in") if(f__lcount == 0) { f__ltype = 0; for(;;) { GETC(ch); switch(ch) { case EOF: err(f__elist->ciend,(EOF),"list in") case ' ': case '\t': case '\n': continue; case '/': f__lquit = 1; goto loopend; case ',': f__lcount = 1; goto loopend; default: (void) Ungetc(ch, f__cf); goto rddata; } } } rddata: switch((int)type) { case TYINT1: case TYSHORT: case TYLONG: #ifndef ALLOW_FLOAT_IN_INTEGER_LIST_INPUT ERR(l_R(0,1)); break; #endif case TYREAL: case TYDREAL: ERR(l_R(0,0)); break; #ifdef TYQUAD case TYQUAD: n = l_R(0,2); if (n) return n; break; #endif case TYCOMPLEX: case TYDCOMPLEX: ERR(l_C()); break; case TYLOGICAL1: case TYLOGICAL2: case TYLOGICAL: ERR(l_L()); break; case TYCHAR: ERR(l_CHAR()); break; } while (GETC(ch) == ' ' || ch == '\t'); if (ch != ',' || f__lcount > 1) Ungetc(ch,f__cf); loopend: if(f__lquit) return(0); if(f__cf && ferror(f__cf)) { clearerr(f__cf); errfl(f__elist->cierr,errno,"list in"); } if(f__ltype==0) goto bump; switch((int)type) { case TYINT1: case TYLOGICAL1: Ptr->flchar = (char)f__lx; break; case TYLOGICAL2: case TYSHORT: Ptr->flshort = (short)f__lx; break; case TYLOGICAL: case TYLONG: Ptr->flint = (ftnint)f__lx; break; #ifdef Allow_TYQUAD case TYQUAD: if (!(Ptr->fllongint = f__llx)) Ptr->fllongint = f__lx; break; #endif case TYREAL: Ptr->flreal=f__lx; break; case TYDREAL: Ptr->fldouble=f__lx; break; case TYCOMPLEX: xx=(real *)ptr; *xx++ = f__lx; *xx = f__ly; break; case TYDCOMPLEX: yy=(doublereal *)ptr; *yy++ = f__lx; *yy = f__ly; break; case TYCHAR: b_char(f__lchar,ptr,len); break; } bump: if(f__lcount>0) f__lcount--; ptr += len; if (nml_read) nml_read++; }
static int l_read(ftnint *number,flex *ptr,ftnlen len,ftnint type) { int i,n,ch; double *yy; float *xx; for(i=0;i<*number;i++) { if(curunit->uend) err(elist->ciend, EOF, "list in") if(l_first) { l_first=0; for(GETC(ch);isblnk(ch);GETC(ch)); ungetc(ch,cf); } else if(lcount==0) { ERR(t_sep()); if(lquit) return(0); } switch((int)type) { case TYSHORT: case TYLONG: case TYREAL: case TYDREAL: ERR(l_R()); break; case TYCOMPLEX: case TYDCOMPLEX: ERR(l_C()); break; case TYLOGICAL: ERR(l_L()); break; case TYCHAR: ERR(l_CHAR()); break; } if(lquit) return(0); if(feof(cf)) err(elist->ciend,(EOF),"list in") else if(ferror(cf)) { clearerr(cf); err(elist->cierr,errno,"list in") } if(ltype==0) goto bump; switch((int)type) { case TYSHORT: ptr->flshort=lx; break; case TYLOGICAL: case TYLONG: ptr->flint=lx; break; case TYREAL: ptr->flreal=lx; break; case TYDREAL: ptr->fldouble=lx; break; case TYCOMPLEX: xx=(float *)ptr; *xx++ = lx; *xx = ly; break; case TYDCOMPLEX: yy=(double *)ptr; *yy++ = lx; *yy = ly; break; case TYCHAR: b_char(lchar,(char *)ptr,len); break; } bump: if(lcount>0) lcount--; ptr = (flex *)((char *)ptr + len); } return(0); }
static int l_C(Void) { int ch, nml_save; double lz; if(f__lcount>0) return(0); f__ltype=0; GETC(ch); if(ch!='(') { if (nml_read > 1 && (ch < '0' || ch > '9')) { Ungetc(ch,f__cf); f__lquit = 2; return 0; } if (rd_count(ch)) { if(!f__cf || !feof(f__cf)) { errfl(f__elist->cierr,112,"complex format"); } else { err(f__elist->cierr,(EOF),"lread"); } } if(GETC(ch)!='*') { if(!f__cf || !feof(f__cf)) errfl(f__elist->cierr,112,"no star"); else err(f__elist->cierr,(EOF),"lread"); } if(GETC(ch)!='(') { Ungetc(ch,f__cf); return(0); } } else f__lcount = 1; while(iswhit(GETC(ch))); Ungetc(ch,f__cf); nml_save = nml_read; nml_read = 0; if ((ch = l_R(1,0))) return ch; if (!f__ltype) errfl(f__elist->cierr,112,"no real part"); lz = f__lx; while(iswhit(GETC(ch))); if(ch!=',') { (void) Ungetc(ch,f__cf); errfl(f__elist->cierr,112,"no comma"); } while(iswhit(GETC(ch))); (void) Ungetc(ch,f__cf); if ((ch = l_R(1,0))) return ch; if (!f__ltype) errfl(f__elist->cierr,112,"no imaginary part"); while(iswhit(GETC(ch))); if(ch!=')') errfl(f__elist->cierr,112,"no )"); f__ly = f__lx; f__lx = lz; #ifdef Allow_TYQUAD f__llx = 0; #endif nml_read = nml_save; return(0); }
unsigned int EncodedPath::match(EncodedPath& text, SSPath* patternPath, SSPath* elementPath) { //////////////////////////////////////////////// // text: the encoded string for the element path // elementPath: the element path // // this: the encoded string for the pattern string // patternPath: the pattern path //////////////////////////////////////////////// //////////////////////////////////////////////// // the unlimited wildcard vector //////////////////////////////////////////////// BitVector* l_U = f_SVectors.findValue(&f_unlimitedWildCard); if ( l_U && patternLength() == 0 ) return true; //////////////////////////////////////////////// // the wildcard vector //////////////////////////////////////////////// BitVector* l_W = f_SVectors.findValue(&f_wildCard); // the S vector of each Letter, including that for '?' BitVector* l_S = 0; // the accumulated result vector BitVector l_R(patternLength(), 0); // placeholder for '*''s contribution BitVector l_I(patternLength(), 0); // hole position record of each path term in the pattern path posRecord l_pr; // expr pointer of each path term in the pattern path PQExpr* expr = 0; CC_TPtrDlistIterator<PathTerm>* elementPathNextPtr = 0; if ( elementPath ) elementPathNextPtr = new CC_TPtrDlistIterator<PathTerm>(*elementPath); // loop over text string for ( int i=0; i<text.length(); i++) { if ( elementPath ) ++(*elementPathNextPtr); //MESSAGE(cerr, "==================="); //debug(cerr, text.f_array[i]); //////////////////////////////////////////////// // get this character's vector, including '?'s //////////////////////////////////////////////// l_S = f_SVectors.findValue(&text.f_array[i]); if ( l_S ) { //debug(cerr, (void*)l_S); //debug(cerr, *l_S); //MESSAGE(cerr, "checking qualifies"); ////////////////////// // check qualifies. ////////////////////// if ( patternPath && l_S -> positionArray() ) { //////////////////// // get a copy of S //////////////////// f_copyOfS -> setTo(*l_S); //debug(cerr, *patternPath); positionArrayIteratorT l_positionNext(*(l_S -> positionArray())); while (++ l_positionNext) { l_pr = l_positionNext.key(); //cerr << " calling patternPath -> fastGetAt(): " << (void*)patternPath << "l_pr.pathTermPos= " << l_pr.pathTermPos << endl; expr = patternPath -> fastGetAt(l_pr.pathTermPos) -> pqexpr(); /* debug(cerr, int(expr)); if ( expr ) { MESSAGE(cerr, "qualify checking is needed."); debug(cerr, *(elementPathNext -> key())); } */ if ( expr && expr->evaluate(elementPathNextPtr->key()->element()) == PQFalse ) { //MESSAGE(cerr, form("set position %d to 0", l_pr.bitPos)); f_copyOfS -> setBitTo(l_pr.bitPos, 0); } } ///////////////////////////////////////// // make l_S point at its modified copy ///////////////////////////////////////// l_S = f_copyOfS; } } else l_S = l_W; //////////////////////////////////////////////// // get unlimited wildcard's vector. //////////////////////////////////////////////// if ( l_U ) { l_I.setTo(l_R); l_I &= (*l_U); //MESSAGE(cerr, "l_I"); //debug(cerr, l_I); } //////////////////////////////////////////////// // shift the partial result vector right once //////////////////////////////////////////////// l_R.shiftRightOneBit(); //MESSAGE(cerr, "after l_R >> 1"); //debug(cerr, l_R); //////////////////////////////////////////////// // AND in this character's vector //////////////////////////////////////////////// if ( l_S ) { l_R &= (*l_S); //debug(cerr, *l_S); //MESSAGE(cerr, "after AND with l_S"); //debug(cerr, l_R); } else { /////////////////////////////////////////////// // this branch is impossible to reach. /////////////////////////////////////////////// //MESSAGE(cerr, "l_R set all bits to 0"); l_R.setAllBitsTo(0); } /////////////////////////////////////////////// // OR in unlimited wild char's vector. /////////////////////////////////////////////// if ( l_U ) { l_R |= l_I; //MESSAGE(cerr, "after OR with l_I"); //debug(cerr, l_R); } //debug(cerr, l_R); //MESSAGE(cerr, "==================="); /////////////////////////////////////////////// // Use this test to get the first matched position // if ( l_R.getBit(0) == 1 ) // return true; /////////////////////////////////////////////// } delete elementPathNextPtr; /////////////////////////////////////////////// // // the last symbol must match // /////////////////////////////////////////////// if ( l_R.getBit(0) == 1 ) return true; else return false; }