ref: ba269d89ec996085ccd93513bf5b9b80702e06a7
parent: 52677147a7a0e4a4c0db4743dd9de3f7f24de8eb
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Feb 28 20:12:36 EST 2025
less capslock
--- a/src/builtins.c
+++ b/src/builtins.c
@@ -22,9 +22,9 @@
BUILTIN("nconc", nconc)
{
if(nargs == 0)
- return SL_nil;
+ return sl_nil;
- value_t lst, first = SL_nil;
+ value_t lst, first = sl_nil;
value_t *pcdr = &first;
cons_t *c;
int i = 0;
@@ -39,7 +39,7 @@
while(iscons(c->cdr))
c = ptr(c->cdr);
pcdr = &c->cdr;
- }else if(lst != SL_nil)
+ }else if(lst != sl_nil)
type_error("cons", lst);
}
*pcdr = lst;
@@ -61,7 +61,7 @@
return bind;
v = cdr_(v);
}
- return SL_nil;
+ return sl_nil;
}
sl_purefn
@@ -75,7 +75,7 @@
if((c = ptr(v))->car == args[0])
return v;
}
- return SL_nil;
+ return sl_nil;
}
BUILTIN("length", length)
@@ -122,7 +122,7 @@
}
return size_wrap(n);
}
- if(a == SL_nil)
+ if(a == sl_nil)
return fixnum(0);
type_error("sequence", a);
}
@@ -154,7 +154,7 @@
BUILTIN("keyword?", keywordp)
{
argcount(nargs, 1);
- return (issymbol(args[0]) && iskeyword((symbol_t*)ptr(args[0]))) ? SL_t : SL_nil;
+ return (issymbol(args[0]) && iskeyword((symbol_t*)ptr(args[0]))) ? sl_t : sl_nil;
}
sl_purefn
@@ -182,7 +182,7 @@
symbol_t *sym = tosymbol(args[0]);
if(!isconstant(sym))
sym->binding = UNBOUND;
- return SL_void;
+ return sl_void;
}
BUILTIN("environment", environment)
@@ -189,7 +189,7 @@
{
USED(args);
argcount(nargs, 0);
- value_t lst = SL_nil;
+ value_t lst = sl_nil;
sl_gc_handle(&lst);
const char *k = nil;
symbol_t *v;
@@ -206,13 +206,13 @@
{
argcount(nargs, 1);
if(issymbol(args[0]))
- return isconstant((symbol_t*)ptr(args[0])) ? SL_t : SL_nil;
+ return isconstant((symbol_t*)ptr(args[0])) ? sl_t : sl_nil;
if(iscons(args[0])){
- if(car_(args[0]) == SL_quote)
- return SL_t;
- return SL_nil;
+ if(car_(args[0]) == sl_quote)
+ return sl_t;
+ return sl_nil;
}
- return SL_t;
+ return sl_t;
}
sl_purefn
@@ -221,11 +221,11 @@
argcount(nargs, 1);
value_t v = args[0];
if(isfixnum(v) || ismpint(v))
- return SL_t;
+ return sl_t;
if(iscprim(v)){
numerictype_t nt = cp_numtype(ptr(v));
if(nt < T_FLOAT)
- return SL_t;
+ return sl_t;
void *data = cp_data(ptr(v));
if(nt == T_FLOAT){
float f = *(float*)data;
@@ -232,7 +232,7 @@
if(f < 0)
f = -f;
if(f <= FLT_MAXINT && (float)(int32_t)f == f)
- return SL_t;
+ return sl_t;
}else{
assert(nt == T_DOUBLE);
double d = *(double*)data;
@@ -239,10 +239,10 @@
if(d < 0)
d = -d;
if(d <= DBL_MAXINT && (double)(int64_t)d == d)
- return SL_t;
+ return sl_t;
}
}
- return SL_nil;
+ return sl_nil;
}
sl_purefn
@@ -252,7 +252,7 @@
value_t v = args[0];
return (isfixnum(v) || ismpint(v) ||
(iscprim(v) && cp_numtype(ptr(v)) < T_FLOAT)) ?
- SL_t : SL_nil;
+ sl_t : sl_nil;
}
sl_purefn
@@ -259,7 +259,7 @@
BUILTIN("bignum?", bignump)
{
argcount(nargs, 1);
- return ismpint(args[0]) ? SL_t : SL_nil;
+ return ismpint(args[0]) ? sl_t : sl_nil;
}
BUILTIN("fixnum", fixnum)
@@ -319,7 +319,7 @@
value_t v = alloc_vector(i, 0);
int a = 1;
for(size_t k = 0; k < i; k++){
- value_t f = a < nargs ? args[a] : SL_void;
+ value_t f = a < nargs ? args[a] : sl_void;
vector_elt(v, k) = f;
if((a = (a + 1) % nargs) < 1)
a = 1;
@@ -383,13 +383,13 @@
if(nargs == 0){
char buf[4096];
if(getcwd(buf, sizeof(buf)) == nil)
- lerrorf(SL_IOError, "could not get current dir");
+ lerrorf(sl_errio, "could not get current dir");
return string_from_cstr(buf);
}
char *ptr = tostring(args[0]);
if(chdir(ptr) != 0)
- lerrorf(SL_IOError, "could not cd to %s", ptr);
- return SL_void;
+ lerrorf(sl_errio, "could not cd to %s", ptr);
+ return sl_void;
}
BUILTIN("path-exists?", path_existsp)
@@ -396,7 +396,7 @@
{
argcount(nargs, 1);
const char *path = tostring(args[0]);
- return access(path, F_OK) == 0 ? SL_t : SL_nil;
+ return access(path, F_OK) == 0 ? sl_t : sl_nil;
}
BUILTIN("delete-file", delete_file)
@@ -404,8 +404,8 @@
argcount(nargs, 1);
const char *path = tostring(args[0]);
if(remove(path) != 0)
- lerrorf(SL_IOError, "could not remove %s", path);
- return SL_void;
+ lerrorf(sl_errio, "could not remove %s", path);
+ return sl_void;
}
BUILTIN("os-getenv", os_getenv)
@@ -414,7 +414,7 @@
char *name = tostring(args[0]);
char *val = getenv(name);
if(val == nil)
- return SL_nil;
+ return sl_nil;
return cvalue_static_cstring(val);
}
@@ -423,7 +423,7 @@
argcount(nargs, 2);
char *name = tostring(args[0]);
int result;
- if(args[1] == SL_nil)
+ if(args[1] == sl_nil)
result = unsetenv(name);
else{
char *val = tostring(args[1]);
@@ -430,6 +430,6 @@
result = setenv(name, val, 1);
}
if(result != 0)
- lerrorf(SL_ArgError, "invalid environment variable");
- return SL_t;
+ lerrorf(sl_errarg, "invalid environment variable");
+ return sl_t;
}
--- a/src/compress.c
+++ b/src/compress.c
@@ -4,7 +4,7 @@
#include "types.h"
#include "brieflz.h"
-static value_t SL_sizesym, SL_tosym;
+static value_t sl_sizesym, sl_tosym;
BUILTIN("lz-pack", lz_pack)
{
@@ -36,7 +36,7 @@
: blz_pack(in, out, insz, work);
MEM_FREE(work);
if(n == BLZ_ERROR)
- lerrorf(SL_ArgError, "blz error");
+ lerrorf(sl_errarg, "blz error");
cvalue_len(v) = n;
return v;
}
@@ -53,19 +53,19 @@
size_t outsz;
uint8_t *out;
value_t v;
- if(args[1] == SL_sizesym){
+ if(args[1] == sl_sizesym){
outsz = tosize(args[2]);
v = cvalue(cv_class(ptr(args[0])), outsz);
out = cvalue_data(v);
- }else if(args[1] == SL_tosym){
+ }else if(args[1] == sl_tosym){
v = args[2];
to_sized_ptr(v, &out, &outsz);
}else{
- lerrorf(SL_ArgError, "either :size or :to must be specified");
+ lerrorf(sl_errarg, "either :size or :to must be specified");
}
unsigned long n = blz_depack_safe(in, insz, out, outsz);
if(n == BLZ_ERROR)
- lerrorf(SL_ArgError, "blz error");
+ lerrorf(sl_errarg, "blz error");
cvalue_len(v) = n;
return v;
}
@@ -73,6 +73,6 @@
void
compress_init(void)
{
- SL_sizesym = csymbol(":size");
- SL_tosym = csymbol(":to");
+ sl_sizesym = csymbol(":size");
+ sl_tosym = csymbol(":to");
}
--- a/src/cvalues.c
+++ b/src/cvalues.c
@@ -366,7 +366,7 @@
return vector_size(arg);
if(iscons(arg))
return llength(arg);
- if(arg == SL_nil)
+ if(arg == sl_nil)
return 0;
if(isarray(arg))
return cvalue_arraylen(arg);
@@ -386,7 +386,7 @@
if(iscons(cdr_(cdr_(type)))){
size_t tc = tosize(car_(cdr_(cdr_(type))));
if(tc != cnt)
- lerrorf(SL_ArgError, "size mismatch");
+ lerrorf(sl_errarg, "size mismatch");
}
sz = elsize * cnt;
@@ -399,7 +399,7 @@
}
return;
}
- if(iscons(arg) || arg == SL_nil){
+ if(iscons(arg) || arg == sl_nil){
i = 0;
while(iscons(arg)){
if(i == cnt){
@@ -412,7 +412,7 @@
arg = cdr_(arg);
}
if(i != cnt)
- lerrorf(SL_ArgError, "size mismatch");
+ lerrorf(sl_errarg, "size mismatch");
return;
}
if(iscvalue(arg)){
@@ -423,11 +423,11 @@
if(cv_len(cv) == sz)
memcpy(dest, cv_data(cv), sz);
else
- lerrorf(SL_ArgError, "size mismatch");
+ lerrorf(sl_errarg, "size mismatch");
return;
}else{
// TODO: initialize array from different type elements
- lerrorf(SL_ArgError, "element type mismatch");
+ lerrorf(sl_errarg, "element type mismatch");
}
}
}
@@ -470,7 +470,7 @@
argcount(nargs, 3);
cnt = tosize(args[1]);
if(cnt < 0)
- lerrorf(SL_ArgError, "invalid size: %"PRIu64, (uint64_t)cnt);
+ lerrorf(sl_errarg, "invalid size: %"PRIu64, (uint64_t)cnt);
sltype_t *type = get_array_type(args[0]);
elsize = type->elsz;
@@ -509,10 +509,10 @@
if(iscons(type)){
value_t hed = car_(type);
- if(hed == SL_arraysym){
+ if(hed == sl_arraysym){
value_t t = car(cdr_(type));
if(!iscons(cdr_(cdr_(type))))
- lerrorf(SL_ArgError, "incomplete type");
+ lerrorf(sl_errarg, "incomplete type");
value_t n = car_(cdr_(cdr_(type)));
size_t sz = tosize(n);
return sz * ctype_sizeof(t);
@@ -519,7 +519,7 @@
}
}
- lerrorf(SL_ArgError, "invalid c type");
+ lerrorf(sl_errarg, "invalid c type");
}
// get pointer and size for any plain-old-data value
@@ -565,22 +565,22 @@
{
argcount(nargs, 1);
switch(tag(args[0])){
- case TAG_CONS: return SL_conssym;
- case TAG_NUM1: case TAG_NUM: return SL_fixnumsym;
- case TAG_SYM: return SL_symbolsym;
- case TAG_VECTOR: return SL_vectorsym;
+ case TAG_CONS: return sl_conssym;
+ case TAG_NUM1: case TAG_NUM: return sl_fixnumsym;
+ case TAG_SYM: return sl_symbolsym;
+ case TAG_VECTOR: return sl_vectorsym;
case TAG_FUNCTION:
- if(args[0] == SL_t)
- return SL_booleansym;
- if(args[0] == SL_nil)
- return SL_nullsym;
- if(args[0] == SL_eof)
- return SL_eof;
- if(args[0] == SL_void)
- return SL_void;
+ if(args[0] == sl_t)
+ return sl_booleansym;
+ if(args[0] == sl_nil)
+ return sl_nullsym;
+ if(args[0] == sl_eof)
+ return sl_eof;
+ if(args[0] == sl_void)
+ return sl_void;
if(isbuiltin(args[0]))
- return SL_builtinsym;
- return SL_function;
+ return sl_builtinsym;
+ return sl_function;
}
return cv_type(ptr(args[0]));
}
@@ -637,11 +637,11 @@
{
argcount(nargs, 1);
if(iscons(args[0]) || isvector(args[0]))
- lerrorf(SL_ArgError, "argument must be a leaf atom");
+ lerrorf(sl_errarg, "argument must be a leaf atom");
if(!iscvalue(args[0]))
return args[0];
if(!cv_isPOD(ptr(args[0])))
- lerrorf(SL_ArgError, "argument must be a plain-old-data type");
+ lerrorf(sl_errarg, "argument must be a plain-old-data type");
return cvalue_copy(args[0]);
}
@@ -651,7 +651,7 @@
argcount(nargs, 1);
return (iscprim(args[0]) ||
(iscvalue(args[0]) && cv_isPOD(ptr(args[0])))) ?
- SL_t : SL_nil;
+ sl_t : sl_nil;
}
static void
@@ -659,7 +659,7 @@
{
cvinitfunc_t f = type->init;
if(f == nil)
- lerrorf(SL_ArgError, "invalid c type");
+ lerrorf(sl_errarg, "invalid c type");
f(type, v, dest);
}
@@ -781,7 +781,7 @@
argcount(nargs, 1);
symbol_t *s = tosymbol(args[0]);
if(!iscbuiltin(s->binding))
- lerrorf(SL_ArgError, "function \"%s\" not found", s->name);
+ lerrorf(sl_errarg, "function \"%s\" not found", s->name);
return s->binding;
}
@@ -804,7 +804,7 @@
#define cv_intern(tok) \
do{ \
- SL_##tok##sym = csymbol(#tok); \
+ sl_##tok##sym = csymbol(#tok); \
}while(0)
#define ctor_cv_intern(tok, nt, ctype) \
@@ -811,9 +811,9 @@
do{ \
symbol_t *s; \
cv_intern(tok); \
- set(SL_##tok##sym, cbuiltin(#tok, fn_builtin_##tok)); \
+ set(sl_##tok##sym, cbuiltin(#tok, fn_builtin_##tok)); \
if(valid_numtype(nt)){ \
- s = ptr(SL_##tok##sym); \
+ s = ptr(sl_##tok##sym); \
s->numtype = nt; \
s->size = sizeof(ctype); \
} \
@@ -821,7 +821,7 @@
#define mk_primtype(name, ctype) \
do{ \
- SL(name##type) = get_type(SL_##name##sym); \
+ SL(name##type) = get_type(sl_##name##sym); \
SL(name##type)->init = cvalue_##ctype##_init; \
}while(0)
@@ -989,7 +989,7 @@
_Noreturn void
divide_by_0_error(void)
{
- lerrorf(SL_DivideError, "/: division by zero");
+ lerrorf(sl_errdiv0, "/: division by zero");
}
value_t
@@ -1156,7 +1156,7 @@
}
}
assert(0);
- return SL_nil;
+ return sl_nil;
}
BUILTIN("logand", logand)
@@ -1307,7 +1307,7 @@
htable_new(&SL(TypeTable), 256);
htable_new(&SL(reverse_dlsym_lookup_table), 256);
- SL(builtintype) = define_opaque_type(SL_builtinsym, sizeof(builtin_t), nil, nil);
+ SL(builtintype) = define_opaque_type(sl_builtinsym, sizeof(builtin_t), nil, nil);
ctor_cv_intern(int8, T_INT8, int8_t);
ctor_cv_intern(uint8, T_UINT8, uint8_t);
@@ -1324,11 +1324,11 @@
ctor_cv_intern(array, NONNUMERIC, int);
- SL_stringtypesym = csymbol("*string-type*");
- setc(SL_stringtypesym, sl_list2(SL_arraysym, SL_bytesym));
+ sl_stringtypesym = csymbol("*string-type*");
+ setc(sl_stringtypesym, sl_list2(sl_arraysym, sl_bytesym));
- SL_runestringtypesym = csymbol("*runestring-type*");
- setc(SL_runestringtypesym, sl_list2(SL_arraysym, SL_runesym));
+ sl_runestringtypesym = csymbol("*runestring-type*");
+ setc(sl_runestringtypesym, sl_list2(sl_arraysym, sl_runesym));
mk_primtype(int8, int8_t);
mk_primtype(uint8, uint8_t);
@@ -1344,11 +1344,11 @@
mk_primtype(double, double);
ctor_cv_intern(bignum, T_MPINT, mpint*);
- SL(mpinttype) = get_type(SL_bignumsym);
+ SL(mpinttype) = get_type(sl_bignumsym);
SL(mpinttype)->init = cvalue_mpint_init;
SL(mpinttype)->vtable = &mpint_vtable;
- SL(stringtype) = get_type(symbol_value(SL_stringtypesym));
+ SL(stringtype) = get_type(symbol_value(sl_stringtypesym));
SL(the_empty_string) = cvalue_from_ref(SL(stringtype), (char*)"", 0);
- SL(runestringtype) = get_type(symbol_value(SL_runestringtypesym));
+ SL(runestringtype) = get_type(symbol_value(sl_runestringtypesym));
}
--- a/src/equal.c
+++ b/src/equal.c
@@ -23,7 +23,7 @@
{
value_t c = (value_t)ptrhash_get(table, (void*)key);
if(c == (value_t)HT_NOTFOUND)
- return SL_nil;
+ return sl_nil;
if(c == key)
return c;
return eq_class(table, c);
@@ -32,8 +32,8 @@
static void
eq_union(htable_t *table, value_t a, value_t b, value_t c, value_t cb)
{
- value_t ca = c == SL_nil ? a : c;
- if(cb != SL_nil)
+ value_t ca = c == sl_nil ? a : c;
+ if(cb != sl_nil)
ptrhash_put(table, (void*)cb, (void*)ca);
ptrhash_put(table, (void*)a, (void*)ca);
ptrhash_put(table, (void*)b, (void*)ca);
@@ -53,7 +53,7 @@
m = la < lb ? la : lb;
for(i = 0; i < m; i++){
value_t d = bounded_compare(vector_elt(a, i), vector_elt(b, i), bound-1, eq);
- if(d == SL_nil || numval(d) != 0)
+ if(d == sl_nil || numval(d) != 0)
return d;
}
if(la < lb)
@@ -75,7 +75,7 @@
if(a == b)
return fixnum(0);
if(bound <= 0)
- return SL_nil;
+ return sl_nil;
int taga = tag(a);
int tagb = cmptag(b);
int c;
@@ -133,13 +133,13 @@
function_t *fa = ptr(a);
function_t *fb = ptr(b);
d = bounded_compare(fa->bcode, fb->bcode, bound-1, eq);
- if(d == SL_nil || numval(d) != 0)
+ if(d == sl_nil || numval(d) != 0)
return d;
d = bounded_compare(fa->vals, fb->vals, bound-1, eq);
- if(d == SL_nil || numval(d) != 0)
+ if(d == sl_nil || numval(d) != 0)
return d;
d = bounded_compare(fa->env, fb->env, bound-1, eq);
- if(d == SL_nil || numval(d) != 0)
+ if(d == sl_nil || numval(d) != 0)
return d;
return fixnum(0);
}
@@ -150,7 +150,7 @@
if(tagb < TAG_CONS)
return fixnum(1);
d = bounded_compare(car_(a), car_(b), bound-1, eq);
- if(d == SL_nil || numval(d) != 0)
+ if(d == sl_nil || numval(d) != 0)
return d;
a = cdr_(a); b = cdr_(b);
bound--;
@@ -176,7 +176,7 @@
xb = vector_elt(b, i);
if(leafp(xa) || leafp(xb)){
d = bounded_compare(xa, xb, 1, eq);
- if(d != SL_nil && numval(d) != 0)
+ if(d != sl_nil && numval(d) != 0)
return d;
}else if(tag(xa) < tag(xb))
return fixnum(-1);
@@ -186,7 +186,7 @@
ca = eq_class(table, a);
cb = eq_class(table, b);
- if(ca != SL_nil && ca == cb)
+ if(ca != sl_nil && ca == cb)
return fixnum(0);
eq_union(table, a, b, ca, cb);
@@ -227,7 +227,7 @@
int tagdb = tag(db);
if(leafp(aa) || leafp(ab)){
d = bounded_compare(aa, ab, 1, eq);
- if(d != SL_nil && numval(d) != 0)
+ if(d != sl_nil && numval(d) != 0)
return d;
}
if(tagaa < tagab)
@@ -236,7 +236,7 @@
return fixnum(1);
if(leafp(da) || leafp(db)){
d = bounded_compare(da, db, 1, eq);
- if(d != SL_nil && numval(d) != 0)
+ if(d != sl_nil && numval(d) != 0)
return d;
}
if(tagda < tagdb)
@@ -246,7 +246,7 @@
ca = eq_class(table, a);
cb = eq_class(table, b);
- if(ca != SL_nil && ca == cb)
+ if(ca != sl_nil && ca == cb)
return fixnum(0);
eq_union(table, a, b, ca, cb);
@@ -271,7 +271,7 @@
ca = eq_class(table, a);
cb = eq_class(table, b);
- if(ca != SL_nil && ca == cb)
+ if(ca != sl_nil && ca == cb)
return fixnum(0);
eq_union(table, a, b, ca, cb);
@@ -298,7 +298,7 @@
sl_compare(value_t a, value_t b, bool eq)
{
value_t guess = bounded_compare(a, b, BOUNDED_COMPARE_BOUND, eq);
- if(guess == SL_nil){
+ if(guess == sl_nil){
guess = cyc_compare(a, b, &equal_eq_hashtable, eq);
htable_reset(&equal_eq_hashtable, 512);
}
--- a/src/iostream.c
+++ b/src/iostream.c
@@ -51,7 +51,7 @@
BUILTIN("iostream?", iostreamp)
{
argcount(nargs, 1);
- return isiostream(args[0]) ? SL_t : SL_nil;
+ return isiostream(args[0]) ? sl_t : sl_nil;
}
sl_purefn
@@ -58,7 +58,7 @@
BUILTIN("eof-object?", eof_objectp)
{
argcount(nargs, 1);
- return args[0] == SL_eof ? SL_t : SL_nil;
+ return args[0] == sl_eof ? sl_t : sl_nil;
}
sl_purefn
@@ -76,15 +76,15 @@
argcount(nargs, 1);
bool r = false, w = false, c = false, t = false, a = false;
for(int i = 1; i < nargs; i++){
- if(args[i] == SL_rdsym)
+ if(args[i] == sl_rdsym)
r = 1;
- else if(args[i] == SL_wrsym)
+ else if(args[i] == sl_wrsym)
w = 1;
- else if(args[i] == SL_apsym)
+ else if(args[i] == sl_apsym)
a = w = 1;
- else if(args[i] == SL_crsym)
+ else if(args[i] == sl_crsym)
c = w = 1;
- else if(args[i] == SL_truncsym)
+ else if(args[i] == sl_truncsym)
t = w = 1;
}
if(!r && !w && !c && !t && !a)
@@ -93,7 +93,7 @@
char *fname = tostring(args[0]);
ios_t *s = value2c(ios_t*, f);
if(ios_file(s, fname, r, w, c, t) == nil)
- lerrorf(SL_IOError, "could not open \"%s\"", fname);
+ lerrorf(sl_errio, "could not open \"%s\"", fname);
if(a)
ios_seek_end(s);
return f;
@@ -106,7 +106,7 @@
value_t f = cvalue(SL(iostreamtype), sizeof(ios_t));
ios_t *s = value2c(ios_t*, f);
if(ios_mem(s, 0) == nil)
- lerrorf(SL_MemoryError, "could not allocate stream");
+ lerrorf(sl_errmem, "could not allocate stream");
return f;
}
@@ -114,11 +114,11 @@
{
if(nargs > 1)
argcount(nargs, 1);
- value_t a = nargs == 0 ? symbol_value(SL_instrsym) : args[0];
+ value_t a = nargs == 0 ? symbol_value(sl_instrsym) : args[0];
sl_gc_handle(&a);
value_t v = sl_read_sexpr(a);
sl_free_gc_handles(1);
- return ios_eof(toiostream(a)) ? SL_eof : v;
+ return ios_eof(toiostream(a)) ? sl_eof : v;
}
BUILTIN("io-getc", io_getc)
@@ -128,10 +128,10 @@
Rune r;
int res;
if((res = ios_getutf8(s, &r)) == IOS_EOF)
- //lerrorf(SL_IOError, "end of file reached");
- return SL_eof;
+ //lerrorf(sl_errio, "end of file reached");
+ return sl_eof;
if(res == 0)
- lerrorf(SL_IOError, "invalid UTF-8 sequence");
+ lerrorf(sl_errio, "invalid UTF-8 sequence");
return mk_rune(r);
}
@@ -142,10 +142,10 @@
ios_t *s = toiostream(args[0]);
int r = ios_wait(s, nargs > 1 ? todouble(args[1]) : -1);
if(r >= 0)
- return r ? SL_t : SL_nil;
+ return r ? sl_t : sl_nil;
if(r == IOS_EOF)
- return SL_eof;
- lerrorf(SL_IOError, "i/o error");
+ return sl_eof;
+ lerrorf(sl_errio, "i/o error");
}
BUILTIN("io-putc", io_putc)
@@ -166,7 +166,7 @@
off_t off = tooffset(args[1]);
off_t res = ios_skip(s, off);
if(res < 0)
- return SL_nil;
+ return sl_nil;
return sizeof(res) == sizeof(int64_t) ? mk_int64(res) : mk_int32(res);
}
@@ -173,7 +173,7 @@
BUILTIN("io-flush", io_flush)
{
argcount(nargs, 1);
- return ios_flush(toiostream(args[0])) == 0 ? SL_t : SL_nil;
+ return ios_flush(toiostream(args[0])) == 0 ? sl_t : sl_nil;
}
BUILTIN("io-close", io_close)
@@ -180,7 +180,7 @@
{
argcount(nargs, 1);
ios_close(toiostream(args[0]));
- return SL_void;
+ return sl_void;
}
BUILTIN("io-truncate", io_truncate)
@@ -188,8 +188,8 @@
argcount(nargs, 2);
ios_t *s = toiostream(args[0]);
if(ios_trunc(s, tooffset(args[1])) < 0)
- lerrorf(SL_IOError, "truncation failed");
- return SL_void;
+ lerrorf(sl_errio, "truncation failed");
+ return sl_void;
}
BUILTIN("io-discardbuffer", io_discardbuffer)
@@ -196,7 +196,7 @@
{
argcount(nargs, 1);
ios_purge(toiostream(args[0]));
- return SL_void;
+ return sl_void;
}
sl_purefn
@@ -203,7 +203,7 @@
BUILTIN("io-eof?", io_eofp)
{
argcount(nargs, 1);
- return ios_eof(toiostream(args[0])) ? SL_t : SL_nil;
+ return ios_eof(toiostream(args[0])) ? sl_t : sl_nil;
}
BUILTIN("io-seek", io_seek)
@@ -213,8 +213,8 @@
size_t pos = tosize(args[1]);
off_t res = ios_seek(s, (off_t)pos);
if(res < 0)
- return SL_nil;
- return SL_t;
+ return sl_nil;
+ return sl_t;
}
BUILTIN("io-pos", io_pos)
@@ -223,7 +223,7 @@
ios_t *s = toiostream(args[0]);
off_t res = ios_pos(s);
if(res < 0)
- return SL_nil;
+ return sl_nil;
return size_wrap((size_t)res);
}
@@ -232,7 +232,7 @@
if(nargs < 1 || nargs > 2)
argcount(nargs, 1);
ios_t *s;
- s = nargs == 2 ? toiostream(args[1]) : toiostream(symbol_value(SL_outstrsym));
+ s = nargs == 2 ? toiostream(args[1]) : toiostream(symbol_value(sl_outstrsym));
sl_print(s, args[0]);
return args[0];
}
@@ -251,7 +251,7 @@
}else{
ft = get_type(args[1]);
if(ft->eltype != nil && !iscons(cdr_(cdr_(args[1]))))
- lerrorf(SL_ArgError, "incomplete type");
+ lerrorf(sl_errarg, "incomplete type");
n = ft->size;
}
value_t cv = cvalue(ft, n);
@@ -258,8 +258,8 @@
uint8_t *data = cptr(cv);
size_t got = ios_read(s, data, n);
if(got < n)
- //lerrorf(SL_IOError, "end of input reached");
- return SL_eof;
+ //lerrorf(sl_errio, "end of input reached");
+ return sl_eof;
return cv;
}
@@ -284,7 +284,7 @@
cprim_t *cp = ptr(v);
if(iscprim(args[1]) && cp_class(cp) == SL(runetype)){
if(nargs > 2)
- lerrorf(SL_ArgError, "offset argument not supported for characters");
+ lerrorf(sl_errarg, "offset argument not supported for characters");
Rune r = *(Rune*)cp_data(ptr(args[1]));
return fixnum(ios_pututf8(s, r));
}
@@ -306,7 +306,7 @@
if(uldelim > 0x7f){
// runes > 0x7f, or anything else > 0xff, are out of range
if((iscprim(arg) && cp_class(ptr(arg)) == SL(runetype)) || uldelim > 0xff)
- lerrorf(SL_ArgError, "delimiter out of range");
+ lerrorf(sl_errarg, "delimiter out of range");
}
return (uint8_t)uldelim;
}
@@ -333,7 +333,7 @@
((uint8_t*)cv->data)[n] = 0;
}
if(n == 0 && ios_eof(src))
- return SL_eof;
+ return sl_eof;
return str;
}
@@ -426,11 +426,11 @@
argcount(nargs, 1);
ios_t *src = toiostream(args[0]);
if(src->bm != bm_mem)
- lerrorf(SL_ArgError, "requires memory stream");
+ lerrorf(sl_errarg, "requires memory stream");
bool eof = ios_eof(src);
value_t v = stream_to_string(&args[0]);
if(eof && v == SL(the_empty_string))
- v = SL_eof;
+ v = sl_eof;
return v;
}
@@ -437,15 +437,15 @@
void
iostream_init(void)
{
- SL_iostreamsym = csymbol("iostream");
- SL_rdsym = csymbol(":read");
- SL_wrsym = csymbol(":write");
- SL_apsym = csymbol(":append");
- SL_crsym = csymbol(":create");
- SL_truncsym = csymbol(":truncate");
- SL_instrsym = csymbol("*input-stream*");
- SL_outstrsym = csymbol("*output-stream*");
- SL(iostreamtype) = define_opaque_type(SL_iostreamsym, sizeof(ios_t), &iostream_vtable, nil);
+ sl_iostreamsym = csymbol("iostream");
+ sl_rdsym = csymbol(":read");
+ sl_wrsym = csymbol(":write");
+ sl_apsym = csymbol(":append");
+ sl_crsym = csymbol(":create");
+ sl_truncsym = csymbol(":truncate");
+ sl_instrsym = csymbol("*input-stream*");
+ sl_outstrsym = csymbol("*output-stream*");
+ SL(iostreamtype) = define_opaque_type(sl_iostreamsym, sizeof(ios_t), &iostream_vtable, nil);
set(csymbol("*stdout*"), cvalue_from_ref(SL(iostreamtype), ios_stdout, sizeof(ios_t)));
set(csymbol("*stderr*"), cvalue_from_ref(SL(iostreamtype), ios_stderr, sizeof(ios_t)));
set(csymbol("*stdin*"), cvalue_from_ref(SL(iostreamtype), ios_stdin, sizeof(ios_t)));
--- a/src/print.c
+++ b/src/print.c
@@ -177,7 +177,7 @@
return cv_len(ptr(v)) < SMALL_STR_LEN;
return (
isfixnum(v) || isbuiltin(v) || iscprim(v) ||
- v == SL_t || v == SL_nil || v == SL_eof || v == SL_void
+ v == sl_t || v == sl_nil || v == sl_eof || v == sl_void
);
}
@@ -190,7 +190,7 @@
return true;
if(iscons(v)){
if(tinyp(car_(v)) &&
- (tinyp(cdr_(v)) || (iscons(cdr_(v)) && tinyp(car_(cdr_(v))) && cdr_(cdr_(v)) == SL_nil)))
+ (tinyp(cdr_(v)) || (iscons(cdr_(v)) && tinyp(car_(cdr_(v))) && cdr_(cdr_(v)) == sl_nil)))
return true;
return false;
}
@@ -208,8 +208,8 @@
specialindent(value_t head)
{
// indent these forms 2 spaces, not lined up with the first argument
- if(head == SL_lambda || head == SL_trycatch || head == SL_defsym ||
- head == SL_defmacrosym || head == SL_forsym)
+ if(head == sl_lambda || head == sl_trycatch || head == sl_defsym ||
+ head == sl_defmacrosym || head == sl_forsym)
return 2;
return -1;
}
@@ -246,7 +246,7 @@
indentafter3(value_t head, value_t v)
{
// for certain X always indent (X a b c) after b
- return head == SL_forsym && !allsmallp(cdr_(v));
+ return head == sl_forsym && !allsmallp(cdr_(v));
}
static int
@@ -253,7 +253,7 @@
indentafter2(value_t head, value_t v)
{
// for certain X always indent (X a b) after a
- return (head == SL_defsym || head == SL_defmacrosym) && !allsmallp(cdr_(v));
+ return (head == sl_defsym || head == sl_defmacrosym) && !allsmallp(cdr_(v));
}
static bool
@@ -262,7 +262,7 @@
// indent before every subform of a special form, unless every
// subform is "small"
value_t c = car_(v);
- if(c == SL_lambda || c == SL_setqsym)
+ if(c == sl_lambda || c == sl_setqsym)
return false;
//if(c == SL(IF)) // TODO: others
// return !allsmallp(cdr_(v));
@@ -284,13 +284,13 @@
{
value_t cd;
const char *op;
- if(iscons(cdr_(v)) && cdr_(cdr_(v)) == SL_nil &&
+ if(iscons(cdr_(v)) && cdr_(cdr_(v)) == sl_nil &&
!ptrhash_has(&SL(printconses), (void*)cdr_(v)) &&
- ((car_(v) == SL_quote && (op = "'")) ||
- (car_(v) == SL_backquote && (op = "`")) ||
- (car_(v) == SL_comma && (op = ",")) ||
- (car_(v) == SL_commaat && (op = ",@")) ||
- (car_(v) == SL_commadot && (op = ",.")))){
+ ((car_(v) == sl_quote && (op = "'")) ||
+ (car_(v) == sl_backquote && (op = "`")) ||
+ (car_(v) == sl_comma && (op = ",")) ||
+ (car_(v) == sl_commaat && (op = ",@")) ||
+ (car_(v) == sl_commadot && (op = ",.")))){
// special prefix syntax
unmark_cons(v);
unmark_cons(cdr_(v));
@@ -311,7 +311,7 @@
int n_unindented = 1;
while(1){
cd = cdr_(v);
- if(SL(print_length) >= 0 && n >= SL(print_length) && cd != SL_nil){
+ if(SL(print_length) >= 0 && n >= SL(print_length) && cd != sl_nil){
outsn(f, "...)", 4);
break;
}
@@ -319,7 +319,7 @@
unmark_cons(v);
sl_print_child(f, car_(v));
if(!iscons(cd) || ptrhash_has(&SL(printconses), (void*)cd)){
- if(cd != SL_nil){
+ if(cd != sl_nil){
outsn(f, " . ", 3);
sl_print_child(f, cd);
}
@@ -328,7 +328,7 @@
}
if(!SL(print_pretty) ||
- (head == SL_lambda && n == 0)){
+ (head == sl_lambda && n == 0)){
// never break line before lambda-list
ind = 0;
}else{
@@ -342,7 +342,7 @@
(est != -1 && SL(hpos)+est > SL(scr_width)-2) ||
- (head == SL_lambda && !nextsmall) ||
+ (head == sl_lambda && !nextsmall) ||
(n > 0 && always) ||
@@ -417,13 +417,13 @@
print_symbol_name(f, name);
break;
case TAG_FUNCTION:
- if(v == SL_t)
+ if(v == sl_t)
outc(f, 'T');
- else if(v == SL_nil)
+ else if(v == sl_nil)
outsn(f, "NIL", 3);
- else if(v == SL_eof)
+ else if(v == sl_eof)
outsn(f, "#<eof>", 6);
- else if(v == SL_void){
+ else if(v == sl_void){
outsn(f, "#<void>", 7);
}else if(isbuiltin(v)){
if(!SL(print_princ))
@@ -445,11 +445,11 @@
data[i] -= 48;
outc(f, ' ');
sl_print_child(f, fn->vals);
- if(fn->env != SL_nil){
+ if(fn->env != sl_nil){
outc(f, ' ');
sl_print_child(f, fn->env);
}
- if(fn->name != SL_lambda){
+ if(fn->name != sl_lambda){
outc(f, ' ');
sl_print_child(f, fn->name);
}
@@ -641,7 +641,7 @@
static void
cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, int weak)
{
- if(type == SL_bytesym){
+ if(type == sl_bytesym){
uint8_t ch = *(uint8_t*)data;
if(SL(print_princ))
outc(f, ch);
@@ -649,7 +649,7 @@
SL(hpos) += ios_printf(f, "0x%hhx", ch);
else
SL(hpos) += ios_printf(f, "#byte(0x%hhx)", ch);
- }else if(type == SL_runesym){
+ }else if(type == sl_runesym){
Rune r = *(Rune*)data;
char seq[UTFmax+1];
int nb = runetochar(seq, &r);
@@ -678,11 +678,11 @@
break;
}
}
- }else if(type == SL_floatsym || type == SL_doublesym){
+ }else if(type == sl_floatsym || type == sl_doublesym){
char buf[64];
double d;
int ndec;
- if(type == SL_floatsym){
+ if(type == sl_floatsym){
d = (double)*(float*)data;
ndec = 8;
}else{
@@ -697,7 +697,7 @@
rep = signbit(d) ? "-nan.0" : "+nan.0";
else
rep = signbit(d) ? "-wtf.0" : "+wtf.0";
- if(type == SL_floatsym && !SL(print_princ) && !weak)
+ if(type == sl_floatsym && !SL(print_princ) && !weak)
SL(hpos) += ios_printf(f, "#%s(%s)", symbol_name(type), rep);
else
outs(f, rep);
@@ -706,7 +706,7 @@
outsn(f, "-0.0", 4);
else
outsn(f, "0.0", 3);
- if(type == SL_floatsym && !SL(print_princ) && !weak)
+ if(type == sl_floatsym && !SL(print_princ) && !weak)
outc(f, 'f');
}else{
snprint_real(buf, sizeof(buf), d, 0, ndec, 3, 10);
@@ -714,16 +714,16 @@
outs(f, buf);
if(!hasdec)
outsn(f, ".0", 2);
- if(type == SL_floatsym && !SL(print_princ) && !weak)
+ if(type == sl_floatsym && !SL(print_princ) && !weak)
outc(f, 'f');
}
- }else if(type == SL_uint64sym){
+ }else if(type == sl_uint64sym){
uint64_t ui64 = *(uint64_t*)data;
if(weak || SL(print_princ))
SL(hpos) += ios_printf(f, "%"PRIu64, ui64);
else
SL(hpos) += ios_printf(f, "#%s(%"PRIu64")", symbol_name(type), ui64);
- }else if(type == SL_bignumsym){
+ }else if(type == sl_bignumsym){
mpint *i = *(mpint**)data;
char *s = mptoa(i, 10, nil, 0);
SL(hpos) += ios_printf(f, "%s", s);
@@ -742,7 +742,7 @@
SL(hpos) += ios_printf(f, "#<%s>", symbol_name(type));
}
}else if(iscons(type)){
- if(car_(type) == SL_arraysym){
+ if(car_(type) == sl_arraysym){
size_t i;
value_t eltype = car(cdr_(type));
size_t cnt, elsize;
@@ -754,7 +754,7 @@
elsize = ctype_sizeof(eltype);
cnt = elsize ? len/elsize : 0;
}
- if(eltype == SL_bytesym){
+ if(eltype == sl_bytesym){
if(SL(print_princ)){
ios_write(f, data, len);
/*
@@ -770,7 +770,7 @@
outc(f, '"');
}
return;
- }else if(eltype == SL_runesym){
+ }else if(eltype == sl_runesym){
char buf[UTFmax+1];
if(!SL(print_princ))
outc(f, '"');
@@ -787,7 +787,7 @@
return;
}
if(!weak){
- if(eltype == SL_uint8sym){
+ if(eltype == sl_uint8sym){
outsn(f, "#vu8(", 5);
}else{
outsn(f, "#array(", 7);
@@ -838,7 +838,7 @@
static void
set_print_width(void)
{
- value_t pw = symbol_value(SL_printwidthsym);
+ value_t pw = symbol_value(sl_printwidthsym);
if(!isfixnum(pw))
return;
SL(scr_width) = numval(pw);
@@ -847,13 +847,13 @@
void
sl_print(ios_t *f, value_t v)
{
- SL(print_pretty) = symbol_value(SL_printprettysym) != SL_nil;
+ SL(print_pretty) = symbol_value(sl_printprettysym) != sl_nil;
if(SL(print_pretty))
set_print_width();
- SL(print_princ) = symbol_value(SL_printreadablysym) == SL_nil;
- value_t pl = symbol_value(SL_printlengthsym);
+ SL(print_princ) = symbol_value(sl_printreadablysym) == sl_nil;
+ value_t pl = symbol_value(sl_printlengthsym);
SL(print_length) = isfixnum(pl) ? numval(pl) : -1;
- pl = symbol_value(SL_printlevelsym);
+ pl = symbol_value(sl_printlevelsym);
SL(print_level) = isfixnum(pl) ? numval(pl) : -1;
SL(p_level) = 0;
@@ -868,6 +868,6 @@
memset(SL(consflags), 0, 4*bitvector_nwords(SL(heapsize)/sizeof(cons_t)));
if((iscons(v) || isvector(v) || isfunction(v) || iscvalue(v)) &&
- !sl_isstring(v) && v != SL_t && v != SL_nil && v != SL_void)
+ !sl_isstring(v) && v != sl_t && v != sl_nil && v != sl_void)
htable_reset(&SL(printconses), 32);
}
--- a/src/read.c
+++ b/src/read.c
@@ -137,7 +137,7 @@
value_t msg = string_from_cstr(msgbuf);
va_end(args);
- sl_raise(sl_list2(SL_ParseError, msg));
+ sl_raise(sl_list2(sl_errparse, msg));
}
static void
@@ -250,18 +250,18 @@
read_token(ctx, (char)cval, 0);
ctx->tokval = symbol(ctx->buf, true);
if(ctx->buf[1] == '\0') USED(cval); /* one character */
- else if(ctx->tokval == SL_nulsym) cval = 0x00;
- else if(ctx->tokval == SL_alarmsym) cval = 0x07;
- else if(ctx->tokval == SL_backspacesym) cval = 0x08;
- else if(ctx->tokval == SL_tabsym) cval = 0x09;
- else if(ctx->tokval == SL_linefeedsym) cval = 0x0A;
- else if(ctx->tokval == SL_newlinesym) cval = 0x0A;
- else if(ctx->tokval == SL_vtabsym) cval = 0x0B;
- else if(ctx->tokval == SL_pagesym) cval = 0x0C;
- else if(ctx->tokval == SL_returnsym) cval = 0x0D;
- else if(ctx->tokval == SL_escsym) cval = 0x1B;
- else if(ctx->tokval == SL_spacesym) cval = 0x20;
- else if(ctx->tokval == SL_deletesym) cval = 0x7F;
+ else if(ctx->tokval == sl_nulsym) cval = 0x00;
+ else if(ctx->tokval == sl_alarmsym) cval = 0x07;
+ else if(ctx->tokval == sl_backspacesym) cval = 0x08;
+ else if(ctx->tokval == sl_tabsym) cval = 0x09;
+ else if(ctx->tokval == sl_linefeedsym) cval = 0x0A;
+ else if(ctx->tokval == sl_newlinesym) cval = 0x0A;
+ else if(ctx->tokval == sl_vtabsym) cval = 0x0B;
+ else if(ctx->tokval == sl_pagesym) cval = 0x0C;
+ else if(ctx->tokval == sl_returnsym) cval = 0x0D;
+ else if(ctx->tokval == sl_escsym) cval = 0x1B;
+ else if(ctx->tokval == sl_spacesym) cval = 0x20;
+ else if(ctx->tokval == sl_deletesym) cval = 0x7F;
else
parse_error(&ctx->loc, "unknown character #\\%s", ctx->buf);
}
@@ -373,11 +373,11 @@
}
ctx->toktype = TOK_SYM;
if(strcasecmp(s, "nil") == 0)
- ctx->tokval = SL_nil;
+ ctx->tokval = sl_nil;
else if(s[1] == 0 && (s[0] == 't' || s[0] == 'T'))
- ctx->tokval = SL_t;
+ ctx->tokval = sl_t;
else if(strcmp(s, "λ") == 0 || strcmp(s, "lambda") == 0)
- ctx->tokval = SL_lambda;
+ ctx->tokval = sl_lambda;
else{
ctx->tokval = symbol(s, true);
if(s[strlen(s)-1] == '#')
@@ -556,13 +556,13 @@
loc0 = RS->loc;
loc0.colno--;
ipval = SL(sp)-1;
- PUSH(SL_nil);
+ PUSH(sl_nil);
ipc = SL(sp)-1; // to keep track of current cons cell
t = peek(ctx);
while(t != closer){
if(ios_eof(RS))
parse_error(&loc0, "not closed: unexpected EOI "PAtLoc, ctx->loc.lineno, ctx->loc.colno);
- c = mk_cons(); car_(c) = cdr_(c) = SL_nil;
+ c = mk_cons(); car_(c) = cdr_(c) = sl_nil;
pc = ipc;
if(iscons(*pc))
cdr_(*pc) = c;
@@ -614,7 +614,7 @@
take(ctx);
switch(t){
case TOK_OPEN:
- PUSH(SL_nil);
+ PUSH(sl_nil);
read_list(ctx, label, TOK_CLOSE);
return POP();
case TOK_SYM:
@@ -621,28 +621,28 @@
case TOK_NUM:
return ctx->tokval;
case TOK_OPENB:
- PUSH(SL_nil);
+ PUSH(sl_nil);
read_list(ctx, label, TOK_CLOSEB);
return POP();
case TOK_OPENC:
- PUSH(SL_nil);
+ PUSH(sl_nil);
read_list(ctx, label, TOK_CLOSEC);
return POP();
case TOK_COMMA:
- head = &SL_comma; goto listwith;
+ head = &sl_comma; goto listwith;
case TOK_COMMAAT:
- head = &SL_commaat; goto listwith;
+ head = &sl_commaat; goto listwith;
case TOK_COMMADOT:
- head = &SL_commadot; goto listwith;
+ head = &sl_commadot; goto listwith;
case TOK_BQ:
- head = &SL_backquote; goto listwith;
+ head = &sl_backquote; goto listwith;
case TOK_QUOTE:
- head = &SL_quote;
+ head = &sl_quote;
listwith:
v = cons_reserve(2);
car_(v) = *head;
cdr_(v) = tagptr((cons_t*)ptr(v)+1, TAG_CONS);
- car_(cdr_(v)) = cdr_(cdr_(v)) = SL_nil;
+ car_(cdr_(v)) = cdr_(cdr_(v)) = sl_nil;
PUSH(v);
if(label != UNBOUND)
ptrhash_put(&SL(readstate)->backrefs, (void*)label, (void*)v);
@@ -661,13 +661,13 @@
take(ctx);
parse_error(&ctx->loc, "expected argument list for %s", symbol_name(ctx->tokval));
}
- PUSH(SL_nil);
+ PUSH(sl_nil);
read_list(ctx, UNBOUND, TOK_CLOSE);
- if(sym == SL_vu8sym){
- sym = SL_arraysym;
- SL(sp)[-1] = sl_cons(SL_uint8sym, SL(sp)[-1]);
- }else if(sym == SL_fnsym){
- sym = SL_function;
+ if(sym == sl_vu8sym){
+ sym = sl_arraysym;
+ SL(sp)[-1] = sl_cons(sl_uint8sym, SL(sp)[-1]);
+ }else if(sym == sl_fnsym){
+ sym = sl_function;
}
v = symbol_value(sym);
if(v == UNBOUND)
@@ -719,7 +719,7 @@
case TOK_DOT:
parse_error(&ctx->loc, "unexpected '.'");
}
- return SL_void;
+ return sl_void;
}
value_t
--- a/src/sl.c
+++ b/src/sl.c
@@ -11,25 +11,25 @@
#include "iostream.h"
#include "compress.h"
-value_t SL_builtins_table_sym, SL_quote, SL_lambda, SL_function, SL_comma, SL_commaat;
-value_t SL_commadot, SL_trycatch, SL_backquote;
-value_t SL_conssym, SL_symbolsym, SL_fixnumsym, SL_vectorsym, SL_builtinsym, SL_vu8sym;
-value_t SL_defsym, SL_defmacrosym, SL_forsym, SL_setqsym;
-value_t SL_booleansym, SL_nullsym, SL_evalsym, SL_fnsym;
-value_t SL_nulsym, SL_alarmsym, SL_backspacesym, SL_tabsym, SL_linefeedsym, SL_newlinesym;
-value_t SL_vtabsym, SL_pagesym, SL_returnsym, SL_escsym, SL_spacesym, SL_deletesym;
-value_t SL_IOError, SL_ParseError, SL_TypeError, SL_ArgError, SL_MemoryError;
-value_t SL_DivideError, SL_BoundsError, SL_Error, SL_KeyError, SL_UnboundError;
+value_t sl_builtins_table_sym, sl_quote, sl_lambda, sl_function, sl_comma, sl_commaat;
+value_t sl_commadot, sl_trycatch, sl_backquote;
+value_t sl_conssym, sl_symbolsym, sl_fixnumsym, sl_vectorsym, sl_builtinsym, sl_vu8sym;
+value_t sl_defsym, sl_defmacrosym, sl_forsym, sl_setqsym;
+value_t sl_booleansym, sl_nullsym, sl_evalsym, sl_fnsym;
+value_t sl_nulsym, sl_alarmsym, sl_backspacesym, sl_tabsym, sl_linefeedsym, sl_newlinesym;
+value_t sl_vtabsym, sl_pagesym, sl_returnsym, sl_escsym, sl_spacesym, sl_deletesym;
+value_t sl_errio, sl_errparse, sl_errtype, sl_errarg, sl_errmem;
+value_t sl_errdiv0, sl_errbounds, sl_err, sl_errkey, sl_errunbound;
-value_t SL_printwidthsym, SL_printreadablysym, SL_printprettysym, SL_printlengthsym;
-value_t SL_printlevelsym;
-value_t SL_tablesym, SL_arraysym;
-value_t SL_iostreamsym, SL_rdsym, SL_wrsym, SL_apsym, SL_crsym, SL_truncsym;
-value_t SL_instrsym, SL_outstrsym;
-value_t SL_int8sym, SL_uint8sym, SL_int16sym, SL_uint16sym, SL_int32sym, SL_uint32sym;
-value_t SL_int64sym, SL_uint64sym, SL_bignumsym;
-value_t SL_bytesym, SL_runesym, SL_floatsym, SL_doublesym;
-value_t SL_stringtypesym, SL_runestringtypesym;
+value_t sl_printwidthsym, sl_printreadablysym, sl_printprettysym, sl_printlengthsym;
+value_t sl_printlevelsym;
+value_t sl_tablesym, sl_arraysym;
+value_t sl_iostreamsym, sl_rdsym, sl_wrsym, sl_apsym, sl_crsym, sl_truncsym;
+value_t sl_instrsym, sl_outstrsym;
+value_t sl_int8sym, sl_uint8sym, sl_int16sym, sl_uint16sym, sl_int32sym, sl_uint32sym;
+value_t sl_int64sym, sl_uint64sym, sl_bignumsym;
+value_t sl_bytesym, sl_runesym, sl_floatsym, sl_doublesym;
+value_t sl_stringtypesym, sl_runestringtypesym;
sl_thread(Sl *sl);
@@ -64,7 +64,7 @@
exit(status);
}
-#define SL_TRY \
+#define sl_TRY \
sl_exception_context_t _ctx; int l__tr, l__ca; \
_ctx.sp = SL(sp); _ctx.frame = SL(curr_frame); _ctx.rdst = SL(readstate); _ctx.prev = SL(exctx); \
_ctx.ngchnd = SL(ngchandles); SL(exctx) = &_ctx; \
@@ -71,14 +71,14 @@
if(!sl_setjmp(_ctx.buf)) \
for(l__tr = 1; l__tr; l__tr = 0, (void)(SL(exctx) = SL(exctx)->prev))
-#define SL_CATCH_INC \
- l__ca = 0, SL(lasterror) = SL_nil, SL(throwing_frame) = 0, SL(sp) = _ctx.sp, SL(curr_frame) = _ctx.frame
+#define sl_CATCH_INC \
+ l__ca = 0, SL(lasterror) = sl_nil, SL(throwing_frame) = 0, SL(sp) = _ctx.sp, SL(curr_frame) = _ctx.frame
-#define SL_CATCH \
+#define sl_CATCH \
else \
- for(l__ca = 1; l__ca; SL_CATCH_INC)
+ for(l__ca = 1; l__ca; sl_CATCH_INC)
-#define SL_CATCH_NO_INC \
+#define sl_CATCH_NO_INC \
else \
for(l__ca = 1; l__ca;)
@@ -95,7 +95,7 @@
void
sl_restorestate(sl_exception_context_t *_ctx)
{
- SL(lasterror) = SL_nil;
+ SL(lasterror) = sl_nil;
SL(throwing_frame) = 0;
SL(sp) = _ctx->sp;
SL(curr_frame) = _ctx->frame;
@@ -141,25 +141,25 @@
_Noreturn void
type_error(const char *expected, value_t got)
{
- sl_raise(sl_listn(3, SL_TypeError, symbol(expected, false), got));
+ sl_raise(sl_listn(3, sl_errtype, symbol(expected, false), got));
}
_Noreturn void
bounds_error(value_t arr, value_t ind)
{
- sl_raise(sl_listn(3, SL_BoundsError, arr, ind));
+ sl_raise(sl_listn(3, sl_errbounds, arr, ind));
}
_Noreturn void
unbound_error(value_t sym)
{
- sl_raise(sl_listn(2, SL_UnboundError, sym));
+ sl_raise(sl_listn(2, sl_errunbound, sym));
}
_Noreturn void
arity_error(int nargs, int c)
{
- lerrorf(SL_ArgError, "arity mismatch: wanted %"PRId32", got %"PRId32, c, nargs);
+ lerrorf(sl_errarg, "arity mismatch: wanted %"PRId32", got %"PRId32, c, nargs);
}
// safe cast operators --------------------------------------------------------
@@ -248,7 +248,7 @@
BUILTIN("gensym?", gensymp)
{
argcount(nargs, 1);
- return isgensym(args[0]) ? SL_t : SL_nil;
+ return isgensym(args[0]) ? sl_t : sl_nil;
}
char *
@@ -329,7 +329,7 @@
vector_setsize(v, n);
if(init){
for(size_t i = 0; i < n; i++)
- vector_elt(v, i) = SL_void;
+ vector_elt(v, i) = sl_void;
}
return v;
}
@@ -340,7 +340,7 @@
sl_gc_handle(value_t *pv)
{
if(sl_unlikely(SL(ngchandles) >= N_GC_HANDLES))
- lerrorf(SL_MemoryError, "out of gc handles");
+ lerrorf(sl_errmem, "out of gc handles");
SL(gchandles)[SL(ngchandles)++] = pv;
}
@@ -377,7 +377,7 @@
pcdr = &cdr_(nc);
v = d;
}while(iscons(v));
- *pcdr = d == SL_nil ? SL_nil : relocate(d);
+ *pcdr = d == sl_nil ? sl_nil : relocate(d);
return first;
}
@@ -555,7 +555,7 @@
else if(isfunction(f))
v = apply_cl(n);
else if(sl_likely(isbuiltin(f))){
- value_t tab = symbol_value(SL_builtins_table_sym);
+ value_t tab = symbol_value(sl_builtins_table_sym);
if(sl_unlikely(ptr(tab) == nil))
unbound_error(tab);
saveSP[-n-1] = vector_elt(tab, uintval(f));
@@ -578,8 +578,8 @@
PUSH(car_(v));
v = cdr_(v);
}
- if(v != SL_nil)
- lerrorf(SL_ArgError, "apply: last argument: not a list");
+ if(v != sl_nil)
+ lerrorf(sl_errarg, "apply: last argument: not a list");
v = _applyn(n);
SL(sp) = saveSP;
return v;
@@ -620,7 +620,7 @@
c->cdr = tagptr(c+1, TAG_CONS);
c++;
}
- c[-1].cdr = SL_nil;
+ c[-1].cdr = sl_nil;
POPN(n);
va_end(ap);
@@ -638,7 +638,7 @@
c[0].car = a;
c[0].cdr = tagptr(c+1, TAG_CONS);
c[1].car = b;
- c[1].cdr = SL_nil;
+ c[1].cdr = sl_nil;
return tagptr(c, TAG_CONS);
}
@@ -672,7 +672,7 @@
list(value_t *args, int nargs, bool star)
{
if(sl_unlikely(nargs == 0))
- return SL_nil;
+ return sl_nil;
value_t v = cons_reserve(nargs);
cons_t *c = ptr(v);
for(int i = 0; i < nargs; i++){
@@ -683,7 +683,7 @@
if(star)
c[-2].cdr = c[-1].car;
else
- c[-1].cdr = SL_nil;
+ c[-1].cdr = sl_nil;
return v;
}
@@ -691,21 +691,21 @@
copy_list(value_t L)
{
if(!iscons(L))
- return SL_nil;
+ return sl_nil;
value_t *plcons = SL(sp);
value_t *pL = plcons+1;
- PUSH(SL_nil);
+ PUSH(sl_nil);
PUSH(L);
value_t c;
c = mk_cons(); PUSH(c); // save first cons
car_(c) = car_(*pL);
- cdr_(c) = SL_nil;
+ cdr_(c) = sl_nil;
*plcons = c;
*pL = cdr_(*pL);
while(iscons(*pL)){
c = mk_cons();
car_(c) = car_(*pL);
- cdr_(c) = SL_nil;
+ cdr_(c) = sl_nil;
cdr_(*plcons) = c;
*plcons = c;
*pL = cdr_(*pL);
@@ -719,15 +719,15 @@
do_trycatch(void)
{
value_t *saveSP = SL(sp);
- value_t v = SL_nil;
+ value_t v = sl_nil;
value_t thunk = saveSP[-2];
SL(sp)[-2] = saveSP[-1];
SL(sp)[-1] = thunk;
- SL_TRY{
+ sl_TRY{
v = apply_cl(0);
}
- SL_CATCH{
+ sl_CATCH{
v = saveSP[-2];
PUSH(v);
PUSH(SL(lasterror));
@@ -746,15 +746,15 @@
{
int extr = nopt+nkw;
int ntot = nreq+extr;
- value_t args[64], v = SL_nil;
+ value_t args[64], v = sl_nil;
int i, a = 0, nrestargs;
value_t s1 = SL(sp)[-1];
value_t s3 = SL(sp)[-3];
value_t s4 = SL(sp)[-4];
if(sl_unlikely(nargs < nreq))
- lerrorf(SL_ArgError, "too few arguments");
+ lerrorf(sl_errarg, "too few arguments");
if(sl_unlikely(extr > nelem(args)))
- lerrorf(SL_ArgError, "too many arguments");
+ lerrorf(sl_errarg, "too many arguments");
for(i = 0; i < extr; i++)
args[i] = UNBOUND;
for(i = nreq; i < nargs; i++){
@@ -772,7 +772,7 @@
do{
i++;
if(sl_unlikely(i >= nargs))
- lerrorf(SL_ArgError, "keyword %s requires an argument", symbol_name(v));
+ lerrorf(sl_errarg, "keyword %s requires an argument", symbol_name(v));
value_t hv = fixnum(((symbol_t*)ptr(v))->hash);
fixnum_t lx = numval(hv);
uintptr_t x = 2*((lx < 0 ? -lx : lx) % n);
@@ -785,7 +785,7 @@
args[idx] = bp[i];
}
}else{
- lerrorf(SL_ArgError, "unsupported keyword %s", symbol_name(v));
+ lerrorf(sl_errarg, "unsupported keyword %s", symbol_name(v));
}
i++;
if(i >= nargs)
@@ -795,7 +795,7 @@
no_kw:
nrestargs = nargs - i;
if(sl_unlikely(!va && nrestargs > 0))
- lerrorf(SL_ArgError, "too many arguments");
+ lerrorf(sl_errarg, "too many arguments");
nargs = ntot + nrestargs;
if(nrestargs)
memmove(bp+ntot, bp+i, nrestargs*sizeof(value_t));
@@ -879,7 +879,7 @@
static value_t
_stacktrace(value_t *top)
{
- value_t lst = SL_nil;
+ value_t lst = sl_nil;
value_t *stack = SL(stack);
sl_gc_handle(&lst);
@@ -897,7 +897,7 @@
value_t si = bp[i];
// if there's an error evaluating argument defaults some slots
// might be left set to UNBOUND
- vector_elt(v, i+1) = si == UNBOUND ? SL_void : si;
+ vector_elt(v, i+1) = si == UNBOUND ? sl_void : si;
}
lst = sl_cons(v, lst);
top = (value_t*)top[-3];
@@ -913,7 +913,7 @@
USED(args);
argcount(nargs, 0);
sl_gc(false);
- return SL_void;
+ return sl_void;
}
BUILTIN("function", function)
@@ -939,8 +939,8 @@
value_t fv = tagptr(fn, TAG_FUNCTION);
fn->bcode = args[0];
fn->vals = args[1];
- fn->env = SL_nil;
- fn->name = SL_lambda;
+ fn->env = sl_nil;
+ fn->name = sl_lambda;
if(nargs > 2){
if(issymbol(args[2])){
fn->name = args[2];
@@ -955,7 +955,7 @@
}
}
if(sl_unlikely(isgensym(fn->name)))
- lerrorf(SL_ArgError, "name should not be a gensym");
+ lerrorf(sl_errarg, "name should not be a gensym");
}
return fv;
}
@@ -1001,7 +1001,7 @@
if(iscbuiltin(v)){
v = (value_t)ptrhash_get(&SL(reverse_dlsym_lookup_table), ptr(v));
if(v == (value_t)HT_NOTFOUND)
- return SL_nil;
+ return sl_nil;
return v;
}
type_error("function", v);
@@ -1015,10 +1015,10 @@
BUILTIN("append", append)
{
- value_t first = SL_nil, lst, lastcons = SL_nil;
+ value_t first = sl_nil, lst, lastcons = sl_nil;
int i;
if(nargs == 0)
- return SL_nil;
+ return sl_nil;
sl_gc_handle(&first);
sl_gc_handle(&lastcons);
for(i = 0; i < nargs; i++){
@@ -1025,12 +1025,12 @@
lst = args[i];
if(iscons(lst)){
lst = copy_list(lst);
- if(first == SL_nil)
+ if(first == sl_nil)
first = lst;
else
cdr_(lastcons) = lst;
lastcons = tagptr((((cons_t*)SL(curheap))-1), TAG_CONS);
- }else if(lst != SL_nil){
+ }else if(lst != sl_nil){
type_error("cons", lst);
}
}
@@ -1057,10 +1057,10 @@
BUILTIN("map", map)
{
if(sl_unlikely(nargs < 2))
- lerrorf(SL_ArgError, "too few arguments");
+ lerrorf(sl_errarg, "too few arguments");
value_t *k = SL(sp);
- PUSH(SL_nil);
- PUSH(SL_nil);
+ PUSH(sl_nil);
+ PUSH(sl_nil);
for(bool first = true;;){
PUSH(args[0]);
for(int i = 1; i < nargs; i++){
@@ -1075,7 +1075,7 @@
POPN(nargs);
PUSH(v);
value_t c = mk_cons();
- car_(c) = POP(); cdr_(c) = SL_nil;
+ car_(c) = POP(); cdr_(c) = sl_nil;
if(first)
k[1] = c;
else
@@ -1088,7 +1088,7 @@
BUILTIN("for-each", for_each)
{
if(sl_unlikely(nargs < 2))
- lerrorf(SL_ArgError, "too few arguments");
+ lerrorf(sl_errarg, "too few arguments");
for(size_t n = 0;; n++){
PUSH(args[0]);
int pargs = 0;
@@ -1134,7 +1134,7 @@
h->i = 0;
}
POPN(pargs+1);
- return SL_void;
+ return sl_void;
}
_applyn(pargs);
POPN(pargs+1);
@@ -1147,7 +1147,7 @@
argcount(nargs, 1);
double s = nargs > 0 ? todouble(args[0]) : 0;
sleep_ms(s * 1000.0);
- return SL_void;
+ return sl_void;
}
BUILTIN("vm-stats", vm_stats)
@@ -1163,7 +1163,7 @@
ios_printf(ios_stderr, "gc handles %10"PRIu32"\n", (uint32_t)SL(ngchandles));
ios_printf(ios_stderr, "gc calls %10"PRIu64"\n", (uint64_t)SL(gccalls));
ios_printf(ios_stderr, "opcodes %10d\n", N_OPCODES);
- return SL_void;
+ return sl_void;
}
static const builtinspec_t builtin_fns[] = {
@@ -1218,58 +1218,58 @@
comparehash_init();
- SL_lambda = csymbol("λ");
- SL_function = csymbol("function");
- SL_quote = csymbol("quote");
- SL_trycatch = csymbol("trycatch");
- SL_backquote = csymbol("quasiquote");
- SL_comma = csymbol("unquote");
- SL_commaat = csymbol("unquote-splicing");
- SL_commadot = csymbol("unquote-nsplicing");
- SL_IOError = csymbol("io-error");
- SL_ParseError = csymbol("parse-error");
- SL_TypeError = csymbol("type-error");
- SL_ArgError = csymbol("arg-error");
- SL_UnboundError = csymbol("unbound-error");
- SL_KeyError = csymbol("key-error");
- SL_MemoryError = csymbol("memory-error");
- SL_BoundsError = csymbol("bounds-error");
- SL_DivideError = csymbol("divide-error");
- SL_Error = csymbol("error");
- SL_conssym = csymbol("cons");
- SL_symbolsym = csymbol("symbol");
- SL_fixnumsym = csymbol("fixnum");
- SL_vectorsym = csymbol("vector");
- SL_builtinsym = csymbol("builtin");
- SL_booleansym = csymbol("boolean");
- SL_nullsym = csymbol("null");
- SL_defsym = csymbol("def");
- SL_defmacrosym = csymbol("defmacro");
- SL_forsym = csymbol("for");
- SL_setqsym = csymbol("set!");
- SL_evalsym = csymbol("eval");
- SL_vu8sym = csymbol("vu8");
- SL_fnsym = csymbol("fn");
- SL_nulsym = csymbol("nul");
- SL_alarmsym = csymbol("alarm");
- SL_backspacesym = csymbol("backspace");
- SL_tabsym = csymbol("tab");
- SL_linefeedsym = csymbol("linefeed");
- SL_vtabsym = csymbol("vtab");
- SL_pagesym = csymbol("page");
- SL_returnsym = csymbol("return");
- SL_escsym = csymbol("esc");
- SL_spacesym = csymbol("space");
- SL_deletesym = csymbol("delete");
- SL_newlinesym = csymbol("newline");
- SL_builtins_table_sym = csymbol("*builtins*");
+ sl_lambda = csymbol("λ");
+ sl_function = csymbol("function");
+ sl_quote = csymbol("quote");
+ sl_trycatch = csymbol("trycatch");
+ sl_backquote = csymbol("quasiquote");
+ sl_comma = csymbol("unquote");
+ sl_commaat = csymbol("unquote-splicing");
+ sl_commadot = csymbol("unquote-nsplicing");
+ sl_errio = csymbol("io-error");
+ sl_errparse = csymbol("parse-error");
+ sl_errtype = csymbol("type-error");
+ sl_errarg = csymbol("arg-error");
+ sl_errunbound = csymbol("unbound-error");
+ sl_errkey = csymbol("key-error");
+ sl_errmem = csymbol("memory-error");
+ sl_errbounds = csymbol("bounds-error");
+ sl_errdiv0 = csymbol("divide-error");
+ sl_err = csymbol("error");
+ sl_conssym = csymbol("cons");
+ sl_symbolsym = csymbol("symbol");
+ sl_fixnumsym = csymbol("fixnum");
+ sl_vectorsym = csymbol("vector");
+ sl_builtinsym = csymbol("builtin");
+ sl_booleansym = csymbol("boolean");
+ sl_nullsym = csymbol("null");
+ sl_defsym = csymbol("def");
+ sl_defmacrosym = csymbol("defmacro");
+ sl_forsym = csymbol("for");
+ sl_setqsym = csymbol("set!");
+ sl_evalsym = csymbol("eval");
+ sl_vu8sym = csymbol("vu8");
+ sl_fnsym = csymbol("fn");
+ sl_nulsym = csymbol("nul");
+ sl_alarmsym = csymbol("alarm");
+ sl_backspacesym = csymbol("backspace");
+ sl_tabsym = csymbol("tab");
+ sl_linefeedsym = csymbol("linefeed");
+ sl_vtabsym = csymbol("vtab");
+ sl_pagesym = csymbol("page");
+ sl_returnsym = csymbol("return");
+ sl_escsym = csymbol("esc");
+ sl_spacesym = csymbol("space");
+ sl_deletesym = csymbol("delete");
+ sl_newlinesym = csymbol("newline");
+ sl_builtins_table_sym = csymbol("*builtins*");
- set(SL_printprettysym = csymbol("*print-pretty*"), SL_t);
- set(SL_printreadablysym = csymbol("*print-readably*"), SL_t);
- set(SL_printwidthsym = csymbol("*print-width*"), fixnum(SL(scr_width)));
- set(SL_printlengthsym = csymbol("*print-length*"), SL_nil);
- set(SL_printlevelsym = csymbol("*print-level*"), SL_nil);
- SL(lasterror) = SL_nil;
+ set(sl_printprettysym = csymbol("*print-pretty*"), sl_t);
+ set(sl_printreadablysym = csymbol("*print-readably*"), sl_t);
+ set(sl_printwidthsym = csymbol("*print-width*"), fixnum(SL(scr_width)));
+ set(sl_printlengthsym = csymbol("*print-length*"), sl_nil);
+ set(sl_printlevelsym = csymbol("*print-level*"), sl_nil);
+ SL(lasterror) = sl_nil;
for(i = 0; i < nelem(builtins); i++){
if(builtins[i].name)
@@ -1287,7 +1287,7 @@
#if defined(__os_version__)
set(csymbol("*os-version*"), cvalue_static_cstring(__os_version__));
#endif
- SL(memory_exception_value) = sl_list2(SL_MemoryError, cvalue_static_cstring("out of memory"));
+ SL(memory_exception_value) = sl_list2(sl_errmem, cvalue_static_cstring("out of memory"));
const builtinspec_t *b;
for(i = 0, b = builtin_fns; i < nelem(builtin_fns); i++, b++)
@@ -1303,7 +1303,7 @@
value_t
sl_toplevel_eval(value_t expr)
{
- return sl_applyn(1, symbol_value(SL_evalsym), expr);
+ return sl_applyn(1, symbol_value(sl_evalsym), expr);
}
int
@@ -1312,7 +1312,7 @@
SL(loading) = true;
PUSH(sys_image_iostream);
value_t *saveSP = SL(sp);
- SL_TRY{
+ sl_TRY{
while(1){
SL(sp) = saveSP;
value_t e = sl_read_sexpr(SL(sp)[-1]);
@@ -1336,7 +1336,7 @@
}
}
}
- SL_CATCH_NO_INC{
+ sl_CATCH_NO_INC{
ios_puts(ios_stderr, "fatal error during bootstrap: ");
sl_print(ios_stderr, SL(lasterror));
ios_putc(ios_stderr, '\n');
--- a/src/sl.h
+++ b/src/sl.h
@@ -241,17 +241,17 @@
void free_readstate(sl_readstate_t *rs);
-#define SL_TRY_EXTERN \
+#define sl_TRY_EXTERN \
sl_exception_context_t _ctx; int l__tr, l__ca; \
sl_savestate(&_ctx); SL(exctx) = &_ctx; \
if(!sl_setjmp(_ctx.buf)) \
for(l__tr = 1; l__tr; l__tr = 0, (void)(SL(exctx) = SL(exctx)->prev))
-#define SL_CATCH_EXTERN_NO_RESTORE \
+#define sl_CATCH_EXTERN_NO_RESTORE \
else \
for(l__ca=1; l__ca;)
-#define SL_CATCH_EXTERN \
+#define sl_CATCH_EXTERN \
else \
for(l__ca=1; l__ca; l__ca=0, sl_restorestate(&_ctx))
@@ -342,10 +342,10 @@
#include "opcodes.h"
enum {
- SL_nil = builtin(OP_LOADNIL),
- SL_t = builtin(OP_LOADT),
- SL_void = builtin(OP_LOADVOID),
- SL_eof = builtin(OP_EOF_OBJECT),
+ sl_nil = builtin(OP_LOADNIL),
+ sl_t = builtin(OP_LOADT),
+ sl_void = builtin(OP_LOADVOID),
+ sl_eof = builtin(OP_EOF_OBJECT),
};
#define N_GC_HANDLES 1024
@@ -429,24 +429,24 @@
extern sl_thread(Sl *sl);
#define SL(f) sl->f
-extern value_t SL_builtins_table_sym, SL_quote, SL_lambda, SL_function, SL_comma, SL_commaat;
-extern value_t SL_commadot, SL_trycatch, SL_backquote;
-extern value_t SL_conssym, SL_symbolsym, SL_fixnumsym, SL_vectorsym, SL_builtinsym, SL_vu8sym;
-extern value_t SL_defsym, SL_defmacrosym, SL_forsym, SL_setqsym;
-extern value_t SL_booleansym, SL_nullsym, SL_evalsym, SL_fnsym;
-extern value_t SL_nulsym, SL_alarmsym, SL_backspacesym, SL_tabsym, SL_linefeedsym, SL_newlinesym;
-extern value_t SL_vtabsym, SL_pagesym, SL_returnsym, SL_escsym, SL_spacesym, SL_deletesym;
-extern value_t SL_IOError, SL_ParseError, SL_TypeError, SL_ArgError, SL_MemoryError;
-extern value_t SL_DivideError, SL_BoundsError, SL_Error, SL_KeyError, SL_UnboundError;
+extern value_t sl_builtins_table_sym, sl_quote, sl_lambda, sl_function, sl_comma, sl_commaat;
+extern value_t sl_commadot, sl_trycatch, sl_backquote;
+extern value_t sl_conssym, sl_symbolsym, sl_fixnumsym, sl_vectorsym, sl_builtinsym, sl_vu8sym;
+extern value_t sl_defsym, sl_defmacrosym, sl_forsym, sl_setqsym;
+extern value_t sl_booleansym, sl_nullsym, sl_evalsym, sl_fnsym;
+extern value_t sl_nulsym, sl_alarmsym, sl_backspacesym, sl_tabsym, sl_linefeedsym, sl_newlinesym;
+extern value_t sl_vtabsym, sl_pagesym, sl_returnsym, sl_escsym, sl_spacesym, sl_deletesym;
+extern value_t sl_errio, sl_errparse, sl_errtype, sl_errarg, sl_errmem;
+extern value_t sl_errdiv0, sl_errbounds, sl_err, sl_errkey, sl_errunbound;
-extern value_t SL_printwidthsym, SL_printreadablysym, SL_printprettysym, SL_printlengthsym;
-extern value_t SL_printlevelsym;
-extern value_t SL_arraysym;
-extern value_t SL_iostreamsym, SL_rdsym, SL_wrsym, SL_apsym, SL_crsym, SL_truncsym;
-extern value_t SL_instrsym, SL_outstrsym;
-extern value_t SL_int8sym, SL_uint8sym, SL_int16sym, SL_uint16sym, SL_int32sym, SL_uint32sym;
-extern value_t SL_int64sym, SL_uint64sym, SL_bignumsym;
-extern value_t SL_bytesym, SL_runesym, SL_floatsym, SL_doublesym;
-extern value_t SL_stringtypesym, SL_runestringtypesym;
+extern value_t sl_printwidthsym, sl_printreadablysym, sl_printprettysym, sl_printlengthsym;
+extern value_t sl_printlevelsym;
+extern value_t sl_arraysym;
+extern value_t sl_iostreamsym, sl_rdsym, sl_wrsym, sl_apsym, sl_crsym, sl_truncsym;
+extern value_t sl_instrsym, sl_outstrsym;
+extern value_t sl_int8sym, sl_uint8sym, sl_int16sym, sl_uint16sym, sl_int32sym, sl_uint32sym;
+extern value_t sl_int64sym, sl_uint64sym, sl_bignumsym;
+extern value_t sl_bytesym, sl_runesym, sl_floatsym, sl_doublesym;
+extern value_t sl_stringtypesym, sl_runestringtypesym;
_Noreturn void slmain(const uint8_t *boot, int bootsz, int argc, char **argv);
--- a/src/slmain.c
+++ b/src/slmain.c
@@ -32,7 +32,7 @@
argv_list(int argc, char **argv)
{
int i;
- value_t lst = SL_nil, temp;
+ value_t lst = sl_nil, temp;
sl_gc_handle(&lst);
sl_gc_handle(&temp);
for(i = argc-1; i >= 0; i--){
@@ -125,7 +125,7 @@
ios_static_buffer(s, boot, bootsz);
int r = 1;
- SL_TRY_EXTERN{
+ sl_TRY_EXTERN{
if(sl_load_system_image(f) == 0){
MEM_FREE(unpacked);
s = value2c(ios_t*, f);
@@ -135,7 +135,7 @@
r = 0;
}
}
- SL_CATCH_EXTERN_NO_RESTORE{
+ sl_CATCH_EXTERN_NO_RESTORE{
ios_puts(ios_stderr, "fatal error:\n");
sl_print(ios_stderr, SL(lasterror));
ios_putc(ios_stderr, '\n');
--- a/src/string.c
+++ b/src/string.c
@@ -13,7 +13,7 @@
BUILTIN("string?", stringp)
{
argcount(nargs, 1);
- return sl_isstring(args[0]) ? SL_t : SL_nil;
+ return sl_isstring(args[0]) ? sl_t : sl_nil;
}
BUILTIN("string-length", string_length)
@@ -48,7 +48,7 @@
cprim_t *cp = ptr(args[0]);
if(cp_class(cp) == SL(runetype)){
int w = sl_wcwidth(*(Rune*)cp_data(cp));
- return w < 0 ? SL_nil : fixnum(w);
+ return w < 0 ? sl_nil : fixnum(w);
}
}
if(!sl_isstring(args[0]))
@@ -56,7 +56,7 @@
char *str = tostring(args[0]);
size_t len = cv_len(ptr(args[0]));
ssize_t w = u8_strwidth(str, len);
- return w < 0 ? SL_nil : size_wrap(w);
+ return w < 0 ? sl_nil : size_wrap(w);
}
BUILTIN("string-reverse", string_reverse)
@@ -94,7 +94,7 @@
{
bool term = false;
if(nargs == 2)
- term = args[1] != SL_nil;
+ term = args[1] != sl_nil;
else
argcount(nargs, 1);
if(!sl_isstring(args[0]))
@@ -123,17 +123,17 @@
value_t arg, buf = fn_builtin_buffer(nil, 0);
sl_gc_handle(&buf);
ios_t *s = value2c(ios_t*, buf);
- value_t oldpr = symbol_value(SL_printreadablysym);
- value_t oldpp = symbol_value(SL_printprettysym);
- set(SL_printreadablysym, SL_nil);
- set(SL_printprettysym, SL_nil);
+ value_t oldpr = symbol_value(sl_printreadablysym);
+ value_t oldpp = symbol_value(sl_printprettysym);
+ set(sl_printreadablysym, sl_nil);
+ set(sl_printprettysym, sl_nil);
int i;
FOR_ARGS(i, 0, arg, args){
USED(arg);
sl_print(s, args[i]);
}
- set(SL_printreadablysym, oldpr);
- set(SL_printprettysym, oldpp);
+ set(sl_printreadablysym, oldpr);
+ set(sl_printprettysym, oldpp);
value_t outp = stream_to_string(&buf);
sl_free_gc_handles(1);
return outp;
@@ -147,7 +147,7 @@
size_t len = cv_len(ptr(args[0]));
size_t dlen = cv_len(ptr(args[1]));
size_t ssz, tokend, tokstart, i = 0;
- value_t first = SL_nil, c = SL_nil, last;
+ value_t first = sl_nil, c = sl_nil, last;
size_t junk;
sl_gc_handle(&first);
sl_gc_handle(&last);
@@ -159,7 +159,7 @@
tokend = i;
ssz = tokend - tokstart;
last = c; // save previous cons cell
- c = sl_cons(cvalue_string(ssz), SL_nil);
+ c = sl_cons(cvalue_string(ssz), sl_nil);
// we've done allocation; reload movable pointers
s = cvalue_data(args[0]);
@@ -169,7 +169,7 @@
memmove(cvalue_data(car_(c)), &s[tokstart], ssz);
// link new cell
- if(last == SL_nil)
+ if(last == sl_nil)
first = c; // first time, save first cons
else
((cons_t*)ptr(last))->cdr = c;
@@ -256,7 +256,7 @@
cprim_t *cp = ptr(args[0]);
if(!iscprim(args[0]) || cp_class(cp) != SL(runetype))
type_error("rune", args[0]);
- return isalpharune(*(Rune*)cp_data(cp)) ? SL_t : SL_nil;
+ return isalpharune(*(Rune*)cp_data(cp)) ? sl_t : sl_nil;
}
sl_purefn
@@ -266,7 +266,7 @@
cprim_t *cp = ptr(args[0]);
if(!iscprim(args[0]) || cp_class(cp) != SL(runetype))
type_error("rune", args[0]);
- return islowerrune(*(Rune*)cp_data(cp)) ? SL_t : SL_nil;
+ return islowerrune(*(Rune*)cp_data(cp)) ? sl_t : sl_nil;
}
sl_purefn
@@ -276,7 +276,7 @@
cprim_t *cp = ptr(args[0]);
if(!iscprim(args[0]) || cp_class(cp) != SL(runetype))
type_error("rune", args[0]);
- return isupperrune(*(Rune*)cp_data(cp)) ? SL_t : SL_nil;
+ return isupperrune(*(Rune*)cp_data(cp)) ? sl_t : sl_nil;
}
sl_purefn
@@ -286,7 +286,7 @@
cprim_t *cp = ptr(args[0]);
if(!iscprim(args[0]) || cp_class(cp) != SL(runetype))
type_error("rune", args[0]);
- return istitlerune(*(Rune*)cp_data(cp)) ? SL_t : SL_nil;
+ return istitlerune(*(Rune*)cp_data(cp)) ? sl_t : sl_nil;
}
sl_purefn
@@ -296,7 +296,7 @@
cprim_t *cp = ptr(args[0]);
if(!iscprim(args[0]) || cp_class(cp) != SL(runetype))
type_error("rune", args[0]);
- return isdigitrune(*(Rune*)cp_data(cp)) ? SL_t : SL_nil;
+ return isdigitrune(*(Rune*)cp_data(cp)) ? sl_t : sl_nil;
}
sl_purefn
@@ -306,7 +306,7 @@
cprim_t *cp = ptr(args[0]);
if(!iscprim(args[0]) || cp_class(cp) != SL(runetype))
type_error("rune", args[0]);
- return isspacerune(*(Rune*)cp_data(cp)) ? SL_t : SL_nil;
+ return isspacerune(*(Rune*)cp_data(cp)) ? sl_t : sl_nil;
}
BUILTIN("string-find", string_find)
@@ -343,7 +343,7 @@
type_error("string", args[1]);
}
if(needlesz > len-start)
- return SL_nil;
+ return sl_nil;
if(needlesz == 0)
return size_wrap(start);
size_t i;
@@ -351,7 +351,7 @@
if(s[i] == needle[0] && memcmp(&s[i+1], needle+1, needlesz-1) == 0)
return size_wrap(i);
}
- return SL_nil;
+ return sl_nil;
}
static unsigned long
@@ -359,7 +359,7 @@
{
unsigned long radix = tosize(arg);
if(radix < 2 || radix > 36)
- lerrorf(SL_ArgError, "invalid radix");
+ lerrorf(sl_errarg, "invalid radix");
return radix;
}
@@ -380,12 +380,12 @@
if(cp_numtype(data) < T_FLOAT)
num = conv_to_uint64(cp_data(data), cp_numtype(data));
else if(radix != 10)
- lerrorf(SL_ArgError, "invalid radix with floating point");
+ lerrorf(sl_errarg, "invalid radix with floating point");
else
return fn_builtin_string(args, nargs);
}else if(ismpint(n)){
if(radix != 16 && radix != 10 && radix != 8 && radix != 4 && radix != 2)
- lerrorf(SL_ArgError, "invalid radix with bignum");
+ lerrorf(sl_errarg, "invalid radix with bignum");
mpint *i = tompint(n);
char *s = mptoa(i, radix, nil, 0);
assert(s != nil);
@@ -419,7 +419,7 @@
if(nargs == 2)
radix = get_radix_arg(args[1]);
if(!sl_read_numtok(str, &n, (int)radix))
- return SL_nil;
+ return sl_nil;
return n;
}
@@ -429,5 +429,5 @@
argcount(nargs, 1);
char *s = tostring(args[0]);
size_t len = cv_len(ptr(args[0]));
- return u8_isvalid(s, len) ? SL_t : SL_nil;
+ return u8_isvalid(s, len) ? sl_t : sl_nil;
}
--- a/src/table.c
+++ b/src/table.c
@@ -76,7 +76,7 @@
BUILTIN("table?", tablep)
{
argcount(nargs, 1);
- return ishashtable(args[0]) ? SL_t : SL_nil;
+ return ishashtable(args[0]) ? sl_t : sl_nil;
}
htable_t *
@@ -91,7 +91,7 @@
{
int cnt = nargs;
if(cnt & 1)
- lerrorf(SL_ArgError, "arguments must come in pairs");
+ lerrorf(sl_errarg, "arguments must come in pairs");
value_t nt;
// prevent small tables from being added to finalizer list
if(cnt <= HT_N_INLINE)
@@ -100,7 +100,7 @@
nt = cvalue(SL(tabletype), sizeof(htable_t)-inline_space);
htable_t *h = cvalue_data(nt);
htable_new(h, cnt/2);
- value_t k = SL_nil, arg;
+ value_t k = sl_nil, arg;
int i;
FOR_ARGS(i, 0, arg, args){
if(i & 1)
@@ -132,7 +132,7 @@
static void
key_error(value_t key)
{
- lerrorf(sl_list2(SL_KeyError, key), "key not found");
+ lerrorf(sl_list2(sl_errkey, key), "key not found");
}
// (get table key [default])
@@ -157,7 +157,7 @@
{
argcount(nargs, 2);
htable_t *h = totable(args[0]);
- return equalhash_has(h, (void*)args[1]) ? SL_t : SL_nil;
+ return equalhash_has(h, (void*)args[1]) ? sl_t : sl_nil;
}
// (del! table key)
--- a/src/types.c
+++ b/src/types.c
@@ -18,7 +18,7 @@
return *bp;
}
- bool isarray = iscons(t) && car_(t) == SL_arraysym && iscons(cdr_(t));
+ bool isarray = iscons(t) && car_(t) == sl_arraysym && iscons(cdr_(t));
size_t sz;
if(isarray && !iscons(cdr_(cdr_(t)))){
// special case: incomplete array type
@@ -54,7 +54,7 @@
{
sltype_t *et = get_type(eltype);
if(et->artype == nil)
- et->artype = get_type(sl_list2(SL_arraysym, eltype));
+ et->artype = get_type(sl_list2(sl_arraysym, eltype));
return et->artype;
}
--- a/src/vm.inc
+++ b/src/vm.inc
@@ -142,7 +142,7 @@
NEXT_OP;
OP(OP_BRN)
- ip += *(--sp) == SL_nil ? GET_INT16(ip) : 2;
+ ip += *(--sp) == sl_nil ? GET_INT16(ip) : 2;
NEXT_OP;
OP(OP_LOADG) {
@@ -173,12 +173,12 @@
{
int i = n;
value_t a = sp[-i], b, v;
- for(v = SL_t; i > 1; a = b){
+ for(v = sl_t; i > 1; a = b){
i--;
b = sp[-i];
if(bothfixnums(a, b)){
if((fixnum_t)a >= (fixnum_t)b){
- v = SL_nil;
+ v = sl_nil;
break;
}
}else{
@@ -186,7 +186,7 @@
if(x > 1)
x = numval(sl_compare(a, b, false));
if(x >= 0){
- v = SL_nil;
+ v = sl_nil;
break;
}
}
@@ -239,7 +239,7 @@
NEXT_OP;
OP(OP_BRNN)
- ip += *(--sp) != SL_nil ? GET_INT16(ip) : 2;
+ ip += *(--sp) != sl_nil ? GET_INT16(ip) : 2;
NEXT_OP;
OP(OP_DUP)
@@ -255,7 +255,7 @@
value_t v = sp[-1];
if(sl_likely(iscons(v)))
v = car_(v);
- else if(sl_unlikely(v != SL_nil)){
+ else if(sl_unlikely(v != sl_nil)){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
type_error("cons", v);
@@ -319,7 +319,7 @@
value_t v = sp[-1];
if(sl_likely(iscons(v)))
v = cdr_(v);
- else if(sl_unlikely(v != SL_nil)){
+ else if(sl_unlikely(v != sl_nil)){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
type_error("cons", v);
@@ -329,11 +329,11 @@
}
OP(OP_LOADVOID)
- *sp++ = SL_void;
+ *sp++ = sl_void;
NEXT_OP;
OP(OP_NOT)
- sp[-1] = sp[-1] == SL_nil ? SL_t : SL_nil;
+ sp[-1] = sp[-1] == sl_nil ? sl_t : sl_nil;
NEXT_OP;
OP(OP_SETA)
@@ -362,13 +362,13 @@
}else if(sl_unlikely(s < 0)){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
- lerrorf(SL_ArgError, "too few arguments");
+ lerrorf(sl_errarg, "too few arguments");
}else{
sp++;
sp[-2] = i+1;
sp[-3] = sp[-4];
sp[-4] = sp[-5];
- sp[-5] = SL_nil;
+ sp[-5] = sl_nil;
SL(curr_frame) = sp;
}
ipd = sp-1;
@@ -396,7 +396,7 @@
}
OP(OP_LOADNIL)
- *sp++ = SL_nil;
+ *sp++ = sl_nil;
NEXT_OP;
OP(OP_BOX) {
@@ -404,7 +404,7 @@
SL(sp) = sp;
value_t v = mk_cons();
car_(v) = bp[i];
- cdr_(v) = SL_nil;
+ cdr_(v) = sl_nil;
bp[i] = v;
NEXT_OP;
}
@@ -414,7 +414,7 @@
NEXT_OP;
OP(OP_ATOMP)
- sp[-1] = iscons(sp[-1]) ? SL_nil : SL_t;
+ sp[-1] = iscons(sp[-1]) ? sl_nil : sl_t;
NEXT_OP;
OP(OP_AREF2) {
@@ -442,7 +442,7 @@
v = vector_elt(v, isz);
continue;
}
- if(!iscons(v) && v != SL_nil){
+ if(!iscons(v) && v != sl_nil){
SL(sp) = sp;
type_error("sequence", v);
}
@@ -466,18 +466,18 @@
OP(OP_NANP) {
value_t v = sp[-1];
if(!iscprim(v))
- v = SL_nil;
+ v = sl_nil;
else{
void *p = ptr(v);
switch(cp_numtype(p)){
case T_DOUBLE:
- v = isnan(*(double*)cp_data(p)) ? SL_t : SL_nil;
+ v = isnan(*(double*)cp_data(p)) ? sl_t : sl_nil;
break;
case T_FLOAT:
- v = isnan(*(float*)cp_data(p)) ? SL_t : SL_nil;
+ v = isnan(*(float*)cp_data(p)) ? sl_t : sl_nil;
break;
default:
- v = SL_nil;
+ v = sl_nil;
break;
}
}
@@ -528,7 +528,7 @@
v = vector_elt(v, isz);
continue;
}
- if(!iscons(v) && v != SL_nil){
+ if(!iscons(v) && v != sl_nil){
SL(sp) = sp;
type_error("sequence", v);
}
@@ -554,7 +554,7 @@
bounds_error(v, e);
}
vector_elt(v, isz) = (e = sp[-1]);
- }else if(iscons(v) || v == SL_nil){
+ }else if(iscons(v) || v == sl_nil){
for(value_t v0 = v;; isz--){
if(isz == 0){
car_(v) = (e = sp[-1]);
@@ -580,9 +580,9 @@
OP(OP_EQUAL) {
value_t v;
if(sp[-2] == sp[-1])
- v = SL_t;
+ v = sl_t;
else
- v = sl_compare(sp[-2], sp[-1], true) == 0 ? SL_t : SL_nil;
+ v = sl_compare(sp[-2], sp[-1], true) == 0 ? sl_t : sl_nil;
sp[-2] = v;
sp--;
NEXT_OP;
@@ -589,7 +589,7 @@
}
OP(OP_CONSP)
- sp[-1] = iscons(sp[-1]) ? SL_t : SL_nil;
+ sp[-1] = iscons(sp[-1]) ? sl_t : sl_nil;
NEXT_OP;
OP(OP_LOADC) {
@@ -602,15 +602,15 @@
}
OP(OP_SYMBOLP)
- sp[-1] = issymbol(sp[-1]) ? SL_t : SL_nil;
+ sp[-1] = issymbol(sp[-1]) ? sl_t : sl_nil;
NEXT_OP;
OP(OP_NUMBERP)
- sp[-1] = sl_isnumber(sp[-1]) ? SL_t : SL_nil;
+ sp[-1] = sl_isnumber(sp[-1]) ? sl_t : sl_nil;
NEXT_OP;
OP(OP_BRBOUND)
- *sp++ = bp[GET_INT32(ip)] != UNBOUND ? SL_t : SL_nil;
+ *sp++ = bp[GET_INT32(ip)] != UNBOUND ? sl_t : sl_nil;
ip += 4;
NEXT_OP;
@@ -622,13 +622,13 @@
if(sl_unlikely(nargs < i)){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
- lerrorf(SL_ArgError, "too few arguments");
+ lerrorf(sl_errarg, "too few arguments");
}
if(x > 0){
if(sl_unlikely(nargs > x)){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
- lerrorf(SL_ArgError, "too many arguments");
+ lerrorf(sl_errarg, "too many arguments");
}
}else
x = -x;
@@ -649,7 +649,7 @@
}
OP(OP_EQ)
- sp[-2] = sp[-2] == sp[-1] ? SL_t : SL_nil;
+ sp[-2] = sp[-2] == sp[-1] ? sl_t : sl_nil;
sp--;
NEXT_OP;
@@ -666,7 +666,7 @@
OP(OP_BOUNDP) {
*ipd = (uintptr_t)ip;
symbol_t *sym = tosymbol(sp[-1]);
- sp[-1] = sym->binding == UNBOUND ? SL_nil : SL_t;
+ sp[-1] = sym->binding == UNBOUND ? sl_nil : sl_t;
NEXT_OP;
}
@@ -675,16 +675,16 @@
LABEL(apply_numeq):;
int i = n;
value_t a = sp[-i], b, v;
- for(v = SL_t; i > 1; a = b){
+ for(v = sl_t; i > 1; a = b){
i--;
b = sp[-i];
if(bothfixnums(a, b)){
if(a != b){
- v = SL_nil;
+ v = sl_nil;
break;
}
}else if(numeric_compare(a, b, true, false, true) != 0){
- v = SL_nil;
+ v = sl_nil;
break;
}
}
@@ -703,7 +703,7 @@
goto LABEL(cadr_nil);
}else{
LABEL(cadr_nil):
- if(sl_unlikely(v != SL_nil)){
+ if(sl_unlikely(v != sl_nil)){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
type_error("cons", v);
@@ -727,10 +727,10 @@
*sp++ = car_(v);
v = cdr_(v);
}
- if(v != SL_nil){
+ if(v != sl_nil){
*ipd = (uintptr_t)ip;
SL(sp) = sp;
- lerrorf(SL_ArgError, "apply: last argument: not a list");
+ lerrorf(sl_errarg, "apply: last argument: not a list");
}
n = sp-p;
goto LABEL(do_call);
@@ -737,12 +737,12 @@
}
OP(OP_LOADT)
- *sp++ = SL_t;
+ *sp++ = sl_t;
NEXT_OP;
OP(OP_BUILTINP) {
value_t v = sp[-1];
- sp[-1] = (isbuiltin(v) || iscbuiltin(v)) ? SL_t : SL_nil;
+ sp[-1] = (isbuiltin(v) || iscbuiltin(v)) ? sl_t : sl_nil;
NEXT_OP;
}
@@ -756,7 +756,7 @@
}
OP(OP_FIXNUMP)
- sp[-1] = isfixnum(sp[-1]) ? SL_t : SL_nil;
+ sp[-1] = isfixnum(sp[-1]) ? sl_t : sl_nil;
NEXT_OP;
OP(OP_MUL) {
@@ -834,7 +834,7 @@
fixnum_t hi = tofixnum(p[-2]);
sp += 2;
SL(sp) = sp;
- for(v = SL_void; s <= hi; s++){
+ for(v = sl_void; s <= hi; s++){
p[0] = p[-1];
p[1] = fixnum(s);
v = _applyn(1);
@@ -863,7 +863,7 @@
}
OP(OP_VECTORP)
- sp[-1] = isvector(sp[-1]) ? SL_t : SL_nil;
+ sp[-1] = isvector(sp[-1]) ? sl_t : sl_nil;
NEXT_OP;
OP(OP_TRYCATCH) {
@@ -896,11 +896,11 @@
OP(OP_EQV) {
value_t v;
if(sp[-2] == sp[-1])
- v = SL_t;
+ v = sl_t;
else if(!leafp(sp[-2]) || !leafp(sp[-1]))
- v = SL_nil;
+ v = sl_nil;
else
- v = sl_compare(sp[-2], sp[-1], true) == 0 ? SL_t : SL_nil;
+ v = sl_compare(sp[-2], sp[-1], true) == 0 ? sl_t : sl_nil;
sp[-2] = v;
sp--;
NEXT_OP;
@@ -947,7 +947,7 @@
}
OP(OP_BRNL)
- ip += *(--sp) == SL_nil ? GET_INT32(ip) : 4;
+ ip += *(--sp) == sl_nil ? GET_INT32(ip) : 4;
NEXT_OP;
OP(OP_SETAL)
@@ -961,7 +961,7 @@
SL(sp) = sp;
value_t v = mk_cons();
car_(v) = bp[i];
- cdr_(v) = SL_nil;
+ cdr_(v) = sl_nil;
bp[i] = v;
NEXT_OP;
}
@@ -971,7 +971,7 @@
sp[-1] =
((tag(v) == TAG_FUNCTION &&
(isbuiltin(v) || v>(N_BUILTINS<<3))) ||
- iscbuiltin(v)) ? SL_t : SL_nil;
+ iscbuiltin(v)) ? sl_t : sl_nil;
NEXT_OP;
}
@@ -985,7 +985,7 @@
NEXT_OP;
OP(OP_BRNNL)
- ip += *(--sp) != SL_nil ? GET_INT32(ip) : 4;
+ ip += *(--sp) != sl_nil ? GET_INT32(ip) : 4;
NEXT_OP;
OP(OP_LOADCL)