📄 pangen3.h
字号:
" }", " return 1;", "}", "#endif", "int", "q_len(int x)", "{ if (!x--)", " uerror(\"ref to uninitialized chan name (len)\");", " return ((Q0 *)qptr(x))->Qlen;", "}\n", "int", "q_full(int from)", "{ if (!from--)", " uerror(\"ref to uninitialized chan name (qfull)\");", " switch(((Q0 *)qptr(from))->_t) {", 0,};static char *Addq4[] = { " case 0: printf(\"queue %%d was deleted\\n\", from+1);", " }", " Uerror(\"bad queue - q_full\");", " return 0;", "}\n", "#ifdef HAS_UNLESS", "int", "q_e_f(int from)", "{ /* empty or full */", " return !q_len(from) || q_full(from);", "}", "#endif", "#if NQS>0", "int", "qrecv(int from, int slot, int fld, int done)", "{ uchar *z;", " int j, k, r=0;\n", " if (!from--)", " uerror(\"ref to uninitialized chan name (receiving)\");", " if (from >= (int) now._nr_qs || from < 0)", " Uerror(\"qrecv bad queue#\");", " z = qptr(from);", "#ifdef EVENT_TRACE", " if (done && (in_r_scope(from+1)))", " require('r', from);", "#endif", " switch (((Q0 *)qptr(from))->_t) {", 0,};static char *Addq5[] = { " case 0: printf(\"queue %%d was deleted\\n\", from+1);", " default: Uerror(\"bad queue - qrecv\");", " }", " return r;", "}", "#endif\n", "#ifndef BITSTATE", "#ifdef COLLAPSE", "long", "col_q(int i, char *z)", "{ int j=0, k;", " char *x, *y;", " Q0 *ptr = (Q0 *) qptr(i);", " switch (ptr->_t) {", 0,};static char *Code0[] = { "void", "run(void)", "{ /* int i; */", " memset((char *)&now, 0, sizeof(State));", " vsize = sizeof(State) - VECTORSZ;", "#ifndef NOVSZ", " now._vsz = vsize;", "#endif", "/* optional provisioning statements, e.g. to */", "/* set hidden variables, used as constants */", "#ifdef PROV", "#include PROV", "#endif", " settable();", 0,};static char *R0[] = { " Maxbody = max(Maxbody, sizeof(P%d));", " reached[%d] = reached%d;", " accpstate[%d] = (uchar *) emalloc(nstates%d);", " progstate[%d] = (uchar *) emalloc(nstates%d);", " stopstate[%d] = (uchar *) emalloc(nstates%d);", " visstate[%d] = (uchar *) emalloc(nstates%d);", " mapstate[%d] = (short *) emalloc(nstates%d * sizeof(short));", "#ifdef HAS_CODE", " NrStates[%d] = nstates%d;", "#endif", " stopstate[%d][endstate%d] = 1;", 0,};static char *R0a[] = { " retrans(%d, nstates%d, start%d, src_ln%d, reached%d);", 0,};static char *R0b[] = { " if (state_tables)", " { printf(\"\\nTransition Type: \");", " printf(\"A=atomic; D=d_step; L=local; G=global\\n\");", " printf(\"Source-State Labels: \");", " printf(\"p=progress; e=end; a=accept;\\n\");", "#ifdef MERGED", " printf(\"Note: statement merging was used. Only the first\\n\");", " printf(\" stmnt executed in each merge sequence is shown\\n\");", " printf(\" (use spin -a -o3 to disable statement merging)\\n\");", "#endif", " pan_exit(0);", " }", 0,};static char *Code1[] = { "#ifdef NP", "#define ACCEPT_LAB 1 /* at least 1 in np_ */", "#else", "#define ACCEPT_LAB %d /* user-defined accept labels */", "#endif", 0,};static char *Code3[] = { "#define PROG_LAB %d /* progress labels */", 0,};static char *R2[] = { "uchar *accpstate[%d];", "uchar *progstate[%d];", "uchar *reached[%d];", "uchar *stopstate[%d];", "uchar *visstate[%d];", "short *mapstate[%d];", "#ifdef HAS_CODE", "int NrStates[%d];", "#endif", 0,};static char *R3[] = { " Maxbody = max(Maxbody, sizeof(Q%d));", 0,};static char *R4[] = { " r_ck(reached%d, nstates%d, %d, src_ln%d, src_file%d);", 0,};static char *R5[] = { " case %d: j = sizeof(P%d); break;", 0,};static char *R6[] = { " }", " this = o_this;", " return h-BASE;", "#ifndef NOBOUNDCHECK", "#undef Index", "#define Index(x, y) Boundcheck(x, y, II, tt, t)", "#endif", "}\n", "#if defined(BITSTATE) && defined(COLLAPSE)", "/* just to allow compilation, to generate the error */", "long col_p(int i, char *z) { return 0; }", "long col_q(int i, char *z) { return 0; }", "#endif", "#ifndef BITSTATE", "#ifdef COLLAPSE", "long", "col_p(int i, char *z)", "{ int j, k; unsigned long ordinal(char *, long, short);", " char *x, *y;", " P0 *ptr = (P0 *) pptr(i);", " switch (ptr->_t) {", " case 0: j = sizeof(P0); break;", 0,};static char *R8a[] = { " default: Uerror(\"bad proctype - collapse\");", " }", " if (z) x = z; else x = scratch;", " y = (char *) ptr; k = proc_offset[i];", " for ( ; j > 0; j--, y++)", " if (!Mask[k++]) *x++ = *y;", " for (j = 0; j < WS-1; j++)", " *x++ = 0;", " x -= j;", " if (z) return (long) (x - z);", " return ordinal(scratch, x-scratch, (short) (2+ptr->_t));", "}", "#endif", "#endif", 0,};static char *R8b[] = { " default: Uerror(\"bad qtype - collapse\");", " }", " if (z) x = z; else x = scratch;", " y = (char *) ptr; k = q_offset[i];", " /* no need to store the empty slots at the end */", " j -= (q_max[ptr->_t] - ptr->Qlen) * ((j - 2)/q_max[ptr->_t]);", " for ( ; j > 0; j--, y++)", " if (!Mask[k++]) *x++ = *y;", " for (j = 0; j < WS-1; j++)", " *x++ = 0;", " x -= j;", " if (z) return (long) (x - z);", " return ordinal(scratch, x-scratch, 1); /* chan */", "}", "#endif", "#endif", 0,};static char *R12[] = { "\t\tcase %d: r = ((Q%d *)z)->contents[slot].fld%d; break;", 0,};char *R13[] = { "int ", "unsend(int into)", "{ int _m=0, j; uchar *z;\n", "#ifdef HAS_SORTED", " int k;", "#endif", " if (!into--)", " uerror(\"ref to uninitialized chan (unsend)\");", " z = qptr(into);", " j = ((Q0 *)z)->Qlen;", " ((Q0 *)z)->Qlen = --j;", " switch (((Q0 *)qptr(into))->_t) {", 0,};char *R14[] = { " default: Uerror(\"bad queue - unsend\");", " }", " return _m;", "}\n", "void", "unrecv(int from, int slot, int fld, int fldvar, int strt)", "{ int j; uchar *z;\n", " if (!from--)", " uerror(\"ref to uninitialized chan (unrecv)\");", " z = qptr(from);", " j = ((Q0 *)z)->Qlen;", " if (strt) ((Q0 *)z)->Qlen = j+1;", " switch (((Q0 *)qptr(from))->_t) {", 0,};char *R15[] = { " default: Uerror(\"bad queue - qrecv\");", " }", "}", 0,};static char *Proto[] = { "", "/** function prototypes **/", "char *emalloc(unsigned long);", "char *Malloc(unsigned long);", "int Boundcheck(int, int, int, int, Trans *);", "/* int abort(void); */", "int addqueue(int, int);", "/* int atoi(char *); */", "int close(int);","#ifndef SC", "int creat(char *, unsigned short);", "int write(int, void *, unsigned);","#endif", "int delproc(int, int);", "int endstate(void);", "int hstore(char *, int);","#ifdef MA", "int gstore(char *, int, uchar);","#endif", "int q_cond(short, Trans *);", "int q_full(int);", "int q_len(int);", "int q_zero(int);", "int qrecv(int, int, int, int);", "int unsend(int);", "/* void *sbrk(int); */", "void Uerror(char *);", "void assert(int, char *, int, int, Trans *);", "void c_chandump(int);", "void c_globals(void);", "void c_locals(int, int);", "void checkcycles(void);", "void crack(int, int, Trans *, short *);", "void d_hash(uchar *, int);", "void s_hash(uchar *, int);", "void r_hash(uchar *, int);", "void delq(int);", "void do_reach(void);", "void pan_exit(int);", "void exit(int);", "void hinit(void);", "void imed(Trans *, int, int, int);", "void new_state(void);", "void p_restor(int);", "void putpeg(int, int);", "void putrail(void);", "void q_restor(void);", "void retrans(int, int, int, short *, uchar *);", "void settable(void);", "void setq_claim(int, int, char *, int, char *);", "void sv_restor(void);", "void sv_save(void);", "void tagtable(int, int, int, short *, uchar *);", "void uerror(char *);", "void unrecv(int, int, int, int, int);", "void usage(FILE *);", "void wrap_stats(void);", "#if defined(FULLSTACK) && defined(BITSTATE)", "int onstack_now(void);", "void onstack_init(void);", "void onstack_put(void);", "void onstack_zap(void);", "#endif", "#ifndef XUSAFE", "int q_S_check(int, int);", "int q_R_check(int, int);", "uchar q_claim[MAXQ+1];", "char *q_name[MAXQ+1];", "char *p_name[MAXPROC+1];", "#endif", 0,};static char *SvMap[] = { "void", "to_compile(void)", "{ char ctd[1024], carg[64];", "#ifdef BITSTATE", " strcpy(ctd, \"-DBITSTATE \");", "#else", " strcpy(ctd, \"\");", "#endif", "#ifdef NOVSZ", " strcat(ctd, \"-DNOVSZ \");", "#endif", "#ifdef MEMLIM", " sprintf(carg, \"-DMEMLIM=%%d \", MEMLIM);", " strcat(ctd, carg);", "#else", "#ifdef MEMCNT", " sprintf(carg, \"-DMEMCNT=%%d \", MEMCNT);", " strcat(ctd, carg);", "#endif", "#endif", "#ifdef NOCLAIM", " strcat(ctd, \"-DNOCLAIM \");", "#endif", "#ifdef SAFETY", " strcat(ctd, \"-DSAFETY \");", "#else", "#ifdef NOFAIR", " strcat(ctd, \"-DNOFAIR \");", "#else", "#ifdef NFAIR", " if (NFAIR != 2)", " { sprintf(carg, \"-DNFAIR=%%d \", NFAIR);", " strcat(ctd, carg);", " }", "#endif", "#endif", "#endif", "#ifdef NOREDUCE", " strcat(ctd, \"-DNOREDUCE \");", "#else", "#ifdef XUSAFE", " strcat(ctd, \"-DXUSAFE \");", "#endif", "#endif", "#ifdef NP", " strcat(ctd, \"-DNP \");", "#endif", "#ifdef PEG", " strcat(ctd, \"-DPEG \");", "#endif", "#ifdef VAR_RANGES", " strcat(ctd, \"-DVAR_RANGES \");", "#endif", "#ifdef HC0", " strcat(ctd, \"-DHC0 \");", "#endif", "#ifdef HC1", " strcat(ctd, \"-DHC1 \");", "#endif", "#ifdef HC2", " strcat(ctd, \"-DHC2 \");", "#endif", "#ifdef HC3", " strcat(ctd, \"-DHC3 \");", "#endif", "#ifdef HC4", " strcat(ctd, \"-DHC4 \");", "#endif", "#ifdef CHECK", " strcat(ctd, \"-DCHECK \");", "#endif", "#ifdef CTL", " strcat(ctd, \"-DCTL \");", "#endif", "#ifdef NIBIS", " strcat(ctd, \"-DNIBIS \");", "#endif", "#ifdef NOBOUNDCHECK", " strcat(ctd, \"-DNOBOUNDCHECK \");", "#endif", "#ifdef NOSTUTTER", " strcat(ctd, \"-DNOSTUTTER \");", "#endif", "#ifdef REACH", " strcat(ctd, \"-DREACH \");", "#endif", "#ifdef PRINTF", " strcat(ctd, \"-DPRINTF \");", "#endif", "#ifdef OTIM", " strcat(ctd, \"-DOTIM \");", "#endif", "#ifdef COLLAPSE", " strcat(ctd, \"-DCOLLAPSE \");", "#endif", "#ifdef MA", " sprintf(carg, \"-DMA=%%d \", MA);", " strcat(ctd, carg);", "#endif", "#ifdef SVDUMP", " strcat(ctd, \"-DSVDUMP \");", "#endif", "#ifdef VECTORSZ", " if (VECTORSZ != 1024)", " { sprintf(carg, \"-DVECTORSZ=%%d \", VECTORSZ);", " strcat(ctd, carg);", " }", "#endif", "#ifdef VERBOSE", " strcat(ctd, \"-DVERBOSE \");", "#endif", "#ifdef CHECK", " strcat(ctd, \"-DCHECK \");", "#endif", "#ifdef SDUMP", " strcat(ctd, \"-DSDUMP \");", "#endif", "#ifdef COVEST", " strcat(ctd, \"-DCOVEST \");", "#endif", " printf(\"Compiled as: cc -o pan %%span.c\\n\", ctd);", "}", 0,};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -