4 Ann Hell Ex Machina - Music Software
5 Copyright (C) 2003/2007 Angel Ortega <angel@triptico.com>
7 compiler.y - Scripting language YACC parser
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 http://www.triptico.com
41 void yyerror(char * s
);
43 /* injecting code functions (defined in compiler.l) */
44 int push_code
(char * code
);
45 int push_code_from_file
(char * file
);
51 double cur_time
= 0.0;
53 /* end time (longest time seen) */
54 double end_time
= 0.0;
60 static double staccato
;
61 static float volume_from
;
62 static float volume_to
;
65 /* parser debugging */
67 #define DEBUGF if(verbose >= 2)printf
77 static struct block
* blocks
= NULL
;
78 static int n_blocks
= 0;
87 static struct group
* groups
= NULL
;
88 static int n_groups
= 0;
89 static int groups_size
= 0;
97 static struct mark
* marks
= NULL
;
98 static int n_marks
= 0;
108 static struct arp
* arps
= NULL
;
109 static int n_arps
= 0;
110 static int arps_size
= 0;
112 static double arp_delay
;
113 static int arp_transpose
;
114 static float arp_volume
;
115 static int arp_track_off
;
117 int compiler_error
= 0;
121 /* alterations for each note */
125 unsigned long block_seed
= 0;
126 unsigned long volume_seed
= 0;
128 /* solo track (-1, no solo) */
131 /* number of tracks in song */
132 int n_song_tracks
= 0;
136 ********************/
138 unsigned long ah_rnd
(unsigned long * seed
)
139 /* special randomizer */
141 *seed
= (*seed
* 58321) + 11113;
147 void c_err
(char * e1
, char * e2
, char * e3
)
148 /* reports an error from the compiler */
159 printf
(" in line %d\n", yyline
);
165 static void forward
(double step
)
166 /* moves forward current time */
171 /* quantizations could be done here */
175 static float volume
(void)
179 if
(volume_from
== volume_to
)
182 unsigned long r
= ah_rnd
(&volume_seed
) %
1000;
184 f
= volume_from
+ (volume_to
- volume_from
) *
185 (((float)r
) / 1000.0);
194 static int find_block
(char * name
)
199 for
(n
= 0; n
< n_blocks
; n
++) {
200 if
(strcmp
(name
, blocks
[n
].name
) == 0)
208 static int set_block
(char * name
, char * block
)
209 /* defines a block */
216 /* if block already exists, free it */
217 if
((n
= find_block
(name
)) >= 0) {
220 /* free all subblocks */
221 for
(n
= 0; n
< b
->n_sblocks
; n
++)
224 /* free the subblock array */
228 GROW
(blocks
, n_blocks
, struct block
);
229 b
= &blocks
[n_blocks
++];
231 b
->name
= strdup
(name
);
238 /* now split in subblocks (delimited by : ) */
241 while
((stop
= strchr
(start
, ':')) != NULL
) {
245 /* add the subblock */
246 GROW
(b
->sblocks
, b
->n_sblocks
, char *);
247 b
->sblocks
[b
->n_sblocks
++] = strdup
(start
);
252 /* no more separators? store the rest */
253 GROW
(b
->sblocks
, b
->n_sblocks
, char *);
254 b
->sblocks
[b
->n_sblocks
++] = strdup
(start
);
256 /* the original block is no longer needed */
263 static void insert_block
(char * name
)
264 /* inserts a block */
268 if
((n
= find_block
(name
)) >= 0) {
273 /* get one of them, randomly */
274 n
= ah_rnd
(&block_seed
) % b
->n_sblocks
;
276 push_code
(strdup
(b
->sblocks
[n
]));
279 c_err
("block-not-found", name
, NULL
);
283 static int insert_file
(char * filename
)
285 if
(!push_code_from_file
(filename
)) {
286 c_err
("script-not-found", filename
, NULL
);
296 static int push_group
(void)
297 /* starts a new group of notes */
301 if
(n_groups
== groups_size
) {
302 GROW
(groups
, groups_size
, struct group
);
306 g
= &groups
[n_groups
++];
316 static int next_group_part
(void)
322 c_err
("missing-start-of-group", NULL
, NULL
);
326 g
= &groups
[n_groups
- 1];
328 /* store maximum frame */
329 if
(g
->max
< cur_time
)
332 /* add glissando delay */
336 cur_time
= g
->start
+ g
->gliss
;
342 static int pop_group
(void)
343 /* finishes a group, moving the frame to the end of the longer part */
346 c_err
("missing-start-of-group", NULL
, NULL
);
352 /* if other parts of group were longer than the last one,
353 move pointer there */
354 if
(groups
[n_groups
].max
> cur_time
)
355 cur_time
= groups
[n_groups
].max
;
363 static int seek_mark
(char * name
)
364 /* seeks a mark by name; returns its offset or -1 */
368 for
(n
= 0; n
< n_marks
; n
++)
369 if
(strcmp
(marks
[n
].name
, name
) == 0)
376 static void add_mark
(char * name
)
377 /* creates a new mark */
381 if
((n
= seek_mark
(name
)) == -1) {
383 GROW
(marks
, n
, struct mark
);
384 marks
[n
].name
= strdup
(name
);
387 marks
[n
].time
= cur_time
;
391 static void find_mark
(char * name
, int set
)
392 /* finds a mark by name, optionally moving time cursor there */
396 if
((n
= seek_mark
(name
)) != -1) {
398 if
(cur_time
> marks
[n
].time
) {
399 /* if mark is not END, fail */
400 if
(strcmp
(name
, "END") != 0)
401 c_err
("mark-overpassed", name
, NULL
);
404 cur_time
= marks
[n
].time
;
407 if
(cur_time
!= marks
[n
].time
)
408 c_err
("mark-mismatch", name
, NULL
);
413 c_err
("mark-not-found", name
, NULL
);
419 static void arp_default
(void)
420 /* resets arpeggiator values to the default ones */
429 static void add_arp
(void)
430 /* adds an arpeggiator note */
434 /* if the note is exactly the same, do nothing */
435 if
(arp_delay
== 0.0 && arp_transpose
== 0 &&
436 arp_volume
== 1.0 && arp_track_off
== 0)
439 if
(n_arps
== arps_size
) {
440 GROW
(arps
, arps_size
, struct arp
);
446 a
->delay
= arp_delay
;
447 a
->transpose
= arp_transpose
;
448 a
->volume
= arp_volume
;
449 a
->track_off
= arp_track_off
;
456 static void set_alteration
(char * altstr
)
457 /* sets the alterations from altstr */
459 int n
, steps
[] = { 2, 0, 2, 0, 1, 2, 0, 2, 0, 2, 0, 1 };
461 /* reset alterations */
462 for
(n
= 0; n
< 12; n
++)
465 /* changed according the altstr spec */
466 for
(n
= 0; *altstr
!= '\0' && n
< 12; altstr
++) {
477 /* move to next natural note */
485 static struct song_ev
* add_song_ev
(song_ev_type type
)
489 /* FIXME: solo tracks don't work */
490 /* if (solo_track != -1 && ev->trk_id >= 0 && ev->trk_id != solo_track)
493 /* FIXME: account number of tracks */
494 /* if (n_song_tracks < ev->trk_id + 1)
495 n_song_tracks = ev->trk_id + 1;
497 r
= add_event
(&song
, &n_song_ev
);
507 static void copy_song_ev
(song_ev_type type
, double time
, struct song_ev
*ev
)
509 /* skip tracks if a solo is requested */
510 if
(solo_track
!= -1 && ev
->trk_id
>= 0 && ev
->trk_id
!= solo_track
)
513 /* account number of tracks */
514 if
(n_song_tracks
< ev
->trk_id
+ 1)
515 n_song_tracks
= ev
->trk_id
+ 1;
519 ev
->event_id
= n_song_ev
;
521 copy_event
(&song
, &n_song_ev
, ev
);
525 static void add_note_event
(int note
)
526 /* adds a note event */
532 /* sum the alteration */
533 if
((n
= note %
12) < 0)
536 note
+= alterations
[n
];
538 /* calculate the note */
539 np
= note
+ transpose
+ (octave
* 12);
541 /* is note out of range? */
542 if
(np
< 0 || np
> 127) {
543 c_err
("note-out-of-range", NULL
, NULL
);
547 e
= add_song_ev
(SONG_EV_NOTE
);
550 e
->len
= length
* staccato
;
553 /* add arpeggiator repetitions */
554 for
(n
= 0; n
< n_arps
; n
++) {
556 e
= add_song_ev
(SONG_EV_NOTE
);
558 e
->time
= cur_time
+ arps
[n
].delay
;
559 e
->trk_id
= track
+ arps
[n
].track_off
;
560 e
->value
= np
+ arps
[n
].transpose
;
561 e
->len
= length
* staccato
;
562 e
->vol
= volume
() * arps
[n
].volume
;
567 static void add_back_event
(void)
569 struct song_ev
*e
= add_song_ev
(SONG_EV_BACK
);
575 static void add_tempo_event
(int trk_id
, double tempo
)
577 struct song_ev
*e
= add_song_ev
(SONG_EV_TEMPO
);
584 static void add_meter_event
(int trk_id
, int num
, int den
)
586 struct song_ev
*e
= add_song_ev
(SONG_EV_METER
);
593 static void add_measure_event
(void)
595 struct song_ev
*e
= add_song_ev
(SONG_EV_MEASURE
);
602 static void add_ss_sustain_event
(double sustain
)
604 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_SUSTAIN
);
610 static void add_ss_attack_event
(double attack
)
612 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_ATTACK
);
618 static void add_ss_vibrato_event
(double depth
, double freq
)
620 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_VIBRATO
);
627 static void add_ss_portamento_event
(double portamento
)
629 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_PORTAMENTO
);
631 e
->amount
= portamento
;
635 static void add_ss_channel_event
(int channel
, float vol
)
637 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_CHANNEL
);
639 e
->channel
= channel
;
644 static void add_ss_wav_event
(char * wav_file
, int base
, int min
, int max
,
645 double loop_start
, double loop_end
, int first_channel
, int skip_channels
)
647 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_WAV
);
653 e
->start
= loop_start
;
655 e
->channel
= first_channel
;
656 e
->skip_channels
= skip_channels
;
660 static void add_ss_pat_event
(char * pat_file
)
662 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_PAT
);
668 static void add_ss_eff_event
(int type
, int channel
, double size
, float gain
,
669 double depth
, double freq
, double phase
, float initial
, float final
)
671 struct song_ev
*e
= add_song_ev
(type
);
673 e
->channel
= channel
;
679 e
->initial
= initial
;
684 static void add_ss_pitch_stretch
(int note
, double len
, float vol
)
686 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_PITCH_STRETCH
);
694 static void add_ss_print_wave_tempo
(int note
, double len
)
696 struct song_ev
*e
= add_song_ev
(SONG_EV_SS_PRINT_WAVE_TEMPO
);
703 static void add_midi_channel_event
(int channel
)
705 struct song_ev
*e
= add_song_ev
(SONG_EV_MIDI_CHANNEL
);
707 e
->channel
= channel
- 1;
711 static void add_midi_program_event
(int program
)
713 struct song_ev
*e
= add_song_ev
(SONG_EV_MIDI_PROGRAM
);
719 static void add_song_info_event
(char * author
, char * name
)
721 struct song_ev
*e
= add_song_ev
(SONG_EV_SONG_INFO
);
728 static void init_track
(void)
729 /* sets the default values for a new track */
733 /* is there an end time? test if this is longer */
734 if
(cur_time
> end_time
) {
743 volume_from
= volume_to
= 0.75;
747 /* groups should not cross track boundaries */
750 /* reset arpeggiator */
754 /* is there a START mark? if so, move there */
755 if
((n
= seek_mark
("START")) != -1)
756 cur_time
= marks
[n
].time
;
758 /* reset alterations */
759 for
(n
= 0; n
< 12; n
++)
772 %token
<i
> P_INTEGER S_INTEGER
773 %token
<d
> P_REAL S_REAL
774 %token
<i
> NOTE_P NOTE_T3 NOTE_T5
775 %token
<p
> NEW_MARK GOTO_MARK ASSERT_MARK
777 %token
<p
> BLOCK BLK_ASSIGN BLK_INSERT FILE_INSERT
782 %token
<i
> XC_ABSNOTE
785 %token SS_SEP SS_WAV SS_LOOP_WAV SS_PAT
786 %token SS_SUSTAIN SS_ATTACK SS_VIBRATO SS_PORTAMENTO SS_CHANNEL SS_VOL
788 %token SS_EFF_DELAY SS_EFF_ECHO SS_EFF_COMB SS_EFF_ALLPASS SS_EFF_FLANGER
789 %token SS_EFF_WOBBLE SS_EFF_SQWOBBLE SS_EFF_HFWOBBLE
790 %token SS_EFF_FADER SS_EFF_REVERB
791 %token SS_EFF_FOLDBACK SS_EFF_ATAN SS_EFF_DISTORT SS_EFF_OVERDRIVE
794 %token SS_PITCH_STRETCH SS_TIME_STRETCH SS_PRINT_WAVE_TEMPO
798 %token MIDI_CHANNEL MIDI_PROGRAM MIDI_GENERIC
800 %type
<i
> integer note note_pitch rest back
801 %type
<d
> real p_number number note_length
803 %type
<d
> arp_list arp_note
832 /* absolute octave */
836 /* relative octave */
840 /* absolute volume */
841 volume_from
= volume_to
= (float)$2;
844 /* absolute volume */
845 volume_from
= volume_to
= (float)$2;
848 /* relative volume */
849 volume_from
+= (float)$2;
850 volume_to
+= (float)$2;
852 |
'v' P_REAL
',' P_REAL
{
853 /* absolute volume ranges */
854 volume_from
= (float)$2;
855 volume_to
= (float)$4;
871 /* group delimiter */
884 /* measure mark event */
909 add_tempo_event
(-1, $2);
911 |
'M' P_INTEGER
'/' P_INTEGER
{
912 /* meter (time signature) setting */
913 add_meter_event
(-1, $2, $4);
916 /* alteration string */
920 | BLOCK
'*' P_INTEGER
{
924 /* store the block as <TMP> */
925 set_block
("<TMP>", $1);
927 for
(n
= 0;n
< $3;n
++)
928 insert_block
("<TMP>");
950 P_INTEGER
{ $$
= $1; }
951 | S_INTEGER
{ $$
= $1; }
956 | S_REAL
{ $$
= $1; }
960 P_INTEGER
{ $$
= (double) $1; }
961 | P_REAL
{ $$
= $1; }
965 integer
{ $$
= (double) $1; }
970 note_pitch
{ $$
= $1; }
971 | note note_length
{ $$
= $1; length
=$2; }
972 | note
'~' number
{ $$
= $1; DEBUGF
("imm volume: %lf\n", $3); }
977 | note_pitch
'&' { $$
= $1 - 1; }
978 | note_pitch
'#' { $$
= $1 + 1; }
979 | note_pitch
'\'' { $$
= $1 + 12; }
980 | note_pitch
',' { $$
= $1 - 12; }
984 P_INTEGER
{ $$
= 1 / (double) $1; }
985 | note_length NOTE_T3
{ $$
= $1 * 2.0 / 3.0; }
986 | note_length NOTE_T5
{ $$
= $1 * 4.0 / 5.0; }
987 | note_length
'*' p_number
{ $$
= $1 * $3; }
988 | note_length
'.' { $$
= $1 * 1.5; }
994 /* rest with length */
1001 | back note_length
{
1002 /* back with length */
1009 /* empty arpeggiator */
1013 |
'x' arp_list
{ ; }
1018 /* first arpeggiator note */
1022 | arp_list
',' arp_note
{
1023 /* rest of arpeggiator notes */
1030 /* arpeggiator delay */
1033 | arp_note
'~' number
{
1034 /* arpeggiator volume */
1035 arp_volume
= (float)$3;
1037 | arp_note S_INTEGER
{
1038 /* arpeggiator transpose */
1041 | arp_note
'/' P_INTEGER
{
1042 /* arpeggiator track offset */
1045 | arp_note NOTE_T3
{
1049 | arp_note NOTE_T5
{
1056 P_INTEGER
{ $$
= $1; }
1057 | XC_ABSNOTE
{ $$
= $1; }
1061 SS_WAV XC_STR xc_absnote
{
1062 /* load .wav file with just one note */
1063 add_ss_wav_event
($2, $3, $3, $3, -1.0, -1.0, 0, 0);
1065 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote
{
1066 /* load .wav file */
1067 add_ss_wav_event
($2, $3, $4, $5, -1.0, -1.0, 0, 0);
1069 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote number number
{
1070 /* load .wav file, with loop boundaries */
1071 add_ss_wav_event
($2, $3, $4, $5, $6, $7, 0, 0);
1073 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote number number number number
{
1074 /* load .wav file, with loop boundaries,
1075 first channel and skip channels */
1076 add_ss_wav_event
($2, $3, $4, $5, $6, $7, $8, $9);
1079 /* load .pat file */
1080 add_ss_pat_event
($2);
1082 | SS_SUSTAIN XC_MSECS
{
1084 add_ss_sustain_event
($2);
1086 | SS_ATTACK XC_MSECS
{
1088 add_ss_attack_event
($2);
1090 | SS_VIBRATO XC_MSECS number
{
1092 add_ss_vibrato_event
($2, $3);
1094 | SS_PORTAMENTO number
{
1095 /* sets portamento */
1096 add_ss_portamento_event
($2);
1098 | SS_CHANNEL integer number
{
1099 /* sets volume for a channel */
1100 add_ss_channel_event
($2, $3);
1102 | SS_VOL number number
{
1103 /* set vol for 2 channels */
1104 add_ss_channel_event
(0, $2);
1105 add_ss_channel_event
(1, $3);
1107 | SS_VOL number number number
{
1108 /* set vol for 3 channels */
1109 add_ss_channel_event
(0, $2);
1110 add_ss_channel_event
(1, $3);
1111 add_ss_channel_event
(2, $4);
1113 | SS_VOL number number number number
{
1114 /* set vol for 4 channels */
1115 add_ss_channel_event
(0, $2);
1116 add_ss_channel_event
(1, $3);
1117 add_ss_channel_event
(2, $4);
1118 add_ss_channel_event
(3, $5);
1120 | SS_VOL number number number number number number
{
1121 /* set vol for 6 channels */
1122 add_ss_channel_event
(0, $2);
1123 add_ss_channel_event
(1, $3);
1124 add_ss_channel_event
(2, $4);
1125 add_ss_channel_event
(3, $5);
1126 add_ss_channel_event
(4, $6);
1127 add_ss_channel_event
(5, $7);
1129 | SS_EFF_DELAY integer XC_MSECS
{
1131 add_ss_eff_event
(SONG_EV_SS_EFF_DELAY
,
1132 $2, $3, 0, 0, 0, 0, 0, 0);
1135 | SS_EFF_ECHO integer XC_MSECS number
{
1137 add_ss_eff_event
(SONG_EV_SS_EFF_ECHO
,
1138 $2, $3, $4, 0, 0, 0, 0, 0);
1141 | SS_EFF_COMB integer XC_MSECS number
{
1143 add_ss_eff_event
(SONG_EV_SS_EFF_COMB
,
1144 $2, $3, $4, 0, 0, 0, 0, 0);
1147 | SS_EFF_ALLPASS integer XC_MSECS number
{
1148 /* allpass effect */
1149 add_ss_eff_event
(SONG_EV_SS_EFF_ALLPASS
,
1150 $2, $3, $4, 0, 0, 0, 0, 0);
1153 | SS_EFF_FLANGER integer XC_MSECS number XC_MSECS number number
{
1154 /* flanger effect */
1155 add_ss_eff_event
(SONG_EV_SS_EFF_FLANGER
,
1156 $2, $3, $4, $5, $6, $7, 0, 0);
1159 | SS_EFF_WOBBLE integer number number
{
1161 add_ss_eff_event
(SONG_EV_SS_EFF_WOBBLE
,
1162 $2, 0, 0.8, 0, $3, $4, 0, 0);
1165 | SS_EFF_WOBBLE integer number number number
{
1166 /* wobble effect, with gain */
1167 add_ss_eff_event
(SONG_EV_SS_EFF_WOBBLE
,
1168 $2, 0, $5, 0, $3, $4, 0, 0);
1171 | SS_EFF_SQWOBBLE integer number number
{
1172 /* square wobble effect */
1173 add_ss_eff_event
(SONG_EV_SS_EFF_SQWOBBLE
,
1174 $2, 0, 0, 0, $3, $4, 0, 0);
1177 | SS_EFF_HFWOBBLE integer number number
{
1178 /* half wobble effect */
1179 add_ss_eff_event
(SONG_EV_SS_EFF_HFWOBBLE
,
1180 $2, 0, 0, 0, $3, $4, 0, 0);
1183 | SS_EFF_FADER integer XC_MSECS number number
{
1185 add_ss_eff_event
(SONG_EV_SS_EFF_FADER
,
1186 $2, $3, 0, 0, 0, 0, $4, $5);
1189 | SS_EFF_REVERB integer
{
1191 add_ss_eff_event
(SONG_EV_SS_EFF_REVERB
,
1192 $2, 0, 0, 0, 0, 0, 0, 0);
1195 | SS_EFF_FOLDBACK integer number
{
1196 /* foldback distortion effect */
1197 add_ss_eff_event
(SONG_EV_SS_EFF_FOLDBACK
,
1198 $2, 0, $3, 0, 0, 0, 0, 0);
1200 | SS_EFF_ATAN integer number
{
1201 /* atan distortion effect */
1202 add_ss_eff_event
(SONG_EV_SS_EFF_ATAN
,
1203 $2, 0, $3, 0, 0, 0, 0, 0);
1205 | SS_EFF_DISTORT integer number
{
1206 /* distort distortion effect */
1207 add_ss_eff_event
(SONG_EV_SS_EFF_DISTORT
,
1208 $2, 0, $3, 0, 0, 0, 0, 0);
1210 | SS_EFF_OVERDRIVE integer number
{
1211 /* overdrive distortion effect */
1212 add_ss_eff_event
(SONG_EV_SS_EFF_OVERDRIVE
,
1213 $2, 0, $3, 0, 0, 0, 0, 0);
1216 | SS_EFF_OFF integer
{
1218 add_ss_eff_event
(SONG_EV_SS_EFF_OFF
,
1219 $2, 0, 0, 0, 0, 0, 0, 0);
1222 | SS_PITCH_STRETCH xc_absnote number number
{
1223 /* pitch stretch note */
1224 add_ss_pitch_stretch
($2, $3, $4);
1229 | SS_PRINT_WAVE_TEMPO xc_absnote number
{
1230 /* print tempo from wave */
1231 add_ss_print_wave_tempo
($2, $3);
1234 | SONG_INFO XC_STR XC_STR
{
1236 add_song_info_event
($2, $3);
1239 | MIDI_CHANNEL integer
{
1241 add_midi_channel_event
($2);
1244 | MIDI_PROGRAM integer
{
1246 add_midi_program_event
($2);
1252 void yyerror(char * s
)
1254 c_err
(s
, NULL
, NULL
);
1258 #define set_block_d(n,b) set_block(n,strdup(b))
1260 static void compile_startup
(void)
1266 /* default settings */
1267 add_tempo_event
(-2, 120.0);
1268 add_meter_event
(-2, 4, 4);
1271 /* standard tonalities */
1272 set_block_d
("CM", "A"); set_block_d
("Am", "$CM");
1273 set_block_d
("C#M", "A#######"); set_block_d
("A#m", "$C#M");
1274 set_block_d
("DM", "A#--#---"); set_block_d
("Bm", "$DM");
1275 set_block_d
("E&M", "A--&--&&"); set_block_d
("Cm", "$E&M");
1276 set_block_d
("EM", "A##-##--"); set_block_d
("C#m", "$EM");
1277 set_block_d
("FM", "A------&"); set_block_d
("Dm", "$FM");
1278 set_block_d
("F#M", "A######-"); set_block_d
("D#m", "$F#M");
1279 set_block_d
("GM", "A---#---"); set_block_d
("Em", "$GM");
1280 set_block_d
("A&M", "A-&&--&&"); set_block_d
("Fm", "$A&M");
1281 set_block_d
("AM", "A#--##--"); set_block_d
("F#m", "$AM");
1282 set_block_d
("B&M", "A--&---&"); set_block_d
("Gm", "$B&M");
1283 set_block_d
("BM", "A##-###-"); set_block_d
("G#m", "$BM");
1287 static int do_parse
(void)
1291 return r
+ compiler_error
;
1295 int compile_ahs_string
(char * code
)
1299 push_code
(strdup
(code
));
1305 int compile_ahs
(char * file
)
1309 if
(insert_file
(file
))