1
2 /*
3 # Sfront, a SAOL to C translator
4 # This file: Contains main()
5 #
6 # Copyright (c) 1999-2006, Regents of the University of California
7 # All rights reserved.
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions are
11 # met:
12 #
13 # Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 #
16 # Redistributions in binary form must reproduce the above copyright
17 # notice, this list of conditions and the following disclaimer in the
18 # documentation and/or other materials provided with the distribution.
19 #
20 # Neither the name of the University of California, Berkeley nor the
21 # names of its contributors may be used to endorse or promote products
22 # derived from this software without specific prior written permission.
23 #
24 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #
36 # Maintainer: John Lazzaro, lazzaro@cs.berkeley.edu
37 */
38
39
40 #include "tree.h"
41 #include "parser.tab.h"
42
43 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
44 /* welcome to the sfront source tree. we begin with externs */
45 /* for all of the functions called by main(), and then main */
46 /* itself. the remainder of this file is the command line */
47 /* parsing part of sfront. the guidance comments, like this */
48 /* one will be surronded with ~~~ and ___ instead of ***. */
49 /*______________________________________________________________*/
50
51
52 extern void sfrontinitialize(int, char **);
53 extern void commandlineargs(int, char **);
54 extern void sfrontshutdown(void);
55
56 /****************************************************************/
57 /* main() for sfront */
58 /****************************************************************/
59
main(int argc,char ** argv)60 int main(int argc, char ** argv)
61
62 {
63
64 /*~~~~~~~~~~~~~~~*/
65 /* part 1: setup */
66 /*_______________*/
67
68 /* initialize sfront */
69
70 sfrontinitialize(argc, argv); /* sfmain.c */
71 commandlineargs(argc, argv); /* sfmain.c */
72
73 /* read parts of mp4 file */
74
75 if (saolfilelist == NULL)
76 {
77 readsampleset(); /* mp4read.c */
78 if (orcoutfile || scooutfile || csasl)
79 readsymboltable(); /* mp4read.c */
80 }
81
82 /* write diagnostic SAOL file */
83
84 if (orcoutfile)
85 ascsaolwrite(); /* ascwrite.c */
86
87
88 /*~~~~~~~~~~~~~~~~~~~*/
89 /* part 2: front end */
90 /*___________________*/
91
92 /* parse SAOL/SASL/MIDI */
93
94 saolparse(); /* postparse.c */
95
96 /* SAOL optimization */
97
98 optmain(); /* optmain.c */
99
100 /* combine scores, write mp4 file */
101
102 renumberabs(); /* readscore.c */
103 if (boutfile)
104 mp4write(); /* mp4write.c */
105 mergescores(); /* readscore.c */
106
107
108 /*~~~~~~~~~~~~~~~~~~~~~~~~~*/
109 /* part 3: code generation */
110 /*_________________________*/
111
112 preamble(); /* writepre.c */
113 opcodefunctions(); /* writeop.c */
114 toptree(PRINTIPASS); /* writeorc.c */
115 toptree(PRINTKPASS);
116 toptree(PRINTAPASS);
117 printtablefunctions(); /* readscore.c */
118 postscript(); /* writeorc.c */
119
120
121 /*~~~~~~~~~~~~~~~~~~*/
122 /* part 4: shutdown */
123 /*__________________*/
124
125 sfrontshutdown(); /* sfmain.c */
126 return 0;
127
128 }
129
130
131 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
132 /* below are the functions called above that are in the file: */
133 /* sfrontinitialize commandlineargs sfrontshutdown */
134 /*______________________________________________________________*/
135
136 extern void printhelpshort(void);
137
138 /****************************************************************/
139 /* sfront initialization before cmdline parsing */
140 /****************************************************************/
141
sfrontinitialize(int argc,char ** argv)142 void sfrontinitialize(int argc, char ** argv)
143
144 {
145
146 sfront_argc = argc;
147 sfront_argv = argv;
148 systemshell = system(NULL);
149
150 vmcheck(confsasl = calloc(1, sizeof(sasdata)));
151 vmcheck(sstrsasl = calloc(1, sizeof(sasdata)));
152 vmcheck(abssasl = calloc(1, sizeof(sasdata)));
153 vmcheck(confmidi = calloc(1, sizeof(midata)));
154 vmcheck(sstrmidi = calloc(1, sizeof(midata)));
155 cppincludes = dupval(" ");
156
157 printf("sfront, a SAOL to C translator. Version %s.\n",IDSTRING);
158 printf("Run sfront with -license option for Copyright/License info.\n\n");
159
160 if (argc == 1)
161 printhelpshort();
162
163 }
164
165
166 extern int singleflags(char *);
167 extern int oneparamflags(char *, char *);
168 extern void cmdlineorchestra(int *, int, char **);
169 extern void sfrontpostparsecheck(void);
170 extern void saolcppcheck(void);
171 extern void audiodefaults(void);
172
173
174 /****************************************************************/
175 /* parses command line arguments */
176 /****************************************************************/
177
commandlineargs(int argc,char ** argv)178 void commandlineargs(int argc, char ** argv)
179
180 {
181 int i = 1;
182
183 while (i<argc)
184 {
185 if (singleflags(argv[i]))
186 {
187 i++;
188 continue;
189 }
190 if (oneparamflags(argv[i], (argc == (i + 1)) ? NULL : argv[i+1]))
191 {
192 i+=2;
193 continue;
194 }
195 if (!strcmp(argv[i],"-orc"))
196 {
197 cmdlineorchestra(&i, argc, argv);
198 continue;
199 }
200 printf("Error: Command-line option %s unknown or incorrectly used.\n\n",
201 argv[i]);
202 printhelpshort();
203 }
204
205 sfrontpostparsecheck();
206 saolcppcheck();
207 audiodefaults();
208 }
209
210
211 /****************************************************************/
212 /* what sfront does before exiting normally */
213 /****************************************************************/
214
sfrontshutdown(void)215 void sfrontshutdown(void)
216
217 {
218 if (outfile != NULL)
219 fclose(outfile);
220 if (orcoutfile != NULL)
221 fclose(orcoutfile);
222 if (scooutfile != NULL)
223 fclose(scooutfile);
224 if (midoutfile != NULL)
225 fclose(midoutfile);
226 deletecppfiles();
227
228 }
229
230 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
231 /* this ends the part of the file that has externs. from now on */
232 /* functions are declared in the order needed. the rest of the */
233 /* file implements the command-line parsing functions -- the */
234 /* only exported function is deletecppfiles(), that cleans up */
235 /* temporary files used by the preprocessor. */
236 /*______________________________________________________________*/
237
238
239
240 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
241 /* the first set of functions print out extended user messages */
242 /*______________________________________________________________*/
243
244
245
246 /****************************************************************/
247 /* print bsd license */
248 /****************************************************************/
249
printbsd(void)250 void printbsd(void)
251
252 {
253
254 printf("Copyright (c) 1999-2006, Regents of the University of California\n");
255 printf("All rights reserved.\n");
256 printf("\n");
257 printf("Redistribution and use in source and binary forms, with or without\n");
258 printf("modification, are permitted provided that the following conditions are\n");
259 printf("met:\n");
260 printf("\n");
261 printf(" Redistributions of source code must retain the above copyright\n");
262 printf(" notice, this list of conditions and the following disclaimer.\n");
263 printf("\n");
264 printf(" Redistributions in binary form must reproduce the above copyright\n");
265 printf(" notice, this list of conditions and the following disclaimer in the\n");
266 printf(" documentation and/or other materials provided with the distribution.\n");
267 printf("\n");
268 printf(" Neither the name of the University of California, Berkeley nor the\n");
269 printf(" names of its contributors may be used to endorse or promote products\n");
270 printf(" derived from this software without specific prior written permission.\n");
271 printf("\n");
272 printf("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n");
273 printf("\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n");
274 printf("LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n");
275 printf("A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n");
276 printf("OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n");
277 printf("SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n");
278 printf("LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n");
279 printf("DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n");
280 printf("THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n");
281 printf("(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n");
282 printf("OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n");
283
284 }
285
286 /****************************************************************/
287 /* prints top part of help screen */
288 /****************************************************************/
289
printhelptop(void)290 void printhelptop(void)
291
292 {
293
294 printf("Usage: sfront [options]\n");
295 printf("For input, either:\n");
296 printf(" [-bit mp4file] MP4 binary file\n");
297 printf(" [-bitc mp4file] MP4 binary file: skip streaming data.\n");
298 printf("Or:\n");
299 printf(" [-orc f1 [f2 ...]] SAOL orchestra file(s)\n");
300 printf("SAOL file(s) may be combined with:\n");
301 printf(" [-sco scorefile] SASL score file\n");
302 printf(" [-sstr scorefile] SASL score file (encode as stream)\n");
303 printf(" [-midi midifile] MIDI score file\n");
304 printf(" [-mstr midifile] MIDI score file (encode as stream)\n");
305
306 }
307
308 /****************************************************************/
309 /* prints short version of help screen */
310 /****************************************************************/
311
printhelpshort(void)312 void printhelpshort(void)
313
314 {
315
316 printhelptop();
317 printf("Run 'sfront -help' for more options.\n");
318 noerrorplace();
319
320 }
321
322
323 /****************************************************************/
324 /* prints help screen */
325 /****************************************************************/
326
printhelp(void)327 void printhelp(void)
328
329 {
330
331 printhelptop();
332 printf("Produces C output as: \n");
333 printf(" [-o cfile] C output file (default: sa.c)\n");
334 printaudiohelp();
335 printcontrolhelp();
336 printf("Time-management options (last option on command-line used):\n");
337 printf(" [-render] Accurately compute audio output.\n");
338 printf(" [-playback] Real-time streaming audio output.\n");
339 printf(" [-timesync] Real-time interactive option.\n");
340 printf("Audio output latency (caution: default value is usually best):\n");
341 printf(" [-latency time] Soundcard latency, in seconds.\n");
342 printf("To create an MP4 file, use:\n");
343 printf(" [-bitout mp4file] Generate mp4 bitstream\n");
344 printf(" [-symtab] Include symbol table in file\n");
345 printf("To extract component files from MP4 file, use:\n");
346 printf(" [-orcout orcfile] Generate SAOL file\n");
347 printf(" [-scoout scorefile] Generate SASL file\n");
348 printf(" [-midout midifile] Generate MIDI bitstream\n");
349 printf("SAOL file parsing directives:\n");
350 printf(" [-isosyntax] Reject sfront SAOL enhancements.\n");
351 printf(" [-cpp] Run pre-processor on SAOL files.\n");
352 printf(" [-gcc] System pre-processor is -gcc.\n");
353 printf(" [-Is dirname] Library directory for pre-processor.\n");
354 printf("C output file generation directives:\n");
355 printf(" [-except] Generate signal handler in C file.\n");
356 printf(" [-hexdata] Initialize arrays using hex strings.\n");
357 printf(" [-fixedseed] Use same random seed for each run.\n");
358 printf(" [-00] Skip all optimizations.\n");
359
360 if (NET_STATUS == HAS_NETWORKING)
361 {
362 printf("Networking options (UNIX-only):\n");
363 printf(" [-session name] Join network session [name].\n");
364 printf(" [-passphrase key] Session secret (at least %i characters).\n",
365 MINIMUM_SESSIONKEY);
366 printf(" [-bandsize num] Max number of other players [default %i].\n", DEFAULTBANDSIZE);
367 printf(" [-latetime t] Mute notes arriving t seconds late"
368 " (default %gs)\n", LATETIME_LIMIT);
369 printf(" [-lateplay] Never mute notes (even if very late).\n");
370 printf(" [-fec standard] Full forward-error correction (default).\n");
371 printf(" [-fec extra] Extra-strength FEC, protects NoteOns.\n");
372 printf(" [-fec minimal] Reduced FEC, for low-bandwidth links.\n");
373 printf(" [-fec noguard] FEC w/o last note guard (for debug).\n");
374 printf(" [-fec none] No FEC, for use with a proxy.\n");
375 printf(" [-sip_ip dotquad] SIP IP number (default %s).\n",SIP_IP);
376 printf(" [-sip_port num] SIP server port (default %hu).\n",
377 SIP_RTP_PORT);
378 printf(" [-m_semitones num] Mirror session pitch shift (default %hu).\n",
379 MSESSION_INTERVAL);
380 }
381 printf("Sample-rate interpolation options:\n");
382 printf(" [-interp [linear, sinc]] Override SAOL global interp parameter.\n");
383 printf(" [-sinc_pilen n] Lookup table size for 1 cycle of sinc sinusoid.\n");
384 printf(" [-sinc_zcross n] Number of zero-crossings on sinc-function lobe.\n");
385 printf("Miscellanous options:\n");
386 printf(" [-null-program] Map unassigned MIDI presets to silence.\n");
387 printf(" [-mv] Verbose -midi or -mstr file read.\n");
388 printf(" [-pporc] -orcout shows processed parse tree\n");
389 printf(" [-license] Warantee/License info\n");
390 printf("See http://www.cs.berkeley.edu/~lazzaro/sa/sfman/ for full list.\n");
391 noerrorplace();
392
393 }
394
395
396 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
397 /* the next set of functions handles the pre-processor calls */
398 /*______________________________________________________________*/
399
400
401
402 /****************************************************************/
403 /* run cpp: tptr->ttype codes S_SAOLFILE or S_SASLFILE */
404 /****************************************************************/
405
cppsystemcall(tnode * tptr)406 void cppsystemcall(tnode * tptr)
407
408 {
409 char * command = NULL;
410 char * prefix;
411 char * lastinclude;
412 FILE * fd = NULL;
413
414 /* formulate cpp file name */
415
416 vmcheck(tptr->filename = calloc(strlen(tptr->val)+5, sizeof(char)));
417 strcat(strcpy(tptr->filename, tptr->val),".tpp");
418 remove(tptr->filename);
419
420 /* generate command string for each compiler */
421
422 switch (compilertype) {
423 case GCC_COMPILER:
424 if (tptr->ttype == S_SAOLFILE)
425 prefix = "gcc -nostdinc -x c++ -E -o ";
426 else
427 prefix = "gcc -P -nostdinc -x c++ -E -o ";
428 lastinclude = " -I " SAOLLIBDIR " ";
429 vmcheck(command = calloc(strlen(prefix) + strlen(tptr->filename)
430 + strlen(cppincludes) + strlen(lastinclude)
431 + strlen(tptr->val) + 1,
432 sizeof(char)));
433 sprintf(command,"%s%s%s%s%s", prefix, tptr->filename,
434 cppincludes, lastinclude, tptr->val);
435 break;
436 default:
437 internalerror("sfmain.c","cppsystemcall()");
438 }
439
440 /* execute preprocessor */
441
442 if ( system(command) || ! (fd = fopen(tptr->filename,"r")))
443 {
444 printf("\nError: Pre-processing for file %s was not successful.\n",
445 tptr->val);
446 printf("See diagnostics message above (if any) for details.\n\n");
447 noerrorplace();
448 }
449
450 free(command);
451 fclose(fd);
452
453 }
454
455 /****************************************************************/
456 /* run cpp on the SASL file */
457 /****************************************************************/
458
cppsaslfile(FILE ** fd,tnode ** flist,char * option)459 void cppsaslfile(FILE ** fd, tnode ** flist, char * option)
460
461 {
462 int i = 0;
463 char * name;
464 int argc = sfront_argc;
465 char ** argv = sfront_argv;
466
467 /* find SASL file */
468
469 fclose(*fd);
470 while ((i < argc) && strcmp(argv[i], option))
471 i++;
472
473 /* make ????filelist for it */
474
475 if ((*fd = fopen((name = argv[++i]),"r")))
476 fclose(*fd);
477 else
478 {
479 vmcheck(name = calloc(strlen(argv[i]) + 6, 1));
480 strcat(strcpy(name, argv[i]), ".sasl");
481 }
482
483 /* run cpp, make new saslfile on result */
484
485 cppsystemcall((*flist = make_tnode(name, S_SASLFILE)));
486 *fd = fopen((*flist)->filename,"r");
487
488 }
489
490 /****************************************************************/
491 /* adds SFRONT_INCLUDE_PATH to cppincludes */
492 /****************************************************************/
493
cppenvironment(void)494 void cppenvironment(void)
495
496 {
497 char * envstr, * newlib, * oldstr;
498 int idx, i, len, lenname;
499
500
501 if (!(envstr = getenv("SFRONT_INCLUDE_PATH")))
502 return;
503
504 /* some systems include name in return string */
505
506 lenname = strlen("SFRONT_INCLUDE_PATH");
507 len = strlen(envstr);
508 idx = 0;
509 if (len >= lenname)
510 {
511 while ((idx < len) && (isspace((int)envstr[idx]) || (envstr[idx] == ':')
512 || (envstr[idx] == '=')))
513 idx++;
514 if ((len - idx) >= lenname)
515 if (!strncmp("SFRONT_INCLUDE_PATH",&(envstr[idx]),lenname))
516 idx += lenname;
517 }
518
519 /* remove trailing = sign, if any */
520
521 while ((idx < len) && (isspace((int)envstr[idx]) || (envstr[idx] == ':')
522 || (envstr[idx] == '=')))
523 idx++;
524
525 /* parse include directories */
526
527 while (idx < len)
528 {
529 i = 0;
530 while ((idx + i < len) && (!isspace((int)envstr[idx+i])) &&
531 (envstr[idx+i] != ':'))
532 i++;
533 vmcheck(newlib = calloc(i+6, sizeof(char)));
534 strcat(newlib," -I ");
535 strncat(newlib,&(envstr[idx]),i);
536 strcat(newlib," ");
537 idx += i;
538 oldstr = cppincludes;
539 vmcheck(cppincludes = calloc(strlen(oldstr) + strlen(newlib) + 1,
540 sizeof(char)));
541 strcat(cppincludes, oldstr);
542 strcat(cppincludes, newlib);
543 free(oldstr);
544 free(newlib);
545 while ((idx < len) && (isspace((int)envstr[idx])||(envstr[idx] == ':')))
546 idx++;
547 }
548 }
549
550
551 /****************************************************************/
552 /* run cpp on saolfilelist,saslfilelist,sstrfilelist */
553 /****************************************************************/
554
saolcppcheck(void)555 void saolcppcheck(void)
556
557 {
558 tnode * tptr;
559
560 if ((!cppsaol) || (!saolfilelist))
561 return;
562
563 if (!systemshell)
564 {
565 printf("Error: -cpp option not supported on your platform.\n");
566 printf(" No shell available for system() command.\n\n");
567 printhelpshort();
568 }
569
570 if (compilertype != GCC_COMPILER)
571 {
572 printf("Error: -cpp option requires a companion compiler flag.\n");
573 printf(" Supported compiler flags: -gcc\n\n");
574 printf("Run 'sfront -help' for more information.\n");
575 noerrorplace();
576 }
577
578 cppenvironment();
579 tptr = saolfilelist;
580 while (tptr)
581 {
582 cppsystemcall(tptr);
583 tptr = tptr->next;
584 }
585
586 if (saslfile)
587 cppsaslfile(&saslfile, &saslfilelist, "-sco");
588 if (sstrfile)
589 cppsaslfile(&sstrfile, &sstrfilelist, "-sstr");
590
591
592 }
593
594 /******************************************************************/
595 /* deletes any cpp temporary files */
596 /******************************************************************/
597
deletecppfiles(void)598 void deletecppfiles(void)
599
600 {
601 tnode * tptr;
602
603 /* delete temporary cpp files */
604
605 if (cppsaol)
606 {
607 tptr = saolfilelist;
608 while (tptr)
609 {
610 if (tptr->filename)
611 remove(tptr->filename);
612 tptr = tptr->next;
613 }
614 if (saslfilelist && saslfilelist->filename)
615 remove(saslfilelist->filename);
616 if (sstrfilelist && sstrfilelist->filename)
617 remove(sstrfilelist->filename);
618 }
619
620 }
621
622
623 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
624 /* this function runs post-parse, checks for conflicting state */
625 /*______________________________________________________________*/
626
627
628 /****************************************************************/
629 /* sfront state checking post cmdline parsing */
630 /****************************************************************/
631
sfrontpostparsecheck(void)632 void sfrontpostparsecheck(void)
633
634 {
635 int len;
636
637 if ((saolfilelist == NULL)&&(bitfile == NULL))
638 {
639 printf("Error: -orc, -bit, or -bitc option is required.\n");
640 printhelpshort();
641 }
642 if ((bitfile != NULL) && ((saolfilelist != NULL) || (saslfile != NULL)||
643 (midifile != NULL) || (mstrfile != NULL)))
644 {
645 printf("Error: -bit file specified with other input files.\n");
646 printhelpshort();
647 }
648 if ( (bitfile != NULL) && (boutfile != NULL))
649 {
650 printf("Error: -bitout option cannot be used with -bit option \n");
651 printhelpshort();
652 }
653 if (outfile == NULL)
654 {
655 outfile = fopen("sa.c","w");
656 if (outfile == NULL)
657 {
658 printf("Error: Cannot open output file sa.c\n\n");
659 printhelpshort();
660 }
661 }
662
663 if (ain && aout && (ain != aout) &&
664 (ainflow == ACTIVE_FLOW) && (aoutflow == ACTIVE_FLOW))
665 {
666 printf("Error: -ain and -aout drivers are both active-flow drivers.\n\n");
667 printhelpshort();
668 }
669
670 if (reentrant)
671 {
672 if (cin && !creentrant)
673 {
674 printf("Error: The non-reentrant -cin driver is incompatible with\n");
675 printf(" the re-entrant -aout or -ain driver.\n\n");
676 printhelpshort();
677 }
678 if (session)
679 {
680 printf("Error: Sfront networking is incompatible with\n");
681 printf(" the re-entrant -aout or -ain driver.\n\n");
682 printhelpshort();
683 }
684 }
685
686 if ((cin && (!strcmp(cinname,"aucontrol") || !strcmp(cinname,"aucontrolm"))) ||
687 (ain && (!strcmp(ainname,"audiounit") || !strcmp(ainname,"audiounit_debug"))) ||
688 (aout && (!strcmp(aoutname,"audiounit") || !strcmp(aoutname,"audiounit_debug"))))
689 {
690 if (ain && aout && cin && !strcmp(cinname, "aucontrol"))
691 au_component_type = dupval("aufx");
692
693 if (ain && aout && cin && !strcmp(cinname, "aucontrolm"))
694 au_component_type = dupval("aumf");
695
696 if (!ain && aout && cin && !strcmp(cinname, "aucontrolm"))
697 au_component_type = dupval("aumu");
698
699 if (!au_component_type)
700 {
701 printf("Error: Unsupported combination of AudioUnit drivers:\n");
702
703 printf(" ");
704 if (aout &&(!strcmp(aoutname,"audiounit") || !strcmp(aoutname,"audiounit_debug")))
705 printf("-aout %s ", aoutname);
706 if ((cin && (!strcmp(cinname,"aucontrol") || !strcmp(cinname,"aucontrolm"))))
707 printf("-cin %s ", cinname);
708 if (ain && (!strcmp(ainname,"audiounit") || !strcmp(ainname,"audiounit_debug")))
709 printf("-ain %s", ainname);
710 printf("\n\n");
711
712 printf(" Supported combinations:\n");
713 printf(" -aout audiounit -cin aucontrol -ain audiounit (Effect)\n");
714 printf(" -aout audiounit -cin aucontrolm -ain audiounit (MusicEffect)\n");
715 printf(" -aout audiounit -cin aucontrolm (MusicDevice)\n");
716 printf("\n (audiounit_debug may substitute for audiounit)\n");
717 noerrorplace();
718 }
719
720 if (!au_filesystem_name)
721 {
722 if (!saolfilelist)
723 {
724 printf("Error: -au_filesystem_name flag is required for AUs built"
725 "from -bit/-bitc files.\n");
726 noerrorplace();
727 }
728
729 au_filesystem_name = dupval(saolfilelist->val);
730 len = strlen(au_filesystem_name);
731
732 if ((len > 5) && (!strcmp(&(au_filesystem_name[len - 5]), ".saol") ||
733 !strcmp(&(au_filesystem_name[len - 5]),".SAOL")))
734 {
735 au_filesystem_name[len - 5] = '\0';
736 au_filesystem_name[len - 4] = '\0';
737 au_filesystem_name[len - 3] = '\0';
738 au_filesystem_name[len - 2] = '\0';
739 au_filesystem_name[len - 1] = '\0';
740 }
741 }
742
743 /* au_component_subtype */
744
745 if (!au_component_subtype)
746 {
747 au_component_subtype = dupval("wxyz");
748 au_component_subtype[0] = au_filesystem_name[0];
749 len = strlen(au_filesystem_name);
750 au_component_subtype[1] = ((len > 1) ?
751 au_filesystem_name[1] : au_component_subtype[1]);
752 au_component_subtype[2] = ((len > 2) ?
753 au_filesystem_name[2] : au_component_subtype[2]);
754 au_component_subtype[3] = ((len > 3) ?
755 au_filesystem_name[3] : au_component_subtype[3]);
756 }
757
758 if (!au_ui_name)
759 au_ui_name = dupval(au_filesystem_name);
760 if (!au_component_manu)
761 au_component_manu = dupval("Xmpl");
762 if (!au_ui_manu)
763 au_ui_manu = dupval("Example");
764 if (!au_manu_url)
765 au_manu_url = dupval("com.example");
766
767 if (!strcmp(au_component_type, "aufx"))
768 printf("Making an Effect AudioUnit\n\n");
769 if (!strcmp(au_component_type, "aumf"))
770 printf("Making a MusicEffect AudioUnit\n\n");
771 if (!strcmp(au_component_type, "aumu"))
772 printf("Making a MusicDevice AudioUnit\n\n");
773 }
774
775 cinmaxchan = cmaxchan;
776
777 if (session)
778 {
779 if ((sessionkey == NULL) && strcmp("mirror", session))
780 {
781 printf("Error: -passphrase option missing.\n\n");
782 printhelpshort();
783 }
784
785 if (!strcmp("mirror", session))
786 netmsets = 1; /* for security reasons */
787
788 netstart = cmaxchan;
789 cmaxchan += 16*netmsets; /* 16 channels per netuser */
790 if (fixedseed)
791 {
792 fixedseed = 0;
793 printf("Warning: -fixedseed ignored due to network requirements.\n");
794 }
795 }
796 }
797
798 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
799 /* the remaining files actually parse cmdline flags */
800 /*______________________________________________________________*/
801
802 /****************************************************************/
803 /* opens a command-line file */
804 /****************************************************************/
805
cmdlinefileopen(FILE ** stream,char * command,char * name,char * mode,char * ext)806 int cmdlinefileopen(FILE ** stream, char * command, char * name,
807 char * mode, char * ext)
808
809 {
810 char * suffix;
811
812 if (*stream != NULL)
813 {
814 printf("Error: sfront only processes one %s file\n\n", command);
815 printhelpshort();
816 }
817 if (!name)
818 {
819 printf("Error: No filename specified for %s option\n", command);
820 printhelpshort();
821 }
822 *stream = fopen(name, mode);
823 if (*stream == NULL)
824 {
825 vmcheck(suffix = calloc(strlen(name)+strlen(ext)+2, sizeof(char)));
826 sprintf(suffix,"%s.%s", name, ext);
827 *stream = fopen(suffix, mode);
828 if (*stream == NULL)
829 {
830 printf("Error: Cannot open %s file `%s' [also tried `%s'\n\n",
831 command, name, suffix);
832 printhelpshort();
833 }
834 free(suffix);
835 }
836 return 1;
837 }
838
839 /****************************************************************/
840 /* opens a command-line file */
841 /****************************************************************/
842
cmddriveropen(int od,char * command,char * name,int check)843 int cmddriveropen(int od, char * command, char * name, int check)
844
845 {
846 if (od)
847 {
848 printf("Error: sfront only processes one %s file/device\n\n", command);
849 printhelpshort();
850 }
851 if (!name)
852 {
853 printf("Error: No %s file/device specified\n\n", command);
854 printhelpshort();
855 }
856 if (check)
857 {
858 printf("Error: Bad %s file/device: %s\n\n", command, name);
859 printhelpshort();
860 }
861 return 1;
862 }
863
864 /****************************************************************/
865 /* parses one-parameter flags */
866 /****************************************************************/
867
oneparamflags(char * s1,char * s2)868 int oneparamflags(char * s1, char * s2)
869
870 {
871 int od, i, q1, q2, q3, q4;
872 float f;
873 char * name1, * name2, * sptr;
874
875 /* all files */
876
877 if ((!strcmp(s1,"-bit"))||(!strcmp(s1,"-bitc")))
878 {
879 if (saolfilelist != NULL)
880 {
881 printf("sfront can't combine -orc and -bit files\n\n");
882 printhelpshort();
883 }
884 bitreadaccessunits = strcmp(s1,"-bitc") ? 1 : 0;
885 isocompliant = 1;
886 return cmdlinefileopen(&bitfile, s1, s2, "rb", "mp4");
887 }
888 if (!strcmp(s1,"-bitout"))
889 return cmdlinefileopen(&boutfile, s1, s2, "wb", "mp4");
890 if (!strcmp(s1,"-midi"))
891 return cmdlinefileopen(&midifile, s1, s2, "rb", "mid");
892 if (!strcmp(s1,"-midout"))
893 return cmdlinefileopen(&midoutfile, s1, s2, "wb", "mid");
894 if (!strcmp(s1,"-mstr"))
895 return cmdlinefileopen(&mstrfile, s1, s2, "rb", "mid");
896 if (!strcmp(s1,"-o"))
897 return cmdlinefileopen(&outfile, s1, s2, "w", "c");
898 if (!strcmp(s1,"-orcout"))
899 return cmdlinefileopen(&orcoutfile, s1, s2, "w", "saol");
900 if (!strcmp(s1,"-sco"))
901 return cmdlinefileopen(&saslfile, s1, s2, "r", "sasl");
902 if (!strcmp(s1,"-scoout"))
903 return cmdlinefileopen(&scooutfile, s1, s2, "w", "sasl");
904 if (!strcmp(s1,"-sstr"))
905 return cmdlinefileopen(&sstrfile, s1, s2, "r", "sasl");
906
907 /* all drivers */
908
909 if (!strcmp(s1,"-ain"))
910 {
911 od = ain;
912 return cmddriveropen(od, s1, s2, (!ain && s2) ? ainfilecheck(s2) : 0);
913 }
914 if (!strcmp(s1,"-aout"))
915 {
916 od = aout;
917 return cmddriveropen(od, s1, s2, (!aout && s2) ? aoutfilecheck(s2) : 0);
918 }
919 if (!strcmp(s1,"-cin"))
920 {
921 od = cin;
922 return cmddriveropen(od, s1, s2, (!cin && s2) ? cinfilecheck(s2) : 0);
923 }
924
925 /* other parameters */
926
927 if ((NET_STATUS == HAS_NETWORKING) && (!strcmp(s1,"-bandsize")))
928 {
929
930 if (!s2 || (sscanf(s2, "%i", &netmsets) != 1) ||
931 (netmsets < 0) ||(netmsets > MAXBANDSIZE))
932 {
933 if (s2)
934 printf("Error: Illegal -bandsize parameter %s \n\n", s2);
935 else
936 printf("Error: Missing -bandsize parameter.\n\n");
937 printhelpshort();
938 }
939 return 1;
940 }
941
942 if ((NET_STATUS == HAS_NETWORKING) && (!strcmp(s1,"-fec")))
943 {
944
945 if (!s2)
946 {
947 printf("Error: Missing -fec level "
948 "[extra, standard, minimal, noguard, none].\n\n");
949 printhelpshort();
950 }
951
952 if (!strcmp("extra", s2))
953 feclevel = FEC_EXTRA;
954 else
955 if (!strcmp("standard", s2))
956 feclevel = FEC_STANDARD;
957 else
958 if (!strcmp("minimal", s2))
959 feclevel = FEC_MINIMAL;
960 else
961 if (!strcmp("noguard", s2))
962 feclevel = FEC_NOGUARD;
963 else
964 if (!strcmp("none", s2))
965 feclevel = FEC_NONE;
966 else
967 {
968 printf("Error: Invalid -fec level %s; use one of\n"
969 "[extra, standard, minimal, noguard, none]\n\n",
970 s2);
971 printhelpshort();
972 }
973
974 return 1;
975 }
976
977 if ((!strcmp(s1,"-interp")))
978 {
979 if (!s2)
980 {
981 printf("Error: Missing -interp type [linear | sinc].\n\n");
982 printhelpshort();
983 }
984
985 if (!strcmp("linear", s2))
986 interp_cmdline = INTERP_LINEAR;
987 else
988 if (!strcmp("sinc", s2))
989 interp_cmdline = INTERP_SINC;
990 else
991 {
992 printf("Error: Invalid -interp level %s; use one of\n"
993 "[linear, sinc]\n\n", s2);
994 printhelpshort();
995 }
996
997 return 1;
998 }
999
1000 if (!strcmp(s1,"-latency"))
1001 {
1002
1003 if (!s2 || (sscanf(s2, "%f", &latency) != 1))
1004 {
1005 printf("Error: Missing or illegal -latency time parameter.\n\n");
1006 printhelpshort();
1007 }
1008 return 1;
1009 }
1010
1011 if ((NET_STATUS == HAS_NETWORKING) &&(!strcmp(s1,"-latetime")))
1012 {
1013
1014 if (!s2 || (sscanf(s2, "%f", &latetime) != 1))
1015 {
1016 printf("Error: Missing or illegal -latetime time parameter.\n\n");
1017 printhelpshort();
1018 }
1019 return 1;
1020 }
1021
1022 if ((NET_STATUS == HAS_NETWORKING) && ((!strcmp(s1,"-m_semitones")) ||
1023 (!strcmp(s1,"-m_semitone"))))
1024 {
1025
1026 if (!s2 || (sscanf(s2, "%i", &i) != 1) || (i < 0) || (i > 24))
1027 {
1028 printf("Error: Missing or illegal -m_semitones parameter.\n");
1029 printf(" : Use a positive integer between 0 and 24.\n\n");
1030 printhelpshort();
1031 }
1032 msession_interval = i;
1033 return 1;
1034 }
1035
1036 if ((NET_STATUS == HAS_NETWORKING) && (!strcmp(s1,"-passphrase")))
1037 {
1038
1039 if (!s2)
1040 {
1041 printf("Error: Missing -passphrase parameter.\n\n");
1042 printhelpshort();
1043 }
1044
1045 if (strlen(s2) < MINIMUM_SESSIONKEY)
1046 {
1047 printf("Error: Passphrase \"%s\" less than %i characters in length.\n\n",
1048 s2, MINIMUM_SESSIONKEY);
1049 printhelpshort();
1050 }
1051
1052 sessionkey = dupval(s2);
1053 return 1;
1054 }
1055
1056 if ((NET_STATUS == HAS_NETWORKING) && (!strcmp(s1,"-session")))
1057 {
1058
1059 if (!s2)
1060 {
1061 printf("Error: Missing -session name parameter.\n\n");
1062 printhelpshort();
1063 }
1064
1065 for (i=0; i < ((int)strlen(s2)); i++)
1066 if ( !isalnum((int)s2[i]) &&
1067 (s2[i] != '-') && (s2[i] != '_') && (s2[i] != '.') &&
1068 (s2[i] != '!') && (s2[i] != '~') && (s2[i] != '*') &&
1069 (s2[i] != '\'') && (s2[i] != '(') && (s2[i] != ')'))
1070 {
1071 if (s2[i] == ' ')
1072 printf("Error: Space character not allowed in session name\n");
1073 else
1074 printf("Error: Character '%c' not allowed in session name.\n",
1075 s2[i]);
1076
1077 printf(" : Use letters, numbers"
1078 "and - _ . ! ~ * ' ( ) only.\n\n");
1079 printhelpshort();
1080 }
1081
1082 session = dupval(s2);
1083 return 1;
1084 }
1085
1086 if (!strcmp(s1,"-au_component_manu"))
1087 {
1088
1089 if (!s2)
1090 {
1091 printf("Error: Missing -au_component_manu parameter.\n");
1092 noerrorplace();
1093 }
1094
1095 if (strlen(s2) != 4)
1096 {
1097 printf("Error: -au_component_manu code \"%s\" is not exactly 4 characters in length.\n",
1098 s2);
1099 noerrorplace();
1100 }
1101
1102 au_component_manu = dupval(s2);
1103 return 1;
1104 }
1105
1106 if (!strcmp(s1,"-au_component_subtype"))
1107 {
1108
1109 if (!s2)
1110 {
1111 printf("Error: Missing -au_component_subtype parameter.\n");
1112 noerrorplace();
1113 }
1114
1115 if (strlen(s2) != 4)
1116 {
1117 printf("Error: -au_component_subtype code \"%s\" is not exactly 4 characters in length.\n",
1118 s2);
1119 noerrorplace();
1120 }
1121
1122 au_component_subtype = dupval(s2);
1123 return 1;
1124 }
1125
1126 if (!strcmp(s1,"-au_filesystem_name"))
1127 {
1128
1129 if (!s2)
1130 {
1131 printf("Error: Missing -au_filesystem_name parameter.\n");
1132 noerrorplace();
1133 }
1134
1135 au_filesystem_name = dupval(s2);
1136 return 1;
1137 }
1138
1139 if (!strcmp(s1,"-au_manu_url"))
1140 {
1141
1142 if (!s2)
1143 {
1144 printf("Error: Missing -au_manu_url parameter.\n");
1145 noerrorplace();
1146 }
1147
1148 au_manu_url = dupval(s2);
1149
1150 if ((sptr = strstr(au_manu_url, ".audiounit")))
1151 *sptr = '\0';
1152
1153 return 1;
1154 }
1155
1156 if (!strcmp(s1,"-au_ui_name"))
1157 {
1158
1159 if (!s2)
1160 {
1161 printf("Error: Missing -au_ui_name parameter.\n");
1162 noerrorplace();
1163 }
1164
1165 au_ui_name = dupval(s2);
1166 return 1;
1167 }
1168
1169 if (!strcmp(s1,"-au_ui_manu"))
1170 {
1171
1172 if (!s2)
1173 {
1174 printf("Error: Missing -au_ui_manu parameter.\n");
1175 noerrorplace();
1176 }
1177
1178 au_ui_manu = dupval(s2);
1179 return 1;
1180 }
1181
1182 if (!strcmp(s1,"-au_view_bundlename"))
1183 {
1184
1185 if (!s2)
1186 {
1187 printf("Error: Missing -au_view_bundlename parameter.\n");
1188 noerrorplace();
1189 }
1190
1191 au_view_bundlename = dupval(s2);
1192
1193 if ((sptr = strstr(au_view_bundlename, ".bundle")))
1194 *sptr = '\0';
1195
1196 return 1;
1197 }
1198
1199 if (!strcmp(s1,"-au_view_baseclass"))
1200 {
1201
1202 if (!s2)
1203 {
1204 printf("Error: Missing -au_view_baseclass parameter.\n");
1205 noerrorplace();
1206 }
1207
1208 au_view_baseclass = dupval(s2);
1209
1210 return 1;
1211 }
1212
1213 if (!strcmp(s1,"-sinc_zcross"))
1214 {
1215 if (!s2 || (sscanf(s2, "%f", &f) != 1))
1216 {
1217 printf("Error: Missing or illegal -sinc_zcross parameter.\n\n");
1218 printhelpshort();
1219 }
1220 sinc_zcross = (unsigned int) f;
1221 if ((f != sinc_zcross) || (sinc_zcross < 1) || (sinc_zcross > 30))
1222 {
1223 printf("Error: -sinc_zcross parameter must be integer in 1-30 range.\n\n");
1224 printhelpshort();
1225 }
1226 return 1;
1227 }
1228
1229 if (!strcmp(s1,"-sinc_pilen"))
1230 {
1231 if (!s2 || (sscanf(s2, "%f", &f) != 1))
1232 {
1233 printf("Error: Missing or illegal -sinc_pilen parameter.\n\n");
1234 printhelpshort();
1235 }
1236 sinc_pilen = (unsigned int) f;
1237 if ((f != sinc_pilen) ||
1238 ((sinc_pilen != 2) && (sinc_pilen != 4) && (sinc_pilen != 8) &&
1239 (sinc_pilen != 16) && (sinc_pilen != 32) && (sinc_pilen != 64) &&
1240 (sinc_pilen != 128) && (sinc_pilen != 256) && (sinc_pilen != 512) &&
1241 (sinc_pilen != 1024) && (sinc_pilen != 2048) && (sinc_pilen != 4096) &&
1242 (sinc_pilen != 8192)))
1243 {
1244 printf("Error: -sinc_pilen parameter must be <= 8192 and a power of 2.\n\n");
1245 printhelpshort();
1246 }
1247 return 1;
1248 }
1249
1250 if ((NET_STATUS == HAS_NETWORKING) && (!strcmp(s1,"-sip_ip")))
1251 {
1252 if (!s2)
1253 {
1254 printf("Error: Missing or illegal -sip_ip parameter.\n\n");
1255 printhelpshort();
1256 }
1257
1258 q1 = q2 = q3 = q4 = -1;
1259
1260 if (sscanf(s2, "%3i.%3i.%3i.%3i", &q1, &q2, &q3, &q4) != 4)
1261 {
1262 printf("Error: Bad format (1) for -sip_ip"
1263 " dotted-quad: %s.\n\n", s2);
1264 printhelpshort();
1265 }
1266
1267 if ((q1 < 0) || (q1 > 255) || (q2 < 0) || (q2 > 255) ||
1268 (q3 < 0) || (q3 > 255) || (q4 < 0) || (q4 > 255))
1269 {
1270 printf("Error: Bad format (2) for -sip_ip"
1271 " dotted-quad: %s.\n\n", s2);
1272 printhelpshort();
1273 }
1274
1275 strcpy(sip_ip, s2);
1276 return 1;
1277 }
1278
1279 if ((NET_STATUS == HAS_NETWORKING) &&(!strcmp(s1,"-sip_port")))
1280 {
1281
1282 if (!s2 || (sscanf(s2, "%i", &i) != 1) || (i < 0) || (i > 65535))
1283 {
1284 printf("Error: Missing or illegal -sip_port parameter.\n\n");
1285 printhelpshort();
1286 }
1287 sip_port = (unsigned short) i;
1288 return 1;
1289 }
1290
1291 if (!strcmp(s1,"-Is"))
1292 {
1293 if (!s2)
1294 {
1295 printf("Error: -Is option not followed by directory name.\n\n");
1296 printhelpshort();
1297 }
1298 vmcheck(name1 = calloc(strlen(s2)+6, sizeof(char)));
1299 sprintf(name1," -I %s ", s2);
1300 name2 = cppincludes;
1301 vmcheck(cppincludes = calloc(strlen(name1)+strlen(name2)+1,
1302 sizeof(char)));
1303 strcpy(cppincludes,name2);
1304 strcat(cppincludes,name1);
1305 free(name1);
1306 free(name2);
1307 return 1;
1308 }
1309
1310 return 0;
1311 }
1312
1313
1314 /****************************************************************/
1315 /* parses orchestra files */
1316 /****************************************************************/
1317
cmdlineorchestra(int * idx,int argc,char ** argv)1318 void cmdlineorchestra(int * idx, int argc, char ** argv)
1319
1320 {
1321 char * name;
1322 tnode * tptr;
1323 int done = 0;
1324 int i;
1325
1326 if ((bitfile != NULL))
1327 {
1328 printf("Error: Both -orc and -bit files specified.\n\n");
1329 printhelpshort();
1330 }
1331 if ((i = ((*idx) + 1)) == argc)
1332 {
1333 printf("Error: -orc option without a SAOL file.\n");
1334 printhelpshort();
1335 }
1336 while (!done)
1337 {
1338 vmcheck(name = calloc(strlen(argv[i])+6, sizeof(char)));
1339 saolfile = fopen(strcpy(name, argv[i]),"r");
1340 if (saolfile == NULL)
1341 {
1342 saolfile = fopen(strcat(name,".saol"),"r");
1343 if (saolfile == NULL)
1344 {
1345 printf("Error: Cannot open -orc file `%s' [also tried `%s'\n\n"
1346 ,argv[i], name);
1347 printhelpshort();
1348 }
1349 }
1350 fclose(saolfile);
1351 if (saolfilelist == NULL)
1352 saolfilelist = make_tnode(name, S_SAOLFILE);
1353 else
1354 {
1355 tptr = saolfilelist;
1356 while (tptr->next != NULL)
1357 tptr = tptr->next;
1358 tptr->next = make_tnode(name, S_SAOLFILE);
1359 }
1360 i++;
1361 if ((argc == i) || (argv[i][0] == '-'))
1362 done = 1;
1363 }
1364
1365 *idx = i;
1366
1367 }
1368
1369 /****************************************************************/
1370 /* parses parameter-free flags */
1371 /****************************************************************/
1372
singleflags(char * s)1373 int singleflags(char * s)
1374
1375 {
1376
1377 if (!strcmp(s,"-cpp"))
1378 {
1379 cppsaol = 1;
1380 return 1;
1381 }
1382 if (!strcmp(s,"-except"))
1383 {
1384 catchsignals = 1;
1385 return 1;
1386 }
1387 if (!strcmp(s,"-fixedseed"))
1388 {
1389 fixedseed = 1;
1390 return 1;
1391 }
1392 if (!strcmp(s,"-gcc"))
1393 {
1394 compilertype = GCC_COMPILER;
1395 return 1;
1396 }
1397 if (!strcmp(s,"-help"))
1398 {
1399 printhelp();
1400 }
1401 if (!strcmp(s,"-hexdata"))
1402 {
1403 hexstrings = 1;
1404 return 1;
1405 }
1406 if (!strcmp(s,"-isosyntax"))
1407 {
1408 isocompliant = 1;
1409 return 1;
1410 }
1411 if ((NET_STATUS == HAS_NETWORKING) && (!strcmp(s,"-lateplay")))
1412 {
1413 lateplay = 1;
1414 return 1;
1415 }
1416 if ((!strcmp(s,"-lics"))||(!strcmp(s,"-lisc"))||
1417 (!strcmp(s,"-license")))
1418 {
1419 printbsd();
1420 noerrorplace();
1421 }
1422 if (!strcmp(s,"-mv"))
1423 {
1424 midiverbose = 1;
1425 return 1;
1426 }
1427 if ((!strcmp(s,"-isocheck"))||(!strcmp(s,"-no-inline")))
1428 {
1429 isocheck = 1;
1430 return 1;
1431 }
1432 if (!strcmp(s,"-no-rateopt"))
1433 {
1434 rateoptimize = 0;
1435 return 1;
1436 }
1437 if (!strcmp(s,"-no-constopt"))
1438 {
1439 constoptimize = 0;
1440 return 1;
1441 }
1442 if (!strcmp(s,"-null-program"))
1443 {
1444 null_program = 1;
1445 return 1;
1446 }
1447 if (!strcmp(s,"-O0"))
1448 {
1449 isocheck = 1;
1450 rateoptimize = 0;
1451 constoptimize = 0;
1452 return 1;
1453 }
1454 if (!strcmp(s,"-playback"))
1455 {
1456 timeoptions = PLAYBACK;
1457 return 1;
1458 }
1459 if (!strcmp(s,"-pporc"))
1460 {
1461 ascsaolptree = 1;
1462 return 1;
1463 }
1464 if (!strcmp(s,"-render"))
1465 {
1466 timeoptions = RENDER;
1467 return 1;
1468 }
1469 if (!strcmp(s,"-timesync"))
1470 {
1471 timeoptions = TIMESYNC;
1472 return 1;
1473 }
1474 if (!strcmp(s,"-symtab"))
1475 {
1476 bitwritenosymbols = 0;
1477 return 1;
1478 }
1479
1480 return 0;
1481 }
1482
1483