Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 11 files changed
  • 0 comments
  • 1 contributor
36  patches/demo/wheel/README
... ...
@@ -0,0 +1,36 @@
  1
+The "wheel" patch illustrates the use image sequences to create
  2
+animations.
  3
+
  4
+To install the patch, run the script "gen" (needs transfig):
  5
+
  6
+./gen
  7
+
  8
+Then upload wheel.fnp and the PNGs with ftp:
  9
+
  10
+ftp milkymist
  11
+ftp> prompt
  12
+ftp> put wheel.fnp
  13
+ftp> mput w*.png
  14
+
  15
+The patch comes with MIDI bindings for the Faderfox LV3:
  16
+
  17
+- the left half of the controller is for image channel 1, the
  18
+  right half is for image channel 2. They're identical except
  19
+  that the default positions of the images differ.
  20
+
  21
+- faders 1 and 2 sets the image size and alpha channel
  22
+
  23
+- faders 3 and 4 set the sensitivity to bass and treble
  24
+
  25
+- encoder 1 adjusts the frame rate. The rate can be negative,
  26
+  resulting in counterclockwise rotation (with the faux motion
  27
+  blur looking a little odd).
  28
+
  29
+- pushing encoder 1 sets the speed to zero and holds it at zero.
  30
+  The frame number can be changed by turning the encoder. Pushing
  31
+  encoder 1 releases the speed.
  32
+
  33
+- blue button 1 sets the speed to one. Blue button 2 reverses the
  34
+  speed.
  35
+
  36
+- FX1 enables setting the image position with the joystick.
23  patches/demo/wheel/figfilt
... ...
@@ -0,0 +1,23 @@
  1
+#!/usr/bin/perl
  2
+$skip = 0;
  3
+$skipping = 0;
  4
+while (<STDIN>) {
  5
+	if (/^#/ && $. != 1) {
  6
+		$skip = 1;
  7
+		for $key (@ARGV) {
  8
+			if ($_ =~ /^# $key$/) {
  9
+				$skip = 0;
  10
+				last;
  11
+			}
  12
+		}
  13
+		print unless $skip;
  14
+		next;
  15
+	}
  16
+	if (/^\s/) {
  17
+		print unless $skipping;
  18
+		next;
  19
+	}
  20
+	print unless $skip;
  21
+	$skipping = $skip;
  22
+	$skip = 0;
  23
+}
11  patches/demo/wheel/gen
... ...
@@ -0,0 +1,11 @@
  1
+#!/bin/sh -x
  2
+for n in 01 02 03 04 05 06 07 08 09 \
  3
+      10 11 12 13 14 15 16 17 18 19 \
  4
+      20 21 22 23 24; do
  5
+	./figfilt `echo $n | sed s/^0//` <wheel.fig |
  6
+	    fig2dev -L png -S 4 -m 0.311 -g black >w$n.png
  7
+	#
  8
+	# When making changes to the image, adjust the -m parameter such
  9
+	# that the resulting size of the PNG is 216x216 pixels.
  10
+	#
  11
+done
162  patches/demo/wheel/wheel.fig
... ...
@@ -0,0 +1,162 @@
  1
+#FIG 3.2  Produced by xfig version 3.2.5b
  2
+Landscape
  3
+Center
  4
+Metric
  5
+A4      
  6
+100.00
  7
+Single
  8
+-2
  9
+1200 2
  10
+# 2
  11
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 5400 2025 407 407 5400 2025 5807 2025
  12
+1 3 0 5 31 7 15 -1 -1 0.000 1 0.0000 5400 5175 3150 3150 5400 5175 8550 5175
  13
+# 3
  14
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 5400 2025 407 407 5400 2025 5807 2025
  15
+# 1
  16
+1 3 0 0 0 7 45 -1 20 0.000 1 0.0000 5400 2025 407 407 5400 2025 5807 2025
  17
+# 2
  18
+1 3 0 0 0 7 45 -1 20 0.000 1 6.0214 6215 2132 407 407 6215 2132 6622 2132
  19
+# 3
  20
+1 3 0 0 0 7 45 -1 20 0.000 1 5.7596 6975 2447 407 407 6975 2447 7382 2447
  21
+# 4
  22
+1 3 0 0 0 7 45 -1 20 0.000 1 5.4978 7627 2948 407 407 7627 2948 8034 2948
  23
+# 5
  24
+1 3 0 0 0 7 45 -1 20 0.000 1 5.2360 8128 3600 407 407 8128 3600 8535 3600
  25
