Quick fixes for BSD
This commit is contained in:
parent
1ac96b0d60
commit
53dad0f47b
4 changed files with 10 additions and 7 deletions
2
Makefile
2
Makefile
|
@ -36,7 +36,7 @@ builddir:
|
||||||
@- mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/
|
@- mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/
|
||||||
|
|
||||||
yacc: src/parser.y src/parser.l
|
yacc: src/parser.y src/parser.l
|
||||||
cd src && yacc -d -g parser.y && lex parser.l
|
cd src && bison -y -d parser.y && lex parser.l
|
||||||
$(CC) -c src/y.tab.c -o build-tmp/y.tab.o $(CFLAGS)
|
$(CC) -c src/y.tab.c -o build-tmp/y.tab.o $(CFLAGS)
|
||||||
$(CC) -c src/lex.yy.c -o build-tmp/lex.yy.o $(CFLAGS)
|
$(CC) -c src/lex.yy.c -o build-tmp/lex.yy.o $(CFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@ Pre-requisites:
|
||||||
- GNU Make
|
- GNU Make
|
||||||
|
|
||||||
### Unix
|
### Unix
|
||||||
Running `make` twice should work on most Unix systems.
|
Running `make` (or `gmake` for BSDs) should work on most Unix systems.
|
||||||
It produces an executable called `flisp.amd64`
|
It produces an executable called `flisp.amd64`
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
To meet the previously mentionned pre-requisites, you need to use mingw.
|
To meet the previously mentionned pre-requisites, you need to use mingw.
|
||||||
I recommend installing w64devkit, then compiling Bison and Flex from source.
|
I recommend installing w64devkit, then compiling Bison and Flex from source.
|
||||||
Run `make win`, twice.
|
Run `make win`
|
||||||
|
|
|
@ -599,6 +599,7 @@ Value pop(Value a, Value b){
|
||||||
}
|
}
|
||||||
|
|
||||||
Value write(Value a){
|
Value write(Value a){
|
||||||
|
char *nstr;
|
||||||
switch(a.tag.type){
|
switch(a.tag.type){
|
||||||
case T_null:
|
case T_null:
|
||||||
case T_any:
|
case T_any:
|
||||||
|
@ -614,7 +615,6 @@ Value write(Value a){
|
||||||
printf("%f",a.v4B.vfl);
|
printf("%f",a.v4B.vfl);
|
||||||
break;
|
break;
|
||||||
case T_str:
|
case T_str:
|
||||||
char *nstr;
|
|
||||||
nstr = malloc(a.vstr.len+1);
|
nstr = malloc(a.vstr.len+1);
|
||||||
if(a.vstr.len > 4){
|
if(a.vstr.len > 4){
|
||||||
char *str = get_addr(a.vstr.pos);
|
char *str = get_addr(a.vstr.pos);
|
||||||
|
|
|
@ -54,14 +54,16 @@ Value fncall(FnSig *fn, Statement **params){
|
||||||
case 0:
|
case 0:
|
||||||
returnv = fn->bi();
|
returnv = fn->bi();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:{
|
||||||
Value (*fn1)(Value) = (void*)fn->bi;
|
Value (*fn1)(Value) = (void*)fn->bi;
|
||||||
returnv = fn1(execute(params[0]));
|
returnv = fn1(execute(params[0]));
|
||||||
break;
|
break;
|
||||||
case 2:
|
}
|
||||||
|
case 2:{
|
||||||
Value (*fn2)(Value,Value) = (void*)fn->bi;
|
Value (*fn2)(Value,Value) = (void*)fn->bi;
|
||||||
returnv = fn2(execute(params[0]),execute(params[1]));
|
returnv = fn2(execute(params[0]),execute(params[1]));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
runtime_err("Call to builtin with >2 params");
|
runtime_err("Call to builtin with >2 params");
|
||||||
break;
|
break;
|
||||||
|
@ -146,7 +148,7 @@ Value execute(Statement *stat){
|
||||||
case BI_cast:
|
case BI_cast:
|
||||||
returnv = cast(stat->var_type, execute(stat->children[0]));
|
returnv = cast(stat->var_type, execute(stat->children[0]));
|
||||||
break;
|
break;
|
||||||
case ST_Call:
|
case ST_Call:{
|
||||||
FnSig *fn = stat->func;
|
FnSig *fn = stat->func;
|
||||||
Statement **params = NULL;
|
Statement **params = NULL;
|
||||||
if(fn->n_param)
|
if(fn->n_param)
|
||||||
|
@ -154,5 +156,6 @@ Value execute(Statement *stat){
|
||||||
returnv = fncall(fn, params);
|
returnv = fncall(fn, params);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return returnv;
|
return returnv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue