home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.lbl.gov
/
2014.05.ftp.ee.lbl.gov.tar
/
ftp.ee.lbl.gov
/
bmd-1.0beta.tar.Z
/
bmd-1.0beta.tar
/
bmd-1.0beta
/
app
/
omtd
/
setting.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-27
|
3KB
|
122 lines
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Lawrence Berkeley Laboratory,
* Berkeley, CA. The name of the University may not be used to
* endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <sys/types.h>
#include "readline.h"
#include "setting.h"
#include "etime.h"
struct setting s;
init_settings()
{
bzero((char *)&s, sizeof s);
s.end = ~0;
pt_insert(&s.tempo, 0, (float)1.0);
}
void
set_command(tp)
struct token *tp;
{
int n;
char **p;
static char *set_names[] = {
"start",
#define SETX_START 0
"end",
#define SETX_END 1
"tpb",
#define SETX_TPB 2
"bpb",
#define SETX_BPB 3
0,
#define SETX_LI 4,
"li",
};
if (tp == 0 || tp->t_id != TK_STR)
{
error("set variable value");
return;
}
for (n = 0, p = set_names; *p != 0; ++n, ++p)
if (strcmp(tp->t_str, *p) == 0)
break;
if (*p == 0)
{
error("variable name %s unknown", tp->t_str);
return;
}
tp = tp->next;
if (tp == 0) {
error("error");
return;
}
switch (n)
{
case SETX_START:
tp = parse_time(tp, &s.start);
if (tp != 0)
error("trailing garbage ignored");
break;
case SETX_END:
tp = parse_time(tp, &s.end);
if (tp != 0)
error("trailing garbage ignored");
break;
case SETX_BPB:
if (tp->t_id == TK_INT)
s.beats_per_bar = tp->t_int;
else
error("bpb must be an integer");
break;
case SETX_TPB:
error("tpb cannot be modified");
break;
/* case SETX_LI:
if (tp->t_id == TK_INT)
s.lead_in = tp->t_int;
else
error("li must be an integer");
break;
*/
}
}
setting_command(tp)
struct token *tp;
{
printf("start: ");
ptime(s.start);
printf("\nend: ");
ptime(s.end);
printf("\n");
printf("beats-per-bar: %d\n", s.beats_per_bar);
printf("ticks-per-beat: %d\n", s.ticks_per_beat);
printf("echo channel: %d\n", s.echo_channel);
/* printf("number of lead in bars: %d\n", s.lead_in); */
}