+# 6
  26
+1 3 0 0 0 7 45 -1 20 0.000 1 4.9742 8443 4360 407 407 8443 4360 8850 4360
  27
+# 7
  28
+1 3 0 0 0 7 45 -1 20 0.000 1 4.7124 8550 5175 407 407 8550 5175 8957 5175
  29
+# 8
  30
+1 3 0 0 0 7 45 -1 20 0.000 1 4.4506 8443 5990 407 407 8443 5990 8850 5990
  31
+# 9
  32
+1 3 0 0 0 7 45 -1 20 0.000 1 4.1888 8128 6750 407 407 8128 6750 8535 6750
  33
+# 10
  34
+1 3 0 0 0 7 45 -1 20 0.000 1 3.9270 7627 7402 407 407 7627 7402 8034 7402
  35
+# 11
  36
+1 3 0 0 0 7 45 -1 20 0.000 1 3.6652 6975 7903 407 407 6975 7903 7382 7903
  37
+# 12
  38
+1 3 0 0 0 7 45 -1 20 0.000 1 3.4034 6215 8218 407 407 6215 8218 6622 8218
  39
+# 13
  40
+1 3 0 0 0 7 45 -1 20 0.000 1 3.1416 5400 8325 407 407 5400 8325 5807 8325
  41
+# 14
  42
+1 3 0 0 0 7 45 -1 20 0.000 1 2.8798 4585 8218 407 407 4585 8218 4992 8218
  43
+# 15
  44
+1 3 0 0 0 7 45 -1 20 0.000 1 2.6180 3825 7903 407 407 3825 7903 4232 7903
  45
+# 16
  46
+1 3 0 0 0 7 45 -1 20 0.000 1 2.3562 3173 7402 407 407 3173 7402 3580 7402
  47
+# 17
  48
+1 3 0 0 0 7 45 -1 20 0.000 1 2.0944 2672 6750 407 407 2672 6750 3079 6750
  49
+# 18
  50
+1 3 0 0 0 7 45 -1 20 0.000 1 1.8326 2357 5990 407 407 2357 5990 2764 5990
  51
+# 19
  52
+1 3 0 0 0 7 45 -1 20 0.000 1 1.5708 2250 5175 407 407 2250 5175 2657 5175
  53
+# 20
  54
+1 3 0 0 0 7 45 -1 20 0.000 1 1.3090 2357 4360 407 407 2357 4360 2764 4360
  55
+# 21
  56
+1 3 0 0 0 7 45 -1 20 0.000 1 1.0472 2672 3600 407 407 2672 3600 3079 3600
  57
+# 22
  58
+1 3 0 0 0 7 45 -1 20 0.000 1 0.7854 3173 2948 407 407 3173 2948 3580 2948
  59
+# 23
  60
+1 3 0 0 0 7 45 -1 20 0.000 1 0.5236 3825 2447 407 407 3825 2447 4232 2447
  61
+# 24
  62
+1 3 0 0 0 7 45 -1 20 0.000 1 0.2618 4585 2132 407 407 4585 2132 4992 2132
  63
+# 4
  64
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 6215 2132 407 407 6215 2132 6622 2132
  65
+# 5
  66
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 6975 2447 407 407 6975 2447 7382 2447
  67
+# 6
  68
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 7627 2948 407 407 7627 2948 8034 2948
  69
+# 7
  70
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 8128 3600 407 407 8128 3600 8535 3600
  71
+# 8
  72
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 8443 4360 407 407 8443 4360 8850 4360
  73
+# 9
  74
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 8550 5175 407 407 8550 5175 8957 5175
  75
+# 10
  76
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 8443 5990 407 407 8443 5990 8850 5990
  77
+# 11
  78
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 8128 6750 407 407 8128 6750 8535 6750
  79
+# 12
  80
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 7627 7402 407 407 7627 7402 8034 7402
  81
+# 13
  82
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 6975 7903 407 407 6975 7903 7382 7903
  83
+# 14
  84
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 6215 8218 407 407 6215 8218 6622 8218
  85
+# 15
  86
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 5400 8325 407 407 5400 8325 5807 8325
  87
+# 16
  88
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 4585 8218 407 407 4585 8218 4992 8218
  89
+# 17
  90
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 3825 7903 407 407 3825 7903 4232 7903
  91
+# 18
  92
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 3173 7402 407 407 3173 7402 3580 7402
  93
