1 /***** spin: reprosrc.c *****/
3 /* Copyright (c) 2002-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 */
16 static int indent
= 1;
19 void repro_seq(Sequence
*);
24 for (i
= 0; i
< indent
; i
++)
44 repro_seq(e
->n
->sl
->this);
52 repro_seq(Sequence
*s
)
57 for (e
= s
->frst
; e
; e
= e
->nxt
)
60 if (v
) printf("%s:\n", v
->name
);
62 if (e
->n
->ntyp
== UNLESS
)
63 { printf("/* normal */ {\n");
64 repro_seq(e
->n
->sl
->this);
66 printf("} unless {\n");
67 repro_seq(e
->n
->sl
->nxt
->this);
69 printf("}; /* end unless */\n");
73 case DO
: doindent(); printf("do\n"); indent
++; break;
74 case IF
: doindent(); printf("if\n"); indent
++; break;
77 for (h
= e
->sub
; h
; h
= h
->nxt
)
78 { indent
--; doindent(); indent
++; printf("::\n");
84 case DO
: indent
--; doindent(); printf("od;\n"); break;
85 case IF
: indent
--; doindent(); printf("fi;\n"); break;
88 { if (e
->n
->ntyp
== ATOMIC
89 || e
->n
->ntyp
== D_STEP
90 || e
->n
->ntyp
== NON_ATOMIC
)
92 else if (e
->n
->ntyp
!= '.'
94 && e
->n
->ntyp
!= BREAK
)
97 if (e
->n
->ntyp
== C_CODE
)
99 plunk_inline(stdout
, e
->n
->sym
->name
, 1);
100 } else if (e
->n
->ntyp
== 'c'
101 && e
->n
->lft
->ntyp
== C_EXPR
)
102 { printf("c_expr { ");
103 plunk_expr(stdout
, e
->n
->lft
->sym
->name
);
106 { comment(stdout
, e
->n
, 0);
116 repro_proc(ProcList
*p
)
119 if (p
->nxt
) repro_proc(p
->nxt
);
121 if (p
->det
) printf("D"); /* deterministic */
122 printf("proctype %s()", p
->n
->name
);
124 { printf(" provided ");
125 comment(stdout
, p
->prov
, 0);
This page took 0.038808 seconds and 4 git commands to generate.