#include "../H/ugens.h" #include #include #include #include "defs.h" /* parser */ extern mixerr; extern int NBYTES; extern int sfd; extern double dispatch(); /* delete this dummy function when actual performing cmix computation */ /* parse: points to tree to be executed once yacc gets done */ Tree program; /* ug_list MUST be initialized with something... */ struct ug_item ug_head = { 0, 0, "" }; struct ug_item *ug_list = &ug_head; #define CMAX 16 /* allow up to 16 command line args to be passed to subs */ int aargc; char *aargv[CMAX]; /* this are declared in ugens.h */ char name[NAMESIZE];/* to store file name found by card scanner, accessed by m_open in sound.c */ int interactive; /* for m to set interactive mode, set from command line arg later on */ main(argc,argv) char *argv[]; { char buf[256]; float p[256]; short n_args,j; char *malloc(),*bufp,*cp; setlinebuf(stderr); /* just to make fprintf faster. Note that this may not be portable to non BSD systems */ /* copy command-line args, if any*/ aargc = (argc > CMAX) ? CMAX : argc; for(j=0; j Cmix <----------\n"); /* * "Introduce" functions and stuff to program */ ug_intro(); /* introduce standard routines */ profile(); /* introduce user-written routines etc. */ while((*++argv)[0] == '-') { argc -= 2; /* Take away two args */ for(cp = argv[0]+1; *cp; cp++) { switch(*cp) { /* Grap options */ case 'b': interactive = 0; /* set up batch mode */ fprintf(stderr,"Using batch mode\n"); break; case 'r': SR = atof(*++argv); fprintf(stderr,"Sampling rate set to %f\n",SR); break; default: printf("Don't know about option: %c\n",*cp); exit(-1); } } } setbuf(stdout, NULL); /* Want to see stdout errors */ /* * The program is read from stdin, but this can be changed */ yyparse(); /* create intermediate representation */ if(!interactive) exct(program); closesf(); fprintf(stderr,"--------->Goodbye<---------"); } /* * This is the function called be the M-language parser. * It in turn calls the standard cmix dispatch function. */ double parse_dispatch(str,args,n) char *str; int n; double args[]; { int i1; printf ("============================\n"); printf ("%s: ",str); for (i1=0;i1