+# 19
  94
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 2672 6750 407 407 2672 6750 3079 6750
  95
+# 20
  96
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 2357 5990 407 407 2357 5990 2764 5990
  97
+# 21
  98
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 2250 5175 407 407 2250 5175 2657 5175
  99
+# 23
  100
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 2672 3600 407 407 2672 3600 3079 3600
  101
+# 22
  102
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 2357 4360 407 407 2357 4360 2764 4360
  103
+# 24
  104
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 3173 2948 407 407 3173 2948 3580 2948
  105
+# 1
  106
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 3825 2447 407 407 3825 2447 4232 2447
  107
+# 2
  108
+1 3 0 0 0 7 35 -1 5 0.000 1 0.0000 4585 2132 407 407 4585 2132 4992 2132
  109
+# 3
  110
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 6215 2132 407 407 6215 2132 6622 2132
  111
+# 4
  112
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 6975 2447 407 407 6975 2447 7382 2447
  113
+# 5
  114
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 7627 2948 407 407 7627 2948 8034 2948
  115
+# 6
  116
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 8128 3600 407 407 8128 3600 8535 3600
  117
+# 7
  118
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 8443 4360 407 407 8443 4360 8850 4360
  119
+# 8
  120
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 8550 5175 407 407 8550 5175 8957 5175
  121
+# 9
  122
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 8443 5990 407 407 8443 5990 8850 5990
  123
+# 10
  124
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 8128 6750 407 407 8128 6750 8535 6750
  125
+# 11
  126
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 7627 7402 407 407 7627 7402 8034 7402
  127
+# 12
  128
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 6975 7903 407 407 6975 7903 7382 7903
  129
+# 13
  130
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 6215 8218 407 407 6215 8218 6622 8218
  131
+# 14
  132
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 5400 8325 407 407 5400 8325 5807 8325
  133
+# 15
  134
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 4585 8218 407 407 4585 8218 4992 8218
  135
+# 16
  136
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 3825 7903 407 407 3825 7903 4232 7903
  137
+# 18
  138
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 2672 6750 407 407 2672 6750 3079 6750
  139
+# 17
  140
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 3173 7402 407 407 3173 7402 3580 7402
  141
+# 19
  142
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 2357 5990 407 407 2357 5990 2764 5990
  143
+# 20
  144
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 2250 5175 407 407 2250 5175 2657 5175
  145
+# 21
  146
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 2357 4360 407 407 2357 4360 2764 4360
  147
+# 22
  148
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 2672 3600 407 407 2672 3600 3079 3600
  149
+# 24
  150
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 3825 2447 407 407 3825 2447 4232 2447
  151
+# 23
  152
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 3173 2948 407 407 3173 2948 3580 2948
  153
+# 1
  154
+1 3 0 0 0 7 40 -1 10 0.000 1 0.0000 4585 2132 407 407 4585 2132 4992 2132
  155
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
  156
+	 450 225 10350 225 10350 10125 450 10125 450 225
  157
+2 1 0 5 1 7 20 -1 -1 0.000 0 0 -1 0 0 2
  158
+	 2160 8415 8640 1935
  159
+2 1 0 5 1 7 20 -1 -1 0.000 0 0 -1 0 0 2
  160
+	 2160 1935 8640 8415
  161
+2 2 0 5 1 7 20 -1 -1 0.000 0 0 -1 0 0 5
  162
+	 2160 1935 8640 1935 8640 8415 2160 8415 2160 1935
118  patches/demo/wheel/wheel.fnp
... ...
@@ -0,0 +1,118 @@
  1
+/*
  2
+ * wheel.fnp - Demonstrate moving pictures
  3
+ */
  4
+
  5
+imagefiles=w01.png, w02.png, w03.png, w04.png,
  6
+    w05.png, w06.png, w07.png, w08.png, w09.png,
  7
+    w10.png, w11.png, w12.png, w13.png, w14.png,
  8
+    w15.png, w16.png, w17.png, w18.png, w19.png,
  9
+    w20.png, w21.png, w22.png, w23.png, w24.png;
  10
+
  11
+decay = 0;
  12
+
  13
