void testSIimplOI(BDigit r, Word P, Word ZL, Word NZ, Word A) { /* Compute generators A and all its 1st order partials */ Word L = LIST1(A); for(int i = 1; i <= r; ++i) { Word D = IPDER(r,A,i); if (D != 0) L = COMP(D,L); } L = CCONC(L,ZL); /* Compute a variable list for output purposes. */ Word V = NIL; for(int i = r; i > 0; i--) { char s[2]; s[0] = 'a' - 1 + i; s[1] = '\0'; V = COMP(LFS(s),V); } /* Go through assumptions and find non-vanishing conditions. */ Word M = NZ; SWRITE("Test si ==> oi: "); IPDWRITE(r,A,V); SWRITE("\n"); GBTest(r,L,V); }
void VLREADR(Word *V_, Word *t_) { Word C,V,t,v; /* hide C,t; */ Step1: /* Read variables. */ t = 1; V = NIL; C = CREADB(); if (C != '(') { SWRITE("Error VLREADR: '(' was expected.\n"); goto Step2; } C = CREADB(); if (C == ')') goto Return; else BKSP(); do { VREADR(&v,&t); if (t == 0) goto Return; V = COMP(v,V); C = CREADB(); if (C == ')') { V = INV(V); goto Return; } if (C != ',') { SWRITE("Error VLREADR: ',' was expected.\n"); goto Step2; } } while (1); Step2: /* Error. */ DIELOC(); t = 0; goto Return; Return: /* Prepare for return. */ *V_ = V; *t_ = t; return; }
void stop() { ADJ_D_Time = ACLOCK() - ADJ_D_Time; SWRITE("\nADJ_2D took "); IWRITE(ADJ_D_Time); SWRITE(" millseconds.\n"); }
void PIMPTBLWR(Word C, Word R, Word V) { Word R1,Rp,T,V1,Vp,d,i,j,l,m,n,v; /* hide d,i,j,m,n; */ Step1: /* Draw the column heading. */ m = LENGTH(C); n = LENGTH(R); if (m >= 1000 || n >= 1000) { SWRITE("PIMPTBLWR: Sorry the table is too big.\n"); goto Return; } SWRITE("======="); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) CWRITE('='); } SWRITE("\n "); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) { d = i / 100; CWRITE(d + '0'); } } SWRITE("\n "); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) { d = REM(i,100) / 10; CWRITE(d + '0'); } } SWRITE("\n "); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) { d = REM(i,10); CWRITE(d + '0'); } } SWRITE("\n "); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) CWRITE('-'); } SWRITE("\n"); Step2: /* Draw each rows. */ Vp = V; Rp = R; for (j = 1; j <= n; j++) { ADV(Rp,&R1,&Rp); ADV(Vp,&V1,&Vp); if (R1 == ALIVE) { FIRST3(V1,&v,&l,&T); GWRITE(l); TAB(3); GWRITE(j); TAB(6); CWRITE('|'); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) { if (INSET(T,i)) CWRITE('X'); else CWRITE('.'); } } SWRITE("\n"); } } Step3: /* Draw the final line. */ SWRITE("======="); for (i = 1; i <= m; i++) { if (LELTI(C,i) == ALIVE) CWRITE('='); } SWRITE("\n"); Return: /* Prepare for return. */ return; }
void GBTest(Word r, Word L, Word N, Word Vp) { if (LENGTH(Vp) < r) { SWRITE("Not enough variables in GBTest!\n"); } Word F = GVCAP->IPFACTGB(r,L,N); SWRITE("\nSYSTEM:\n"); PRINTCOEFFSYS(r,LIST1(L),Vp); SWRITE("\n"); SWRITE("\nGB's:\n"); PRINTCOEFFSYS(r,F,Vp); SWRITE("\n"); }
void TRMODEWR(Word M) { Step1: /* Write. */ if (M == NIL) SWRITE("-"); else { CLOUT(FIRST(M)); SWRITE(" "); CLOUT(SECOND(M)); } goto Return; Return: /* Prepare for return. */ return; }
void IUPRWR(Word v, Word A, Word I) { Word l,r; Step1: /* Write. */ SWRITE("the unique root of "); IPDWRITE(1,A,LIST1(v)); FIRST2(I,&l,&r); SWRITE(" between "); RNWRITE(l); SWRITE(" and "); RNWRITE(r); Return: /* Prepare for return. */ return; }
void QepcadCls::PRDSEARCH() { Step1: /* Process. */ SWRITE("Search for true cell? : "); CWRITE(PCSEARCHTRUE); SWRITE("\n"); SWRITE("Search for false cell? : "); CWRITE(PCSEARCHFALSE); SWRITE("\n"); Return: /* Prepare for return. */ return; }
void QFWR(Word q) { Step1: /* Write it. */ if (q == UNIVER) SWRITE("A"); else if (q == EXIST) SWRITE("E"); Return: /* Prepare for return. */ return; }
void SIPWRITE(Word *P, BDigit p, BDigit k) { BDigit wii, i; wii = 2*(p + 3); // words in interval for(i = P[0]; i >= 0; i--) { SIDWRITE(P + 1 + i*wii,k); SWRITE(" x^"); IWRITE(i); if (i > 0) SWRITE(" + "); } }
void QepcadCls::PRCCS() { Word C,S,S1,W; /* hide C,S1; */ Step0: /* If fast-cell-choice is used, we cannot honor the strategy! */ if (PCCHFLAG) { SWRITE("The \"fast-cell-choice\" strategy is now switched off!\n"); PCCHFLAG = 0; } Step1: /* Read in the strategy. */ S = NIL; C = CREADB(); if (C != '(') { SWRITE("Error PRCCS: '(' was expected.\n"); goto Step3; } do { W = GETWORD(); if (EQUAL(W,LFS("TC"))) S1 = TCORD; else if (EQUAL(W,LFS("NC"))) S1 = NCORD; else if (EQUAL(W,LFS("LD"))) S1 = LDORD; else if (EQUAL(W,LFS("GD"))) S1 = GDORD; else if (EQUAL(W,LFS("SR"))) S1 = SRORD; else if (EQUAL(W,LFS("SN"))) S1 = SNORD; else if (EQUAL(W,LFS("HL"))) S1 = HLORD; else if (EQUAL(W,LFS("LL"))) S1 = LLORD; else if (EQUAL(W,LFS("GI"))) S1 = GIORD; else if (EQUAL(W,LFS("LI"))) S1 = LIORD; else { SWRITE("Error PRCCS: A partial ordering was expected.\n"); goto Step3; } S = COMP(S1,S); C = CREADB(); if (C != ',' && C != ')') { SWRITE("Error PRCCS: ',' or ')' was expected.\n"); goto Step3; } } while (!(C == ')')); S = INV(S); Step2: /* Set. */ PCCCS = S; goto Return; Step3: /* Error exit. */ DIELOC(); goto Return; Return: /* Prepare for return. */ return; }
int pmelf_putshdr32(Elf_Stream s, Elf32_Shdr *pshdr) { #ifndef PMELF_CONFIG_NO_SWAPSUPPORT Elf32_Shdr nshdr; #endif if ( s->needswap ) { #ifdef PMELF_CONFIG_NO_SWAPSUPPORT return -2; #else nshdr = *pshdr; pshdr = &nshdr; elf_swap32( &pshdr->sh_name); elf_swap32( &pshdr->sh_type); elf_swap32( &pshdr->sh_flags); elf_swap32( &pshdr->sh_addr); elf_swap32( &pshdr->sh_offset); elf_swap32( &pshdr->sh_size); elf_swap32( &pshdr->sh_link); elf_swap32( &pshdr->sh_info); elf_swap32( &pshdr->sh_addralign); elf_swap32( &pshdr->sh_entsize); #endif } return s->write && 1 == SWRITE( pshdr, sizeof(*pshdr), 1, s) ? 0 : -1; }
void GREADR(Word *a_, Word *t_) { Word C,S,a,t; /* hide algorithm */ Step1: /* Skip blanks and read sign, if any. */ t = 1; S = 1; C = CREADB(); if (C == '+') C = CREADB(); else if (C == '-') { C = CREADB(); S = -1; } if (DIGIT(C) == 0) { SWRITE("Error GREADR: A digit was expected.\n"); goto Step3; } Step2: /* Read digits and convert. */ a = 0; do { a = 10 * a + C - '0'; C = CREAD(); } while (!(DIGIT(C) == 0)); BKSP(); a = S * a; goto Return; Step3: /* Error. */ DIELOC(); t = 0; goto Return; Return: /* Prepare for return. */ *a_ = a; *t_ = t; return; }
Word CADFPCAD(Word D, Word P, Word S, Word I, Word Pb) { Word Db,Is,N,Sb,Pb_N,Ts,L,p,i,is,Q,Ms,C,Cs,Ds,Ss; Word Mb,mb; Step1: /* Is D the root cell? */ Db = LELTI(D,SC_REP); if (LELTI(D,SC_PAR) == NIL) { Is = NIL; Ss = NIL; Ms = NIL; } else { Step2: /* D is not the root cell. */ Is = CINV(COMP(LELTI(D,SC_INX),CINV(I))); N = LENGTH(Is); Step3: /* Signiture & multiplicity information. */ Sb = FIRST(LELTI(Db,SIGNPF)); Pb_N = LELTI(Pb,N); Ts = NIL; Ms = NIL; is = 0; /* Loop over each level N polynomial in P. */ for(L = CINV(LELTI(P,N)); L != NIL; L = RED(L)) { p = FIRST(L); i = 1; is++; /* Set i so that p is the ith level N pol in Pb. */ i = PFPIPFL(p,Pb_N); if (i == 0) { SWRITE("CAPFPCAD: Can't find the polynomial!\n"); } Ts = COMP(LELTI(Sb,i),Ts); /* Set the multiplicity list if necessary */ for (Mb = LELTI(Db,MULSUB); Mb != NIL; Mb = RED(Mb)) { mb = FIRST(Mb); if (FIRST(mb) == THIRD(LELTI(p,PO_LABEL))) { Ms = COMP(mb,Ms); } } } /* Ms = CINV(Ms); */ Ss = COMP(Ts,S); } Step4: /* Children. */ C = LELTI(D,SC_CDTV); if ( ISATOM(C) ) { Cs = NIL; } else { for(Cs = NIL; C != NIL; C = RED(C)) { Cs = COMP(CADFPCAD(FIRST(C),P,Ss,Is,Pb),Cs); } Cs = CINV(Cs); } Step5: /* */ Ds = LCOPY(Db); SLELTI(Ds,CHILD,Cs); SLELTI(Ds,INDX,Is); SLELTI(Ds,SIGNPF,Ss); SLELTI(Ds,HOWTV,NOTDET); /* Might want to change. */ SLELTI(Ds,MULSUB,Ms); Return: /* Prepare to return. */ return (Ds); }
void PRWHATIS() { Word C,C1,C_i,Cs,Csp,I,k,N,m; Step1: /* Read in a command name. */ N = GETWORD(); Step2: /* Match the command. */ Cs = NIL; C = COMMANDS; while (C != NIL) { ADV(C,&C_i,&C); if (MATCHWORD(N,FIRST(C_i))) Cs = COMP(C_i,Cs); } Cs = INV(Cs); m = LENGTH(Cs); Step3: /* No matched command. */ if (m == 0) { SWRITE("Error WHATIS: There is no such command!\n"); goto Return; } Step4: /* More than one command matched. */ if (m > 1) { Csp = Cs; ADV(Csp,&C1,&Csp); k = LENGTH(FIRST(C1)); while (Csp != NIL) { if (LENGTH(FIRST(FIRST(Csp))) < k) C1 = FIRST(Csp); Csp = RED(Csp); } if (!EQUAL(N,FIRST(C1))) { SWRITE("Error WHATIS: More than one command is matched.\n"); while (Cs != NIL) { ADV(Cs,&C_i,&Cs); SWRITE(" "); CLOUT(FIRST(C_i)); SWRITE("\n"); } goto Return; } } Step5: /* Give help on the command. */ C1 = FIRST(Cs); I = SECOND(C1); HELPWR(I); goto Return; Return: /* Prepare for return. */ return; }
void QepcadCls::PRDNQFF() { Step1: /* Process. */ QFFWR(GVVL,GVNQFF); SWRITE("\n"); goto Return; Return: /* Prepare for return. */ return; }
void PCADWR(Word c) { Word M,cb,cp,p,s; /* hide p; */ Step1: /* common. */ LWRITE(LELTI(c,INDX)); if (LELTI(c,LEVEL) > 0) { s = LELTI(c,SAMPLE); if (ISPRIMIT(s)) CWRITE('p'); else CWRITE('e'); GWRITE(CELLDEG(c)); } cb = LELTI(c,CHILD); Step2: /* c is a leaf. */ if (cb == NIL) { SWRITE(" "); TRUTHWR(LELTI(c,TRUTH)); SWRITE("\n"); goto Return; } Step3: /* c is not a leaf. */ p = OPOS; ADV(cb,&cp,&cb); SWRITE("---"); PCADWR(cp); while (cb != NIL) { TAB(p); ADV(cb,&cp,&cb); SWRITE("---"); PCADWR(cp); } Return: /* Prepare for return. */ return; }
void PRQUIT() { Step1: /* Process. */ SWRITE("Quitting the QEPCAD system... Bye!\n"); ENDQEPCAD(); ENDSACLIB(SAC_FREEMEM); exit(0); Return: /* Prepare for return. */ return; }
int pmelf_putehdr32(Elf_Stream s, Elf32_Ehdr *pehdr) { uint8_t magic[4] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3 }; #ifndef PMELF_CONFIG_NO_SWAPSUPPORT Elf32_Ehdr nehdr; #endif if ( memcmp(magic, pehdr->e_ident+EI_MAG0, sizeof(magic)) ) { PMELF_PRINTF(pmelf_err, PMELF_PRE"error: not an ELF file\n"); return -1; } if ( pehdr->e_ident[EI_CLASS] != ELFCLASS32 ) { PMELF_PRINTF(pmelf_err, PMELF_PRE"error: not an 32-bit ELF file\n"); return -1; } if ( pehdr->e_ident[EI_VERSION] != EV_CURRENT ) { PMELF_PRINTF(pmelf_err, PMELF_PRE"error: not a version %i ELF file\n", EV_CURRENT); return -1; } s->needswap = iamlsb() ^ (pehdr->e_ident[EI_DATA] == ELFDATA2LSB ? 1 : 0); #ifdef PMELF_CONFIG_NO_SWAPSUPPORT if ( s->needswap ) { PMELF_PRINTF(pmelf_err, PMELF_PRE"error: host/target byte order mismatch but pmelf was configured w/o support for byte-swapping\n"); return -2; } #else if ( s->needswap ) { nehdr = *pehdr; pehdr = &nehdr; elf_swap16( &pehdr->e_type ); elf_swap16( &pehdr->e_machine ); elf_swap32( &pehdr->e_version ); elf_swap32( &pehdr->e_entry ); elf_swap32( &pehdr->e_phoff ); elf_swap32( &pehdr->e_shoff ); elf_swap32( &pehdr->e_flags ); elf_swap16( &pehdr->e_ehsize ); elf_swap16( &pehdr->e_phentsize ); elf_swap16( &pehdr->e_phnum ); elf_swap16( &pehdr->e_shentsize ); elf_swap16( &pehdr->e_shnum ); elf_swap16( &pehdr->e_shstrndx ); } #endif return s->write && 1 == SWRITE(pehdr, sizeof(*pehdr), 1, s) ? 0 : -1; }
int sacMain() { Word V,B,t,Vx,M,L,Lp,i,k = 20; Word wii, p, J, *I , *Bp; /* Read bivariate polynomial */ V = LIST2(LFS("x"),LFS("y")); SWRITE("Enter B, a polynomial in x and y : "); IPEXPREADR(2,V,&B,&t); if (!t) { SWRITE("Polynomial read unsuccessfull!\n"); return 1; } else { SWRITE("Polynomial read in is: "); IPDWRITE(2,B,V); SWRITE("\n"); } /* Get precision */ SWRITE("Enter precision: "); p = IREAD(); SWRITE("Precision read is: "); IWRITE(p); SWRITE("\n"); /* Read Interval */ SWRITE("Enter binary rational interval: "); J = LBRIREAD(); /* Sub! */ Bp = GETARRAY(1 + (PDEG(B) + 1)*2*(p + 3)); IBPELBRISIPR(B,J,p,Bp); SWRITE("Evaluation result is : "); SIPWRITE(Bp,p,k); SWRITE("\n"); return 0; }
Word QepcadCls::SFCFULLDf(Word D, Word P, Word J, Word n) { Word t,SF,Dp,Pp,Lt,Lf,LA,Q,D1,P1,D0,P0,J0,i,Lp,pflag, L; char e,s,m,c; Step1: /* Space is either empty or R^n. */ t = DOPFSUFF_FULLD(P,LIST1(D)); if (t == TRUE) { SF = LIST1(TRUE); /* CAD is identically TRUE. */ goto Return; } else if (t == FALSE) { SF = LIST1(FALSE); /* CAD is identically FALSE. */ goto Return; } Step2: /* Extended language. */ /* Dp,Pp are a simplified CAD for D,P (based only on full-dimensional cells!) */ CCADCONmod(n,P,D,&Pp,&Dp); Dp = PCAD2ESPCAD(P,Pp,Dp,NIL); /* Get list of all the true and false cells. */ LTFOCALWTV(Dp,n,&Lt,&Lf); /* Filter out all but the full-dimensional true/false cells. */ for(L = NIL; Lt != NIL; Lt = RED(Lt)) if (LELTI(LELTI(FIRST(Lt),SC_REP),LEVEL) == CELLDIM(LELTI(FIRST(Lt),SC_REP))) L = COMP(FIRST(Lt),L); Lt = L; for(L = NIL; Lf != NIL; Lf = RED(Lf)) if (LELTI(LELTI(FIRST(Lf),SC_REP),LEVEL) == CELLDIM(LELTI(FIRST(Lf),SC_REP))) L = COMP(FIRST(Lf),L); Lf = L; if (Lt == NIL && Lf == NIL) { SWRITE("No cells have truth values!\n"); goto Return; } t = ESPCADDOPFSUFF(Pp,LIST1(Dp)); LA = LISTOETAmod(Pp,n,t==NIL); /* Construct formula */ SF = NECCONDS(Lt,Lf,LA,Pp); SF = FMASORT(SF); SF = FMA_REMCONST(SF); SF = FMASMOOTH(SF); SF = FMAOPCOMBINE(SF); Return: /* Prepare to return. */ return SF; }
void LABELWR(Word N, Word I) { Word Ip,i; Step1: /* Write the label. */ CLOUT(N); SWRITE("_"); if (I == NIL) goto Return; Ip = I; ADV(Ip,&i,&Ip); AWRITE(i); while (Ip != NIL) { ADV(Ip,&i,&Ip); CWRITE(','); AWRITE(i); } goto Return; Return: /* Prepare for return. */ return; }
void IPLDWR(Word V, Word A) { Word A1,P,r; Step1: /* Write. */ while (A != NIL) { ADV(A,&A1,&A); PLABELWR(A1); SWRITE(" = "); r = SECOND(LELTI(A1,PO_LABEL)); P = LELTI(A1,PO_POLY); if (LELTI(A1,PO_TYPE) == PO_POINT) { SAMPLEWR(r,FIRST(P),4); } else { IPDWRITE(r,P,V); SWRITE("\n"); } } Return: /* Prepare for return. */ return; }
Word POLYINDEX(Word P, Word p, Word r, Word *t) { Word P_r, Pp, pp; for(; PDEG(p) == 0; r--) p = SECOND(p); /* Is p already in P? */ P_r = LELTI(P,r); *t = 0; for(Pp = P_r; Pp != NIL; Pp = RED(Pp)) { pp = FIRST(Pp); if ( EQUAL(LELTI(pp,PO_POLY),p) ) { *t = 1; break; } } if (*t == 0) { SWRITE("Polynomial not found!!\n"); } return RED(LELTI(pp,PO_LABEL)); }
void IPLLDWR(Word V, Word A) { Word A1,A11,i,P,L,H; /* hide i,j,n,r; */ Step1: /* Write. */ i = 0; while (A != NIL) { ADV(A,&A1,&A); i = i + 1; while (A1 != NIL) { ADV(A1,&A11,&A1); PLABELWR(A11); TAB(7); SWRITE("= "); H = LELTI(A11,PO_PARENT); PARENTWR(H); if (LELTI(A11,PO_STATUS) == PO_REMOVE) SWRITE(" *** Removed *** "); if (LELTI(A11,PO_TYPE) == PO_ECON) SWRITE(" *** Equational Constraint *** "); P = LELTI(A11,PO_POLY); SWRITE("\n"); TAB(7); SWRITE("= "); if (LELTI(A11,PO_TYPE) == PO_POINT) { SAMPLEWR(i,FIRST(P),4); } else { IPDWRITE(i,P,V); SWRITE("\n"); } SWRITE("\n"); } if (A != NIL) SWRITE("\n"); } Return: /* Prepare for return. */ return; }
/* Projection point equal */ BDigit PRJPNTEQUAL(Word A, Word B) { if (LENGTH(A) != LENGTH(B)) return 0; /* Both primitive */ Word a = FIRST(A), b = FIRST(B); if (ISPRIMIT(a) && ISPRIMIT(b)) { Word aC,aK,ac,bC,bK,bc; FIRST3(a,&aC,&aK,&ac); FIRST3(b,&bC,&bK,&bc); if (!EQUAL(aC,bC)) return 0; if (EQUAL(FIRST(aK),SECOND(aK)) && EQUAL(aK,bK)) return 1; if (EQUAL(FIRST(aK),SECOND(aK)) && EQUAL(FIRST(bK),SECOND(bK)) && !EQUAL(aK,bK)) return 0; if (RNCOMP(SECOND(aK),FIRST(bK)) <= 0 || RNCOMP(FIRST(aK),SECOND(bK)) >= 0) return 0; return EQUAL(ac,bc); } /* Both Not Primitive */ if (!ISPRIMIT(a) && !ISPRIMIT(b)) { if (!PRJPNTEQUAL(LIST1(SECOND(A)),LIST1(SECOND(B)))) return 0; Word aC,aK,aM,aI,ac,bC,bK,G,Af,Bf; FIRST5(a,&aC,&aK,&aM,&aI,&ac); FIRST2(b,&bC,&bK); if (EQUAL(FIRST(aK),SECOND(aK)) && EQUAL(FIRST(bK),SECOND(bK)) && !EQUAL(aK,bK)) return 0; if (RNCOMP(SECOND(aK),FIRST(bK)) <= 0 || RNCOMP(FIRST(aK),SECOND(bK)) >= 0) return 0; if (EQUAL(aC,bC)) return 1; AFUPGC(aM,aC,bC,&G,&Af,&Bf); if (PDEG(G) < 1) return 0; Word KL = LIST2(FIRST(aK),LIST2(1,1)); Word KR = LIST2(SECOND(aK),LIST2(1,1)); Word sL = AFSIGN(aM,aI,AFPEMV(1,aM,G,KL)); Word sR = AFSIGN(aM,aI,AFPEMV(1,aM,G,KR)); return EQUAL(KL,KR) && sL == 0 || sL == 1 && sR == -1 || sL == -1 && sR == 1; } /* One primitive, the other not */ if (ISPRIMIT(a) != ISPRIMIT(b)) { SWRITE("This condition not implemented in PRJPNTEQUAL!\n"); FAIL("PRJPNTEQUAL","Incomplete Implementation Error!"); } return -1; }
int pmelf_putsym64(Elf_Stream s, Elf64_Sym *psym) { Elf64_Sym nsym; if ( s->needswap ) { #ifdef PMELF_CONFIG_NO_SWAPSUPPORT return -2; #else nsym = *psym; psym = &nsym; elf_swap32( &psym->st_name); elf_swap64( &psym->st_value); elf_swap64( &psym->st_size); elf_swap16( &psym->st_shndx); #endif } return s->write && 1 == SWRITE( psym, sizeof(*psym), 1, s) ? 0 : -1; }
/*==================================================================== main(argc,argv) Main Algorithm which drives the QEPCAD sytem. ====================================================================*/ int main(int argc, char **argv) { Word Fs,F_e,F_n,F_s,V,t,ac; char **av; Step1: /* Set up the system. */ ARGSACLIB(argc,argv,&ac,&av); BEGINSACLIB((Word *)&argc); BEGINQEPCAD(ac,av); #ifndef _MSC_VER init_SIGINT_handler(); /* A special handler for SIGINT is needed to shut down child processes. Also used for SIGTERM. */ #endif Step2: /* Read input, create CAD, write result */ PCCONTINUE = FALSE; PRINTBANNER(); do { // Reinitialize system in between runs if (PCCONTINUE == TRUE) { INITSYS(); PCCONTINUE = FALSE; } INPUTRD(&Fs,&V); QepcadCls Q(V,Fs); BTMQEPCAD = ACLOCK(); Q.QEPCAD(Fs,&t,&F_e,&F_n,&F_s); } while (PCCONTINUE == TRUE); Step3: /* Clean up the system. */ SWRITE("\n===================== The End =======================\n"); STATSACLIB(); ENDQEPCAD(); ENDSACLIB(SAC_FREEMEM); free(av); /* Frees the array malloc'd by ARGSACLIB */ Return: /* Prepare for return. */ return 0; }
void QepcadCls::PRRSP() { Word C; /* hide C; */ Step1: /* Read in the arugment. */ C = CREADB(); Step2: /* Check for validity. */ if (C != 'y' && C != 'n') { SWRITE("Error PRRSP: Either 'y' or 'n' was expected.\n"); goto Step4; } Step3: /* Set. */ PCRSP = C; goto Return; Step4: /* Error exit. */ DIELOC(); goto Return; Return: /* Prepare for return. */ return; }
void PCADWRITE(Word Cs, Word Ps) { Word C,l,i,L,k,I; Step1: /* */ I = PCADCINDEX(Cs); l = LENGTH(I); L = LELTI(Cs,SC_CDTV); Step2: /* */ SWRITE("\n"); for(k = 0; k < l; k++) SWRITE(" "); OWRITE(I); Step3: /* */ SWRITE(":"); SIGNLWR(PCADCSV(Cs,Ps)); Step4: /* */ if (ISATOM(L)) { if (L == 0) SWRITE(":F"); else if (L == 1) SWRITE(":T"); else SWRITE(":?"); } else { SWRITE(":==>"); while (L != NIL) { PCADWRITE(FIRST(L),Ps); L = RED(L); } } Return: /* */ if (I == NIL) SWRITE("\n"); return; }