2022-12-08 21:45:46 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2022-12-09 17:26:10 -07:00
|
|
|
#include "blang.h"
|
|
|
|
#include "ops.h"
|
2022-12-08 21:45:46 -07:00
|
|
|
|
2022-12-09 17:26:10 -07:00
|
|
|
int main(int argc, char **argv){
|
|
|
|
struct State s;
|
2022-12-08 21:45:46 -07:00
|
|
|
int c;
|
2022-12-09 17:26:10 -07:00
|
|
|
void (*op)(struct State *);
|
|
|
|
|
|
|
|
s.chart = *argv;
|
|
|
|
|
|
|
|
while((c = getc(stdin)) != EOF){
|
|
|
|
/* proper exit is ^* */
|
|
|
|
if(s.chart == (char *)0)
|
|
|
|
return (int)s.hand;
|
|
|
|
if((op = Ops_lookup(c)) == NULL)
|
2022-12-08 21:45:46 -07:00
|
|
|
continue;
|
2022-12-09 17:26:10 -07:00
|
|
|
else
|
|
|
|
op(&s);
|
2022-12-08 21:45:46 -07:00
|
|
|
}
|
2022-12-09 17:26:10 -07:00
|
|
|
return 1;
|
2022-12-08 21:45:46 -07:00
|
|
|
}
|