+midi "Faderfox LV3" {
  14
+	fad1 = fader(1, 7);
  15
+	fad2 = fader(2, 7);
  16
+	fad3 = fader(3, 7);
  17
+	fad4 = fader(4, 7);
  18
+	fad5 = fader(5, 7);
  19
+	fad6 = fader(6, 7);
  20
+	fad7 = fader(7, 7);
  21
+	fad8 = fader(8, 7);
  22
+
  23
+	enc1 = differential(24);
  24
+	enc2 = differential(25);
  25
+	enc3 = differential(26);
  26
+	enc4 = differential(27);
  27
+
  28
+	enc1_push = button(28);
  29
+	enc2_push = button(29);
  30
+	enc3_push = button(30);
  31
+	enc4_push = button(31);
  32
+
  33
+	green1 = button(1, 16);
  34
+	green2 = button(2, 16);
  35
+	green3 = button(3, 16);
  36
+	green4 = button(4, 16);
  37
+	green5 = button(5, 16);
  38
+	green6 = button(6, 16);
  39
+	green7 = button(7, 16);
  40
+	green8 = button(8, 16);
  41
+
  42
+	blue1 = button(1, 17);
  43
+	blue2 = button(2, 17);
  44
+	blue3 = button(3, 17);
  45
+	blue4 = button(4, 17);
  46
+	blue5 = button(5, 17);
  47
+	blue6 = button(6, 17);
  48
+	blue7 = button(7, 17);
  49
+	blue8 = button(8, 17);
  50
+
  51
+	fx1 = switch(9, 4);
  52
+	joy1x = pot(9, 1);
  53
+	joy1y = pot(9, 2);
  54
+
  55
+	fx2 = switch(10, 4);
  56
+	joy2x = pot(10, 1);
  57
+	joy2y = pot(10, 2);
  58
+};
  59
+
  60
+size1 = range(fad1);		/* image size */
  61
+alpha1 = range(fad2);		/* image alpha */
  62
+bass1 = range(fad3);		/* sensitivity to bass */
  63
+treb1 = range(fad4);		/* sensitivity to treble */
  64
+size2 = range(fad5);
  65
+alpha2 = range(fad6);
  66
+bass2 = range(fad7);
  67
+treb2 = range(fad8);
  68
+
  69
+speed1 = unbounded(enc1);	/* speed of rotation, relative to off1 */
  70
+speed2 = unbounded(enc3);
  71
+
  72
+reset1 = unbounded(enc1_push);	/* reset speed (and adjust position) */
  73
+reset2 = unbounded(enc3_push);
  74
+
  75
+start1 = button(blue1);		/* set speed to 1 step/frame = 1 rpm */
  76
+rev1 = button(blue2);		/* reverse rotation */
  77
+start2 = button(blue5);
  78
+rev2 = button(blue6);
  79
+
  80
+fx1 = switch(fx1);		/* enable joystick */
  81
+joy1x = range(joy1x);		/* X position of image */
  82
+joy1y = range(joy1y);		/* Y position */
  83
+fx2 = switch(fx2);
  84
+joy2x = range(joy2x);
  85
+joy2y = range(joy2y);
  86
+
  87
+per_frame:
  88
+	scale = 4;
  89
+
  90
+	image1_zoom = size1*size1*7+0.1+20*sin(5*bass1*bass)+10*sin(treb1*treb);
  91
+	image2_zoom = size2*size2*7+0.1+20*sin(5*bass2*bass)+10*sin(treb2*treb);
  92
+	image1_a = alpha1;
  93
+	image2_a = alpha2;
  94
+
  95
+	f1 = f1+(speed1-off1)*scale;
  96
+	f1 = f1 < 0 ? f1+24 : f1;
  97
+	f1 = f1 >= 24 ? f1-24 : f1;
  98
+	off1 = reset1 ? speed1 : start1 ? speed1-1/scale : off1;
  99
+	off1 = rev1 ? 2*speed1-off1 : off1;
  100
+
  101
+	f2 = f2+(speed2-off2)*scale;
  102
+	f2 = f2 < 0 ? f2+24 : f2;
  103
+	f2 = f2 >= 24 ? f2-24 : f2;
  104
+	off2 = reset2 ? speed2 : start2 ? speed2-1/scale : off2;
  105
+	off2 = rev2 ? 2*speed2-off2 : off2;
  106
+
  107
+	image1_index = f1;
  108
+	image2_index = f2;
  109
+
  110
+	image1_x = fx1 ? joy1x : 0.3;
  111
+	image1_y = fx1 ? 1-joy1y : 0.5;
  112
+	image2_x = fx2 ? joy2x : 0.7;
  113
+	image2_y = fx2 ? 1-joy2y : 0.5;
  114
+
  115
+	start1 = 0;
  116
+	start2 = 0;
  117
