Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 10 commits
  • 27 files changed
  • 0 comments
  • 1 contributor
Jan 11, 2012
Werner Almesberger compiler: rename unique_{free,dump} to symtab_*
Leaving "unique" and "unique_n" for now because I can't decide on a
good name.
5cdc43b
Jan 12, 2012
Werner Almesberger compiler: optionally warn if using a variable in the wrong section (WIP)
This warning is currently only accessible via ptest, with the option
-Wsection.

To do:
- generalize the notification mechanism (currently printf)
- consider also handling variables like x, y, rad
5fa3a61
Werner Almesberger compiler: added per-symbol flags to symbol table edecc6e
Werner Almesberger compiler: -Wundefined to warn about undefined variables (WIP)
Limitations:
- complains about iterative calculations like  avg = A*avg+(1-A)*VALUE
- no way to explicitly initialize variables to zero (making the warning
  go away)
cb6d92a
Werner Almesberger regression tests: attempt only valid assignments in initial/global se…
…ction

Many tests consisted of a single line like  x = something
which are not valid, because "x" is not a per-frame variable.

The next commit will slightly tighten the checks the compiler
performs even without code generation, so we need to make the
test cases a little more correct.
eaffaac
Werner Almesberger compiler: allow explicit zero-initialization to suppress warning
This is applicable to all variables, not only per-frame variables.
6e7d6c1
Werner Almesberger symtab: rename "syms" to user_syms, for export; minor cleanup ab35e12
Werner Almesberger compiler: symbol table can now be iterated
symtab.h defines a macro forall_syms() that iterates over all symbols.
This means that it's now trivial to implement symtab_dump, and we can
therefore remove it.
068cfc9
Werner Almesberger compiler: -Wundefined now also works for old-style patches
Old style assumes everything is implicitly initialized to zero.
We can still report identifiers that are never assigned to, though.

