void gennd(int neqns, int **padj, int *mask, int *perm, int *xls, int *ls, int *work) { int num, i, root, nsep ; zeroi(neqns, mask) ; num = 0 ; /* ------------------------------- for each masked component -----------------------------*/ /* modified to operate on equations rather than nodes*/ for (i=0;i<neqns ; i++) { while (mask[i] >= 0) { root = i ; /* ----------------------------------------------------------- find a separator and number the nodes next. ---------------------------------------------------------*/ nsep = fndsep(root, padj, mask,(perm + num), xls, ls, work, neqns); num += nsep ; } if (num >= neqns) printf("breaking out at i %d nums %d neqns %d\n",i,num, neqns); if (num >= neqns ) break ; } /* ----------------------------------------------------------------- since separators found first should be ordered last, routine revrse is called to adjust the ordering vector. ---------------------------------------------------------------*/ revrse(neqns, perm) ; return ; }
FUNCTION CODE getfld ( FAST struct SYNBLK *sb, /* in/out: syntax block */ FAST TEXT *field /* out: field string of length TOKESIZ+1*/ ) { CODE code; FAST CODE toktyp; /* token type */ TEXT token[TOKESIZ+1]; *field = EOS; /* initialize field to null string */ code = SUCCESS; if ((toktyp = gettok(sb,token)) == S_WHITE) /* get token */ toktyp = gettok(sb,token); /* if white, get another */ if (toktyp == S_SYNERR) /* if syntax error */ code = S_SYNERR; else if (toktyp == S_COMSEP) if ((*sb).inpar) (*sb).lstcp = S_COMSEP; else (*sb).lstcg = S_COMSEP; else if (toktyp == EOS) if ((*sb).lstcg == S_COMSEP || (*sb).lstcg == S_START) (*sb).lstcg = EOS; else code = EOS; else if (toktyp == ')' ) /* if right paren */ if ((*sb).lstcp == S_COMSEP || (*sb).lstcp == '(' ) { (*sb).lstcp = ')'; (*sb).curchr--; /* so we get right paren on next call */ } else { code = S_RPAREN; (*sb).inpar = FALSE; /* no longer w/in parentheses */ fndsep(sb); /* posit past trailing sep if present */ } else if (fldtrm(toktyp)) /* if token was a field terminator */ { code = toktyp; s_copy(token, field); } else { if (toktyp==S_QUOTED) code = S_QUOTED; /* call it S_QUOTED if we lead with a quote*/ while (!fldtrm(toktyp)) /* loop until a field terminator */ { if (toktyp == S_QUOTED) /* if token is a quoted string */ strpqu(token); /* strip quotes */ if (s_length(token) + s_length(field) > TOKESIZ) return(S_SYNERR); s_append(token, field); /* add token to field */ if ((toktyp = gettok(sb, token)) == S_SYNERR) /* get another token */ return(S_SYNERR); } if (toktyp != S_COMSEP && toktyp != S_WHITE) /* put back terminator...*/ if (toktyp != EOS) /* if not also separator */ (*sb).curchr--; if ((*sb).inpar) (*sb).lstcp = toktyp; else (*sb).lstcg = toktyp; } return(code); }