1 /***** spin: pangen2.h *****/
3 /* Copyright (c) 1989-2003 by Lucent Technologies, Bell Laboratories. */
4 /* All Rights Reserved. This software is for educational purposes only. */
5 /* No guarantee whatsoever is expressed or implied by the distribution of */
6 /* this code. Permission is given to distribute this code provided that */
7 /* this introductory message is not removed and no monies are exchanged. */
8 /* Software written by Gerard J. Holzmann. For tool documentation see: */
9 /* http://spinroot.com/ */
10 /* Send all bug-reports and/or questions to: bugs@spinroot.com */
12 static char *Nvr1[] = { /* allow separate compilation */
15 "check_claim(int st)",
17 " if (st == endclaim)",
18 " uerror(\"claim violated!\");",
19 " if (stopstate[VERI][st])",
20 " uerror(\"end state in claim reached\");",
26 static char *Pre0[] = {
28 "#define _FILE_OFFSET_BITS 64", /* to allow file sizes greater than 2Gb */
31 "#include <signal.h>",
32 "#include <stdlib.h>",
33 "#include <stdarg.h>",
34 "#include <string.h>",
37 "#if defined(WIN32) || defined(WIN64)",
40 "#include <unistd.h>",
41 "#include <sys/times.h>", /* new 4.3.0 */
43 "#include <sys/types.h>", /* defines off_t */
44 "#include <sys/stat.h>",
46 "#define Offsetof(X, Y) ((unsigned long)(&(((X *)0)->Y)))",
48 "#define max(a,b) (((a)<(b)) ? (b) : (a))",
51 "int Printf(const char *fmt, ...); /* prototype only */",
56 static char *Preamble[] = {
59 "#define onstack_now() (LL[trpt->j6] && LL[trpt->j7])",
60 "#define onstack_put() LL[trpt->j6]++; LL[trpt->j7]++",
61 "#define onstack_zap() LL[trpt->j6]--; LL[trpt->j7]--",
64 "#if !defined(SAFETY) && !defined(NOCOMP)",
66 * V_A identifies states in the current statespace
67 * A_V identifies states in the 'other' statespace
68 * S_A remembers how many leading bytes in the sv
69 * are used for these markers + fairness bits
71 "#define V_A (((now._a_t&1)?2:1) << (now._a_t&2))",
72 "#define A_V (((now._a_t&1)?1:2) << (now._a_t&2))",
84 "#define onstack_put() ;",
85 "#define onstack_zap() gstore((char *) &now, vsize, 4)",
87 "#if defined(FULLSTACK) && !defined(BITSTATE)",
88 "#define onstack_put() trpt->ostate = Lstate",
89 "#define onstack_zap() { \\",
90 " if (trpt->ostate) \\",
91 " trpt->ostate->tagged = \\",
92 " (S_A)? (trpt->ostate->tagged&~V_A) : 0; \\",
99 " unsigned int tagged;",
100 "#if defined(BITSTATE) && !defined(NOREDUCE) && !defined(SAFETY)",
101 " unsigned int proviso;", /* uses just 1 bit 0/1 */
104 "#if defined(CHECK) || (defined(COLLAPSE) && !defined(FULLSTACK))",
105 " unsigned long st_id;",
108 "#if VECTORSZ<65536",
109 " unsigned short ln;", /* length of vector */
111 " unsigned long ln;", /* length of vector */
114 "#if !defined(SAFETY) || defined(REACH)",
118 "} **H_tab, **S_Tab;\n",
120 "typedef struct Trail {",
121 " int st; /* current state */",
122 " uchar pr; /* process id */",
123 " uchar tau; /* 8 bit-flags */",
124 " uchar o_pm; /* 8 more bit-flags */",
126 " Meaning of bit-flags:",
127 " tau&1 -> timeout enabled",
128 " tau&2 -> request to enable timeout 1 level up (in claim)",
129 " tau&4 -> current transition is a claim move",
130 " tau&8 -> current transition is an atomic move",
131 " tau&16 -> last move was truncated on stack",
132 " tau&32 -> current transition is a preselected move",
133 " tau&64 -> at least one next state is not on the stack",
134 " tau&128 -> current transition is a stutter move",
136 " o_pm&1 -> the current pid moved -- implements else",
137 " o_pm&2 -> this is an acceptance state",
138 " o_pm&4 -> this is a progress state",
139 " o_pm&8 -> fairness alg rule 1 undo mark",
140 " o_pm&16 -> fairness alg rule 3 undo mark",
141 " o_pm&32 -> fairness alg rule 2 undo mark",
142 " o_pm&64 -> the current proc applied rule2",
143 " o_pm&128 -> a fairness, dummy move - all procs blocked",
145 "#if defined(FULLSTACK) && defined(MA) && !defined(BFS)",
149 " uchar o_n, o_ot; /* to save locals */",
152 "#ifdef EVENT_TRACE",
153 "#if nstates_event<256",
156 " unsigned short o_event;",
166 "#if defined(HAS_UNLESS) && !defined(BFS)",
167 " int e_state; /* if escape trans - state of origin */",
169 "#if (defined(FULLSTACK) && !defined(MA)) || defined(BFS)",
170 " struct H_el *ostate; /* pointer to stored state */",
172 /* CNTRSTACK when !NOREDUCE && BITSTATE && SAFETY, uses LL[] */
173 "#if defined(CNTRSTACK) && !defined(BFS)",
176 " Trans *o_t;", /* transition fct, next state */
178 " short ipt;", /* insertion slot in q */
181 " int oval;", /* single backup value of variable */
182 " int *ovals;", /* ptr to multiple values */
185 "Trail *trail, *trpt;",
189 "long maxdepth=10000;",
190 "long omaxdepth=10000;",
191 "#ifdef SC", /* stack cycling */
195 "uchar HASH_NR = 0;",
197 "double memcnt = (double) 0;",
198 "double memlim = (double) (1<<30);",
200 "/* for emalloc: */",
201 "static char *have;",
202 "static long left = 0L;",
203 "static double fragment = (double) 0;",
204 "static unsigned long grow;",
206 "unsigned int HASH_CONST[] = {",
207 " /* asuming 4 bytes per int */",
208 " 0x88888EEF, 0x00400007,",
209 " 0x04c11db7, 0x100d4e63,",
210 " 0x0fc22f87, 0x3ff0c3ff,",
211 " 0x38e84cd7, 0x02b148e9,",
212 " 0x98b2e49d, 0xb616d379,",
213 " 0xa5247fd9, 0xbae92a15,",
214 " 0xb91c8bc5, 0x8e5880f3,",
215 " 0xacd7c069, 0xb4c44bb3,",
216 " 0x2ead1fb7, 0x8e428171,",
217 " 0xdbebd459, 0x828ae611,",
218 " 0x6cb25933, 0x86cdd651,",
219 " 0x9e8f5f21, 0xd5f8d8e7,",
220 " 0x9c4e956f, 0xb5cf2c71,",
221 " 0x2e805a6d, 0x33fc3a55,",
222 " 0xaf203ed1, 0xe31f5909,",
223 " 0x5276db35, 0x0c565ef7,",
224 " 0x273d1aa5, 0x8923b1dd,",
227 "int mreached=0, done=0, errors=0, Nrun=1;",
228 "double nstates=0, nlinks=0, truncs=0, truncs2=0;",
229 "double nlost=0, nShadow=0, hcmp=0, ngrabs=0;",
231 "double midrv=0, failedrv=0, revrv=0;",
233 "unsigned long nr_states=0; /* nodes in DFA */",
234 "long Fa=0, Fh=0, Zh=0, Zn=0;",
235 "long PUT=0, PROBE=0, ZAPS=0;",
236 "long Ccheck=0, Cholds=0;",
237 "int a_cycles=0, upto=1, strict=0, verbose = 0, signoff = 0;",
239 "int gui = 0, coltrace = 0, readtrail = 0, whichtrail = 0, onlyproc = -1, silent = 0;",
241 "int state_tables=0, fairness=0, no_rck=0, Nr_Trails=0;",
242 "char simvals[128];",
246 "unsigned long mask, nmask;",
248 "int ssize=23; /* 1 Mb */",
250 "int ssize=19; /* 512K slots */",
252 "int hmax=0, svmax=0, smax=0;",
253 "int Maxbody=0, XX;",
254 "uchar *noptr; /* used by macro Pptr(x) */",
256 "void logval(char *, int);",
257 "void dumpranges(void);",
261 "#define INLINE_REV",
262 "extern void dfa_init(unsigned short);",
263 "extern int dfa_member(unsigned long);",
264 "extern int dfa_store(uchar *);",
265 "unsigned int maxgs = 0;",
268 "State comp_now; /* compressed state vector */",
270 "uchar *Mask = (uchar *) &comp_msk;",
273 "static char *scratch = (char *) &comp_tmp;",
276 "Stack *stack; /* for queues, processes */",
277 "Svtack *svtack; /* for old state vectors */",
279 "static unsigned hfns = 3; /* new default */",
281 "static unsigned long j1;",
282 "static unsigned long K1, K2;",
283 "static unsigned long j2, j3, j4;",
286 "static long udmem;",
289 "static long A_depth = 0;",
290 "long depth = 0;", /* not static to support -S2 option, but possible clash with embedded code */
291 "static uchar warned = 0, iterative = 0, like_java = 0, every_error = 0;",
292 "static uchar noasserts = 0, noends = 0, bounded = 0;",
293 "#if SYNC>0 && ASYNC==0",
294 "void set_recvs(void);",
295 "int no_recvs(int);",
298 "#define IfNotBlocked if (boq != -1) continue;",
299 "#define UnBlock boq = -1",
301 "#define IfNotBlocked /* cannot block */",
302 "#define UnBlock /* don't bother */",
305 "int (*bstore)(char *, int);",
306 "int bstore_reg(char *, int);",
308 "int bstore_mod(char *, int);",
311 "void active_procs(void);",
312 "void cleanup(void);",
313 "void do_the_search(void);",
314 "void find_shorter(int);",
315 "void iniglobals(void);",
316 "void stopped(int);",
317 "void wrapup(void);",
318 "int *grab_ints(int);",
319 "void ungrab_ints(int *, int);",
323 static char *Tail[] = {
325 "settr( int t_id, int a, int b, int c, int d,",
326 " char *t, int g, int tpe0, int tpe1)",
327 "{ Trans *tmp = (Trans *) emalloc(sizeof(Trans));\n",
328 " tmp->atom = a&(6|32); /* only (2|8|32) have meaning */",
329 " if (!g) tmp->atom |= 8; /* no global references */",
331 " tmp->tpe[0] = tpe0;",
332 " tmp->tpe[1] = tpe1;",
334 " tmp->t_id = t_id;",
341 "{ Trans *tmp = (Trans *) emalloc(sizeof(Trans));\n",
343 " tmp->atom = a->atom;",
346 " tmp->e_trans = a->e_trans;",
347 " for (i = 0; i < HAS_UNLESS; i++)",
348 " tmp->escp[i] = a->escp[i];",
350 " tmp->tpe[0] = a->tpe[0];",
351 " tmp->tpe[1] = a->tpe[1];",
352 " for (i = 0; i < 6; i++)",
353 " { tmp->qu[i] = a->qu[i];",
354 " tmp->ty[i] = a->ty[i];",
356 " tmp->tp = (char *) emalloc(strlen(a->tp)+1);",
357 " strcpy(tmp->tp, a->tp);",
358 " tmp->t_id = a->t_id;",
359 " tmp->forw = a->forw;",
360 " tmp->back = a->back;",
366 "{ if (n <= 2) return LOCAL;",
367 " if (n <= 2+ DELTA) return Q_FULL_F; /* 's' or nfull */",
368 " if (n <= 2+2*DELTA) return Q_EMPT_F; /* 'r' or nempty */",
369 " if (n <= 2+3*DELTA) return Q_EMPT_T; /* empty */",
370 " if (n <= 2+4*DELTA) return Q_FULL_T; /* full */",
371 " if (n == 5*DELTA) return GLOBAL;",
372 " if (n == 6*DELTA) return TIMEOUT_F;",
373 " if (n == 7*DELTA) return ALPHA_F;",
374 " Uerror(\"cannot happen srinc_class\");",
378 "srunc(int n, int m)",
380 " case Q_FULL_F: return n-2;",
381 " case Q_EMPT_F: return n-2-DELTA;",
382 " case Q_EMPT_T: return n-2-2*DELTA;",
383 " case Q_FULL_T: return n-2-3*DELTA;",
385 " case TIMEOUT_F: return 257; /* non-zero, and > MAXQ */",
387 " Uerror(\"cannot happen srunc\");",
394 "isthere(Trans *a, int b)", /* is b already in a's list? */
396 " for (t = a; t; t = t->nxt)",
397 " if (t->t_id == b)",
404 "mark_safety(Trans *t) /* for conditional safety */",
405 "{ int g = 0, i, j, k;",
407 " if (!t) return 0;",
409 " return (t->qu[1])?2:1; /* marked */",
411 " for (i = 0; i < 2; i++)",
412 " { j = srinc_set(t->tpe[i]);",
413 " if (j >= GLOBAL && j != ALPHA_F)",
416 " { k = srunc(t->tpe[i], j);",
419 " || t->ty[0] != j)",
428 "retrans(int n, int m, int is, short srcln[], uchar reach[])",
429 " /* process n, with m states, is=initial state */",
430 "{ Trans *T0, *T1, *T2, *T3;",
438 " if (state_tables >= 4)",
439 " { printf(\"STEP 1 proctype %%s\\n\", ",
441 " for (i = 1; i < m; i++)",
442 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
443 " crack(n, i, T0, srcln);",
447 " for (i = 1, cnt = 0; i < m; i++)",
448 " { T2 = trans[n][i];",
449 " T1 = T2?T2->nxt:(Trans *)0;",
450 "/* prescan: */ for (T0 = T1; T0; T0 = T0->nxt)",
451 "/* choice in choice */ { if (T0->st && trans[n][T0->st]",
452 " && trans[n][T0->st]->nxt)",
457 " printf(\"\\tstate %%d / %%d: choice in choice\\n\",",
461 " for (T0 = T1; T0; T0 = T0->nxt)",
462 " { T3 = trans[n][T0->st];",
464 " { T2->nxt = cpytr(T0);",
466 " imed(T2, T0->st, n, i);",
469 " do { T3 = T3->nxt;",
470 " T2->nxt = cpytr(T3);",
472 " imed(T2, T0->st, n, i);",
473 " } while (T3->nxt);",
479 " if (state_tables >= 3)",
480 " { printf(\"STEP 2 proctype %%s\\n\", ",
482 " for (i = 1; i < m; i++)",
483 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
484 " crack(n, i, T0, srcln);",
487 " for (i = 1; i < m; i++)",
488 " { if (trans[n][i] && trans[n][i]->nxt) /* optimize */",
489 " { T1 = trans[n][i]->nxt;",
491 " printf(\"\\t\\tpull %%d (%%d) to %%d\\n\",",
492 " T1->st, T1->forw, i);",
494 " if (!trans[n][T1->st]) continue;",
495 " T0 = cpytr(trans[n][T1->st]);",
496 " trans[n][i] = T0;",
497 " reach[T1->st] = 1;",
498 " imed(T0, T1->st, n, i);",
499 " for (T1 = T1->nxt; T1; T1 = T1->nxt)",
502 " printf(\"\\t\\tpull %%d (%%d) to %%d\\n\",",
503 " T1->st, T1->forw, i);",
505 " if (!trans[n][T1->st]) continue;",
506 " T0->nxt = cpytr(trans[n][T1->st]);",
508 " reach[T1->st] = 1;",
509 " imed(T0, T1->st, n, i);",
511 " if (state_tables >= 2)",
512 " { printf(\"STEP 3 proctype %%s\\n\", ",
514 " for (i = 1; i < m; i++)",
515 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
516 " crack(n, i, T0, srcln);",
520 " for (i = 1; i < m; i++)",
521 " { if (!trans[n][i]) continue;",
522 " /* check for each state i if an",
523 " * escape to some state p is defined",
524 " * if so, copy and mark p's transitions",
525 " * and prepend them to the transition-",
526 " * list of state i",
528 " if (!like_java) /* the default */",
529 " { for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
530 " for (k = HAS_UNLESS-1; k >= 0; k--)",
531 " { if (p = T0->escp[k])",
532 " for (T1 = trans[n][p]; T1; T1 = T1->nxt)",
533 " { if (isthere(trans[n][i], T1->t_id))",
537 " T2->nxt = trans[n][i];",
538 " trans[n][i] = T2;",
540 " } else /* outermost unless checked first */",
542 " T4 = T3 = (Trans *) 0;",
543 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
544 " for (k = HAS_UNLESS-1; k >= 0; k--)",
545 " { if (p = T0->escp[k])",
546 " for (T1 = trans[n][p]; T1; T1 = T1->nxt)",
547 " { if (isthere(trans[n][i], T1->t_id))",
550 " T2->nxt = (Trans *) 0;",
552 " if (T3) T3->nxt = T2;",
557 " { T3->nxt = trans[n][i];",
558 " trans[n][i] = T4;",
565 " for (i = 1; i < m; i++)",
568 " { /* moves through these states are visible */",
569 "#if PROG_LAB>0 && defined(HAS_NP)",
570 " if (progstate[n][i])",
572 " for (T1 = trans[n][i]; T1; T1 = T1->nxt)",
573 " if (progstate[n][T1->st])",
576 " if (accpstate[n][i] || visstate[n][i])",
578 " for (T1 = trans[n][i]; T1; T1 = T1->nxt)",
579 " if (accpstate[n][T1->st])",
582 " T1 = trans[n][i];",
583 " if (!T1) continue;",
584 " g = mark_safety(T1); /* V3.3.1 */",
585 " if (g < 0) goto degrade; /* global */",
586 " /* check if mixing of guards preserves reduction */",
589 " for (T0 = T1; T0; T0 = T0->nxt)",
590 " { if (!(T0->atom&8))",
592 " for (aa = 0; aa < 2; aa++)",
593 " { j = srinc_set(T0->tpe[aa]);",
594 " if (j >= GLOBAL && j != ALPHA_F)",
601 " /* g = 0; V3.3.1 */",
602 " if (k) /* non-uniform selection */",
603 " for (T0 = T1; T0; T0 = T0->nxt)",
604 " for (aa = 0; aa < 2; aa++)",
605 " { j = srinc_set(T0->tpe[aa]);",
607 " { k = srunc(T0->tpe[aa], j);",
608 " for (h = 0; h < 6; h++)",
609 " if (T1->qu[h] == k",
610 " && T1->ty[h] == j)",
613 " { T1->qu[g%%6] = k;",
614 " T1->ty[g%%6] = j;",
618 " { T1->qu[0] = 0; /* turn it off */",
619 " printf(\"pan: warning, line %%d, \",",
621 " printf(\"too many stmnt types (%%d)\",",
623 " printf(\" in selection\\n\");",
627 " /* mark all options global if >=1 is global */",
628 " for (T1 = trans[n][i]; T1; T1 = T1->nxt)",
629 " if (!(T1->atom&8)) break;",
631 "degrade: for (T1 = trans[n][i]; T1; T1 = T1->nxt)",
632 " T1->atom &= ~8; /* mark as unsafe */",
634 " /* can only mix 'r's or 's's if on same chan */",
635 " /* and not mixed with other local operations */",
636 " T1 = trans[n][i];",
638 " if (!T1 || T1->qu[0]) continue;",
641 " if (T1->nxt && T1->atom&8)",
642 " { if (j == 5*DELTA)",
643 " { printf(\"warning: line %%d \", srcln[i]);",
644 " printf(\"mixed condition \");",
645 " printf(\"(defeats reduction)\\n\");",
648 " for (T0 = T1; T0; T0 = T0->nxt)",
649 " for (aa = 0; aa < 2; aa++)",
650 " if (T0->tpe[aa] && T0->tpe[aa] != j)",
651 " { printf(\"warning: line %%d \", srcln[i]);",
652 " printf(\"[%%d-%%d] mixed %%stion \",",
654 " (j==5*DELTA)?\"condi\":\"selec\");",
655 " printf(\"(defeats reduction)\\n\");",
656 " printf(\" '%%s' <-> '%%s'\\n\",",
662 " for (i = 1; i < m; i++)", /* R */
663 " { T2 = trans[n][i];",
666 " || strncmp(T2->tp, \".(goto)\", 7)",
667 " || !stopstate[n][i])",
669 " stopstate[n][T2->st] = 1;",
671 " if (state_tables)",
672 " { printf(\"proctype \");",
673 " if (!strcmp(procname[n], \":init:\"))",
674 " printf(\"init\\n\");",
676 " printf(\"%%s\\n\", procname[n]);",
677 " for (i = 1; i < m; i++)",
679 " tagtable(n, m, is, srcln, reach);",
681 " for (i = 1; i < m; i++)",
683 " if (strcmp(procname[n], \":never:\") != 0)",
684 " { for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
685 " { if (T0->st == i",
686 " && strcmp(T0->tp, \"(1)\") == 0)",
687 " { printf(\"error: proctype '%%s' \",",
689 " printf(\"line %%d, state %%d: has un\",",
691 " printf(\"conditional self-loop\\n\");",
695 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
696 " { if (strcmp(T0->tp, \"else\") == 0)",
700 " { printf(\"error: proctype '%%s' state\",",
702 " printf(\" %%d, inherits %%d\", i, nrelse);",
703 " printf(\" 'else' stmnts\\n\");",
706 " if (!state_tables && strcmp(procname[n], \":never:\") == 0)",
708 " for (i = 1; i < m; i++)",
709 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
710 " if (T0->forw > h) h = T0->forw;",
712 " frm_st0 = (short *) emalloc(h * sizeof(short));",
713 " for (i = 1; i < m; i++)",
714 " for (T0 = trans[n][i]; T0; T0 = T0->nxt)",
715 " frm_st0[T0->forw] = i;",
719 "imed(Trans *T, int v, int n, int j) /* set intermediate state */",
720 "{ progstate[n][T->st] |= progstate[n][v];",
721 " accpstate[n][T->st] |= accpstate[n][v];",
722 " stopstate[n][T->st] |= stopstate[n][v];",
723 " mapstate[n][j] = T->st;",
726 "tagtable(int n, int m, int is, short srcln[], uchar reach[])",
728 " if (is >= m || !trans[n][is]",
729 " || is <= 0 || reach[is] == 0)",
732 " if (state_tables)",
733 " for (z = trans[n][is]; z; z = z->nxt)",
734 " crack(n, is, z, srcln);",
735 " for (z = trans[n][is]; z; z = z->nxt)",
740 " tagtable(n, m, z->st, srcln, reach);",
742 " for (i = 0; i < HAS_UNLESS; i++)",
743 " { j = trans[n][is]->escp[i];",
745 " tagtable(n, m, j, srcln, reach);",
751 "crack(int n, int j, Trans *z, short srcln[])",
754 " printf(\"\tstate %%3d -(tr %%3d)-> state %%3d \",",
755 " j, z->forw, z->st);",
756 " printf(\"[id %%3d tp %%3d\", z->t_id, z->tpe[0]);",
757 " if (z->tpe[1]) printf(\",%%d\", z->tpe[1]);",
760 " printf(\" org %%3d\", z->e_trans);",
761 " else if (state_tables >= 2)",
762 " for (i = 0; i < HAS_UNLESS; i++)",
763 " { if (!z->escp[i]) break;",
764 " printf(\" esc %%d\", z->escp[i]);",
768 " printf(\" [%%s%%s%%s%%s%%s] line %%d => \",",
769 " z->atom&6?\"A\":z->atom&32?\"D\":\"-\",",
770 " accpstate[n][j]?\"a\" :\"-\",",
771 " stopstate[n][j]?\"e\" : \"-\",",
772 " progstate[n][j]?\"p\" : \"-\",",
773 " z->atom & 8 ?\"L\":\"G\",",
775 " for (i = 0; z->tp[i]; i++)",
776 " if (z->tp[i] == \'\\n\')",
777 " printf(\"\\\\n\");",
779 " putchar(z->tp[i]);",
781 " { printf(\"\\t[\");",
782 " for (i = 0; i < 6; i++)",
784 " printf(\"(%%d,%%d)\",",
785 " z->qu[i], z->ty[i]);",
793 "#define BYTESIZE 32 /* 2^8 : 2^3 = 256:8 = 32 */",
795 "typedef struct Vr_Ptr {",
797 " uchar vals[BYTESIZE];",
798 " struct Vr_Ptr *nxt;",
800 "Vr_Ptr *ranges = (Vr_Ptr *) 0;",
803 "logval(char *s, int v)",
806 " if (v<0 || v > 255) return;",
807 " for (tmp = ranges; tmp; tmp = tmp->nxt)",
808 " if (!strcmp(tmp->nm, s))",
810 " tmp = (Vr_Ptr *) emalloc(sizeof(Vr_Ptr));",
811 " tmp->nxt = ranges;",
815 " tmp->vals[(v)/8] |= 1<<((v)%%8);",
819 "dumpval(uchar X[], int range)",
820 "{ int w, x, i, j = -1;",
822 " for (w = i = 0; w < range; w++)",
823 " for (x = 0; x < 8; x++, i++)",
825 "from: if ((X[w] & (1<<x)))",
826 " { printf(\"%%d\", i);",
831 " for (w = 0; w < range; w++)",
832 " for (x = 0; x < 8; x++, i++)",
834 "upto: if (!(X[w] & (1<<x)))",
838 " printf(\"-%%d, \", i-1);",
841 " if (j >= 0 && j != 255)",
842 " printf(\"-255\");",
848 " printf(\"\\nValues assigned within \");",
849 " printf(\"interval [0..255]:\\n\");",
850 " for (tmp = ranges; tmp; tmp = tmp->nxt)",
851 " { printf(\"\\t%%s\\t: \", tmp->nm);",
852 " dumpval(tmp->vals, BYTESIZE);",