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
;
64 /* parser debugging */
66 #define DEBUGF if(verbose >= 2)printf
77 static struct block
* blocks
= NULL
;
78 static int n_blocks
= 0;
88 static struct group
* groups
= NULL
;
89 static int n_groups
= 0;
90 static int groups_size
= 0;
99 static struct mark
* marks
= NULL
;
100 static int n_marks
= 0;
111 static struct arp
* arps
= NULL
;
112 static int n_arps
= 0;
113 static int arps_size
= 0;
115 static double arp_delay
;
116 static int arp_transpose
;
117 static float arp_volume
;
118 static int arp_track_off
;
120 int compiler_error
= 0;
124 /* alterations for each note */
128 unsigned long block_seed
= 0;
132 ********************/
134 unsigned long ah_rnd
(unsigned long * seed
)
135 /* special randomizer */
137 *seed
= (*seed
* 58321) + 11113;
143 void c_err
(char * e1
, char * e2
, char * e3
)
144 /* reports an error from the compiler */
147 if
(e1
!= NULL
) printf
(" %s", e1
);
148 if
(e2
!= NULL
) printf
(" %s", e2
);
149 if
(e3
!= NULL
) printf
(" %s", e3
);
150 printf
(" in line %d\n", yyline
);
156 static void forward
(double step
)
157 /* moves forward current time */
162 /* quantizations could be done here */
168 static int find_block
(char * name
)
173 for
(n
= 0;n
< n_blocks
;n
++)
175 if
(strcmp
(name
, blocks
[n
].name
) == 0)
183 static int set_block
(char * name
, char * block
)
184 /* defines a block */
191 /* if block already exists, free it */
192 if
((n
= find_block
(name
)) >= 0)
196 /* free all subblocks */
197 for
(n
= 0;n
< b
->n_sblocks
;n
++)
200 /* free the subblock array */
205 GROW
(blocks
, n_blocks
, struct block
);
206 b
= &blocks
[n_blocks
++];
208 b
->name
= strdup
(name
);
215 /* now split in subblocks (delimited by : ) */
218 while
((stop
= strchr
(start
, ':')) != NULL
)
223 /* add the subblock */
224 GROW
(b
->sblocks
, b
->n_sblocks
, char *);
225 b
->sblocks
[b
->n_sblocks
++] = strdup
(start
);
230 /* no more separators? store the rest */
231 GROW
(b
->sblocks
, b
->n_sblocks
, char *);
232 b
->sblocks
[b
->n_sblocks
++] = strdup
(start
);
234 /* the original block is no longer needed */
241 static void insert_block
(char * name
)
242 /* inserts a block */
246 if
((n
= find_block
(name
)) >= 0)
252 /* get one of them, randomly */
253 n
= ah_rnd
(&block_seed
) % b
->n_sblocks
;
255 push_code
(strdup
(b
->sblocks
[n
]));
258 c_err
("block-not-found", name
, NULL
);
262 static int insert_file
(char * filename
)
264 if
(!push_code_from_file
(filename
))
266 c_err
("script-not-found", filename
, NULL
);
276 static int push_group
(void)
277 /* starts a new group of notes */
281 if
(n_groups
== groups_size
)
283 GROW
(groups
, groups_size
, struct group
);
287 g
= &groups
[n_groups
++];
297 static int next_group_part
(void)
304 c_err
("missing-start-of-group", NULL
, NULL
);
308 g
= &groups
[n_groups
- 1];
310 /* store maximum frame */
311 if
(g
->max
< cur_time
)
314 /* add glissando delay */
318 cur_time
= g
->start
+ g
->gliss
;
324 static int pop_group
(void)
325 /* finishes a group, moving the frame to the end of the longer part */
329 c_err
("missing-start-of-group", NULL
, NULL
);
335 /* if other parts of group were longer than the last one,
336 move pointer there */
337 if
(groups
[n_groups
].max
> cur_time
)
338 cur_time
= groups
[n_groups
].max
;
346 static int seek_mark
(char * name
)
347 /* seeks a mark by name; returns its offset or -1 */
351 for
(n
= 0;n
< n_marks
;n
++)
352 if
(strcmp
(marks
[n
].name
, name
) == 0)
359 static void add_mark
(char * name
)
360 /* creates a new mark */
364 if
((n
= seek_mark
(name
)) == -1)
367 GROW
(marks
, n
, struct mark
);
368 marks
[n
].name
= strdup
(name
);
371 marks
[n
].time
= cur_time
;
375 static void find_mark
(char * name
, int set
)
376 /* finds a mark by name, optionally moving time cursor there */
380 if
((n
= seek_mark
(name
)) != -1)
384 if
(cur_time
> marks
[n
].time
)
386 /* if mark is not END, fail */
387 if
(strcmp
(name
, "END") != 0)
388 c_err
("mark-overpassed", name
, NULL
);
391 cur_time
= marks
[n
].time
;
394 if
(cur_time
!= marks
[n
].time
)
395 c_err
("mark-mismatch", name
, NULL
);
400 c_err
("mark-not-found", name
, NULL
);
406 static void arp_default
(void)
407 /* resets arpeggiator values to the default ones */
416 static void add_arp
(void)
417 /* adds an arpeggiator note */
421 /* if the note is exactly the same, do nothing */
422 if
(arp_delay
== 0.0 && arp_transpose
== 0 &&
423 arp_volume
== 1.0 && arp_track_off
== 0)
426 if
(n_arps
== arps_size
)
428 GROW
(arps
, arps_size
, struct arp
);
434 a
->delay
= arp_delay
;
435 a
->transpose
= arp_transpose
;
436 a
->volume
= arp_volume
;
437 a
->track_off
= arp_track_off
;
444 static void set_alteration
(char * altstr
)
445 /* sets the alterations from altstr */
447 int n
, steps
[] = { 2, 0, 2, 0, 1, 2, 0, 2, 0, 2, 0, 1 };
449 /* reset alterations */
450 for
(n
= 0;n
< 12;n
++) alterations
[n
] = 0;
452 /* changed according the altstr spec */
453 for
(n
= 0;*altstr
!= '\0' && n
< 12;altstr
++)
457 case
'&': alterations
[n
] = -1; break
;
458 case
'#': alterations
[n
] = 1; break
;
461 /* move to next natural note */
469 static void add_note_event
(int note
)
470 /* adds a note event */
476 /* sum the alteration */
477 if
((n
= note %
12) < 0) n
+= 12;
478 note
+= alterations
[n
];
480 /* calculate the note */
481 np
= note
+ transpose
+ (octave
* 12);
483 /* is note out of range? */
484 if
(np
< 0 || np
> 127)
486 c_err
("note-out-of-range", NULL
, NULL
);
490 e.note.trk_id
= track
;
492 e.note.len
= length
* staccato
;
495 add_song_ev
(SONG_EV_NOTE
, cur_time
, &e
);
497 /* add arpeggiator repetitions */
498 for
(n
= 0;n
< n_arps
;n
++)
500 e.note.trk_id
= track
+ arps
[n
].track_off
;
501 e.note.note
= np
+ arps
[n
].transpose
;
502 e.note.vol
= volume
* arps
[n
].volume
;
504 add_song_ev
(SONG_EV_NOTE
, cur_time
+ arps
[n
].delay
, &e
);
509 static void add_back_event
(void)
513 e.back.trk_id
= track
;
515 add_song_ev
(SONG_EV_BACK
, cur_time
, &e
);
519 static void add_tempo_event
(int trk_id
, double tempo
)
523 e.tempo.trk_id
= trk_id
;
524 e.tempo.tempo
= tempo
;
525 add_song_ev
(SONG_EV_TEMPO
, cur_time
, &e
);
529 static void add_meter_event
(int trk_id
, int num
, int den
)
533 e.meter.trk_id
= trk_id
;
536 add_song_ev
(SONG_EV_METER
, cur_time
, &e
);
539 static void add_measure_event
(void)
543 e.measure.trk_id
= -1;
544 e.measure.line
= yyline
;
546 add_song_ev
(SONG_EV_MEASURE
, cur_time
, &e
);
550 static void add_ss_sustain_event
(double sustain
)
554 e.ss_sustain.trk_id
= track
;
555 e.ss_sustain.sustain
= sustain
;
557 add_song_ev
(SONG_EV_SS_SUSTAIN
, cur_time
, &e
);
561 static void add_ss_attack_event
(double attack
)
565 e.ss_attack.trk_id
= track
;
566 e.ss_attack.attack
= attack
;
568 add_song_ev
(SONG_EV_SS_ATTACK
, cur_time
, &e
);
572 static void add_ss_vibrato_event
(double depth
, double freq
)
576 e.ss_vibrato.trk_id
= track
;
577 e.ss_vibrato.vib_depth
= depth
;
578 e.ss_vibrato.vib_freq
= freq
;
580 add_song_ev
(SONG_EV_SS_VIBRATO
, cur_time
, &e
);
584 static void add_ss_portamento_event
(double portamento
)
588 e.ss_portamento.trk_id
= track
;
589 e.ss_portamento.portamento
= portamento
;
591 add_song_ev
(SONG_EV_SS_PORTAMENTO
, cur_time
, &e
);
595 static void add_ss_channel_event
(int channel
, float vol
)
599 e.ss_channel.trk_id
= track
;
600 e.ss_channel.channel
= channel
;
601 e.ss_channel.vol
= vol
;
603 add_song_ev
(SONG_EV_SS_CHANNEL
, cur_time
, &e
);
607 static void add_ss_wav_event
(char * wav_file
, int base
, int min
, int max
,
608 double loop_start
, double loop_end
, int first_channel
, int skip_channels
)
612 e.ss_wav.trk_id
= track
;
613 e.ss_wav.file
= wav_file
;
614 e.ss_wav.base
= base
;
617 e.ss_wav.loop_start
= loop_start
;
618 e.ss_wav.loop_end
= loop_end
;
619 e.ss_wav.first_channel
= first_channel
;
620 e.ss_wav.skip_channels
= skip_channels
;
622 add_song_ev
(SONG_EV_SS_WAV
, cur_time
, &e
);
626 static void add_ss_pat_event
(char * pat_file
)
630 e.ss_pat.trk_id
= track
;
631 e.ss_pat.file
= pat_file
;
633 add_song_ev
(SONG_EV_SS_PAT
, cur_time
, &e
);
637 static void add_ss_eff_event
(int type
, int channel
, double size
, float gain
,
638 double depth
, double freq
, double phase
, float initial
, float final
)
642 e.ss_eff.trk_id
= track
;
643 e.ss_eff.channel
= channel
;
644 e.ss_eff.size
= size
;
645 e.ss_eff.gain
= gain
;
646 e.ss_eff.depth
= depth
;
647 e.ss_eff.freq
= freq
;
648 e.ss_eff.phase
= phase
;
649 e.ss_eff.initial
= initial
;
650 e.ss_eff.final
= final
;
652 add_song_ev
(type
, cur_time
, &e
);
656 static void add_ss_pitch_stretch
(int note
, double len
, float vol
)
660 e.ss_pitch_stretch.trk_id
= track
;
661 e.ss_pitch_stretch.note
= note
;
662 e.ss_pitch_stretch.len
= len
;
663 e.ss_pitch_stretch.vol
= vol
;
665 add_song_ev
(SONG_EV_SS_PITCH_STRETCH
, cur_time
, &e
);
669 static void add_ss_print_wave_tempo
(int note
, double len
)
673 e.ss_print_wave_tempo.trk_id
= track
;
674 e.ss_print_wave_tempo.note
= note
;
675 e.ss_print_wave_tempo.len
= len
;
677 add_song_ev
(SONG_EV_SS_PRINT_WAVE_TEMPO
, cur_time
, &e
);
681 static void add_midi_channel_event
(int channel
)
685 e.midi_channel.trk_id
= track
;
686 e.midi_channel.channel
= channel
- 1;
688 add_song_ev
(SONG_EV_MIDI_CHANNEL
, cur_time
, &e
);
692 static void add_midi_program_event
(int program
)
696 e.midi_program.trk_id
= track
;
697 e.midi_program.program
= program
;
699 add_song_ev
(SONG_EV_MIDI_PROGRAM
, cur_time
, &e
);
703 static void add_song_info_event
(char * author
, char * name
)
707 e.song_info.trk_id
= track
;
708 e.song_info.author
= author
;
709 e.song_info.name
= name
;
711 add_song_ev
(SONG_EV_SONG_INFO
, cur_time
, &e
);
715 static void init_track
(void)
716 /* sets the default values for a new track */
720 /* is there an end time? test if this is longer */
721 if
(cur_time
> end_time
)
735 /* groups should not cross track boundaries */
738 /* reset arpeggiator */
742 /* is there a START mark? if so, move there */
743 if
((n
= seek_mark
("START")) != -1)
744 cur_time
= marks
[n
].time
;
746 /* reset alterations */
747 for
(n
= 0;n
< 12;n
++)
760 %token
<i
> P_INTEGER S_INTEGER
761 %token
<d
> P_REAL S_REAL
762 %token
<i
> NOTE_P NOTE_T3 NOTE_T5
763 %token
<p
> NEW_MARK GOTO_MARK ASSERT_MARK
765 %token
<p
> BLOCK BLK_ASSIGN BLK_INSERT FILE_INSERT
770 %token
<i
> XC_ABSNOTE
773 %token SS_SEP SS_WAV SS_LOOP_WAV SS_PAT
774 %token SS_SUSTAIN SS_ATTACK SS_VIBRATO SS_PORTAMENTO SS_CHANNEL SS_VOL
776 %token SS_EFF_DELAY SS_EFF_ECHO SS_EFF_COMB SS_EFF_ALLPASS SS_EFF_FLANGER
777 %token SS_EFF_WOBBLE SS_EFF_SQWOBBLE SS_EFF_HFWOBBLE
778 %token SS_EFF_FADER SS_EFF_REVERB
779 %token SS_EFF_FOLDBACK SS_EFF_ATAN SS_EFF_DISTORT SS_EFF_OVERDRIVE
782 %token SS_PITCH_STRETCH SS_TIME_STRETCH SS_PRINT_WAVE_TEMPO
786 %token MIDI_CHANNEL MIDI_PROGRAM MIDI_GENERIC
788 %type
<i
> integer note note_pitch rest back
789 %type
<d
> real p_number number note_length
791 %type
<d
> arp_list arp_note
820 /* absolute octave */
824 /* relative octave */
828 /* absolute volume */
832 /* absolute volume */
836 /* relative volume */
853 /* group delimiter */
866 /* measure mark event */
891 add_tempo_event
(-1, $2);
893 |
'M' P_INTEGER
'/' P_INTEGER
{
894 /* meter (time signature) setting */
895 add_meter_event
(-1, $2, $4);
898 /* alteration string */
902 | BLOCK
'*' P_INTEGER
{
906 /* store the block as <TMP> */
907 set_block
("<TMP>", $1);
909 for
(n
= 0;n
< $3;n
++)
910 insert_block
("<TMP>");
932 P_INTEGER
{ $$
= $1; }
933 | S_INTEGER
{ $$
= $1; }
938 | S_REAL
{ $$
= $1; }
942 P_INTEGER
{ $$
= (double) $1; }
943 | P_REAL
{ $$
= $1; }
947 integer
{ $$
= (double) $1; }
952 note_pitch
{ $$
= $1; }
953 | note note_length
{ $$
= $1; length
=$2; }
954 | note
'~' number
{ $$
= $1; DEBUGF
("imm volume: %lf\n", $3); }
959 | note_pitch
'&' { $$
= $1 - 1; }
960 | note_pitch
'#' { $$
= $1 + 1; }
961 | note_pitch
'\'' { $$
= $1 + 12; }
962 | note_pitch
',' { $$
= $1 - 12; }
966 P_INTEGER
{ $$
= 1 / (double) $1; }
967 | note_length NOTE_T3
{ $$
= $1 * 2.0 / 3.0; }
968 | note_length NOTE_T5
{ $$
= $1 * 4.0 / 5.0; }
969 | note_length
'*' p_number
{ $$
= $1 * $3; }
970 | note_length
'.' { $$
= $1 * 1.5; }
976 /* rest with length */
984 /* back with length */
991 /* empty arpeggiator */
1000 /* first arpeggiator note */
1004 | arp_list
',' arp_note
{
1005 /* rest of arpeggiator notes */
1012 /* arpeggiator delay */
1015 | arp_note
'~' number
{
1016 /* arpeggiator volume */
1017 arp_volume
= (float)$3;
1019 | arp_note S_INTEGER
{
1020 /* arpeggiator transpose */
1023 | arp_note
'/' P_INTEGER
{
1024 /* arpeggiator track offset */
1027 | arp_note NOTE_T3
{
1031 | arp_note NOTE_T5
{
1038 P_INTEGER
{ $$
= $1; }
1039 | XC_ABSNOTE
{ $$
= $1; }
1043 SS_WAV XC_STR xc_absnote
{
1044 /* load .wav file with just one note */
1045 add_ss_wav_event
($2, $3, $3, $3, -1.0, -1.0, 0, 0);
1047 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote
{
1048 /* load .wav file */
1049 add_ss_wav_event
($2, $3, $4, $5, -1.0, -1.0, 0, 0);
1051 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote number number
{
1052 /* load .wav file, with loop boundaries */
1053 add_ss_wav_event
($2, $3, $4, $5, $6, $7, 0, 0);
1055 | SS_WAV XC_STR xc_absnote xc_absnote xc_absnote number number number number
{
1056 /* load .wav file, with loop boundaries,
1057 first channel and skip channels */
1058 add_ss_wav_event
($2, $3, $4, $5, $6, $7, $8, $9);
1061 /* load .pat file */
1062 add_ss_pat_event
($2);
1064 | SS_SUSTAIN XC_MSECS
{
1066 add_ss_sustain_event
($2);
1068 | SS_ATTACK XC_MSECS
{
1070 add_ss_attack_event
($2);
1072 | SS_VIBRATO XC_MSECS number
{
1074 add_ss_vibrato_event
($2, $3);
1076 | SS_PORTAMENTO number
{
1077 /* sets portamento */
1078 add_ss_portamento_event
($2);
1080 | SS_CHANNEL integer number
{
1081 /* sets volume for a channel */
1082 add_ss_channel_event
($2, $3);
1084 | SS_VOL number number
{
1085 /* set vol for 2 channels */
1086 add_ss_channel_event
(0, $2);
1087 add_ss_channel_event
(1, $3);
1089 | SS_VOL number number number
{
1090 /* set vol for 3 channels */
1091 add_ss_channel_event
(0, $2);
1092 add_ss_channel_event
(1, $3);
1093 add_ss_channel_event
(2, $4);
1095 | SS_VOL number number number number
{
1096 /* set vol for 4 channels */
1097 add_ss_channel_event
(0, $2);
1098 add_ss_channel_event
(1, $3);
1099 add_ss_channel_event
(2, $4);
1100 add_ss_channel_event
(3, $5);
1102 | SS_VOL number number number number number number
{
1103 /* set vol for 6 channels */
1104 add_ss_channel_event
(0, $2);
1105 add_ss_channel_event
(1, $3);
1106 add_ss_channel_event
(2, $4);
1107 add_ss_channel_event
(3, $5);
1108 add_ss_channel_event
(4, $6);
1109 add_ss_channel_event
(5, $7);
1111 | SS_EFF_DELAY integer XC_MSECS
{
1113 add_ss_eff_event
(SONG_EV_SS_EFF_DELAY
,
1114 $2, $3, 0, 0, 0, 0, 0, 0);
1117 | SS_EFF_ECHO integer XC_MSECS number
{
1119 add_ss_eff_event
(SONG_EV_SS_EFF_ECHO
,
1120 $2, $3, $4, 0, 0, 0, 0, 0);
1123 | SS_EFF_COMB integer XC_MSECS number
{
1125 add_ss_eff_event
(SONG_EV_SS_EFF_COMB
,
1126 $2, $3, $4, 0, 0, 0, 0, 0);
1129 | SS_EFF_ALLPASS integer XC_MSECS number
{
1130 /* allpass effect */
1131 add_ss_eff_event
(SONG_EV_SS_EFF_ALLPASS
,
1132 $2, $3, $4, 0, 0, 0, 0, 0);
1135 | SS_EFF_FLANGER integer XC_MSECS number XC_MSECS number number
{
1136 /* flanger effect */
1137 add_ss_eff_event
(SONG_EV_SS_EFF_FLANGER
,
1138 $2, $3, $4, $5, $6, $7, 0, 0);
1141 | SS_EFF_WOBBLE integer number number
{
1143 add_ss_eff_event
(SONG_EV_SS_EFF_WOBBLE
,
1144 $2, 0, 0.8, 0, $3, $4, 0, 0);
1147 | SS_EFF_WOBBLE integer number number number
{
1148 /* wobble effect, with gain */
1149 add_ss_eff_event
(SONG_EV_SS_EFF_WOBBLE
,
1150 $2, 0, $5, 0, $3, $4, 0, 0);
1153 | SS_EFF_SQWOBBLE integer number number
{
1154 /* square wobble effect */
1155 add_ss_eff_event
(SONG_EV_SS_EFF_SQWOBBLE
,
1156 $2, 0, 0, 0, $3, $4, 0, 0);
1159 | SS_EFF_HFWOBBLE integer number number
{
1160 /* half wobble effect */
1161 add_ss_eff_event
(SONG_EV_SS_EFF_HFWOBBLE
,
1162 $2, 0, 0, 0, $3, $4, 0, 0);
1165 | SS_EFF_FADER integer XC_MSECS number number
{
1167 add_ss_eff_event
(SONG_EV_SS_EFF_FADER
,
1168 $2, $3, 0, 0, 0, 0, $4, $5);
1171 | SS_EFF_REVERB integer
{
1173 add_ss_eff_event
(SONG_EV_SS_EFF_REVERB
,
1174 $2, 0, 0, 0, 0, 0, 0, 0);
1177 | SS_EFF_FOLDBACK integer number
{
1178 /* foldback distortion effect */
1179 add_ss_eff_event
(SONG_EV_SS_EFF_FOLDBACK
,
1180 $2, 0, $3, 0, 0, 0, 0, 0);
1182 | SS_EFF_ATAN integer number
{
1183 /* atan distortion effect */
1184 add_ss_eff_event
(SONG_EV_SS_EFF_ATAN
,
1185 $2, 0, $3, 0, 0, 0, 0, 0);
1187 | SS_EFF_DISTORT integer number
{
1188 /* distort distortion effect */
1189 add_ss_eff_event
(SONG_EV_SS_EFF_DISTORT
,
1190 $2, 0, $3, 0, 0, 0, 0, 0);
1192 | SS_EFF_OVERDRIVE integer number
{
1193 /* overdrive distortion effect */
1194 add_ss_eff_event
(SONG_EV_SS_EFF_OVERDRIVE
,
1195 $2, 0, $3, 0, 0, 0, 0, 0);
1198 | SS_EFF_OFF integer
{
1200 add_ss_eff_event
(SONG_EV_SS_EFF_OFF
,
1201 $2, 0, 0, 0, 0, 0, 0, 0);
1204 | SS_PITCH_STRETCH xc_absnote number number
{
1205 /* pitch stretch note */
1206 add_ss_pitch_stretch
($2, $3, $4);
1211 | SS_PRINT_WAVE_TEMPO xc_absnote number
{
1212 /* print tempo from wave */
1213 add_ss_print_wave_tempo
($2, $3);
1216 | SONG_INFO XC_STR XC_STR
{
1218 add_song_info_event
($2, $3);
1221 | MIDI_CHANNEL integer
{
1223 add_midi_channel_event
($2);
1226 | MIDI_PROGRAM integer
{
1228 add_midi_program_event
($2);
1234 void yyerror(char * s
)
1236 c_err
(s
, NULL
, NULL
);
1240 #define set_block_d(n,b) set_block(n,strdup(b))
1242 static void compile_startup
(void)
1248 /* default settings */
1249 add_tempo_event
(-2, 120.0);
1250 add_meter_event
(-2, 4, 4);
1253 /* standard tonalities */
1254 set_block_d
("CM", "A"); set_block_d
("Am", "$CM");
1255 set_block_d
("C#M", "A#######"); set_block_d
("A#m", "$C#M");
1256 set_block_d
("DM", "A#--#---"); set_block_d
("Bm", "$DM");
1257 set_block_d
("E&M", "A--&--&&"); set_block_d
("Cm", "$E&M");
1258 set_block_d
("EM", "A##-##--"); set_block_d
("C#m", "$EM");
1259 set_block_d
("FM", "A------&"); set_block_d
("Dm", "$FM");
1260 set_block_d
("F#M", "A######-"); set_block_d
("D#m", "$F#M");
1261 set_block_d
("GM", "A---#---"); set_block_d
("Em", "$GM");
1262 set_block_d
("A&M", "A-&&--&&"); set_block_d
("Fm", "$A&M");
1263 set_block_d
("AM", "A#--##--"); set_block_d
("F#m", "$AM");
1264 set_block_d
("B&M", "A--&---&"); set_block_d
("Gm", "$B&M");
1265 set_block_d
("BM", "A##-###-"); set_block_d
("G#m", "$BM");
1269 static int do_parse
(void)
1273 return
(r
+ compiler_error
);
1277 int compile_ahs_string
(char * code
)
1281 push_code
(strdup
(code
));
1287 int compile_ahs
(char * file
)
1291 if
(insert_file
(file
))