static uim_lisp c_process_waitpid(uim_lisp pid_, uim_lisp options_) { uim_lisp ret_ = uim_scm_null(); int status; ret_ = MAKE_INT(waitpid(C_INT(pid_), &status, C_INT(options_))); if (WIFEXITED(status)) return LIST5(ret_, uim_scm_t(), uim_scm_f(), uim_scm_f(), MAKE_INT(WEXITSTATUS(status))); else if (WIFSIGNALED(status)) return LIST5(ret_, uim_scm_f(), uim_scm_t(), uim_scm_f(), MAKE_INT(WTERMSIG(status))); #ifdef WIFSTOPPED else if (WIFSTOPPED(status)) return LIST5(ret_, uim_scm_f(), uim_scm_f(), uim_scm_t(), MAKE_INT(WSTOPSIG(status))); #endif return LIST5(ret_, uim_scm_f(), uim_scm_f(), uim_scm_f(), MAKE_INT(status)); }
Word NORMAL(Word s) { Word I,J,Js,M,N,g,gs,j,sh,b; Word g1; /* hide j; */ Step1: /* Setup. */ FIRST5(s,&g,&J,&M,&I,&b); Step2: /* Normalize. */ N = AFPNIPDB(M,g); g = AFPICR(1,g); IPSRP(2,g,&g1,&g); AMUPMPR(M,I,g,J,N,&Js,&j); gs = LELTI(N,j); Js = IPSIFI(gs,Js); sh = LIST5(gs,Js,M,I,b); Return: /* Prepare for return. */ return(sh); }
void QepcadCls::CSORCELLTR_MOD(Word c, Word Pp, Word PpO, Word PpN, Word P) { Word f,s,sh,M,K,C,Pps,L,T,B,E,I,A,a,b,k; Word PP,NP,L_P,TP,i,ta,t; Step0: k = LELTI(c,LEVEL); s = LELTI(c,SAMPLE); sh = CONVERT(s,k); SLELTI(c,SAMPLE,sh); /* Trick CONSTRUCT into working for us by wrapping the elements of Pp (which are SACLIB polynomials) in a dummy QEPCAD projection polynomial/factor data structure. */ Word PpM = NIL; for(Word PpR = CINV(Pp),j=LENGTH(Pp); PpR != NIL; PpR = RED(PpR),--j) PpM = COMP( LIST5(FIRST(PpR),LIST3(LFS("P"),k+1,j),0,PO_FAC,0) ,PpM); CONSTRUCT(c,k,GVNFV,PpM,GVNIP); Step5: /* Add two new fields to each cell to make it an RCell. */ T = NIL; for(A = LELTI(c,CHILD); A != NIL; A = RED(A)) { T = COMP(CCONC(FIRST(A),LIST2(NIL,NIL)),T); } SLELTI(c,CHILD,CINV(T)); Step6: /* Add truth values and other information. */ /* Get mask for pivot pol's, i.e. a list of 1's and zeros corresponding to PpO, where the non-pivot pol positions are 1, and the pivot pol positions are zero. */ SEPPIVNONPIV(LELTI(P,k+1),k+1,&PP,&NP); /* Get list of pivot pol's for this level. */ if ( (NP != NIL) && SINTER(LELTI(GVPIVOT,k+1),LLPFZC(c,P)) != NIL ) { PP = LELTI(P,k+1); NP = NIL; } L_P = NIL; ta = FIRST(LELTI(FIRST(LELTI(c,CHILD)),SIGNPF)); /* signiture of a sector on level k+1 pols. */ for(TP = LELTI(P,k+1); TP != NIL; TP = RED(TP)) { /* Subtle point: a pivot pol might vanish identically in this stack, which would mess everything up. If this pol does vanish identically in the stack, don't include it in the mask! */ ADV(ta,&i,&ta); /* sign of current pol in a sector: if 0 then pol vanishes in stack. */ if ( PFPIPFL(FIRST(TP),PP) && i ) { L_P = COMP(0,L_P); } else L_P = COMP(1,L_P); } L_P = INV(L_P); A = LELTI(c,CHILD); /* Stack with more cells, i.e. new. */ B = LELTI(LELTI(c,INCELL),CHILD); /* Stack with fewer cells, i.e. old. */ ADV(B,&b,&B); ADV(A,&a,&A); while (A != NIL) { SLELTI(a,INCELL,b); SLELTI(a,TRUTH,LELTI(b,TRUTH)); SLELTI(a,HOWTV,LELTI(b,HOWTV)); ADV(A,&a,&A); if (LELTI(b,MULSUB) != NIL) ADV(B,&b,&B); /* i.e. if b is a section. */ if ( ISCSOPP(a,L_P) ) { do{ ADV(B,&b,&B); } while( ! ISCSOPP(b,L_P) ); } } SLELTI(a,INCELL,b); SLELTI(a,TRUTH,LELTI(b,TRUTH)); SLELTI(a,HOWTV,LELTI(b,HOWTV)); Return: /* */ return; }