+	rev1 = 0;
  118
+	rev2 = 0;
29  src/compiler/parser.y
@@ -185,10 +185,11 @@ static struct id *symbolify(struct id *id)
185 185
 
186 186
 struct file_list {
187 187
 	const char *name;
  188
+	struct sym *tag;
188 189
 	struct file_list *next;
189 190
 };
190 191
 
191  
-static struct file_list *alloc_file_list(const char *name)
  192
+static struct file_list *alloc_file_list(const char *name, const struct id *id)
192 193
 {
193 194
 	struct file_list *fn;
194 195
 
@@ -196,6 +197,7 @@ static struct file_list *alloc_file_list(const char *name)
196 197
 	if(!fn)
197 198
 		return NULL;
198 199
 	fn->name = name;
  200
+	fn->tag = id ? id->sym : NULL;
199 201
 	fn->next = NULL;
200 202
 	return fn;
201 203
 }
@@ -252,9 +254,11 @@ static void free_file_list(struct file_list *l)
252 254
 %type midi_fn_type {enum stim_midi_fn_type}
253 255
 %type midi_addr {struct { int chan, ctrl; }}
254 256
 %type file_list {struct file_list *}
  257
+%type opt_tag {struct id *}
255 258
 
256 259
 %destructor opt_arg { parse_free($$); }
257 260
 %destructor file_list { free_file_list($$); }
  261
+%destructor opt_tag { free($$); }
258 262
 