New style allows explicit initialization and thus can report
uninitialized variables immediately when they're read.
1f53fb2
Werner Almesberger parser.y: tok2op wasn't "static", oops 6259a03
6  src/compiler/compiler.c
@@ -469,6 +469,8 @@ struct patch *patch_compile(const char *basedir, const char *patch_code,
469 469
 	sc->rmc = rmc;
470 470
 	sc->linenr = 0;
471 471
 
  472
+	symtab_init();
  473
+
472 474
 	load_defaults(sc);
473 475
 	if(!init_pfv(sc)) goto fail;
474 476
 	if(!init_pvv(sc)) goto fail;
@@ -481,13 +483,13 @@ struct patch *patch_compile(const char *basedir, const char *patch_code,
481 483
 	if(!finalize_pvv(sc)) goto fail;
482 484
 	if(!schedule_pvv(sc)) goto fail;
483 485
 
484  
-	unique_free();
  486
+	symtab_free();
485 487
 
486 488
 	free(sc);
487 489
 	return p;
488 490
 
489 491
 fail:
490  
-	unique_free();
  492
+	symtab_free();
491 493
 	free(sc->p);
492 494
 	free(sc);
493 495
 	return NULL;
1  src/compiler/idgen
@@ -50,6 +50,7 @@ sed 's/#.*//;/^ *$/d' $1 | sort | {
50 50
 	.fpvm_sym = { .name = "$1" },
51 51
 	.pfv_idx = $2,
52 52
 	.pvv_idx = $3,
  53
+	.flags = SF_SYSTEM,
53 54
 },
54 55
 EOF
55 56
 		i=`expr $i + 1`
66  src/compiler/parser.y
@@ -32,6 +32,9 @@
32 32
 	#include "parser.h"
33 33
 
34 34
 
  35
+	int warn_section = 0;
  36
+	int warn_undefined = 0;
  37
+
35 38
 	struct yyParser;
36 39
 	static void yy_parse_failed(struct yyParser *yypParser);
37 40
 
@@ -56,7 +59,7 @@
56 59
 			state->style = which;				\
57 60
 		} while (0)
58 61
 
59  
-	const enum ast_op tok2op[] = {
  62
+	static const enum ast_op tok2op[] = {
60 63
 		[TOK_IDENT]	= op_ident,
61 64
 		[TOK_CONSTANT]	= op_constant,
62 65
 		[TOK_PLUS]	= op_plus,
@@ -225,6 +228,14 @@ start ::= TOK_START_EXPR expr(N). {
225 228
 }
226 229
 
227 230
 start ::= TOK_START_ASSIGN sections. {
  231
+	if(warn_undefined && state->style == old_style) {
  232
+		const struct sym *sym;
  233
+
  234
+		forall_syms(sym)
  235
+			if(!(sym->flags & (SF_SYSTEM | SF_ASSIGNED)))
  236
+				printf("variable %s is only read, never set\n",
  237
+				    sym->fpvm_sym.name);
  238
+	}
228 239
 	state->success = 1;
229 240
 }
230 241
 
@@ -253,11 +264,33 @@ assignments ::= assignments assignment.
253 264
 assignments ::= .
254 265
 
255 266
 assignment ::= ident(I) TOK_ASSIGN expr(N) opt_semi. {
256  
-	state->error = state->comm->assign_default(state->comm, I->sym, N);
257  
-	free(I);
258  
-	if(state->error) {
259  
-		FAIL;
260  
-		return;
  267
+	I->sym->flags |= SF_ASSIGNED;
  268
+	/*
  269
+	 * The conditions are as follows:
  270
+	 * - we must be outside compile_chunk (has different rules)
  271
+	 * - must be in the initial section
  272
+	 * - must not assign to a per-frame system variable
  273
+	 */
  274
+	if(state->comm->assign_per_frame &&
  275
+	    state->comm->assign_default != state->comm->assign_per_frame &&
  276
+	    state->comm->assign_default != state->comm->assign_per_vertex &&
  277
+	    I->sym->pfv_idx == -1) {
  278
+		free(I);
  279
+		if(N->op != op_constant || N->contents.constant) {
  280
+			state->error = strdup("can initialize non-system "
  281
+			    "variables only to zero");
  282
+			FAIL;
  283
+			return;
  284
+		}
  285
+		IS_STYLE(new_style);
  286
+	} else {
  287
+		state->error =
  288
+		    state->comm->assign_default(state->comm, I->sym, N);
  289
+		free(I);
  290
+		if(state->error) {
  291
+			FAIL;
  292
+			return;
  293
+		}
261 294
 	}
262 295
 	parse_free(N);
263 296
 }
@@ -475,6 +508,10 @@ primary_expr(N) ::= TOK_CONSTANT(C). {
475 508
 }
476 509
 
477 510
 primary_expr(N) ::= ident(I). {
  511
+	if(warn_undefined && state->style == new_style &&
  512
+	    !(I->sym->flags & (SF_SYSTEM | SF_ASSIGNED)))
  513
+		printf("accessing undefined variable %s\n",
  514
+		    I->sym->fpvm_sym.name);
478 515
 	N = node(I->token, I->sym, NULL, NULL, NULL);
479 516
 	free(I);
480 517
 }
@@ -495,7 +532,22 @@ primary_expr(N) ::= ident(I). {
495 532
  * for variables should be a rare condition anyway.
496 533
  */
497 534
 
498  
-ident(O) ::= TOK_IDENT(I).	{ O = I; }
  535
+ident(O) ::= TOK_IDENT(I). {
  536
+	if(warn_section) {
  537
+		if(state->comm->assign_default ==
  538
+		    state->comm->assign_per_frame &&
  539
+		    I->sym->pfv_idx == -1 && I->sym->pvv_idx != -1)
  540
+			printf("using per-vertex variable %s in "
  541
+			    "per-frame section\n", I->sym->fpvm_sym.name);
  542
+		if(state->comm->assign_default ==
  543
+		    state->comm->assign_per_vertex &&
  544
+		    I->sym->pfv_idx != -1 && I->sym->pvv_idx == -1)
  545
+			printf("using per-frame variable %s in "
  546
+			    "per-vertex section\n", I->sym->fpvm_sym.name);
  547
+	}
  548
+	O = I;
  549
+}
  550
+
499 551
 ident(O) ::= unary(I).		{ O = symbolify(I); }
500 552
 ident(O) ::= unary_misc(I).	{ O = symbolify(I); }
501 553
 ident(O) ::= binary(I).		{ O = symbolify(I); }
3  src/compiler/parser_helper.h
@@ -45,6 +45,9 @@ struct parser_comm {
45 45
 	    int number, const char *name);
46 46
 };
47 47
 
  48
+extern int warn_section;
  49
+extern int warn_undefined;
  50
+
48 51
 const char *parse(const char *expr, int start_token, struct parser_comm *comm);
49 52
 void parse_free_one(struct ast_node *node);
50 53
 void parse_free(struct ast_node *node);
24  src/compiler/ptest/ptest.c
@@ -238,10 +238,15 @@ static void parse_only(const char *pgm)
238 238
 	 };
239 239
 	const char *error;
240 240
 
  241
+	symtab_init();
241 242
 	error = parse(pgm, TOK_START_ASSIGN, &comm);
242  
-	if (symbols)
243  
-		unique_dump();
244  
-	unique_free();
  243
+	if (symbols) {
  244
+		const struct sym *sym;
  245
+
  246
+		forall_syms(sym)
  247
+			printf("%s\n", sym->fpvm_sym.name);
  248
+	}
  249
+	symtab_free();
245 250
 	if (!error)
246 251
 		return;
247 252
 	fflush(stdout);
@@ -326,12 +331,13 @@ static void free_buffer(void)
326 331
 static void usage(const char *name)
327 332
 {
328 333
 	fprintf(stderr,
329  
-"usage: %s [-c|-f error] [-n runs] [-q] [-s] [expr]\n\n"
  334
+"usage: %s [-c|-f error] [-n runs] [-q] [-s] [-Wwarning...] [expr]\n\n"
330 335
 "  -c        generate code and dump generated code (unless -q is set)\n"
331 336
 "  -f error  fail any assignment with specified error message\n"
332 337
 "  -n runs   run compilation repeatedly (default: run only once)\n"
333 338
 "  -q        quiet operation\n"
334 339
 "  -s        dump symbol table after parsing (only if -c is not set)\n"
  340
+"  -Wwarning enable compiler warning (one of: section, undefined)\n"
335 341
     , name);
336 342
 	exit(1);
337 343
 }
@@ -344,7 +350,7 @@ int main(int argc, char **argv)
344 350
 	unsigned long repeat = 1;
345 351
 	char *end;
346 352
 
347  
-	while ((c = getopt(argc, argv, "cf:n:qs")) != EOF)
  353
+	while ((c = getopt(argc, argv, "cf:n:qsW:")) != EOF)
348 354
 		switch (c) {
349 355
 		case 'c':
350 356
 			codegen = 1;
@@ -363,6 +369,14 @@ int main(int argc, char **argv)
363 369
 		case 's':
364 370
 			symbols = 1;
365 371
 			break;
  372
+		case 'W':
  373
+			if (!strcmp(optarg, "section"))
  374
+				warn_section = 1;
  375
+			else if (!strcmp(optarg, "undefined"))
  376
+				warn_undefined = 1;
  377
+			else
  378
+				usage(*argv);
  379
+			break;
366 380
 		default:
367 381
 			usage(*argv);
368 382
 		}
70  src/compiler/symtab.c
@@ -29,9 +29,12 @@ struct key_n {
29 29
 struct sym well_known[] = {
30 30
 #include "fnp.inc"
31 31
 };
  32
+int num_well_known;
32 33
 
33  
-static struct sym *syms = NULL;
34  
-static int num_syms = 0, allocated = 0;
  34
+struct sym *user_syms = NULL;
  35
+int num_user_syms = 0;
  36
+
  37
+static int allocated = 0;
35 38
 
36 39
 
37 40
 /*
@@ -64,11 +67,11 @@ static char *strdup_n(const char *s, int n)
64 67
 
65 68
 static void grow_table(void)
66 69
 {
67  
-	if(num_syms != allocated)
  70
+	if(num_user_syms != allocated)
68 71
 		return;
69 72
 
70 73
 	allocated = allocated ? allocated*2 : INITIAL_ALLOC;
71  
-	syms = realloc(syms, allocated*sizeof(*syms));
  74
+	user_syms = realloc(user_syms, allocated*sizeof(*user_syms));
72 75
 }
73 76
 
74 77
 
@@ -91,20 +94,20 @@ static int cmp_n(const void *a, const void *b)
91 94
 
92 95
 struct sym *unique(const char *s)
93 96
 {
94  
-	struct sym *res;
95  
-	struct sym *walk;
  97
+	struct sym *res, *walk, *new;
96 98
 
97  
-	res = bsearch(s, well_known, sizeof(well_known)/sizeof(*well_known),
98  
-	    sizeof(*well_known), cmp);
  99
+	res = bsearch(s, well_known, num_well_known, sizeof(*well_known), cmp);
99 100
 	if(res)
100 101
 		return res;
101  
-	for(walk = syms; walk != syms+num_syms; walk++)
  102
+	for(walk = user_syms; walk != user_syms+num_user_syms; walk++)
102 103
 		if(!strcmp(walk->fpvm_sym.name, s))
103 104
 			return walk;
104 105
 	grow_table();
105  
-	syms[num_syms].fpvm_sym.name = strdup(s);
106  
-	syms[num_syms].pfv_idx = syms[num_syms].pvv_idx = -1;
107  
-	return syms+num_syms++;
  106
+	new = user_syms+num_user_syms++;
  107
+	new->fpvm_sym.name = strdup(s);
  108
+	new->pfv_idx = new->pvv_idx = -1;
  109
+	new->flags = 0;
  110
+	return new;
108 111
 }
109 112
 
110 113
 
@@ -114,47 +117,42 @@ struct sym *unique_n(const char *s, int n)
114 117
 		.s = s,
115 118
 		.n = n,
116 119
 	};
117  
-	struct sym *res;
118  
-	struct sym *walk;
  120
+	struct sym *res, *walk, *new;
119 121
 
120 122
 	assert(n);
121  
-	res = bsearch(&key, well_known, sizeof(well_known)/sizeof(*well_known),
122  
-	    sizeof(*well_known), cmp_n);
  123
+	res = bsearch(&key, well_known, num_well_known, sizeof(*well_known),
  124
+	    cmp_n);
123 125
 	if(res)
124 126
 		return res;
125  
-	for(walk = syms; walk != syms+num_syms; walk++)
  127
+	for(walk = user_syms; walk != user_syms+num_user_syms; walk++)
126 128
 		if(!strcmp_n(s, walk->fpvm_sym.name, n))
127 129
 			return walk;
128 130
 	grow_table();
129  
-	syms[num_syms].fpvm_sym.name = strdup_n(s, n);
130  
-	syms[num_syms].pfv_idx = syms[num_syms].pvv_idx = -1;
131  
-	return syms+num_syms++;
  131
+	new = user_syms+num_user_syms++;
  132
+	new->fpvm_sym.name = strdup_n(s, n);
  133
+	new->pfv_idx = new->pvv_idx = -1;
  134
+	new->flags = 0;
  135
+	return new;
132 136
 }
133 137
 
134 138
 
135  
-void unique_free(void)
  139
+void symtab_init(void)
136 140
 {
137 141
 	int i;
138 142
 
139  
-	for(i = 0; i != num_syms; i++)
140  
-		free((void *) syms[i].fpvm_sym.name);
141  
-	free(syms);
142  
-	syms = NULL;
143  
-	num_syms = allocated = 0;
  143
+	num_well_known = sizeof(well_known)/sizeof(*well_known);
  144
+	for(i = 0; i != num_well_known; i++)
  145
+		well_known[i].flags &= SF_FIXED;
144 146
 }
145 147
 
146 148
 
147  
-#ifdef STANDALONE
148  
-
149  
-void unique_dump(void)
  149
+void symtab_free(void)
150 150
 {
151 151
 	int i;
152 152
 
153  
-	for(i = 0; i != sizeof(well_known)/sizeof(*well_known); i++)
154  
-		printf("%s\n", well_known[i].fpvm_sym.name);
155  
-	printf("\n");
156  
-	for(i = 0; i != num_syms; i++)
157  
-		printf("%s\n", syms[i].fpvm_sym.name);
  153
+	for(i = 0; i != num_user_syms; i++)
  154
+		free((void *) user_syms[i].fpvm_sym.name);
  155
+	free(user_syms);
  156
+	user_syms = NULL;
  157
+	num_user_syms = allocated = 0;
158 158
 }
159  
-
160  
-#endif /* STANDALONE */
18  src/compiler/symtab.h
@@ -14,17 +14,31 @@
14 14
 #include <fpvm/symbol.h>
15 15
 
16 16
 
  17
+#define	SF_SYSTEM	(1 << 0)
  18
+#define	SF_ASSIGNED	(1 << 1)
  19
+#define	SF_FIXED	SF_SYSTEM
  20
+
17 21
 struct sym {
18 22
 	struct fpvm_sym fpvm_sym;
19 23
 	int pfv_idx, pvv_idx;	/* index; -1 if not a variable known to FN */
  24
+	int flags;
20 25
 };
21 26
 
22 27
 
  28
+extern struct sym well_known[];
  29
+extern int num_well_known;
  30
+extern struct sym *user_syms;
  31
+extern int num_user_syms;
  32
+
23 33
 #define	FPVM2SYM(fpvm_sym)	((struct sym *) (fpvm_sym))
24 34
 
  35
+#define	forall_syms(p) \
  36
+	for ((p) = well_known; (p) != user_syms+num_user_syms; \
  37
+	    (p) = (p) == well_known+num_well_known ? user_syms : (p)+1)
  38
+
  39
+void symtab_init(void);
25 40
 struct sym *unique(const char *s);
26 41
 struct sym *unique_n(const char *s, int n);
27  
-void unique_free(void);
28  
-void unique_dump(void);
  42
+void symtab_free(void);
29 43
 
30 44
 #endif /* !SYMTAB_H */
30  src/compiler/test/arith
@@ -3,47 +3,47 @@
3 3
 
4 4
 ###############################################################################
5 5
 
6  
-ptest "arithmetic: x = a+b" <<EOF
7  
-x = a+b
  6
+ptest "arithmetic: sx = a+b" <<EOF
  7
+sx = a+b
8 8
 EOF
9 9
 expect <<EOF
10  
-x = (+ a b)
  10
+sx = (+ a b)
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest "arithmetic: x = a-b" <<EOF
16  
-x = a-b
  15
+ptest "arithmetic: sx = a-b" <<EOF
  16
+sx = a-b
17 17
 EOF
18 18
 expect <<EOF
19  
-x = (- a b)
  19
+sx = (- a b)
20 20
 EOF
21 21
 
22 22
 #------------------------------------------------------------------------------
23 23
 
24  
-ptest "arithmetic: x = a*b" <<EOF
25  
-x = a*b
  24
+ptest "arithmetic: sx = a*b" <<EOF
  25
+sx = a*b
26 26
 EOF
27 27
 expect <<EOF
28  
-x = (* a b)
  28
+sx = (* a b)
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32
 
33  
-ptest "arithmetic: x = a/b" <<EOF
34  
-x = a/b
  33
+ptest "arithmetic: sx = a/b" <<EOF
  34
+sx = a/b
35 35
 EOF
36 36
 expect <<EOF
37  
-x = (/ a b)
  37
+sx = (/ a b)
38 38
 EOF
39 39
 
40 40
 #------------------------------------------------------------------------------
41 41
 
42  
-ptest "arithmetic: x = a%b" <<EOF
43  
-x = a/b
  42
+ptest "arithmetic: sx = a%b" <<EOF
  43
+sx = a/b
44 44
 EOF
45 45
 expect <<EOF
46  
-x = (/ a b)
  46
+sx = (/ a b)
47 47
 EOF
48 48
 
49 49
 ###############################################################################
2  src/compiler/test/codegen
@@ -15,7 +15,7 @@ ptest_fail "codegen: global foo = 1" -c -q <<EOF
15 15
 foo = 1
16 16
 EOF
17 17
 expect <<EOF
18  
-FPVM, line 2: unknown parameter near 'EOF'
  18
+FPVM, line 2: can initialize non-system variables only to zero near 'EOF'
19 19
 EOF
20 20
 
21 21
 #------------------------------------------------------------------------------
88  src/compiler/test/comment
@@ -5,112 +5,112 @@
5 5
 
6 6
 ptest "comment: line with just // " <<EOF
7 7
 // this is a comment
8  
-a = b + c
  8
+sx = b + c
9 9
 EOF
10 10
 expect <<EOF
11  
-a = (+ b c)
  11
+sx = (+ b c)
12 12
 EOF
13 13
 
14 14
 #------------------------------------------------------------------------------
15 15
 
16 16
 ptest "comment: line ending with // comment" <<EOF
17  
-a = b + c // comment
18  
-d = e + f
  17
+sx = b + c // comment
  18
+sy = e + f
19 19
 EOF
20 20
 expect <<EOF
21  
-a = (+ b c)
22  
-d = (+ e f)
  21
+sx = (+ b c)
  22
+sy = (+ e f)
23 23
 EOF
24 24
 
25 25
 #------------------------------------------------------------------------------
26 26
 
27 27
 ptest "comment: // after //" <<EOF
28  
-a = b + c // comment // more
29  
-d = e + f
  28
+sx = b + c // comment // more
  29
+sy = e + f
30 30
 EOF
31 31
 expect <<EOF
32  
-a = (+ b c)
33  
-d = (+ e f)
  32
+sx = (+ b c)
  33
+sy = (+ e f)
34 34
 EOF
35 35
 
36 36
 #------------------------------------------------------------------------------
37 37
 
38  
-ptest "comment: // ending with EOF" "a = b// end"
  38
+ptest "comment: // ending with EOF" "sx = b// end"
39 39
 expect <<EOF
40  
-a = b
  40
+sx = b
41 41
 EOF
42 42
 
43 43
 #------------------------------------------------------------------------------
44 44
 
45 45
 ptest "comment: /* ... */" <<EOF
46  
-a = b + c /* comment */
47  
-d = e + f
  46
+sx = b + c /* comment */
  47
+sy = e + f
48 48
 EOF
49 49
 expect <<EOF
50  
-a = (+ b c)
51  
-d = (+ e f)
  50
+sx = (+ b c)
  51
+sy = (+ e f)
52 52
 EOF
53 53
 
54 54
 #------------------------------------------------------------------------------
55 55
 
56 56
 ptest "comment: /* ... newline ... */" <<EOF
57  
-a = b + c /* comment
58  
-more */ d = e + f
  57
+sx = b + c /* comment
  58
+more */ sy = e + f
59 59
 EOF
60 60
 expect <<EOF
61  
-a = (+ b c)
62  
-d = (+ e f)
  61
+sx = (+ b c)
  62
+sy = (+ e f)
63 63
 EOF
64 64
 
65 65
 #------------------------------------------------------------------------------
66 66
 
67 67
 ptest "comment: /* ... * ... */" <<EOF
68  
-a = 1 /* comment * more */
69  
-b = 2
  68
+sx = 1 /* comment * more */
  69
+sy = 2
70 70
 EOF
71 71
 expect <<EOF
72  
-a = 1
73  
-b = 2
  72
+sx = 1
  73
+sy = 2
74 74
 EOF
75 75
 
76 76
 #------------------------------------------------------------------------------
77 77
 
78 78
 ptest "comment: /* ... ** ... */" <<EOF
79  
-a = 3 /* comment ** more */
80  
-b = 4
  79
+sx = 3 /* comment ** more */
  80
+sy = 4
81 81
 EOF
82 82
 expect <<EOF
83  
-a = 3
84  
-b = 4
  83
+sx = 3
  84
+sy = 4
85 85
 EOF
86 86
 
87 87
 #------------------------------------------------------------------------------
88 88
 
89 89
 ptest "comment: /* ... **/" <<EOF
90  
-a = 5 /* comment **/
91  
-b = 6
  90
+sx = 5 /* comment **/
  91
+sy = 6
92 92
 EOF
93 93
 expect <<EOF
94  
-a = 5
95  
-b = 6
  94
+sx = 5
  95
+sy = 6
96 96
 EOF
97 97
 
98 98
 #------------------------------------------------------------------------------
99 99
 
100 100
 ptest "comment: /**/" <<EOF
101  
-a = 7 /**/
102  
-b = 8
  101
+sx = 7 /**/
  102
+sy = 8
103 103
 EOF
104 104
 expect <<EOF
105  
-a = 7
106  
-b = 8
  105
+sx = 7
  106
+sy = 8
107 107
 EOF
108 108
 
109 109
 #------------------------------------------------------------------------------
110 110
 
111 111
 ptest_fail "comment: /*/ (error)" <<EOF
112  
-a = 9 /*/
113  
-b = a
  112
+sx = 9 /*/
  113
+sy = a
114 114
 EOF
115 115
 expect <<EOF
116 116
 FPVM, line 1: parse error near '*/'
@@ -119,8 +119,8 @@ EOF
119 119
 #------------------------------------------------------------------------------
120 120
 
121 121
 ptest_fail "comment: unterminated /* ... with newline" <<EOF
122  
-a = b + c /* comment
123  
-d = e + f
  122
+sx = b + c /* comment
  123
+sy = e + f
124 124
 EOF
125 125
 expect <<EOF
126 126
 FPVM, line 1: parse error near '*'
@@ -136,22 +136,22 @@ EOF
136 136
 #------------------------------------------------------------------------------
137 137
 
138 138
 ptest "comment: multiple /*...*/ comments" <<EOF
139  
-/* */ a /* */
  139
+/* */ sx /* */
140 140
 /***/ =  /**/
141 141
 /**/  b /* */
142 142
 EOF
143 143
 expect <<EOF
144  
-a = b
  144
+sx = b
145 145
 EOF
146 146
 
147 147
 #------------------------------------------------------------------------------
148 148
 
149 149
 ptest "comment: [preset00]" <<EOF
150 150
   [preset00]
151  
-x=y
  151
+sx=y
152 152
 EOF
153 153
 expect <<EOF
154  
-x = y
  154
+sx = y
155 155
 EOF
156 156
 
157 157
 ###############################################################################
24  src/compiler/test/cond
@@ -3,38 +3,38 @@
3 3
 
4 4
 ###############################################################################
5 5
 
6  
-ptest "conditional: x = a ? b : c" <<EOF
7  
-x = a ? b : c
  6
+ptest "conditional: sx = a ? b : c" <<EOF
  7
+sx = a ? b : c
8 8
 EOF
9 9
 expect <<EOF
10  
-x = (if a b c)
  10
+sx = (if a b c)
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest "conditional: x = a+b ? c+d : e+f" <<EOF
16  
-x = a+b ? c+d : e+f
  15
+ptest "conditional: sx = a+b ? c+d : e+f" <<EOF
  16
+sx = a+b ? c+d : e+f
17 17
 EOF
18 18
 expect <<EOF
19  
-x = (if (+ a b) (+ c d) (+ e f))
  19
+sx = (if (+ a b) (+ c d) (+ e f))
20 20
 EOF
21 21
 
22 22
 #------------------------------------------------------------------------------
23 23
 
24  
-ptest "conditional: x = a ? b ? c : d : e" <<EOF
25  
-x = a ? b ? c : d : e
  24
+ptest "conditional: sx = a ? b ? c : d : e" <<EOF
  25
+sx = a ? b ? c : d : e
26 26
 EOF
27 27
 expect <<EOF
28  
-x = (if a (if b c d) e)
  28
+sx = (if a (if b c d) e)
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32
 
33  
-ptest "conditional: x = a ? b : c ? d : e" <<EOF
34  
-x = a ? b : c ? d : e
  33
+ptest "conditional: sx = a ? b : c ? d : e" <<EOF
  34
+sx = a ? b : c ? d : e
35 35
 EOF
36 36
 expect <<EOF
37  
-x = (if a b (if c d e))
  37
+sx = (if a b (if c d e))
38 38
 EOF
39 39
 
40 40
 ###############################################################################
9  src/compiler/test/dualuse
@@ -4,28 +4,31 @@
4 4
 ###############################################################################
5 5
 
6 6
 ptest "dual use: min = sin+cos" <<EOF
  7
+per_frame:
7 8
 min = sin+cos
8 9
 EOF
9 10
 expect <<EOF
10  
-min = (+ (sin) (cos))
  11
+per_frame = min = (+ (sin) (cos))
11 12
 EOF
12 13
 
13 14
 #------------------------------------------------------------------------------
14 15
 
15 16
 ptest "dual use: sin = sqr-if" <<EOF
  17
+per_frame:
16 18
 sin = sqr-if
17 19
 EOF
18 20
 expect <<EOF
19  
-sin = (- (sqr) (if))
  21
+per_frame = sin = (- (sqr) (if))
20 22
 EOF
21 23
 
22 24
 #------------------------------------------------------------------------------
23 25
 
24 26
 ptest "dual use: if = max*int" <<EOF
  27
+per_frame:
25 28
 if = max*int
26 29
 EOF
27 30
 expect <<EOF
28  
-if = (* (max) (int))
  31
+per_frame = if = (* (max) (int))
29 32
 EOF
30 33
 
31 34
 ###############################################################################
12  src/compiler/test/error
@@ -12,18 +12,18 @@ EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest_fail "syntax error: x = a b" <<EOF
16  
-x = a b
  15
+ptest_fail "syntax error: sx = a b" <<EOF
  16
+sx = a b
17 17
 EOF
18 18
 expect <<EOF
19  
-x = a
  19
+sx = a
20 20
 FPVM, line 2: parse error near 'EOF'
21 21
 EOF
22 22
 
23 23
 #------------------------------------------------------------------------------
24 24
 
25  
-ptest_fail "syntax error: x = a + + b" <<EOF
26  
-x = a + + b
  25
+ptest_fail "syntax error: sx = a + + b" <<EOF
  26
+sx = a + + b
27 27
 EOF
28 28
 expect <<EOF
29 29
 FPVM, line 1: parse error near '+'
@@ -32,7 +32,7 @@ EOF
32 32
 #------------------------------------------------------------------------------
33 33
 
34 34
 ptest_fail "inject code generation error" -f "codegen" <<EOF
35  
-x = a + b
  35
+sx = a + b
36 36
 EOF
37 37
 expect <<EOF
38 38
 FPVM, line 2: codegen near 'EOF'
36  src/compiler/test/fcond
@@ -3,56 +3,56 @@
3 3
 
4 4
 ###############################################################################
5 5
 
6  
-ptest "fold conditional: x = a ? b : c (nothing to fold)" << EOF
7  
-x = a ? b : c
  6
+ptest "fold conditional: sx = a ? b : c (nothing to fold)" << EOF
  7
+sx = a ? b : c
8 8
 EOF
9 9
 expect <<EOF
10  
-x = (if a b c)
  10
+sx = (if a b c)
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest "fold conditional: x = 1 ? b : c" << EOF
16  
-x = 1 ? b : c
  15
+ptest "fold conditional: sx = 1 ? b : c" << EOF
  16
+sx = 1 ? b : c
17 17
 EOF
18 18
 expect <<EOF
19  
-x = b
  19
+sx = b
20 20
 EOF
21 21
 
22 22
 #------------------------------------------------------------------------------
23 23
 
24  
-ptest "fold conditional: x = 0 ? b : c" << EOF
25  
-x = 0 ? b : c
  24
+ptest "fold conditional: sx = 0 ? b : c" << EOF
  25
+sx = 0 ? b : c
26 26
 EOF
27 27
 expect <<EOF
28  
-x = c
  28
+sx = c
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32
 
33  
-ptest "fold conditional: x = if(a, b, c) (nothing to fold)" << EOF
34  
-x = if(a, b, c)
  33
+ptest "fold conditional: sx = if(a, b, c) (nothing to fold)" << EOF
  34
+sx = if(a, b, c)
35 35
 EOF
36 36
 expect <<EOF
37  
-x = (if a b c)
  37
+sx = (if a b c)
38 38
 EOF
39 39
 
40 40
 #------------------------------------------------------------------------------
41 41
 
42  
-ptest "fold conditional: x = if(1, b, c)" << EOF
43  
-x = if(1, b, c)
  42
+ptest "fold conditional: sx = if(1, b, c)" << EOF
  43
+sx = if(1, b, c)
44 44
 EOF
45 45
 expect <<EOF
46  
-x = b
  46
+sx = b
47 47
 EOF
48 48
 
49 49
 #------------------------------------------------------------------------------
50 50
 
51  
-ptest "fold conditional: x = if(0, b,c)" << EOF
52  
-x = if(0, b, c)
  51
+ptest "fold conditional: sx = if(0, b,c)" << EOF
  52
+sx = if(0, b, c)
53 53
 EOF
54 54
 expect <<EOF
55  
-x = c
  55
+sx = c
56 56
 EOF
57 57
 
58 58
 ###############################################################################
106  src/compiler/test/fold
@@ -3,153 +3,153 @@
3 3
 
4 4
 ###############################################################################
5 5
 
6  
-ptest "constant folding: x = 1+2" << EOF
7  
-x = 1+2
  6
+ptest "constant folding: sx = 1+2" << EOF
  7
+sx = 1+2
8 8
 EOF
9 9
 expect <<EOF
10  
-x = 3
  10
+sx = 3
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest "constant folding: x = 1-2" << EOF
16  
-x = 1-2
  15
+ptest "constant folding: sx = 1-2" << EOF
  16
+sx = 1-2
17 17
 EOF
18 18
 expect <<EOF
19  
-x = -1
  19
+sx = -1
20 20
 EOF
21 21
 
22 22
 #------------------------------------------------------------------------------
23 23
 
24  
-ptest "constant folding: x = 2*3" << EOF
25  
-x = 2*3
  24
+ptest "constant folding: sx = 2*3" << EOF
  25
+sx = 2*3
26 26
 EOF
27 27
 expect <<EOF
28  
-x = 6
  28
+sx = 6
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32
 
33  
-ptest "constant folding: x = 4/5" << EOF
34  
-x = 4/5
  33
+ptest "constant folding: sx = 4/5" << EOF
  34
+sx = 4/5
35 35
 EOF
36 36
 expect <<EOF
37  
-x = 0.8
  37
+sx = 0.8
38 38
 EOF
39 39
 
40 40
 #------------------------------------------------------------------------------
41 41
 
42  
-ptest "constant folding: x = 2.8 % 0.5" << EOF
43  
-x = 2.8 % 0.5
  42
+ptest "constant folding: sx = 2.8 % 0.5" << EOF
  43
+sx = 2.8 % 0.5
44 44
 EOF
45 45
 expect <<EOF
46  
-x = 0.3
  46
+sx = 0.3
47 47
 EOF
48 48
 
49 49
 #------------------------------------------------------------------------------
50 50
 
51  
-ptest "constant folding: x = a+1 (nothign to fold)" << EOF
52  
-x = a+1
  51
+ptest "constant folding: sx = a+1 (nothign to fold)" << EOF
  52
+sx = a+1
53 53
 EOF
54 54
 expect <<EOF
55  
-x = (+ a 1)
  55
+sx = (+ a 1)
56 56
 EOF
57 57
 
58 58
 #------------------------------------------------------------------------------
59 59
 
60  
-ptest "constant folding: x = 1+b (nothign to fold)" << EOF
61  
-x = 1+b
  60
+ptest "constant folding: sx = 1+b (nothign to fold)" << EOF
  61
+sx = 1+b
62 62
 EOF
63 63
 expect <<EOF
64  
-x = (+ 1 b)
  64
+sx = (+ 1 b)
65 65
 EOF
66 66
 
67 67
 #------------------------------------------------------------------------------
68 68
 
69 69
 ptest "constant folding: above" << EOF
70  
-x = above(1, 2)
71  
-y = above(2, 1)
72  
-z = above(1, 1)
  70
+sx = above(1, 2)
  71
+sy = above(2, 1)
  72
+cx = above(1, 1)
73 73
 EOF
74 74
 expect <<EOF
75  
-x = 0
76  
-y = 1
77  
-z = 0
  75
+sx = 0
  76
+sy = 1
  77
+cx = 0
78 78
 EOF
79 79
 
80 80
 #------------------------------------------------------------------------------
81 81
 
82 82
 ptest "constant folding: below" << EOF
83  
-x = below(1, 2)
84  
-y = below(2, 1)
85  
-z = below(1, 1)
  83
+sx = below(1, 2)
  84
+sy = below(2, 1)
  85
+cx = below(1, 1)
86 86
 EOF
87 87
 expect <<EOF
88  
-x = 1
89  
-y = 0
90  
-z = 0
  88
+sx = 1
  89
+sy = 0
  90
+cx = 0
91 91
 EOF
92 92
 
93 93
 #------------------------------------------------------------------------------
94 94
 
95 95
 ptest "constant folding: equal" << EOF
96  
-x = equal(1, 2)
97  
-y = equal(2, 1)
98  
-z = equal(1, 1)
  96
+sx = equal(1, 2)
  97
+sy = equal(2, 1)
  98
+cx = equal(1, 1)
99 99
 EOF
100 100
 expect <<EOF
101  
-x = 0
102  
-y = 0
103  
-z = 1
  101
+sx = 0
  102
+sy = 0
  103
+cx = 1
104 104
 EOF
105 105
 
106 106
 #------------------------------------------------------------------------------
107 107
 
108 108
 ptest "constant folding: max" << EOF
109  
-x = max(2, 3)
110  
-y = max(3, 2)
  109
+sx = max(2, 3)
  110
+sy = max(3, 2)
111 111
 EOF
112 112
 expect <<EOF
113  
-x = 3
114  
-y = 3
  113
+sx = 3
  114
+sy = 3
115 115
 EOF
116 116
 
117 117
 #------------------------------------------------------------------------------
118 118
 
119 119
 ptest "constant folding: min" << EOF
120  
-x = min(2, 3)
121  
-y = min(3, 2)
  120
+sx = min(2, 3)
  121
+sy = min(3, 2)
122 122
 EOF
123 123
 expect <<EOF
124  
-x = 2
125  
-y = 2
  124
+sx = 2
  125
+sy = 2
126 126
 EOF
127 127
 
128 128
 #------------------------------------------------------------------------------
129 129
 
130 130
 ptest "constant folding: unary minus" << EOF
131  
-x = -2
  131
+sx = -2
132 132
 EOF
133 133
 expect <<EOF
134  
-x = -2
  134
+sx = -2
135 135
 EOF
136 136
 
137 137
 #------------------------------------------------------------------------------
138 138
 
139 139
 ptest "constant folding: sqr" << EOF
140  
-x = sqr(3)
  140
+sx = sqr(3)
141 141
 EOF
142 142
 expect <<EOF
143  
-x = 9
  143
+sx = 9
144 144
 EOF
145 145
 
146 146
 #------------------------------------------------------------------------------
147 147
 
148 148
 ptest "constant folding: sqrt" << EOF
149  
-x = sqrt(2.25)
  149
+sx = sqrt(2.25)
150 150
 EOF
151 151
 expect <<EOF
152  
-x = 1.5
  152
+sx = 1.5
153 153
 EOF
154 154
 
155 155
 ###############################################################################
6  src/compiler/test/image
@@ -32,13 +32,13 @@ EOF
32 32
 
33 33
 #------------------------------------------------------------------------------
34 34
 
35  
-ptest "image: imagefile2 = hel<nl>lo" <<EOF
  35
+ptest "image: imagefile2 = hel<nl>sx" <<EOF
36 36
 imagefile2 = hel
37  
-lo = u
  37
+sx = u
38 38
 EOF
39 39
 expect <<EOF
40 40
 image 2 = "hel"
41  
-lo = u
  41
+sx = u
42 42
 EOF
43 43
 
44 44
 #------------------------------------------------------------------------------
48  src/compiler/test/initial
... ...
@@ -0,0 +1,48 @@
  1
+#!/bin/sh
  2
+. ./Common
  3
+
  4
+###############################################################################
  5
+
  6
+ptest "initial: initialize non-system to zero" <<EOF
  7
+foo = 0
  8
+EOF
  9
+expect <<EOF
  10
+EOF
  11
+
  12
+#------------------------------------------------------------------------------
  13
+
  14
+ptest "initial: initialize per-frame to non-zero" <<EOF
  15
+wave_x = 1
  16
+EOF
  17
+expect <<EOF
  18
+wave_x = 1
  19
+EOF
  20
+
  21
+#------------------------------------------------------------------------------
  22
+
  23
+ptest_fail "initial: initialize per-vertex to non-zero" <<EOF
  24
+_texsize = 1
  25
+EOF
  26
+expect <<EOF
  27
+FPVM, line 2: can initialize non-system variables only to zero near 'EOF'
  28
+EOF
  29
+
  30
+#------------------------------------------------------------------------------
  31
+
  32
+ptest_fail "initial: initialize non-system to non-zero" <<EOF
  33
+foo = 1
  34
+EOF
  35
+expect <<EOF
  36
+FPVM, line 2: can initialize non-system variables only to zero near 'EOF'
  37
+EOF
  38
+
  39
+#------------------------------------------------------------------------------
  40
+
  41
+ptest_fail "initial: initialize non-system to non-number" <<EOF
  42
+foo = bar
  43
+EOF
  44
+expect <<EOF
  45
+FPVM, line 2: can initialize non-system variables only to zero near 'EOF'
  46
+EOF
  47
+
  48
+###############################################################################
60  src/compiler/test/location
@@ -4,12 +4,12 @@
4 4
 ###############################################################################
5 5
 
6 6
 ptest_fail "location: scanner, inside line" <<EOF
7  
-a = b
  7
+rot = b
8 8
 x = \` y
9 9
 c = d
10 10
 EOF
11 11
 expect <<EOF
12  
-a = b
  12
+rot = b
13 13
 FPVM, line 2: scan error near '\`'
14 14
 EOF
15 15
 
@@ -27,72 +27,72 @@ EOF
27 27
 #------------------------------------------------------------------------------
28 28
 
29 29
 ptest_fail "location: scanner, end of line" <<EOF
30  
-a = b
  30
+sx = b
31 31
 x = y\`
32 32
 c = d
33 33
 EOF
34 34
 expect <<EOF
35  
-a = b
  35
+sx = b
36 36
 FPVM, line 2: scan error near '\`'
37 37
 EOF
38 38
 
39 39
 #------------------------------------------------------------------------------
40 40
 
41 41
 ptest_fail "location: parser, inside line" <<EOF
42  
-a = b
  42
+sx = b
43 43
 x = * y
44 44
 c = d
45 45
 EOF
46 46
 expect <<EOF
47  
-a = b
  47
+sx = b
48 48
 FPVM, line 2: parse error near '*'
49 49
 EOF
50 50
 
51 51
 #------------------------------------------------------------------------------
52 52
 
53 53
 ptest_fail "location: parser, beginning of line" <<EOF
54  
-a = b
  54
+sx = b
55 55
 )x = y
56 56
 c = d
57 57
 EOF
58 58
 expect <<EOF
59  
-a = b
  59
+sx = b
60 60
 FPVM, line 2: parse error near ')x'
61 61
 EOF
62 62
 
63 63
 #------------------------------------------------------------------------------
64 64
 
65 65
 ptest_fail "location: parser, end of line (1)" <<EOF
66  
-a = b
67  
-x = y(
  66
+sx = b
  67
+sy = y(
68 68
 c = d
69 69
 EOF
70 70
 expect <<EOF
71  
-a = b
72  
-x = y
  71
+sx = b
  72
+sy = y
73 73
 FPVM, line 2: parse error near '('
74 74
 EOF
75 75
 
76 76
 #------------------------------------------------------------------------------
77 77
 
78 78
 ptest_fail "location: parser, end of line (2)" <<EOF
79  
-a = b
  79
+sx = b
80 80
 x = )
81 81
 c = d
82 82
 EOF
83 83
 expect <<EOF
84  
-a = b
  84
+sx = b
85 85
 FPVM, line 2: parse error near ')'
86 86
 EOF
87 87
 
88 88
 #------------------------------------------------------------------------------
89 89
 
90 90
 ptest_fail "location: error is end of line" <<EOF
91  
-a = b
  91
+sx = b
92 92
 x =
93 93
 EOF
94 94
 expect <<EOF
95  
-a = b
  95
+sx = b
96 96
 FPVM, line 3: parse error near 'EOF'
97 97
 EOF
98 98
 
@@ -106,23 +106,23 @@ EOF
106 106
 #------------------------------------------------------------------------------
107 107
 
108 108
 ptest_fail "location: error is identifier" <<EOF
109  
-foo = this is an error
  109
+sx = this is an error
110 110
 EOF
111 111
 expect <<EOF
112  
-foo = this
  112
+sx = this
113 113
 FPVM, line 1: parse error near 'an'
114 114
 EOF
115 115
 
116 116
 #------------------------------------------------------------------------------
117 117
 
118 118
 ptest_fail "location: 3rd line" <<EOF
119  
-a = b
120  
-c = d
  119
+sx = b
  120
+sy = d
121 121
 )
122 122
 EOF
123 123
 expect <<EOF
124  
-a = b
125  
-c = d
  124
+sx = b
  125
+sy = d
126 126
 FPVM, line 3: parse error near ')'
127 127
 EOF
128 128
 
@@ -130,28 +130,28 @@ EOF
130 130
 
131 131
 ptest_fail "location: 5th line, with // comments" <<EOF
132 132
 // assign a
133  
-a = b
  133
+sx = b
134 134
 // assign c
135  
-c = d
  135
+sy = d
136 136
 )
137 137
 EOF
138 138
 expect <<EOF
139  
-a = b
140  
-c = d
  139
+sx = b
  140
+sy = d
141 141
 FPVM, line 5: parse error near ')'
142 142
 EOF
143 143
 
144 144
 #------------------------------------------------------------------------------
145 145
 
146 146
 ptest_fail "location: 4th line, with /*...*/ comments" <<EOF
147  
-a = b /* some
  147
+sx = b /* some
148 148
 comment */
149  
-c = d
  149
+sy = d
150 150
 )
151 151
 EOF
152 152
 expect <<EOF
153  
-a = b
154  
-c = d
  153
+sx = b
  154
+sy = d
155 155
 FPVM, line 4: parse error near ')'
156 156
 EOF
157 157
 
40  src/compiler/test/not
@@ -4,10 +4,10 @@
4 4
 ###############################################################################
5 5
 
6 6
 ptest "not: !a" << EOF
7  
-x = !a
  7
+sx = !a
8 8
 EOF
9 9
 expect <<EOF
10  
-x = (! a)
  10
+sx = (! a)
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
@@ -22,82 +22,82 @@ EOF
22 22
 #------------------------------------------------------------------------------
23 23
 
24 24
 ptest "not: !0" << EOF
25  
-x = !0
  25
+sx = !0
26 26
 EOF
27 27
 expect <<EOF
28  
-x = 1
  28
+sx = 1
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32
 
33 33
 ptest "not: !1" << EOF
34  
-x = !1
  34
+sx = !1
35 35
 EOF
36 36
 expect <<EOF
37  
-x = 0
  37
+sx = 0
38 38
 EOF
39 39
 
40 40
 #------------------------------------------------------------------------------
41 41
 
42 42
 ptest "not: !a*b" << EOF
43  
-x = !a*b
  43
+sx = !a*b
44 44
 EOF
45 45
 expect <<EOF
46  
-x = (* (! a) b)
  46
+sx = (* (! a) b)
47 47
 EOF
48 48
 
49 49
 #------------------------------------------------------------------------------
50 50
 
51 51
 ptest "not: -!a" << EOF
52  
-x = -!a
  52
+sx = -!a
53 53
 EOF
54 54
 expect <<EOF
55  
-x = (- (! a))
  55
+sx = (- (! a))
56 56
 EOF
57 57
 
58 58
 #------------------------------------------------------------------------------
59 59
 
60 60
 ptest "not: !-b" << EOF
61  
-x = !-b
  61
+sx = !-b
62 62
 EOF
63 63
 expect <<EOF
64  
-x = (! (- b))
  64
+sx = (! (- b))
65 65
 EOF
66 66
 
67 67
 #------------------------------------------------------------------------------
68 68
 
69 69
 ptest "not: if (!a, b, c)" << EOF
70  
-x = if (!a, b, c)
  70
+sx = if (!a, b, c)
71 71
 EOF
72 72
 expect <<EOF
73  
-x = (if a c b)
  73
+sx = (if a c b)
74 74
 EOF
75 75
 
76 76
 #------------------------------------------------------------------------------
77 77
 
78 78
 ptest "not: !a ? b : c" << EOF
79  
-x = !a ? b : c
  79
+sx = !a ? b : c
80 80
 EOF
81 81
 expect <<EOF
82  
-x = (if a c b)
  82
+sx = (if a c b)
83 83
 EOF
84 84
 
85 85
 #------------------------------------------------------------------------------
86 86
 
87 87
 ptest "not: !0 ? b : c" << EOF
88  
-x = !0 ? b : c
  88
+sx = !0 ? b : c
89 89
 EOF
90 90
 expect <<EOF
91  
-x = b
  91
+sx = b
92 92
 EOF
93 93
 
94 94
 #------------------------------------------------------------------------------
95 95
 
96 96
 ptest "not: !1 ? b : c" << EOF
97  
-x = !1 ? b : c
  97
+sx = !1 ? b : c
98 98
 EOF
99 99
 expect <<EOF
100  
-x = c
  100
+sx = c
101 101
 EOF
102 102
 
103 103
 ###############################################################################
34  src/compiler/test/number
@@ -3,53 +3,53 @@
3 3
 
4 4
 ###############################################################################
5 5
 
6  
-ptest "number: a = 1" <<EOF
7  
-a = 1
  6
+ptest "number: sx = 1" <<EOF
  7
+sx = 1
8 8
 EOF
9 9
 expect <<EOF
10  
-a = 1
  10
+sx = 1
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest "number: b = 1.2" <<EOF
16  
-b = 1.2
  15
+ptest "number: sx = 1.2" <<EOF
  16
+sx = 1.2
17 17
 EOF
18 18
 expect <<EOF
19  
-b = 1.2
  19
+sx = 1.2
20 20
 EOF
21 21
 
22 22
 #------------------------------------------------------------------------------
23 23
 
24  
-ptest "number: c = .3" <<EOF
25  
-c = .3
  24
+ptest "number: sx = .3" <<EOF
  25
+sx = .3
26 26
 EOF
27 27
 expect <<EOF
28  
-c = 0.3
  28
+sx = 0.3
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32
 
33  
-ptest "number: d = 4." <<EOF
34  
-d = 4.
  33
+ptest "number: sx = 4." <<EOF
  34
+sx = 4.
35 35
 EOF
36 36
 expect <<EOF
37  
-d = 4
  37
+sx = 4
38 38
 EOF
39 39
 
40 40
 #------------------------------------------------------------------------------
41 41
 
42  
-ptest "number: e = 51.23" <<EOF
43  
-e = 51.23
  42
+ptest "number: sx = 51.23" <<EOF
  43
+sx = 51.23
44 44
 EOF
45 45
 expect <<EOF
46  
-e = 51.23
  46
+sx = 51.23
47 47
 EOF
48 48
 
49 49
 #------------------------------------------------------------------------------
50 50
 
51  
-ptest_fail "number: f = ." <<EOF
52  
-f = .
  51
+ptest_fail "number: sx = ." <<EOF
  52
+sx = .
53 53
 EOF
54 54
 expect <<EOF
55 55
 FPVM, line 1: scan error near '.'
2  src/compiler/test/patches
@@ -18,7 +18,7 @@ PATCHDIR=../../../patches
18 18
 
19 19
 do_test()
20 20
 {
21  
-	ptest "patch: $n" -c -q <"$PATCHDIR/$n"
  21
+	ptest "patch: $n" -Wsection -c -q <"$PATCHDIR/$n"
22 22
 	expect </dev/null
23 23
 }
24 24
 
84  src/compiler/test/prec
@@ -3,128 +3,128 @@
3 3
 
4 4
 ###############################################################################
5 5
 
6  
-ptest "precedence: x = a+b*c+d" <<EOF
7  
-x = a+b*c+d
  6
+ptest "precedence: sx = a+b*c+d" <<EOF
  7
+sx = a+b*c+d
8 8
 EOF
9 9
 expect <<EOF
10  
-x = (+ (+ a (* b c)) d)
  10
+sx = (+ (+ a (* b c)) d)
11 11
 EOF
12 12
 
13 13
 #------------------------------------------------------------------------------
14 14
 
15  
-ptest "precedence: x = a+b/c+d" <<EOF
16  
-x = a+b/c+d
  15
+ptest "precedence: sx = a+b/c+d" <<EOF
  16
+sx = a+b/c+d
17 17
 EOF
18 18
 expect <<EOF
19  
-x = (+ (+ a (/ b c)) d)
  19
+sx = (+ (+ a (/ b c)) d)
20 20
 EOF
21 21
 
22 22
 #------------------------------------------------------------------------------
23 23
 
24  
-ptest "precedence: x = a+b%c+d" <<EOF
25  
-x = a+b%c+d
  24
+ptest "precedence: sx = a+b%c+d" <<EOF
  25
+sx = a+b%c+d
26 26
 EOF
27 27
 expect <<EOF
28  
-x = (+ (+ a (% b c)) d)
  28
+sx = (+ (+ a (% b c)) d)
29 29
 EOF
30 30
 
31 31
 #------------------------------------------------------------------------------
32 32