259 263
 %syntax_error {
260 264
 	FAIL("parse error");
@@ -487,24 +491,31 @@ assignment ::= TOK_IMAGEFILES TOK_ASSIGN file_list(L) opt_semi. {
487 491
 	free_file_list(L);
488 492
 }
489 493
 
490  
-file_list(L) ::= TOK_STRING(N). {
491  
-	L = alloc_file_list(N->label);
  494
+file_list(L) ::= opt_tag(I) TOK_STRING(N). {
  495
+	L = alloc_file_list(N->label, I);
  496
+	free(I);
492 497
 }
493 498
 
494  
-file_list(L) ::= TOK_FNAME(N). {
495  
-	L = alloc_file_list(N->fname);
  499
+file_list(L) ::= opt_tag(I) TOK_FNAME(N). {
  500
+	L = alloc_file_list(N->fname, I);
  501
+	free(I);
496 502
 }
497 503
 
498  
-file_list(L) ::= TOK_STRING(N) TOK_COMMA file_list(T). {
499  
-	L = alloc_file_list(N->label);
  504
+file_list(L) ::= opt_tag(I) TOK_STRING(N) TOK_COMMA file_list(T). {
  505
+	L = alloc_file_list(N->label, I);
500 506
 	L->next = T;
  507
+	free(I);
501 508
 }
502 509
 
503  
-file_list(L) ::= TOK_FNAME(N) TOK_COMMA file_list(T). {
504  
-	L = alloc_file_list(N->fname);
  510
+file_list(L) ::= opt_tag(I) TOK_FNAME(N) TOK_COMMA file_list(T). {
  511
+	L = alloc_file_list(N->fname, I);
505 512
 	L->next = T;
  513
+	free(I);
506 514
 }
507 515
 
  516
+opt_tag(I) ::= .		{ I = NULL; }
  517
+opt_tag(I) ::= TOK_TAG(T).	{ I = T; }
  518
+
508 519
 
509 520
 /* ----- Old-style sections ------------------------------------------------ */
510 521
 
4  src/compiler/parser_helper.c
@@ -160,6 +160,10 @@ int parse(const char *expr, int start_token, struct parser_comm *comm)
160 160
 			identifier->sym = get_symbol(s);
161 161
 			identifier->label = identifier->sym->fpvm_sym.name;
162 162
 			break;
  163
+		case TOK_TAG:
  164
+			identifier->sym = get_tag(s);
  165
+			identifier->label = identifier->sym->fpvm_sym.name;
  166
+			break;
163 167
 		case TOK_STRING:
164 168
 			identifier->label = get_string(s);
165 169
 			break;
2  src/compiler/scanner.h
@@ -57,6 +57,8 @@ int scan(struct scanner *s);
57 57
  */
58 58
 struct sym *get_symbol(struct scanner *s);
59 59
 
  60
+struct sym *get_tag(struct scanner *s);
  61
+
60 62
 /* malloc'ed non-unique string */
61 63
 const char *get_name(struct scanner *s);
62 64
 
19  src/compiler/scanner.re
@@ -101,6 +101,8 @@ int scan(struct scanner *s)
101 101
 	}
102 102
 
103 103
 	/*!re2c
  104
+		id = [a-zA-Z_][a-zA-Z_0-9]*;
  105
+					/* identifier */
104 106
 		quot = [^"\x00\n\r\t\\]|"\\"[^\x00\n\r\t];
105 107
 					/* character in quoted string */
106 108
 		fnedg = [^ \x00\n\r\t];	/* character at edge of file name */
@@ -180,7 +182,7 @@ int scan(struct scanner *s)
180 182
 		<N>"imagefiles"		{ YYSETCONDITION(yycFNS1);
181 183
 					  return TOK_IMAGEFILES; }
182 184
 
183  
-		<N>[a-zA-Z_0-9]+	{ return TOK_IDENT; }
  185
+		<N>id			{ return TOK_IDENT; }
184 186
 
185 187
 		<N>'"'quot*'"'		{ return TOK_STRING; }
186 188
 		<FNS2>'"'quot*'"'	{ s->fns_state = fns_latent;
@@ -222,7 +224,14 @@ int scan(struct scanner *s)
222 224
 		<FNAME2>fnedg|fnedg(fnins)*fnedg
223 225
 					{ YYSETCONDITION(yycN);
224 226
 					  return TOK_FNAME; }
225  
-		<FNS2>fnsedg|fnsedg1(fnsins)*fnsedg|"/"fnsedg2|"/"fnsedg2(fnsins)*fnsedg
  227
+		<FNS2>id":"		{ return TOK_TAG; }
  228
+		<FNS2>fnsedg|
  229
+		    id|
  230
+		    id(fnsedg\":")|
  231
+		    id(fnsins\[a-zA-Z_0-9:])fnsins*fnsedg|
  232
+		    (fnsedg1\[a-zA-Z_])(fnsins)*fnsedg|
  233
+		    "/"fnsedg2|
  234
+		    "/"fnsedg2(fnsins)*fnsedg
226 235
 					{ YYSETCONDITION(yycN);
227 236
 					  s->fns_state = fns_latent;
228 237
 					  return TOK_FNAME; }
@@ -237,6 +246,12 @@ struct sym *get_symbol(struct scanner *s)
237 246
 	    s->cursor - s->old_cursor);
238 247
 }
239 248
 
  249
+struct sym *get_tag(struct scanner *s)
  250
+{
  251
+	return unique_n((const char *) s->old_cursor,
  252
+	    s->cursor - s->old_cursor-1);
  253
+}
  254
+
240 255
 const char *get_name(struct scanner *s)
241 256
 {
242 257
 	char *buf;
3  src/compiler/test/image
@@ -77,11 +77,10 @@ EOF
77 77
 
78 78
 #------------------------------------------------------------------------------
79 79
 
80  
-ptest_fail "image: imagefile3=foo" -c <<EOF
  80
+ptest "image: imagefile3=foo" -c -q <<EOF
81 81
 imagefile3=foo
82 82
 EOF
83 83
 expect <<EOF
84  
-line 2: image number out of bounds near 'EOF'
85 84
 EOF
86 85
 
87 86
 #------------------------------------------------------------------------------
6  src/compiler/test/images
@@ -34,11 +34,10 @@ EOF
34 34
 
35 35
 #------------------------------------------------------------------------------
36 36
 
37  
-ptest_fail 'image: imagefiles = "foo", "bar", "bang"' -c <<EOF
  37
+ptest 'image: imagefiles = "foo", "bar", "bang"' -c -q <<EOF
38 38
 imagefiles = "foo", "bar", "bang"
39 39
 EOF
40 40
 expect <<EOF
41  
-line 2: image number out of bounds near 'EOF'
42 41
 EOF
43 42
 
44 43
 #------------------------------------------------------------------------------
@@ -84,11 +83,10 @@ EOF
84 83
 
85 84
 #------------------------------------------------------------------------------
86 85
 
87  
-ptest_fail 'image: imagefiles = foo, bar, bang' -c <<EOF
  86
+ptest 'image: imagefiles = foo, bar, bang' -c -q <<EOF
88 87
 imagefiles = foo, bar, bang
89 88
 EOF
90 89
 expect <<EOF
91  
-line 2: image number out of bounds near 'EOF'
92 90
 EOF
93 91
 
94 92
 #------------------------------------------------------------------------------

No commit comments for this range

Something went wrong with that request. Please try again.