From a76b29eee8a484df5b355b9102e4f38a639d32f0 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sat, 8 Jun 2013 19:29:15 -0400 Subject: [PATCH] several minor changes and additions: - add io.ungetc and string.isutf8 - maintain input order in delete-duplicates - error for unicode escapes greater than 0x10ffff - make more builtins constant (use setc instead of set) - use prog1 in begin0 macro - array-ref was incorrectly called array-ref! in aliases.scm - use (void) instead of () in 0-arg C functions - don't do arithmetic with void* --- aliases.scm | 10 +- builtins.c | 8 +- cvalues.c | 10 +- equal.c | 2 +- flisp.boot | 470 ++++++++++++++++++++++++++++------------------------ flisp.c | 7 +- flisp.h | 3 + flmain.c | 11 -- iostream.c | 19 ++- print.c | 10 +- read.c | 10 +- string.c | 11 +- system.lsp | 10 +- table.c | 2 +- types.c | 2 +- 15 files changed, 320 insertions(+), 265 deletions(-) diff --git a/aliases.scm b/aliases.scm index c1deb02..259d57a 100644 --- a/aliases.scm +++ b/aliases.scm @@ -1,5 +1,4 @@ -; definitions of standard scheme procedures in terms of -; femtolisp procedures +; definitions of standard scheme procedures in terms of femtolisp procedures ; sufficient to run the R5RS version of psyntax (define top-level-bound? bound?) @@ -19,10 +18,7 @@ (lambda ((x #f)) ($gensym)))) (define-macro (begin0 first . rest) - (let ((g (gensym))) - `(let ((,g ,first)) - ,@rest - ,g))) + `(prog1 ,first ,@rest)) (define vector-ref aref) (define vector-set! aset!) @@ -34,7 +30,7 @@ #t) (define (vector-map f v) (vector.map f v)) -(define array-ref! aref) +(define array-ref aref) (define (array-set! a obj i0 . idxs) (if (null? idxs) (aset! a i0 obj) diff --git a/builtins.c b/builtins.c index 8ac122e..504450f 100644 --- a/builtins.c +++ b/builtins.c @@ -435,9 +435,9 @@ static value_t fl_randf(value_t *args, u_int32_t nargs) return mk_float(rand_float()); } -extern void stringfuncs_init(); -extern void table_init(); -extern void iostream_init(); +extern void stringfuncs_init(void); +extern void table_init(void); +extern void iostream_init(void); static builtinspec_t builtin_info[] = { { "environment", fl_global_env }, @@ -479,7 +479,7 @@ static builtinspec_t builtin_info[] = { { NULL, NULL } }; -void builtins_init() +void builtins_init(void) { assign_global_builtins(builtin_info); stringfuncs_init(); diff --git a/cvalues.c b/cvalues.c index ad18d1c..24db448 100644 --- a/cvalues.c +++ b/cvalues.c @@ -60,7 +60,7 @@ void add_finalizer(cvalue_t *cv) } // remove dead objects from finalization list in-place -static void sweep_finalizers() +static void sweep_finalizers(void) { cvalue_t **lst = Finalizers; size_t n=0, ndel=0, l=nfinalizers; @@ -420,7 +420,7 @@ static int cvalue_array_init(fltype_t *ft, value_t arg, void *dest) assert(cnt <= vector_size(arg)); for(i=0; i < cnt; i++) { cvalue_init(eltype, vector_elt(arg,i), dest); - dest += elsize; + dest = (char*)dest + elsize; } return 0; } @@ -430,7 +430,7 @@ static int cvalue_array_init(fltype_t *ft, value_t arg, void *dest) if (i == cnt) { i++; break; } // trigger error cvalue_init(eltype, car_(arg), dest); i++; - dest += elsize; + dest = (char*)dest + elsize; arg = cdr_(arg); } if (i != cnt) @@ -939,7 +939,7 @@ static builtinspec_t cvalues_builtin_info[] = { #define mk_primtype_(name,ctype) \ name##type=get_type(name##sym);name##type->init = &cvalue_##ctype##_init -static void cvalues_init() +static void cvalues_init(void) { htable_new(&TypeTable, 256); htable_new(&reverse_dlsym_lookup_table, 256); @@ -1268,7 +1268,7 @@ int numeric_compare(value_t a, value_t b, int eq, int eqnans, char *fname) } static void DivideByZeroError() __attribute__ ((__noreturn__)); -static void DivideByZeroError() +static void DivideByZeroError(void) { lerror(DivideError, "/: division by zero"); } diff --git a/equal.c b/equal.c index d40548c..72565ef 100644 --- a/equal.c +++ b/equal.c @@ -242,7 +242,7 @@ static value_t cyc_compare(value_t a, value_t b, htable_t *table, int eq) } static htable_t equal_eq_hashtable; -void comparehash_init() +void comparehash_init(void) { htable_new(&equal_eq_hashtable, 512); } diff --git a/flisp.boot b/flisp.boot index 70286fa..7cec0f8 100644 --- a/flisp.boot +++ b/flisp.boot @@ -33,36 +33,38 @@ #fn("7000r2|}[;" []) #fn("8000r3|}g2\\;" [])] *interactive* #f *syntax-environment* - #table(with-bindings #fn(">000s1c0qe1c2|32e1e3|32e1c4|3243;" [#fn("B000r3e0c1L1e2c3g2|33L1e4e2c5|}3331c6e0c7L1e4\x7f3132e0c7L1e4e2c8|g2333132L3L144;" [nconc - let map #.list copy-list #fn("8000r2c0|}L3;" [set!]) unwind-protect begin #fn("8000r2c0|}L3;" [set!])]) - map #.car cadr #fn("6000r1e040;" [gensym])]) letrec #fn("?000s1e0e0c1L1e2c3|32L1e2c4|32e5}3134L1e2c6|3242;" [nconc - lambda map #.car #fn("9000r1e0c1L1e2|3142;" [nconc set! copy-list]) copy-list - #fn("6000r1e040;" [void])]) assert #fn("<000r1c0|]c1c2c3|L2L2L2L4;" [if - raise quote assert-failed]) do #fn("A000s2c0qe130}Me2c3|32e2e4|32e2c5|3245;" [#fn("B000r5c0|c1g2c2}e3c4L1e5\x7fN3132e3c4L1e5i0231e3|L1g432L133L4L3L2L1e3|L1g332L3;" [letrec - lambda if nconc begin copy-list]) gensym map #.car cadr #fn("7000r1e0|31F680e1|41;|M;" [cddr - caddr])]) quasiquote #fn("8000r1e0|`42;" [bq-process]) when #fn("<000s1c0|c1}K^L4;" [if - begin]) with-input-from #fn("=000s1e0c1L1c2|L2L1L1e3}3143;" [nconc + #table(with-bindings #fn(">000s1c0qc1c2|32c1e3|32c1c4|3243;" [#fn("B000r3c0c1L1c2c3g2|33L1c4c2c5|}3331c6c0c7L1c4\x7f3132c0c7L1c4c2c8|g2333132L3L144;" [#fn(nconc) + let #fn(map) #.list #fn(copy-list) #fn("8000r2c0|}L3;" [set!]) unwind-protect + begin #fn("8000r2c0|}L3;" [set!])]) #fn(map) #.car cadr #fn("6000r1c040;" [#fn(gensym)])]) letrec #fn("?000s1c0c0c1L1c2c3|32L1c2c4|32c5}3134L1c2c6|3242;" [#fn(nconc) + lambda #fn(map) #.car #fn("9000r1c0c1L1c2|3142;" [#fn(nconc) set! #fn(copy-list)]) + #fn(copy-list) #fn("6000r1e040;" [void])]) assert #fn("<000r1c0|]c1c2c3|L2L2L2L4;" [if + raise quote assert-failed]) do #fn("A000s2c0qc130}Mc2c3|32c2e4|32c2c5|3245;" [#fn("B000r5c0|c1g2c2}c3c4L1c5\x7fN3132c3c4L1c5i0231c3|L1g432L133L4L3L2L1c3|L1g332L3;" [letrec + lambda if #fn(nconc) begin #fn(copy-list)]) + #fn(gensym) #fn(map) #.car cadr #fn("7000r1e0|31F680e1|41;|M;" [cddr caddr])]) quasiquote #fn("8000r1e0|`42;" [bq-process]) when #fn("<000s1c0|c1}K^L4;" [if + begin]) with-input-from #fn("=000s1c0c1L1c2|L2L1L1c3}3143;" [#fn(nconc) with-bindings *input-stream* - copy-list]) unwind-protect #fn("8000r2c0qe130e13042;" [#fn("@000r2c0}c1_\x7fL3L2L1c2c3~c1|L1c4}L1c5|L2L3L3L3}L1L3L3;" [let - lambda prog1 trycatch begin raise]) gensym]) dotimes #fn(";000s1c0q|M|\x8442;" [#fn("=000r2c0`c1}aL3e2c3L1|L1L1e4\x7f3133L4;" [for - - nconc lambda copy-list])]) define-macro #fn("?000s1c0c1|ML2e2c3L1|NL1e4}3133L3;" [set-syntax! - quote nconc lambda copy-list]) receive #fn("@000s2c0c1_}L3e2c1L1|L1e3g23133L3;" [call-with-values - lambda nconc copy-list]) unless #fn("=000s1c0|^c1}KL4;" [if begin]) let #fn(":000s1c0q^41;" [#fn("<000r1~C6D0~m02\x7fMo002\x7fNo01530]2c0qe1c2L1e3c4~32L1e5\x7f3133e3c6~3242;" [#fn("8000r2~6@0c0~|L2L1~L3530|}K;" [letrec]) - nconc lambda map #fn("6000r1|F650|M;|;" []) copy-list #fn("6000r1|F650|\x84;e040;" [void])])]) cond #fn("9000s0c0q]41;" [#fn("7000r1c0qm02|~41;" [#fn("7000r1|?640^;c0q|M41;" [#fn(":000r1|Mc0<17702|M]<6@0|N\x8550|M;c1|NK;|N\x85@0c2|Mi10~N31L3;|\x84c3\x82W0e4e5|31316A0c6qe7e5|313141;c8qe93041;c:|Mc1|NKi10~N31L4;" [else + #fn(copy-list)]) unwind-protect #fn("8000r2c0qc130c13042;" [#fn("@000r2c0}c1_\x7fL3L2L1c2c3~c1|L1c4}L1c5|L2L3L3L3}L1L3L3;" [let + lambda prog1 trycatch begin raise]) #fn(gensym)]) dotimes #fn(";000s1c0q|M|\x8442;" [#fn("=000r2c0`c1}aL3c2c3L1|L1L1c4\x7f3133L4;" [for + - #fn(nconc) lambda #fn(copy-list)])]) define-macro #fn("?000s1c0c1|ML2c2c3L1|NL1c4}3133L3;" [set-syntax! + quote #fn(nconc) lambda #fn(copy-list)]) receive #fn("@000s2c0c1_}L3c2c1L1|L1c3g23133L3;" [call-with-values + lambda #fn(nconc) #fn(copy-list)]) unless #fn("=000s1c0|^c1}KL4;" [if begin]) let #fn(":000s1c0q^41;" [#fn("<000r1~C6D0~m02\x7fMo002\x7fNo01530]2c0qc1c2L1c3c4~32L1c5\x7f3133c3c6~3242;" [#fn("8000r2~6@0c0~|L2L1~L3530|}K;" [letrec]) + #fn(nconc) lambda #fn(map) #fn("6000r1|F650|M;|;" []) + #fn(copy-list) #fn("6000r1|F650|\x84;e040;" [void])])]) cond #fn("9000s0c0q]41;" [#fn("7000r1c0qm02|~41;" [#fn("7000r1|?640^;c0q|M41;" [#fn(":000r1|Mc0<17702|M]<6@0|N\x8550|M;c1|NK;|N\x85@0c2|Mi10~N31L3;|\x84c3\x82W0e4e5|31316A0c6qe7e5|313141;c8qc93041;c:|Mc1|NKi10~N31L4;" [else begin or => 1arg-lambda? caddr #fn("=000r1c0|~ML2L1c1|c2e3e4~3131Ki20i10N31L4L3;" [let if begin cddr caddr]) caadr #fn("<000r1c0|~ML2L1c1|e2~31|L2i20i10N31L4L3;" [let - if caddr]) gensym if])] cond-clauses->if)])]) throw #fn(":000r2c0c1c2c3L2|}L4L2;" [raise - list quote thrown-value]) time #fn("7000r1c0qe13041;" [#fn(">000r1c0|c1L1L2L1c2~c3c4c5c1L1|L3c6L4L3L3;" [let - time.now prog1 princ "Elapsed time: " - " seconds\n"]) gensym]) let* #fn("A000s1|?6E0e0c1L1_L1e2}3133L1;e0c1L1e3|31L1L1e2|NF6H0e0c4L1|NL1e2}3133L1530}3133e5|31L2;" [nconc - lambda copy-list caar let* cadar]) case #fn(":000s1c0q]41;" [#fn("7000r1c0m02c1qe23041;" [#fn("9000r2}c0\x8250c0;}\x8540^;}C6=0c1|e2}31L3;}?6=0c3|e2}31L3;}N\x85>0c3|e2}M31L3;e4c5}326=0c6|c7}L2L3;c8|c7}L2L3;" [else + if caddr]) #fn(gensym) if])] cond-clauses->if)])]) throw #fn(":000r2c0c1c2c3L2|}L4L2;" [raise + list quote thrown-value]) time #fn("7000r1c0qc13041;" [#fn(">000r1c0|c1L1L2L1c2~c3c4c5c1L1|L3c6L4L3L3;" [let + time.now prog1 princ "Elapsed time: " - " seconds\n"]) + #fn(gensym)]) let* #fn("A000s1|?6E0c0c1L1_L1c2}3133L1;c0c1L1e3|31L1L1c2|NF6H0c0c4L1|NL1c2}3133L1530}3133e5|31L2;" [#fn(nconc) + lambda #fn(copy-list) caar let* cadar]) case #fn(":000s1c0q]41;" [#fn("7000r1c0m02c1qc23041;" [#fn("9000r2}c0\x8250c0;}\x8540^;}C6=0c1|e2}31L3;}?6=0c3|e2}31L3;}N\x85>0c3|e2}M31L3;e4c5}326=0c6|c7}L2L3;c8|c7}L2L3;" [else eq? quote-value eqv? every #.symbol? memq quote memv] vals->cond) - #fn("<000r1c0|i10L2L1e1c2L1e3c4qi113232L3;" [let nconc cond map #fn("8000r1i10~|M32|NK;" [])]) - gensym])]) with-output-to #fn("=000s1e0c1L1c2|L2L1L1e3}3143;" [nconc - with-bindings - *output-stream* - copy-list]) catch #fn("7000r2c0qe13041;" [#fn("@000r1c0\x7fc1|L1c2c3c4|L2c5c6|L2c7c8L2L3c5c9|L2~L3L4c:|L2c;|L2L4L3L3;" [trycatch - lambda if and pair? eq car quote thrown-value cadr caddr raise]) gensym])) + #fn("<000r1c0|i10L2L1c1c2L1c3c4qi113232L3;" [let #fn(nconc) cond #fn(map) + #fn("8000r1i10~|M32|NK;" [])]) + #fn(gensym)])]) with-output-to #fn("=000s1c0c1L1c2|L2L1L1c3}3143;" [#fn(nconc) + with-bindings *output-stream* #fn(copy-list)]) catch #fn("7000r2c0qc13041;" [#fn("@000r1c0\x7fc1|L1c2c3c4|L2c5c6|L2c7c8L2L3c5c9|L2~L3L4c:|L2c;|L2L4L3L3;" [trycatch + lambda if and pair? eq car quote thrown-value cadr caddr raise]) + #fn(gensym)])) *whitespace* "\t\n\v\f\r \u0085  ᠎           \u2028\u2029   " 1+ #fn("7000r1|aw;" [] 1+) 1- #fn("7000r1|ax;" [] 1-) 1arg-lambda? #fn("8000r1|F16T02|Mc0<16J02|NF16B02|\x84F16:02e1|\x84a42;" [lambda @@ -74,38 +76,38 @@ win32 win64 windows "\\" *directory-separator* "\r\n" *linefeed* "/" "\n" *stdout* *output-stream* *stdin* *input-stream* *stderr* *error-stream*] __init_globals) __script #fn("7000r1c0qc1t;" [#fn("7000r0e0~41;" [load]) - #fn("7000r1e0|312e1a41;" [top-level-exception-handler - exit])] __script) - __start #fn("8000r1e0302|NF6D0|Nk12^k22e3|\x84315E0|k12]k22e4e5312e6302e7`41;" [__init_globals - *argv* *interactive* __script princ *banner* repl exit] __start) + #fn("7000r1e0|312c1a41;" [top-level-exception-handler + #fn(exit)])] __script) + __start #fn("8000r1e0302|NF6D0|Nk12^k22e3|\x84315E0|k12]k22e4e5312e6302c7`41;" [__init_globals + *argv* *interactive* __script princ *banner* repl #fn(exit)] __start) abs #fn("7000r1|`X650|y;|;" [] abs) any #fn("8000r2}F16D02|}M3117:02e0|}N42;" [any] any) arg-counts #table(#.equal? 2 #.atom? 1 #.set-cdr! 2 #.symbol? 1 #.car 1 #.eq? 2 #.aref 2 #.boolean? 1 #.not 1 #.null? 1 #.eqv? 2 #.number? 1 #.pair? 1 #.builtin? 1 #.aset! 3 #.div0 2 #.= 2 #.bound? 1 #.compare 2 #.vector? 1 #.cdr 1 #.set-car! 2 #.< 2 #.fixnum? 1 #.cons 2) argc-error #fn("<000r2e0c1|c2}}aW670c3540c445;" [error "compile error: " " expects " " argument." " arguments."] argc-error) - array? #fn("8000r1|H17<02c0e1|3141;" [#fn("7000r1|F16802|Mc0<;" [array]) - typeof] array?) + array? #fn("8000r1|H17<02c0c1|3141;" [#fn("7000r1|F16802|Mc0<;" [array]) + #fn(typeof)] array?) assoc #fn("8000r2}?640^;e0}31|>650}M;e1|}N42;" [caar assoc] assoc) assv #fn("8000r2}?640^;e0}31|=650}M;e1|}N42;" [caar assv] assv) bcode:cdepth #fn(":000r2|b3e0|b3[}32\\;" [min] bcode:cdepth) bcode:code #fn("7000r1|`[;" [] bcode:code) bcode:ctable - #fn("7000r1|a[;" [] bcode:ctable) bcode:indexfor #fn("9000r2c0qe1|31e2|3142;" [#fn(":000r2e0|\x7f32690e1|\x7f42;e2|\x7f}332}~b2}aw\\2;" [has? - get put!]) bcode:ctable bcode:nconst] bcode:indexfor) + #fn("7000r1|a[;" [] bcode:ctable) bcode:indexfor #fn("9000r2c0qe1|31e2|3142;" [#fn(":000r2c0|\x7f32690c1|\x7f42;c2|\x7f}332}~b2}aw\\2;" [#fn(has?) + #fn(get) #fn(put!)]) bcode:ctable bcode:nconst] bcode:indexfor) bcode:nconst #fn("7000r1|b2[;" [] bcode:nconst) bq-bracket #fn("<000r2|?6=0c0e1|}32L2;|Mc2\x82R0}`W680c0|NK;c0c3c4e1|N}ax32L3L2;|Mc5\x82S0}`W690c6|\x84L2;c0c0c7e1|\x84}ax32L3L2;|Mc8\x82O0}`W650|\x84;c0c0c9e1|\x84}ax32L3L2;c0e1|}32L2;" [#.list bq-process unquote #.cons 'unquote unquote-splicing copy-list 'unquote-splicing unquote-nsplicing 'unquote-nsplicing] bq-bracket) bq-bracket1 #fn(";000r2|F16802|Mc0<6K0}`W650|\x84;c1c2e3|N}ax32L3;e3|}42;" [unquote #.cons 'unquote bq-process] bq-bracket1) - bq-process #fn(";000r2|C680c0|L2;|H6A0c1e2e3|31}3241;|?640|;|Mc4\x82B0c5c6e2|\x84}aw32L3;|Mc7\x82W0}`W16:02e8|b232650|\x84;c9c:e2|N}ax32L3;e;}`3217;02eqe?|31e@cAq|3242;cBq]31|_42;" [quote + bq-process #fn(";000r2|C680c0|L2;|H6A0c1e2e3|31}3241;|?640|;|Mc4\x82B0c5c6e2|\x84}aw32L3;|Mc7\x82W0}`W16:02e8|b232650|\x84;c9c:e2|N}ax32L3;e;}`3217;02eqe?|31c@cAq|3242;cBq]31|_42;" [quote #fn("8000r1|Mc0\x8280c1|NK;c2c1|L3;" [#.list #.vector #.apply]) bq-process vector->list quasiquote #.list 'quasiquote unquote length= #.cons 'unquote > - any splice-form? #fn(":000r2|\x8570c0}K;}N\x85?0c1}Me2|\x7f32L3;e3e4}Ke2|\x7f32L142;" [#.list - #.cons bq-process nconc list*]) lastcdr map #fn("8000r1e0|\x7f42;" [bq-bracket1]) - #fn("6000r1c0qm02|;" [#fn(">000r2|\x85;0c0e1}31K;|F6s0|Mc2\x82[0c0e3}i11`W670|N5E0c4c5L2e6|Ni11ax32L232K;~|Ne7|Mi1132}K42;c0e1e6|i1132}K31K;" [nconc + any splice-form? #fn(":000r2|\x8570c0}K;}N\x85?0c1}Me2|\x7f32L3;c3c4}Ke2|\x7f32L142;" [#.list + #.cons bq-process #fn(nconc) #fn(list*)]) lastcdr #fn(map) + #fn("8000r1e0|\x7f42;" [bq-bracket1]) #fn("6000r1c0qm02|;" [#fn(">000r2|\x85;0c0e1}31K;|F6s0|Mc2\x82[0c0e3}i11`W670|N5E0c4c5L2e6|Ni11ax32L232K;~|Ne7|Mi1132}K42;c0e1e6|i1132}K31K;" [nconc reverse! unquote nreconc #.list 'unquote bq-process bq-bracket])])] bq-process) - builtin->instruction #fn("9000r1e0~|^43;" [get] [#table(#.equal? equal? #.* * #.car car #.apply apply #.aref aref #.- - #.boolean? boolean? #.builtin? builtin? #.null? null? #.eqv? eqv? #.function? function? #.bound? bound? #.cdr cdr #.list list #.set-car! set-car! #.cons cons #.atom? atom? #.set-cdr! set-cdr! #.symbol? symbol? #.eq? eq? #.vector vector #.not not #.pair? pair? #.number? number? #.div0 div0 #.aset! aset! #.+ + #.= = #.compare compare #.vector? vector? #./ / #.< < #.fixnum? fixnum?) - ()]) + builtin->instruction #fn("9000r1c0~|^43;" [#fn(get)] [#table(#.equal? equal? #.* * #.car car #.apply apply #.aref aref #.- - #.boolean? boolean? #.builtin? builtin? #.null? null? #.eqv? eqv? #.function? function? #.bound? bound? #.cdr cdr #.list list #.set-car! set-car! #.cons cons #.atom? atom? #.set-cdr! set-cdr! #.symbol? symbol? #.eq? eq? #.vector vector #.not not #.pair? pair? #.number? number? #.div0 div0 #.aset! aset! #.+ + #.= = #.compare compare #.vector? vector? #./ / #.< < #.fixnum? fixnum?) + ()]) caaaar #fn("6000r1|MMMM;" [] caaaar) caaadr #fn("6000r1|\x84MM;" [] caaadr) caaar #fn("6000r1|MMM;" [] caaar) caadar #fn("6000r1|M\x84M;" [] caadar) caaddr @@ -126,43 +128,44 @@ cddar #fn("6000r1|MNN;" [] cddar) cdddar #fn("6000r1|MNNN;" [] cdddar) cddddr #fn("6000r1|NNNN;" [] cddddr) cdddr #fn("6000r1|NNN;" [] cdddr) cddr - #fn("6000r1|NN;" [] cddr) char? #fn("7000r1e0|31c1<;" [typeof wchar] char?) + #fn("6000r1|NN;" [] cddr) char? #fn("7000r1c0|31c1<;" [#fn(typeof) + wchar] char?) closure? #fn("7000r1|J16602|G@;" [] closure?) compile #fn("8000r1e0_|42;" [compile-f] compile) compile-and #fn("<000r4e0|}g2g3]c146;" [compile-short-circuit brf] compile-and) - compile-app #fn("7000r4c0qg3M41;" [#fn("9000r1c0q|C16V02e1|\x7f32@16J02|E16C02e2|3116902e3|31G6:0e3|31530|41;" [#fn(":000r1e0i13Nc1326S0e2i10i11^|342c3qe4i10i11i13N3341;c5q|G16802e6|3141;" [length> + compile-app #fn("7000r4c0qg3M41;" [#fn("9000r1c0q|C16V02e1|\x7f32@16J02|E16C02c2|3116902c3|31G6:0c3|31530|41;" [#fn(":000r1e0i13Nc1326S0e2i10i11^|342c3qe4i10i11i13N3341;c5q|G16802e6|3141;" [length> 255 compile-in #fn(":000r1e0i20i22670c1540c2|43;" [emit tcall.l call.l]) - compile-arglist #fn(";000r1~c0<16X02e1~i2132@16J02e2c031e0>16<02e3i23b2326L0e4i20i21^i23\x84342e5i20c042;|7A0e4i20i21^~34530]2c6qe7i20i21i23N3341;" [cadr - in-env? top-level-value length= compile-in emit #fn("=000r1~6H0e0i30i31i32i33i10~|47;e1i30i32670c2540c3|43;" [compile-builtin-call - emit tcall call]) compile-arglist]) builtin->instruction]) in-env? constant? - top-level-value])] compile-app) - compile-arglist #fn("8000r3e0c1qg2322e2g241;" [for-each #fn(":000r1e0~\x7f^|44;" [compile-in]) - length] compile-arglist) + compile-arglist #fn(";000r1~c0<16X02e1~i2132@16J02c2c031e0>16<02e3i23b2326L0e4i20i21^i23\x84342e5i20c042;|7A0e4i20i21^~34530]2c6qe7i20i21i23N3341;" [cadr + in-env? #fn(top-level-value) length= compile-in emit #fn("=000r1~6H0e0i30i31i32i33i10~|47;e1i30i32670c2540c3|43;" [compile-builtin-call + emit tcall call]) compile-arglist]) builtin->instruction]) in-env? #fn(constant?) + #fn(top-level-value)])] compile-app) + compile-arglist #fn("8000r3e0c1qg2322c2g241;" [for-each #fn(":000r1e0~\x7f^|44;" [compile-in]) + #fn(length)] compile-arglist) compile-begin #fn(":000r4g3?6?0e0|}g2e13044;g3N?6>0e0|}g2g3M44;e0|}^g3M342e2|c3322e4|}g2g3N44;" [compile-in void emit pop compile-begin] compile-begin) - compile-builtin-call #fn(":000r7c0qe1e2g5^3341;" [#fn("8000r1|16=02e0i03N|32@6=0e1i04|32530]2c2qi0541;" [length= + compile-builtin-call #fn(":000r7c0qc1e2g5^3341;" [#fn("8000r1|16=02e0i03N|32@6=0e1i04|32530]2c2qi0541;" [length= argc-error #fn(":000r1|c0\x82R0i16`W6<0e1i10c242;e1i10i15i1643;|c3\x82e0i16`W6<0e1i10c442;i16b2W6<0e1i10c542;e1i10i15i1643;|c6\x82v0i16`W6;0e7i14a42;i16aW6<0e1i10c842;i16b2W6<0e1i10c942;e1i10i15i1643;|c:\x82R0i16`W6<0e1i10c;42;e1i10i15i1643;|c<\x82Q0i16`W6;0e7i14a42;e1i10i15i1643;|c=\x82T0i16`W6>0e1i10c>c?43;e1i10i15i1643;|c@\x82]0i16b2X6<0e7i14b242;e1i10i12670cA540c@i1643;e1i10i1542;" [list emit loadnil + load0 add2 - argc-error neg sub2 * load1 / vector loadv [] - apply tapply])]) get arg-counts] compile-builtin-call) + apply tapply])]) #fn(get) arg-counts] compile-builtin-call) compile-f #fn("8000r2e0c1qc242;" [call-with-values #fn("8000r0e0~\x7f42;" [compile-f-]) #fn("6000r2|;" [])] compile-f) - compile-f- #fn("8000r2c0q]]42;" [#fn(">000r2c0qm02c1qm12c2qe330\x7f\x84e4\x7f\x8431e5\x7f\x8431e6c7\x7f\x8432e4\x7f31i10\x8270c8570e4\x7f3146;" [#fn("9000r1c0qe1|31F6N0e2|31F6=0c3e1|31K570e4|31560e53041;" [#fn("8000r1c0qe1|3141;" [#fn(":000r1|\x8540~;e0c1|~i4034e2c3|32K;" [list* - lambda map #fn("6000r1e040;" [void])]) get-defined-vars]) cddr cdddr begin - caddr void] lambda-body) #fn("7000r1e0|31i20\x8280e1|41;~|41;" [lastcdr caddr] lam:body) - #fn("9000r6c0q}?660`570e1}3141;" [#fn("9000r1c0q|e1i0431x41;" [#fn("9000r1c0qe1e2i143241;" [#fn("C000r1i24\x87\xa90|\x85O0e0i20c1~i22\x8580i10560i10y345s0e2i20e3e4c5e4c6|32e7e8|31313331322e0i20c9~e8|31i22\x8580i10560i10y352e:i20i40i24i23~35530]2e;i10c<326L0e0i20i22\x8570c=540c>i10335]0i22\x87A0e0i20c?i10335H0i24\x85A0e0i20c@i1033530^2eAi20i23i40K]i31i4131342e0i20cB322eCeDeEeFi203131eGi2031i2533i20b3[42;" [emit - optargs bcode:indexfor make-perfect-hash-table map #.cons #.car iota length - keyargs emit-optional-arg-inits > 255 largc lvargc vargc argc compile-in ret - values function encode-byte-code bcode:code const-to-idx-vec]) filter - keyword-arg?]) length]) length]) make-code-emitter lastcdr lambda-vars filter - #.pair? lambda])] #0=[#:g711 ()]) + compile-f- #fn("8000r2c0q]]42;" [#fn(">000r2c0qm02c1qm12c2qe330\x7f\x84e4\x7f\x8431e5\x7f\x8431e6c7\x7f\x8432e4\x7f31i10\x8270c8570e4\x7f3146;" [#fn("9000r1c0qe1|31F6N0e2|31F6=0c3e1|31K570e4|31560e53041;" [#fn("8000r1c0qe1|3141;" [#fn(":000r1|\x8540~;c0c1|~i4034c2c3|32K;" [#fn(list*) + lambda #fn(map) #fn("6000r1e040;" [void])]) get-defined-vars]) cddr cdddr + begin caddr void] lambda-body) #fn("7000r1e0|31i20\x8280e1|41;~|41;" [lastcdr + caddr] lam:body) #fn("9000r6c0q}?660`570c1}3141;" [#fn("9000r1c0q|c1i0431x41;" [#fn("9000r1c0qe1e2i143241;" [#fn("C000r1i24\x87\xa90|\x85O0e0i20c1~i22\x8580i10560i10y345s0e2i20e3c4c5c4c6|32e7c8|31313331322e0i20c9~c8|31i22\x8580i10560i10y352e:i20i40i24i23~35530]2e;i10c<326L0e0i20i22\x8570c=540c>i10335]0i22\x87A0e0i20c?i10335H0i24\x85A0e0i20c@i1033530^2eAi20i23i40K]i31i4131342e0i20cB322eCcDeEeFi203131eGi2031i2533i20b3[42;" [emit + optargs bcode:indexfor make-perfect-hash-table + #fn(map) #.cons #.car iota #fn(length) keyargs emit-optional-arg-inits > 255 + largc lvargc vargc argc compile-in ret values #fn(function) encode-byte-code + bcode:code const-to-idx-vec]) filter keyword-arg?]) + #fn(length)]) #fn(length)]) make-code-emitter lastcdr lambda-vars filter #.pair? + lambda])] #0=[#:g715 ()]) compile-for #fn(":000r5e0g4316X0e1|}^g2342e1|}^g3342e1|}^g4342e2|c342;e4c541;" [1arg-lambda? compile-in emit for error "for: third form must be a 1-argument lambda"] compile-for) compile-if #fn("<000r4c0qe1|31e1|31g3\x84e2g331e3g331F6;0e4g331560e53045;" [#fn(";000r5g2]\x82>0e0~\x7fi02g344;g2^\x82>0e0~\x7fi02g444;e0~\x7f^g2342e1~c2|332e0~\x7fi02g3342i026<0e1~c3325:0e1~c4}332e5~|322e0~\x7fi02g4342e5~}42;" [compile-in emit brf ret jmp mark-label]) make-label caddr cdddr cadddr void] compile-if) - compile-in #fn(";000r4g3C6=0e0|}g3c144;g3?6\xaf0g3`\x82:0e2|c342;g3a\x82:0e2|c442;g3]\x82:0e2|c542;g3^\x82:0e2|c642;g3_\x82:0e2|c742;e8g3316<0e2|c9g343;e:g3316C0e;|}g2eg343;g3MC@17D02g3ME17;02e?g3M}326=0e@|}g2g344;cAqg3M41;" [compile-sym - [loada loadc loadg] emit load0 load1 loadt loadf loadnil fits-i8 loadi8 - eof-object? compile-in top-level-value eof-object loadv in-env? compile-app - #fn("<000r1|c0\x82W0e1i03\x84316@0e2~\x7fi02i03\x8444;e3~c4i03\x8443;|c5\x82?0e6~\x7fi02i0344;|c7\x82@0e8~\x7fi02i03N44;|c9\x82<0e:~\x7fi0343;|c;\x82=0eq42;|c?\x82@0e@~\x7fi02i03N44;|cA\x82@0eB~\x7fi02i03N44;|cC\x82G0eD~\x7fi03\x84c7eEi0331K44;|cF\x82K0eG~\x7fi03\x84eHi0331eIi033145;|cJ\x82F0e2~\x7f]i03\x84342e3~cK42;|cL\x82N0e2~\x7f^eHi0331342eM~\x7fi03\x84cN44;|cO\x82C0e2~\x7fi02ePi033144;|cQ\x82s0e2~\x7f^c;_i03\x84L3342eReHi033131660^580eScT312e2~\x7f^eHi0331342e3~cQ42;eU~\x7fi02i0344;" [quote + compile-in #fn(";000r4g3C6=0e0|}g3c144;g3?6\xaf0g3`\x82:0e2|c342;g3a\x82:0e2|c442;g3]\x82:0e2|c542;g3^\x82:0e2|c642;g3_\x82:0e2|c742;e8g3316<0e2|c9g343;c:g3316C0e;|}g2cg343;g3MC@17D02g3ME17;02e?g3M}326=0e@|}g2g344;cAqg3M41;" [compile-sym + [loada loadc loadg] emit load0 load1 loadt loadf loadnil fits-i8 loadi8 #fn(eof-object?) + compile-in #fn(top-level-value) eof-object loadv in-env? compile-app #fn("<000r1|c0\x82W0e1i03\x84316@0e2~\x7fi02i03\x8444;e3~c4i03\x8443;|c5\x82?0e6~\x7fi02i0344;|c7\x82@0e8~\x7fi02i03N44;|c9\x82<0e:~\x7fi0343;|c;\x82=0eq42;|c?\x82@0e@~\x7fi02i03N44;|cA\x82@0eB~\x7fi02i03N44;|cC\x82G0eD~\x7fi03\x84c7eEi0331K44;|cF\x82K0eG~\x7fi03\x84eHi0331eIi033145;|cJ\x82F0e2~\x7f]i03\x84342e3~cK42;|cL\x82N0e2~\x7f^eHi0331342eM~\x7fi03\x84cN44;|cO\x82C0e2~\x7fi02ePi033144;|cQ\x82s0e2~\x7f^c;_i03\x84L3342eReHi033131660^580eScT312e2~\x7f^eHi0331342e3~cQ42;eU~\x7fi02i0344;" [quote self-evaluating? compile-in emit loadv if compile-if begin compile-begin prog1 compile-prog1 lambda call-with-values #fn("8000r0e0i11i1342;" [compile-f-]) #fn("9000r2e0i10c1|332e2i10}322}e3i1131X6<0e0i10c442;];" [emit loadv @@ -178,105 +181,119 @@ compile-short-circuit #fn(":000r6g3?6=0e0|}g2g444;g3N?6>0e0|}g2g3M44;c1qe2|3141;" [compile-in #fn("<000r1e0~\x7f^i03M342e1~c2322e1~i05|332e1~c3322e4~\x7fi02i03Ni04i05362e5~|42;" [compile-in emit dup pop compile-short-circuit mark-label]) make-label] compile-short-circuit) - compile-sym #fn(";000r4c0qe1g2}`]3441;" [#fn(":000r1|D6>0e0~i03`[|43;|MD6R0e0~i03a[|M|N342e1~e2\x7fN31a|MS342;e3i023116>02e4e5i0231316A0e0~c6e5i023143;e0~i03b2[i0243;" [emit - bcode:cdepth nnn constant? printable? top-level-value loadv]) lookup-sym] compile-sym) - compile-thunk #fn(";000r1e0e1c2L1_L1|L1~3441;" [compile nconc lambda] #0#) + compile-sym #fn(";000r4c0qe1g2}`]3441;" [#fn(":000r1|D6>0e0~i03`[|43;|MD6R0e0~i03a[|M|N342e1~e2\x7fN31a|MS342;c3i023116>02e4c5i0231316A0e0~c6c5i023143;e0~i03b2[i0243;" [emit + bcode:cdepth nnn #fn(constant?) printable? #fn(top-level-value) loadv]) + lookup-sym] compile-sym) + compile-thunk #fn(";000r1e0c1c2L1_L1|L1~3441;" [compile #fn(nconc) + lambda] #0#) compile-while #fn("9000r4c0qe1|31e1|3142;" [#fn(":000r2e0~\x7f^e130342e2~|322e0~\x7f^i02342e3~c4}332e3~c5322e0~\x7f^i03342e3~c6|332e2~}42;" [compile-in void mark-label emit brf pop jmp]) make-label] compile-while) - const-to-idx-vec #fn("9000r1c0qe1e2|313141;" [#fn("9000r1e0c1qe2~31322|;" [table.foreach - #fn("8000r2~}|\\;" []) bcode:ctable]) vector.alloc bcode:nconst] const-to-idx-vec) + const-to-idx-vec #fn("9000r1c0qc1e2|313141;" [#fn("9000r1e0c1qe2~31322|;" [table.foreach + #fn("8000r2~}|\\;" []) bcode:ctable]) #fn(vector.alloc) bcode:nconst] const-to-idx-vec) copy-tree #fn("8000r1|?640|;e0|M31e0|N31K;" [copy-tree] copy-tree) count #fn("7000r2c0q]41;" [#fn("9000r1c0qm02|~\x7f`43;" [#fn(":000r3}\x8550g2;~|}N|}M31690g2aw540g243;" [] count-)])] count) - delete-duplicates #fn("8000r1e0|bD326<0c1qe23041;|?640|;c3|M|N42;" [length> - #fn("8000r1e0c1q~322e2|41;" [for-each #fn("9000r1e0~|]43;" [put!]) table.keys]) - table #fn("8000r2e0|}32680e1}41;|e1}31K;" [member delete-duplicates])] delete-duplicates) - disassemble #fn("=000s1}\x85C0e0|`322e1302];530]2c2}Me3|31e4|3143;" [disassemble - newline #fn("7000r3c0q]41;" [#fn(":000r1c0qm02`~axc1u2e2c3e4\x7f`32c5332c6qb4e7\x7f3142;" [#fn("9000r1|J16602|G@6D0e0c1312e2|i10aw42;e3|41;" [princ + delete-duplicates #fn("8000r1e0|bD326<0c1qc23041;|?640|;c3|M|N42;" [length> + #fn("8000r1c0q]31~_42;" [#fn("6000r1c0qm02|;" [#fn("9000r2|?680e0}41;c1i10|M32690~|N}42;c2i10|M]332~|N|M}K42;" [reverse! + #fn(has?) #fn(put!)])])]) #fn(table) #fn("8000r2e0|}32680e1}41;|e1}31K;" [member + delete-duplicates])] delete-duplicates) + disassemble #fn("=000s1}\x85C0e0|`322e1302];530]2c2}Mc3|31c4|3143;" [disassemble + newline #fn("7000r3c0q]41;" [#fn(":000r1c0qm02`~axc1u2e2c3e4\x7f`32c5332c6qb4c7\x7f3142;" [#fn("9000r1|J16602|G@6D0e0c1312e2|i10aw42;e3|41;" [princ "\n" disassemble print] print-val) #fn("7000r1e0c141;" [princ "\t"]) princ "maxstack " - ref-int32-LE "\n" #fn(":000r2]|}X6E02c0qe1c2q^e333315\x19/;" [#fn(";000r1e0~b432690e130530]2`i20axc2u2e3e4~b4x31c5e6|31c7342~awo002c8q|41;" [> - newline #fn("7000r1e0c141;" [princ "\t"]) princ hex5 ": " string "\t" #fn("=000r1e0|c1326P0i20i32e2i31i1032[312i10b4wo10;e0|c3326L0i20i32i31i10[[312i10awo10;e0|c4326K0e5e6i31i10[31312i10awo10;e0|c7326O0e5e6e2i31i103231312i10b4wo10;e0|c8326f0e5e6i31i10[31c9322i10awo102e5e6i31i10[31312i10awo10;e0|c:326\x9c0e5e6e2i31i103231c9322i10b4wo102e5e6e2i31i103231312i10b4wo102~c;\x82X0e5c9312e5e6e2i31i103231c9322i10b4wo10;];|c<=6Q0e5e6e2i31i103231c9322i10b4wo10;e0|c=326X0e5c>e?i10b,e@i31i1032R331322i10b2wo10;e0|cA326X0e5c>e?i10b,e2i31i1032R331322i10b4wo10;^;" [memq + ref-int32-LE "\n" #fn(":000r2]|}X6E02c0qc1c2q^e333315\x19/;" [#fn(";000r1e0~b432690e130530]2`i20axc2u2e3e4~b4x31c5c6|31c7342~awo002c8q|41;" [> + newline #fn("7000r1e0c141;" [princ "\t"]) princ hex5 ": " #fn(string) "\t" + #fn("=000r1c0|c1326P0i20i32e2i31i1032[312i10b4wo10;c0|c3326L0i20i32i31i10[[312i10awo10;c0|c4326K0e5c6i31i10[31312i10awo10;c0|c7326O0e5c6e2i31i103231312i10b4wo10;c0|c8326f0e5c6i31i10[31c9322i10awo102e5c6i31i10[31312i10awo10;c0|c:326\x9c0e5c6e2i31i103231c9322i10b4wo102e5c6e2i31i103231312i10b4wo102~c;\x82X0e5c9312e5c6e2i31i103231c9322i10b4wo10;];|c<=6Q0e5c6e2i31i103231c9322i10b4wo10;c0|c=326X0e5c>e?i10b,e@i31i1032R331322i10b2wo10;c0|cA326X0e5c>e?i10b,e2i31i1032R331322i10b4wo10;^;" [#fn(memq) (loadv.l loadg.l setg.l) ref-int32-LE (loadv loadg setg) (loada seta call tcall list + - * / vector argc vargc loadi8 apply tapply) - princ number->string (loada.l seta.l largc lvargc call.l tcall.l) (loadc setc) - " " (loadc.l setc.l optargs keyargs) keyargs brbound (jmp brf brt brne brnn - brn) "@" hex5 - ref-int16-LE (jmp.l brf.l brt.l brne.l brnn.l brn.l)])]) table.foldl #fn("8000r3g217@02}i21~[<16402|;" []) + princ #fn(number->string) (loada.l seta.l largc lvargc call.l tcall.l) (loadc + setc) " " (loadc.l setc.l optargs keyargs) keyargs brbound (jmp brf brt brne + brnn brn) "@" + hex5 ref-int16-LE (jmp.l brf.l brt.l brne.l brnn.l brn.l)])]) + #fn(table.foldl) + #fn("8000r3g217@02}i21~[<16402|;" []) Instructions]) - length])]) function:code function:vals] disassemble) + #fn(length)])]) #fn(function:code) #fn(function:vals)] disassemble) div #fn("8000r2|}V|`X16C02}`X16402a17502b/17402`w;" [] div) emit - #fn("G000s2g2\x85b0}c0<16C02|`[F16:02|`[Mc1<6;0|`[c2O5:0|`}|`[K\\5\xe20e3}c4326A0e5|g2M32L1m2530]2c6qe7}c832312c9qe7}c:32312}c;\x82\\0g2c<>6=0c=m12_m25F0g2c>>6=0c?m12_m2530^530]2}c@\x82\\0g2cA>6=0cBm12_m25F0g2cC>6=0cDm12_m2530^530]2cEq|`[F690|`[M530_|`[322|;" [car - cdr cadr memq (loadv loadg setg) bcode:indexfor #fn("8000r1|16=02e0i02Mc132680|\x84o01;];" [> - 255]) assq ((loadv loadv.l) (loadg loadg.l) (setg setg.l) (loada loada.l) (seta - seta.l)) #fn("8000r1|16L02e0i02Mc13217=02e0i02\x84c132680|\x84o01;];" [> 255]) + #fn("G000s2g2\x85b0}c0<16C02|`[F16:02|`[Mc1<6;0|`[c2O5:0|`}|`[K\\5\xe20c3}c4326A0e5|g2M32L1m2530]2c6qc7}c832312c9qc7}c:32312}c;\x82\\0g2c<>6=0c=m12_m25F0g2c>>6=0c?m12_m2530^530]2}c@\x82\\0g2cA>6=0cBm12_m25F0g2cC>6=0cDm12_m2530^530]2cEq|`[F690|`[M530_|`[322|;" [car + cdr cadr #fn(memq) (loadv loadg setg) bcode:indexfor #fn("8000r1|16=02e0i02Mc132680|\x84o01;];" [> + 255]) #fn(assq) ((loadv loadv.l) (loadg loadg.l) (setg setg.l) (loada loada.l) + (seta seta.l)) + #fn("8000r1|16L02e0i02Mc13217=02e0i02\x84c132680|\x84o01;];" [> 255]) ((loadc loadc.l) (setc setc.l)) loada (0) loada0 (1) loada1 loadc (0 0) loadc00 (0 1) loadc01 #fn(">000r2\x7fc0<16\x9a02|c1<16802}\x84c2<6E0~`i02Mc3e4}31KK\\5u0|c1\x82B0~`i02Mc5}NKK\\5_0|c6\x82B0~`i02Mc7}NKK\\5I0|c2\x82B0~`i02Mc8}NKK\\530^17^02\x7fc5<16702|c2<6@0~`i02Mc3}NKK\\;~`e9\x7fi02K}32\\;" [brf not null? brn cddr brt eq? brne brnn nreconc])] emit) emit-optional-arg-inits #fn("8000r5g2F6=0c0qe1|3141;];" [#fn("<000r1e0~c1i04332e0~c2|332e3~e4i03i0432\x7fK^e5i0231342e0~c6i04332e0~c7322e8~|322e9~\x7fi02Ni03i04aw45;" [emit brbound brt compile-in list-head cadar seta pop mark-label emit-optional-arg-inits]) make-label] emit-optional-arg-inits) - encode-byte-code #fn("8000r1c0e1|3141;" [#fn("8000r1c0e1|3141;" [#fn(";000r1c0qe1e2|31b3e2|31b2VT2wc33241;" [#fn("=000r1c0qe1~31`e230e230e330^^47;" [#fn("?000r7e0g4c1322]}|X6\xff02i10}[m52g5c2\x82O0e3g2i10}aw[e4g431332}b2wm15\xcf0e0g4e5e6e7~6<0c8qg531540g53231322}awm12}|X6:0i10}[530^m62e9g5c:326^0e3g3e4g431g6332e0g4~670e;540e<`31322}awm15_0g5c=\x82G0e0g4e;g631322}awm15C0g6D6<0c>qg531530^5_/2e?c@qg3322eAg441;" [io.write - #int32(0) label put! sizeof byte get Instructions #fn("7000r1|c0\x8250c1;|c2\x8250c3;|c4\x8250c5;|c6\x8250c7;|c8\x8250c9;|c:\x8250c;;i05;" [jmp - jmp.l brt brt.l brf brf.l brne brne.l brnn brnn.l brn brn.l]) memq (jmp brf - brt brne brnn brn) int32 int16 brbound #fn(":000r1e0|c1326H0e2i04e3i0631322\x7fawo01;e0|c4326`0e2i04e5i0631322\x7fawo012e2i04e5i20\x7f[31322\x7fawo01;e0|c6326\x820e2i04e3i0631322\x7fawo012e2i04e3i20\x7f[31322\x7fawo012i05c7\x82J0e2i04e3i20\x7f[31322\x7fawo01;];e2i04e5i0631322\x7fawo01;" [memq - (loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l) io.write - int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs) keyargs]) - table.foreach #fn("<000r2e0i04|322e1i04i10670e2540e3e4i02}32|x3142;" [io.seek - io.write int32 int16 get]) io.tostring!]) length table buffer]) >= length 65536]) - list->vector]) reverse!] encode-byte-code) - error #fn(":000s0e0c1|K41;" [raise error] error) eval - #fn("8000r1e0e1|313140;" [compile-thunk expand] eval) even? #fn("8000r1e0|a32`W;" [logand] even?) + encode-byte-code #fn("8000r1c0e1|3141;" [#fn("8000r1c0e1|3141;" [#fn(";000r1c0qe1c2|31b3c2|31b2VT2wc33241;" [#fn("=000r1c0qc1~31`c230c230c330^^47;" [#fn("?000r7c0g4c1322]}|X6\xff02i10}[m52g5c2\x82O0c3g2i10}aw[c4g431332}b2wm15\xcf0c0g4e5c6e7~6<0c8qg531540g53231322}awm12}|X6:0i10}[530^m62c9g5c:326^0c3g3c4g431g6332c0g4~670e;540e<`31322}awm15_0g5c=\x82G0c0g4e;g631322}awm15C0g6D6<0c>qg531530^5_/2e?c@qg3322cAg441;" [#fn(io.write) + #int32(0) label #fn(put!) #fn(sizeof) byte #fn(get) Instructions #fn("7000r1|c0\x8250c1;|c2\x8250c3;|c4\x8250c5;|c6\x8250c7;|c8\x8250c9;|c:\x8250c;;i05;" [jmp + jmp.l brt brt.l brf brf.l brne brne.l brnn brnn.l brn brn.l]) + #fn(memq) (jmp brf brt brne brnn brn) int32 int16 brbound #fn(":000r1c0|c1326H0c2i04e3i0631322\x7fawo01;c0|c4326`0c2i04e5i0631322\x7fawo012c2i04e5i20\x7f[31322\x7fawo01;c0|c6326\x820c2i04e3i0631322\x7fawo012c2i04e3i20\x7f[31322\x7fawo012i05c7\x82J0c2i04e3i20\x7f[31322\x7fawo01;];c2i04e5i0631322\x7fawo01;" [#fn(memq) + (loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l) + #fn(io.write) int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs) + keyargs]) table.foreach #fn("<000r2c0i04|322c1i04i10670e2540e3c4i02}32|x3142;" [#fn(io.seek) + #fn(io.write) int32 int16 #fn(get)]) #fn(io.tostring!)]) + #fn(length) #fn(table) #fn(buffer)]) >= #fn(length) 65536]) list->vector]) + reverse!] encode-byte-code) + error #fn(":000s0c0c1|K41;" [#fn(raise) error] error) eval + #fn("8000r1e0e1|313140;" [compile-thunk expand] eval) even? #fn("8000r1c0|a32`W;" [#fn(logand)] even?) every #fn("8000r2}?17D02|}M3116:02e0|}N42;" [every] every) expand - #fn("A000r1c0q]]]]]]]]]]]4;;" [#fn("8000r;c0m02c1qm12c2L1m22c3qm32c4qm42c5qm52c6qm62c7qm72c8qm82c9m92c:qm:2g:~_42;" [#fn("8000r2|E17902e0|}32@;" [assq] top?) - #fn("9000r1|?640|;|c0>640|;|MF16;02e1|31c2<6D0e3\x7fe4|3131\x7f|N3142;|M\x7f|N31K;" [((begin)) - caar begin append cdar] splice-begin) *expanded* #fn("9000r2|?640|;c0q~c1}32690\x7f|31530|41;" [#fn("9000r1c0qi10c1\x7f3241;" [#fn("8000r1c0q|6:0e1~31530_41;" [#fn(":000r1c0qe1e2c3|32i213241;" [#fn("8000r1i107=0e0c1qi2042;c2qc3q]31i203141;" [map + #fn("A000r1c0q]]]]]]]]]]]4;;" [#fn("8000r;c0m02c1qm12c2L1m22c3qm32c4qm42c5qm52c6qm62c7qm72c8qm82c9m92c:qm:2g:~_42;" [#fn("8000r2|E17902c0|}32@;" [#fn(assq)] top?) + #fn("9000r1|?640|;|c0>640|;|MF16;02e1|31c2<6D0c3\x7fe4|3131\x7f|N3142;|M\x7f|N31K;" [((begin)) + caar begin #fn(append) cdar] splice-begin) *expanded* #fn("9000r2|?640|;c0q~c1}32690\x7f|31530|41;" [#fn("9000r1c0qi10c1\x7f3241;" [#fn("8000r1c0q|6:0e1~31530_41;" [#fn(":000r1c0qc1c2c3|32i213241;" [#fn("8000r1i107=0c0c1qi2042;c2qc3q]31i203141;" [#fn(map) #fn("8000r1i5:|~42;" []) #fn("7000r1c0q|41;" [#fn("9000r1]|F6]02i62e0|31<7A0|i6:|Mi1032O590|e1|31O2|Nm05\x02/2~;" [caar cdar])]) #fn("6000r1c0qm02|;" [#fn("9000r1|?640|;|MF16;02c0e1|31<6;0|M~|N31K;c2qi6:|Mi103241;" [define - caar #fn(":000r1e0e1c2e3|3132i2032o202i72|Ki10~N31K;" [nconc map #.list + caar #fn(":000r1c0c1c2e3|3132i2032o202i72|Ki10~N31K;" [#fn(nconc) + #fn(map) #.list get-defined-vars])])])]) - nconc map #.list]) get-defined-vars]) define]) begin] expand-body) + #fn(nconc) #fn(map) #.list]) get-defined-vars]) define]) begin] expand-body) #fn(":000r2|?640|;|MF16702|MNF6G0e0|31i0:e1|31}32L2540|Mi04|N}32K;" [caar cadar] expand-lambda-list) #fn("8000r1|?660|L1;|MF6@0e0|31i05|N31K;|Mi05|N31K;" [caar] l-vars) - #fn(";000r2c0q|\x84e1|31e2|31i05|\x843144;" [#fn(":000r4c0qe1e2c3g332\x7f3241;" [#fn(";000r1e0c1L1i24~|32L1i23i02|32\x7f44;" [nconc - lambda]) nconc map #.list]) lastcdr cddr] expand-lambda) + #fn(";000r2c0q|\x84e1|31e2|31i05|\x843144;" [#fn(":000r4c0qc1c2c3g332\x7f3241;" [#fn(";000r1c0c1L1i24~|32L1i23i02|32\x7f44;" [#fn(nconc) + lambda]) #fn(nconc) #fn(map) #.list]) lastcdr cddr] expand-lambda) #fn("<000r2|NA17602|\x84?6N0e0|31\x8540|;c1|\x84i0:e2|31}32L3;c3qe4|31e5|31e0|31i05e4|313144;" [cddr - define caddr #fn(":000r4c0qe1e2c3g332\x7f3241;" [#fn(";000r1e0c1L1\x7fi24~|32KL1i23i02|3243;" [nconc - define]) nconc map #.list]) cdadr caadr] expand-define) - #fn("7000r2c0q|\x8441;" [#fn("<000r1c0i13e1~31e2e3c4q|32\x7f3232K;" [begin - cddr nconc map #fn(":000r1|Me0i2:|\x84i11323130i11L3;" [compile-thunk])])] expand-let-syntax) - #fn("6000r2|;" [] local-expansion-env) #fn("7000r2|?640|;c0q|M41;" [#fn("9000r1c0qe1|\x7f3241;" [#fn("7000r1c0qc1q41;" [#fn(":000r1~16602~NF6M0i3:~\x84i20NQ2i39e0~31i213242;~17A02i10C@17702i10E660|40;c1qe2i203141;" [caddr + define caddr #fn(":000r4c0qc1c2c3g332\x7f3241;" [#fn(";000r1c0c1L1\x7fi24~|32KL1i23i02|3243;" [#fn(nconc) + define]) #fn(nconc) #fn(map) #.list]) cdadr caadr] expand-define) + #fn("7000r2c0q|\x8441;" [#fn("<000r1c0i13e1~31c2c3c4q|32\x7f3232K;" [begin + cddr #fn(nconc) #fn(map) #fn(":000r1|Me0i2:|\x84i11323130i11L3;" [compile-thunk])])] expand-let-syntax) + #fn("6000r2|;" [] local-expansion-env) #fn("7000r2|?640|;c0q|M41;" [#fn("9000r1c0qc1|\x7f3241;" [#fn("7000r1c0qc1q41;" [#fn(":000r1~16602~NF6M0i3:~\x84i20NQ2i39e0~31i213242;~17A02i10C@17702i10E660|40;c1qe2i203141;" [caddr #fn("8000r1|6B0i4:|i30NQ2i3142;i20c0\x8260i30;i20c1\x82>0i46i30i3142;i20c2\x82>0i47i30i3142;i20c3\x82>0i48i30i3142;~40;" [quote lambda define let-syntax]) macrocall?]) #fn("7000r0c0q]31i2041;" [#fn("6000r1c0qm02|;" [#fn("9000r1|?640|;|M?670|M5<0i4:|Mi3132~|N31K;" [])])])]) - assq])] expand-in)])] expand) - expand-define #fn("=000r1c0|\x84e1|31F6:0e1|315L0|\x84C6;0e230L15=0e3c4e5|313242;" [#fn("<000r2|C6:0c0|}ML3;c0|Me1c2L1|NL1e3}31|M34L3;" [set! - nconc lambda copy-list]) cddr void error "compile error: invalid syntax " + #fn(assq)])] expand-in)])] expand) + expand-define #fn("=000r1c0|\x84e1|31F6:0e1|315L0|\x84C6;0e230L15=0e3c4e5|313242;" [#fn("<000r2|C6:0c0|}ML3;c0|Mc1c2L1|NL1c3}31|M34L3;" [set! + #fn(nconc) lambda #fn(copy-list)]) cddr void error "compile error: invalid syntax " print-to-string] expand-define) filter #fn("7000r2c0q]41;" [#fn("9000r1c0qm02|~\x7f_L143;" [#fn("9000r3g2]}F6S02i10}M316?0g2}M_KPNm2530]2}Nm15\f/2N;" [] filter-)])] filter) fits-i8 #fn("8000r1|I16F02e0|b\xb03216:02e1|b\xaf42;" [>= <=] fits-i8) foldl #fn(":000r3g2\x8540};e0||g2M}32g2N43;" [foldl] foldl) foldr - #fn(";000r3g2\x8540};|g2Me0|}g2N3342;" [foldr] foldr) for-each #fn(";000s2c0q]41;" [#fn(":000r1c0qm02i02\x85J0]\x7fF6A02~\x7fM312\x7fNo015\x1e/5;0|~\x7fi02K322];" [#fn(":000r2}MF6I0|e0c1}32Q22~|e0c2}3242;];" [map + #fn(";000r3g2\x8540};|g2Me0|}g2N3342;" [foldr] foldr) for-each #fn(";000s2c0q]41;" [#fn(":000r1c0qm02i02\x85J0]\x7fF6A02~\x7fM312\x7fNo015\x1e/5;0|~\x7fi02K322];" [#fn(":000r2}MF6I0|c0c1}32Q22~|c0c2}3242;];" [#fn(map) #.car #.cdr] for-each-n)])] for-each) - get-defined-vars #fn("8000r1e0~|3141;" [delete-duplicates] #1=[#fn("9000r1|?640_;|Mc0<16602|NF6d0|\x84C16702|\x84L117S02|\x84F16E02e1|31C16:02e1|31L117402_;|Mc2\x82>0e3e4~|N32v2;_;" [define - caadr begin nconc map] #1#) ()]) - hex5 #fn("9000r1e0e1|b@32b5c243;" [string.lpad number->string #\0] hex5) + get-defined-vars #fn("8000r1e0~|3141;" [delete-duplicates] #1=[#fn("9000r1|?640_;|Mc0<16602|NF6d0|\x84C16702|\x84L117S02|\x84F16E02e1|31C16:02e1|31L117402_;|Mc2\x82>0c3c4~|N32v2;_;" [define + caadr begin #fn(nconc) #fn(map)] #1#) ()]) + hex5 #fn("9000r1e0c1|b@32b5c243;" [string.lpad #fn(number->string) + #\0] hex5) identity #fn("6000r1|;" [] identity) in-env? - #fn("8000r2}F16F02e0|}M3217:02e1|}N42;" [memq in-env?] in-env?) + #fn("8000r2}F16F02c0|}M3217:02e1|}N42;" [#fn(memq) in-env?] in-env?) index-of #fn(":000r3}\x8540^;|}M\x8250g2;e0|}Ng2aw43;" [index-of] index-of) - io.readall #fn("7000r1c0qe13041;" [#fn("8000r1e0|~322c1qe2|3141;" [io.copy - #fn("7000r1|c0>16:02e1i1031670e240;|;" ["" io.eof? eof-object]) io.tostring!]) - buffer] io.readall) - io.readline #fn("8000r1e0|c142;" [io.readuntil #\linefeed] io.readline) + io.readall #fn("7000r1c0qc13041;" [#fn("8000r1c0|~322c1qc2|3141;" [#fn(io.copy) + #fn("7000r1|c0>16:02c1i1031670c240;|;" ["" #fn(io.eof?) + #fn(eof-object)]) + #fn(io.tostring!)]) #fn(buffer)] io.readall) + io.readline #fn("8000r1c0|c142;" [#fn(io.readuntil) + #\linefeed] io.readline) io.readlines #fn("8000r1e0e1|42;" [read-all-of io.readline] io.readlines) iota #fn("8000r1e0e1|42;" [map-int identity] iota) keyword->symbol - #fn("9000r1e0|316@0e1c2e3|313141;|;" [keyword? symbol #fn("<000r1e0|`e1|e2|313243;" [string.sub - string.dec length]) string] keyword->symbol) - keyword-arg? #fn("7000r1|F16902e0|M41;" [keyword?] keyword-arg?) + #fn("9000r1c0|316@0c1c2c3|313141;|;" [#fn(keyword?) + #fn(symbol) + #fn("<000r1c0|`c1|c2|313243;" [#fn(string.sub) + #fn(string.dec) #fn(length)]) #fn(string)] keyword->symbol) + keyword-arg? #fn("7000r1|F16902c0|M41;" [#fn(keyword?)] keyword-arg?) lambda-arg-names #fn("9000r1e0c1e2|3142;" [map! #fn("7000r1|F690e0|M41;|;" [keyword->symbol]) to-proper] lambda-arg-names) - lambda-vars #fn("7000r1c0q]41;" [#fn(":000r1c0qm02|~~^^342e1~41;" [#fn(";000r4|A17502|C640];|F16602|MC6S0g217502g36<0e0c1}c243;~|N}g2g344;|F16602|MF6\x870e3|Mb23216902e4|31C660^5=0e0c5|Mc6}342e7e4|31316<0~|N}g2]44;g36<0e0c1}c843;~|N}]g344;|F6>0e0c9|Mc6}44;|}\x82:0e0c1}42;e0c9|c6}44;" [error + lambda-vars #fn("7000r1c0q]41;" [#fn(":000r1c0qm02|~~^^342e1~41;" [#fn(";000r4|A17502|C640];|F16602|MC6S0g217502g36<0e0c1}c243;~|N}g2g344;|F16602|MF6\x870e3|Mb23216902e4|31C660^5=0e0c5|Mc6}342c7e4|31316<0~|N}g2]44;g36<0e0c1}c843;~|N}]g344;|F6>0e0c9|Mc6}44;|}\x82:0e0c1}42;e0c9|c6}44;" [error "compile error: invalid argument list " ". optional arguments must come after required." length= caar "compile error: invalid optional argument " - " in list " keyword? ". keyword arguments must come last." + " in list " #fn(keyword?) ". keyword arguments must come last." "compile error: invalid formal argument "] check-formals) lambda-arg-names])] lambda-vars) last-pair #fn("7000r1|N?640|;e0|N41;" [last-pair] last-pair) lastcdr #fn("7000r1|?640|;e0|31N;" [last-pair] lastcdr) length= #fn("9000r2}`X640^;}`W650|?;|?660}`W;e0|N}ax42;" [length=] length=) @@ -285,11 +302,10 @@ #fn(":000r2e0}`32640_;|Me1|N}ax32K;" [<= list-head] list-head) list-ref #fn("8000r2e0|}32M;" [list-tail] list-ref) list-tail #fn("9000r2e0}`32640|;e1|N}ax42;" [<= list-tail] list-tail) list? #fn("7000r1|A17@02|F16902e0|N41;" [list?] list?) - load #fn("9000r1c0qe1|c23241;" [#fn("7000r1c0qc1qt;" [#fn("9000r0c0q]31]]]43;" [#fn("6000r1c0qm02|;" [#fn(":000r3e0i10317C0~e1i1031|e2}3143;e3i10312e2}41;" [io.eof? - read load-process io.close])])]) #fn("9000r1e0~312e1c2i10|L341;" [io.close - raise - load-error])]) - file :read] load) + load #fn("9000r1c0qc1|c23241;" [#fn("7000r1c0qc1qt;" [#fn("9000r0c0q]31]]]43;" [#fn("6000r1c0qm02|;" [#fn(":000r3c0i10317C0~c1i1031|e2}3143;c3i10312e2}41;" [#fn(io.eof?) + #fn(read) load-process #fn(io.close)])])]) + #fn("9000r1c0~312c1c2i10|L341;" [#fn(io.close) + #fn(raise) load-error])]) #fn(file) :read] load) load-process #fn("7000r1e0|41;" [eval] load-process) lookup-sym #fn("7000r4}\x8550c0;c1q}M41;" [(global) #fn(":000r1c0qe1~|`3341;" [#fn(";000r1|6@0i13640|;i12|K;e0i10i11Ni1317502~A680i12570i12aw^44;" [lookup-sym]) @@ -297,24 +313,28 @@ macrocall? #fn("7000r1|MC16902e0|M41;" [symbol-syntax] macrocall?) macroexpand-1 #fn("8000r1|?640|;c0qe1|3141;" [#fn("7000r1|680|~Nv2;~;" []) macrocall?] macroexpand-1) - make-code-emitter #fn("9000r0_e030`c1Z4;" [table +inf.0] make-code-emitter) - make-label #fn("6000r1e040;" [gensym] make-label) - make-perfect-hash-table #fn("7000r1c0q]41;" [#fn("8000r1c0m02c1q]31e2~3141;" [#fn("9000r2e0e1e2|3131}42;" [mod0 - abs hash] $hash-keyword) #fn("6000r1c0qm02|;" [#fn("9000r1c0qe1b2|T2^3241;" [#fn("7000r1c0q]31i3041;" [#fn("6000r1c0qm02|;" [#fn("8000r1|F6=0c0qe1|3141;i10;" [#fn(":000r1c0qb2i50|i3032T241;" [#fn("9000r1i30|[6=0i50i40aw41;i30|~\\2i30|awe0i1031\\2i20i10N41;" [cdar])]) - caar])])]) vector.alloc])]) length])] make-perfect-hash-table) - make-system-image #fn(";000r1c0e1|c2c3c434c542;" [#fn("8000r2c0qe1e242;" [#fn("7000r2]k02]k12c2qc3q41;" [*print-pretty* - *print-readably* #fn("7000r1c0qc1qt|302;" [#fn(":000r0c0qe1c2qe3e4303132312e5i2041;" [#fn("=000r1e0e1e2c3|e2e4|3233Q2i20322e5i20e642;" [write - nconc map #.list top-level-value io.write *linefeed*]) filter #fn("9000r1|E16w02e0|31@16l02e1|31G@17C02e2|31e2e1|3131>@16K02e3|i2132@16=02e4e1|3131@;" [constant? - top-level-value string memq iostream?]) simple-sort environment io.close]) - #fn("7000r1~302e0|41;" [raise])]) + make-code-emitter #fn("9000r0_c030`c1Z4;" [#fn(table) +inf.0] make-code-emitter) + make-label #fn("6000r1c040;" [#fn(gensym)] make-label) + make-perfect-hash-table #fn("7000r1c0q]41;" [#fn("8000r1c0m02c1q]31c2~3141;" [#fn("9000r2e0e1c2|3131}42;" [mod0 + abs #fn(hash)] $hash-keyword) #fn("6000r1c0qm02|;" [#fn("9000r1c0qc1b2|T2^3241;" [#fn("7000r1c0q]31i3041;" [#fn("6000r1c0qm02|;" [#fn("8000r1|F6=0c0qe1|3141;i10;" [#fn(":000r1c0qb2i50|i3032T241;" [#fn("9000r1i30|[6=0i50i40aw41;i30|~\\2i30|awe0i1031\\2i20i10N41;" [cdar])]) + caar])])]) #fn(vector.alloc)])]) #fn(length)])] make-perfect-hash-table) + make-system-image #fn(";000r1c0c1|c2c3c434c542;" [#fn("8000r2c0qe1e242;" [#fn("7000r2]k02]k12c2qc3q41;" [*print-pretty* + *print-readably* #fn("7000r1c0qc1qt|302;" [#fn(":000r0c0qe1c2qe3c4303132312c5i2041;" [#fn("=000r1c0c1c2c3|c2c4|3233Q2i20322c5i20e642;" [#fn(write) + #fn(nconc) #fn(map) #.list #fn(top-level-value) + #fn(io.write) *linefeed*]) filter #fn("9000r1|E16w02c0|31@16l02c1|31G@17C02c2|31c2c1|3131>@16K02c3|i2132@16=02c4c1|3131@;" [#fn(constant?) + #fn(top-level-value) #fn(string) #fn(memq) + #fn(iostream?)]) simple-sort #fn(environment) + #fn(io.close)]) #fn("7000r1~302c0|41;" [#fn(raise)])]) #fn("6000r0~k02\x7fk1;" [*print-pretty* *print-readably*])]) *print-pretty* - *print-readably*]) file :write :create :truncate (*linefeed* - *directory-separator* - *argv* that *print-pretty* - *print-width* - *print-readably* - *print-level* - *print-length* *os-name*)] make-system-image) + *print-readably*]) #fn(file) :write :create :truncate (*linefeed* + *directory-separator* + *argv* that + *print-pretty* + *print-width* + *print-readably* + *print-level* + *print-length* + *os-name*)] make-system-image) map! #fn("9000r2}]}F6B02}|}M31O2}Nm15\x1d/2;" [] map!) map-int #fn("8000r2e0}`32640_;c1q|`31_K_42;" [<= #fn(":000r2|m12a\x7faxc0qu2|;" [#fn("8000r1\x7fi10|31_KP2\x7fNo01;" [])])] map-int) mark-label #fn("9000r2e0|c1}43;" [emit label] mark-label) max @@ -325,51 +345,53 @@ mod #fn("9000r2|e0|}32}T2x;" [div] mod) mod0 #fn("8000r2||}V}T2x;" [] mod0) negative? #fn("7000r1|`X;" [] negative?) nestlist #fn(";000r3e0g2`32640_;}e1||}31g2ax33K;" [<= nestlist] nestlist) - newline #fn("9000\x8900001000\x8a0000770e0m02e1|e2322];" [*output-stream* - io.write + newline #fn("9000\x8900001000\x8a0000770e0m02c1|e2322];" [*output-stream* + #fn(io.write) *linefeed*] newline) nnn #fn("8000r1e0c1|42;" [count #fn("6000r1|A@;" [])] nnn) nreconc #fn("8000r2e0}|42;" [reverse!-] nreconc) odd? #fn("7000r1e0|31@;" [even?] odd?) positive? #fn("8000r1e0|`42;" [>] positive?) princ - #fn("9000s0c0qe141;" [#fn("7000r1^k02c1qc2q41;" [*print-readably* #fn("7000r1c0qc1qt|302;" [#fn("8000r0e0e1i2042;" [for-each - write]) #fn("7000r1~302e0|41;" [raise])]) + #fn("9000s0c0qe141;" [#fn("7000r1^k02c1qc2q41;" [*print-readably* #fn("7000r1c0qc1qt|302;" [#fn("8000r0e0c1i2042;" [for-each + #fn(write)]) #fn("7000r1~302c0|41;" [#fn(raise)])]) #fn("6000r0~k0;" [*print-readably*])]) *print-readably*] princ) - print #fn(":000s0e0e1|42;" [for-each write] print) print-exception - #fn("=000r1|F16D02|Mc0<16:02e1|b4326P0e2c3|\x84c4e5|31c6352e7e8|31315\x070|F16D02|Mc9<16:02e1|b4326N0e2|\x84c:e8|31c;342e7e5|31315\xd00|F16@02|Mc<<16602|NF6?0e2c=|\x84c>335\xac0|F16802|Mc?<6B0e2c@312e2|NQ25\x8d0|F16802|McA<6G0eBe5|31312e2cC|\x84325i0eD|3116:02e1|b2326I0e7|M312e2cE312cF|\x84315>0e2cG312e7|312e2eH41;" [type-error + print #fn(":000s0e0c1|42;" [for-each #fn(write)] print) + print-exception #fn("=000r1|F16D02|Mc0<16:02e1|b4326P0e2c3|\x84c4e5|31c6352e7e8|31315\x070|F16D02|Mc9<16:02e1|b4326N0e2|\x84c:e8|31c;342e7e5|31315\xd00|F16@02|Mc<<16602|NF6?0e2c=|\x84c>335\xac0|F16802|Mc?<6B0e2c@312e2|NQ25\x8d0|F16802|McA<6G0eBe5|31312e2cC|\x84325i0eD|3116:02e1|b2326I0e7|M312e2cE312cF|\x84315>0e2cG312e7|312e2eH41;" [type-error length= princ "type error: " ": expected " caddr ", got " print cadddr bounds-error ": index " " out of bounds for " unbound-error "eval: variable " " has no value" error "error: " load-error print-exception "in file " list? - ": " #fn("8000r1e0|3117502|C670e1540e2|41;" [string? princ print]) + ": " #fn("8000r1c0|3117502|C670e1540e2|41;" [#fn(string?) princ print]) "*** Unhandled exception: " *linefeed*] print-exception) - print-stack-trace #fn("8000r1c0q]]42;" [#fn("=000r2c0qm02c1qm12c2qe3e4~e5670b5540b43231e6e7e8c9e:303232`43;" [#fn("8000r3c0qe1|31g2K41;" [#fn("9000r1e0~31e0\x7f31\x82>0e1c2c3|L341;c4qe5~3141;" [function:code - raise thrown-value ffound #fn(":000r1`e0e1|3131c2qu;" [1- length #fn("9000r1e0~|[316A0i30~|[i21i1043;];" [closure?])]) - function:vals]) function:name] find-in-f) - #fn("8000r2c0c1qc2t41;" [#fn(";000r1|6H0e0e1e2e3e4|3132c53241;c6;" [symbol - string.join map string reverse! "/" lambda]) + print-stack-trace #fn("8000r1c0q]]42;" [#fn("=000r2c0qm02c1qm12c2qe3e4~e5670b5540b43231e6e7c8c9c:303232`43;" [#fn("8000r3c0qc1|31g2K41;" [#fn("9000r1c0~31c0\x7f31\x82>0c1c2c3|L341;c4qc5~3141;" [#fn(function:code) + #fn(raise) thrown-value ffound #fn(":000r1`e0c1|3131c2qu;" [1- #fn(length) + #fn("9000r1e0~|[316A0i30~|[i21i1043;];" [closure?])]) + #fn(function:vals)]) #fn(function:name)] find-in-f) + #fn("8000r2c0c1qc2t41;" [#fn(";000r1|6H0c0e1c2c3e4|3132c53241;c6;" [#fn(symbol) + string.join #fn(map) #fn(string) reverse! "/" lambda]) #fn("8000r0e0c1q\x7f322^;" [for-each #fn("9000r1i10|~_43;" [])]) - #fn("7000r1|F16B02|Mc0<16802|\x84c1<680e2|41;e3|41;" [thrown-value - ffound caddr raise])] fn-name) #fn("8000r3e0c1q|42;" [for-each #fn("9000r1e0c1i02c2332e3i11|`[\x7f32e4|31NK312e5302i02awo02;" [princ + #fn("7000r1|F16B02|Mc0<16802|\x84c1<680e2|41;c3|41;" [thrown-value + ffound caddr #fn(raise)])] fn-name) #fn("8000r3e0c1q|42;" [for-each #fn("9000r1e0c1i02c2332e3i11|`[\x7f32e4|31NK312e5302i02awo02;" [princ "#" " " print vector->list newline])]) reverse! list-tail *interactive* - filter closure? map #fn("7000r1|E16802e0|41;" [top-level-value]) environment])] print-stack-trace) - print-to-string #fn("7000r1c0qe13041;" [#fn("8000r1e0~|322e1|41;" [write - io.tostring!]) buffer] print-to-string) - printable? #fn("7000r1e0|3117802e1|31@;" [iostream? eof-object?] printable?) + filter closure? #fn(map) #fn("7000r1|E16802c0|41;" [#fn(top-level-value)]) + #fn(environment)])] print-stack-trace) + print-to-string #fn("7000r1c0qc13041;" [#fn("8000r1c0~|322c1|41;" [#fn(write) + #fn(io.tostring!)]) #fn(buffer)] print-to-string) + printable? #fn("7000r1c0|3117802c1|31@;" [#fn(iostream?) + #fn(eof-object?)] printable?) quote-value #fn("7000r1e0|31640|;c1|L2;" [self-evaluating? quote] quote-value) - random #fn("8000r1e0|316<0e1e230|42;e330|T2;" [integer? mod rand - rand.double] random) - read-all #fn("8000r1e0e1|42;" [read-all-of read] read-all) - read-all-of #fn("9000r2c0q]31_|}3142;" [#fn("6000r1c0qm02|;" [#fn("9000r2e0i1131680e1|41;~}|Ki10i113142;" [io.eof? + random #fn("8000r1c0|316<0e1c230|42;c330|T2;" [#fn(integer?) mod #fn(rand) + #fn(rand.double)] random) + read-all #fn("8000r1e0c1|42;" [read-all-of #fn(read)] read-all) + read-all-of #fn("9000r2c0q]31_|}3142;" [#fn("6000r1c0qm02|;" [#fn("9000r2c0i1131680e1|41;~}|Ki10i113142;" [#fn(io.eof?) reverse!])])] read-all-of) - ref-int16-LE #fn(";000r2e0e1|}`w[`32e1|}aw[b832w41;" [int16 ash] ref-int16-LE) - ref-int32-LE #fn("=000r2e0e1|}`w[`32e1|}aw[b832e1|}b2w[b@32e1|}b3w[bH32R441;" [int32 - ash] ref-int32-LE) - repl #fn("8000r0c0]]42;" [#fn("6000r2c0m02c1qm12}302e240;" [#fn("8000r0e0c1312e2e3312c4c5c6t41;" [princ - "> " io.flush *output-stream* #fn("8000r1e0e131@16<02c2e3|3141;" [io.eof? - *input-stream* - #fn("7000r1e0|312|k12];" [print - that]) load-process]) #fn("6000r0e040;" [read]) - #fn("7000r1e0e1312e2|41;" [io.discardbuffer *input-stream* raise])] prompt) + ref-int16-LE #fn(";000r2e0c1|}`w[`32c1|}aw[b832w41;" [int16 #fn(ash)] ref-int16-LE) + ref-int32-LE #fn("=000r2e0c1|}`w[`32c1|}aw[b832c1|}b2w[b@32c1|}b3w[bH32R441;" [int32 + #fn(ash)] ref-int32-LE) + repl #fn("8000r0c0]]42;" [#fn("6000r2c0m02c1qm12}302e240;" [#fn("8000r0e0c1312c2e3312c4c5c6t41;" [princ + "> " #fn(io.flush) *output-stream* #fn("8000r1c0e131@16<02c2e3|3141;" [#fn(io.eof?) + *input-stream* #fn("7000r1e0|312|k12];" [print that]) load-process]) + #fn("6000r0c040;" [#fn(read)]) #fn("7000r1c0e1312c2|41;" [#fn(io.discardbuffer) + *input-stream* #fn(raise)])] prompt) #fn("7000r0c0qc1t6;0e2302\x7f40;^;" [#fn("7000r0~3016702e040;" [newline]) #fn("7000r1e0|312];" [top-level-exception-handler]) newline] reploop) newline])] repl) @@ -377,56 +399,70 @@ #fn("8000r1e0_|42;" [reverse-] reverse) reverse! #fn("8000r1e0_|42;" [reverse!-] reverse!) reverse!- #fn("9000r2]}F6B02}N}|}m02P2m15\x1d/2|;" [] reverse!-) reverse- #fn("8000r2}\x8540|;e0}M|K}N42;" [reverse-] reverse-) - self-evaluating? #fn("8000r1|?16602|C@17K02e0|3116A02|C16:02|e1|31<;" [constant? - top-level-value] self-evaluating?) + self-evaluating? #fn("8000r1|?16602|C@17K02c0|3116A02|C16:02|c1|31<;" [#fn(constant?) + #fn(top-level-value)] self-evaluating?) separate #fn("7000r2c0q]41;" [#fn(":000r1c0m02|~\x7f_L1_L144;" [#fn(";000r4c0g2g3K]}F6Z02|}M316?0g2}M_KPNm25<0g3}M_KPNm32}Nm15\x05/241;" [#fn("8000r1e0|MN|NN42;" [values])] separate-)])] separate) - set-syntax! #fn("9000r2e0e1|}43;" [put! *syntax-environment*] set-syntax!) + set-syntax! #fn("9000r2c0e1|}43;" [#fn(put!) + *syntax-environment*] set-syntax!) simple-sort #fn("7000r1|A17602|NA640|;c0q|M41;" [#fn("8000r1e0c1qc2q42;" [call-with-values #fn("8000r0e0c1qi10N42;" [separate #fn("7000r1|~X;" [])]) - #fn(":000r2e0e1|31~L1e1}3143;" [nconc simple-sort])])] simple-sort) + #fn(":000r2c0e1|31~L1e1}3143;" [#fn(nconc) simple-sort])])] simple-sort) splice-form? #fn("8000r1|F16X02|Mc0<17N02|Mc1<17D02|Mc2<16:02e3|b23217702|c2<;" [unquote-splicing unquote-nsplicing unquote length>] splice-form?) - string.join #fn("7000r2|\x8550c0;c1qe23041;" ["" #fn("8000r1e0|~M322e1c2q~N322e3|41;" [io.write - for-each #fn("8000r1e0~i11322e0~|42;" [io.write]) io.tostring!]) buffer] string.join) - string.lpad #fn(";000r3e0e1g2}e2|31x32|42;" [string string.rep - string.count] string.lpad) - string.map #fn("9000r2c0qe130e2}3142;" [#fn("7000r2c0q`312e1|41;" [#fn(";000r1]|\x7fX6S02e0~i10e1i11|3231322e2i11|32m05\v/;" [io.putc - string.char string.inc]) io.tostring!]) buffer length] string.map) - string.rep #fn(";000r2}b4X6`0e0}`32650c1;}aW680e2|41;}b2W690e2||42;e2|||43;e3}316@0e2|e4|}ax3242;e4e2||32}b2U242;" [<= - "" string odd? string.rep] string.rep) - string.rpad #fn("<000r3e0|e1g2}e2|31x3242;" [string string.rep - string.count] string.rpad) - string.tail #fn(";000r2e0|e1|`}3342;" [string.sub string.inc] string.tail) - string.trim #fn("8000r3c0q]]42;" [#fn("8000r2c0qm02c1qm12c2qe3~3141;" [#fn(";000r4g2g3X16?02e0}e1|g232326A0~|}e2|g232g344;g2;" [string.find - string.char string.inc] trim-start) #fn("<000r3e0g2`3216D02e1}e2|e3|g23232326?0\x7f|}e3|g23243;g2;" [> - string.find string.char string.dec] trim-end) - #fn("<000r1e0i10~i10i11`|34\x7fi10i12|3343;" [string.sub]) length])] string.trim) - symbol-syntax #fn("9000r1e0e1|^43;" [get *syntax-environment*] symbol-syntax) - table.clone #fn("7000r1c0qe13041;" [#fn("9000r1e0c1q_~332|;" [table.foldl - #fn("9000r3e0~|}43;" [put!])]) table] table.clone) - table.foreach #fn("9000r2e0c1q_}43;" [table.foldl #fn("8000r3~|}322];" [])] table.foreach) - table.invert #fn("7000r1c0qe13041;" [#fn("9000r1e0c1q_~332|;" [table.foldl - #fn("9000r3e0~}|43;" [put!])]) table] table.invert) - table.keys #fn("9000r1e0c1_|43;" [table.foldl #fn("7000r3|g2K;" [])] table.keys) - table.pairs #fn("9000r1e0c1_|43;" [table.foldl #fn("7000r3|}Kg2K;" [])] table.pairs) - table.values #fn("9000r1e0c1_|43;" [table.foldl #fn("7000r3}g2K;" [])] table.values) + string.join #fn("7000r2|\x8550c0;c1qc23041;" ["" #fn("8000r1c0|~M322e1c2q~N322c3|41;" [#fn(io.write) + for-each #fn("8000r1c0~i11322c0~|42;" [#fn(io.write)]) + #fn(io.tostring!)]) #fn(buffer)] string.join) + string.lpad #fn(";000r3c0e1g2}c2|31x32|42;" [#fn(string) string.rep + #fn(string.count)] string.lpad) + string.map #fn("9000r2c0qc130c2}3142;" [#fn("7000r2c0q`312c1|41;" [#fn(";000r1]|\x7fX6S02c0~i10c1i11|3231322c2i11|32m05\v/;" [#fn(io.putc) + #fn(string.char) #fn(string.inc)]) #fn(io.tostring!)]) + #fn(buffer) + #fn(length)] string.map) + string.rep #fn(";000r2}b4X6`0e0}`32650c1;}aW680c2|41;}b2W690c2||42;c2|||43;e3}316@0c2|e4|}ax3242;e4c2||32}b2U242;" [<= + "" #fn(string) odd? string.rep] string.rep) + string.rpad #fn("<000r3c0|e1g2}c2|31x3242;" [#fn(string) string.rep + #fn(string.count)] string.rpad) + string.tail #fn(";000r2c0|c1|`}3342;" [#fn(string.sub) + #fn(string.inc)] string.tail) + string.trim #fn("8000r3c0q]]42;" [#fn("8000r2c0qm02c1qm12c2qc3~3141;" [#fn(";000r4g2g3X16?02c0}c1|g232326A0~|}c2|g232g344;g2;" [#fn(string.find) + #fn(string.char) #fn(string.inc)] trim-start) + #fn("<000r3e0g2`3216D02c1}c2|c3|g23232326?0\x7f|}c3|g23243;g2;" [> #fn(string.find) + #fn(string.char) + #fn(string.dec)] trim-end) + #fn("<000r1c0i10~i10i11`|34\x7fi10i12|3343;" [#fn(string.sub)]) + #fn(length)])] string.trim) + symbol-syntax #fn("9000r1c0e1|^43;" [#fn(get) + *syntax-environment*] symbol-syntax) + table.clone #fn("7000r1c0qc13041;" [#fn("9000r1c0c1q_~332|;" [#fn(table.foldl) + #fn("9000r3c0~|}43;" [#fn(put!)])]) #fn(table)] table.clone) + table.foreach #fn("9000r2c0c1q_}43;" [#fn(table.foldl) + #fn("8000r3~|}322];" [])] table.foreach) + table.invert #fn("7000r1c0qc13041;" [#fn("9000r1c0c1q_~332|;" [#fn(table.foldl) + #fn("9000r3c0~}|43;" [#fn(put!)])]) #fn(table)] table.invert) + table.keys #fn("9000r1c0c1_|43;" [#fn(table.foldl) + #fn("7000r3|g2K;" [])] table.keys) + table.pairs #fn("9000r1c0c1_|43;" [#fn(table.foldl) + #fn("7000r3|}Kg2K;" [])] table.pairs) + table.values #fn("9000r1c0c1_|43;" [#fn(table.foldl) + #fn("7000r3}g2K;" [])] table.values) to-proper #fn("8000r1|\x8540|;|?660|L1;|Me0|N31K;" [to-proper] to-proper) top-level-exception-handler #fn("7000r1c0qe141;" [#fn("7000r1e0k12c2qc3q41;" [*stderr* - *output-stream* #fn("7000r1c0qc1qt|302;" [#fn("7000r0e0i20312e1e23041;" [print-exception - print-stack-trace stacktrace]) #fn("7000r1~302e0|41;" [raise])]) + *output-stream* #fn("7000r1c0qc1qt|302;" [#fn("7000r0e0i20312e1c23041;" [print-exception + print-stack-trace #fn(stacktrace)]) #fn("7000r1~302c0|41;" [#fn(raise)])]) #fn("6000r0~k0;" [*output-stream*])]) *output-stream*] top-level-exception-handler) - trace #fn("8000r1c0qe1|31312c2;" [#fn("7000r1c0qe13041;" [#fn("@000r1e0~317e0e1i10e2c3|c4c5c6c7i10L2|L3L2c8L1c9c7~L2|L3L4L33142;];" [traced? - set-top-level-value! eval lambda begin write cons quote newline apply]) - gensym]) - top-level-value ok] trace) - traced? #fn("8000r1e0|3116>02e1|31e1~31>;" [closure? function:code] [#fn(":000s0e0c1|K312e2302c3|v2;" [write + trace #fn("8000r1c0qc1|31312c2;" [#fn("7000r1c0qc13041;" [#fn("@000r1e0~317e0c1i10e2c3|c4c5c6c7i10L2|L3L2c8L1c9c7~L2|L3L4L33142;];" [traced? + #fn(set-top-level-value!) eval lambda begin write cons quote newline apply]) + #fn(gensym)]) + #fn(top-level-value) ok] trace) + traced? #fn("8000r1e0|3116>02c1|31c1~31>;" [closure? #fn(function:code)] [#fn(":000s0c0c1|K312e2302c3|v2;" [#fn(write) x newline #.apply]) ()]) - untrace #fn("8000r1c0qe1|3141;" [#fn("9000r1e0|316@0e1~e2|31b2[42;];" [traced? - set-top-level-value! function:vals]) top-level-value] untrace) + untrace #fn("8000r1c0qc1|3141;" [#fn("9000r1e0|316@0c1~c2|31b2[42;];" [traced? + #fn(set-top-level-value!) #fn(function:vals)]) + #fn(top-level-value)] untrace) values #fn("9000s0|F16602|NA650|M;~|K;" [] #2#) vector->list - #fn("8000r1c0qe1|31_42;" [#fn(":000r2a|c0qu2};" [#fn("8000r1i10~|x[\x7fKo01;" [])]) - length] vector->list) - vector.map #fn("8000r2c0qe1}3141;" [#fn("8000r1c0qe1|3141;" [#fn(":000r1`~axc0qu2|;" [#fn(":000r1~|i20i21|[31\\;" [])]) - vector.alloc]) length] vector.map) + #fn("8000r1c0qc1|31_42;" [#fn(":000r2a|c0qu2};" [#fn("8000r1i10~|x[\x7fKo01;" [])]) + #fn(length)] vector->list) + vector.map #fn("8000r2c0qc1}3141;" [#fn("8000r1c0qc1|3141;" [#fn(":000r1`~axc0qu2|;" [#fn(":000r1~|i20i21|[31\\;" [])]) + #fn(vector.alloc)]) #fn(length)] vector.map) void #fn("6000r0];" [] void) zero? #fn("7000r1|`W;" [] zero?)) diff --git a/flisp.c b/flisp.c index ca2a2b7..3b73910 100644 --- a/flisp.c +++ b/flisp.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -2004,7 +2005,7 @@ static value_t _stacktrace(uint32_t top) void assign_global_builtins(builtinspec_t *b) { while (b->name != NULL) { - set(symbol(b->name), cbuiltin(b->name, b->fptr)); + setc(symbol(b->name), cbuiltin(b->name, b->fptr)); b++; } } @@ -2229,8 +2230,8 @@ static builtinspec_t core_builtin_info[] = { // initialization ------------------------------------------------------------- -extern void builtins_init(); -extern void comparehash_init(); +extern void builtins_init(void); +extern void comparehash_init(void); static void lisp_init(size_t initial_heapsize) { diff --git a/flisp.h b/flisp.h index c74ed2f..8c069b3 100644 --- a/flisp.h +++ b/flisp.h @@ -1,6 +1,9 @@ #ifndef FLISP_H #define FLISP_H +#include +#include + typedef uptrint_t value_t; typedef int_t fixnum_t; #ifdef BITS64 diff --git a/flmain.c b/flmain.c index 5e26b04..79d83ae 100644 --- a/flmain.c +++ b/flmain.c @@ -1,19 +1,8 @@ #include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include "llt.h" #include "flisp.h" -#include "opcodes.h" static value_t argv_list(int argc, char *argv[]) { diff --git a/iostream.c b/iostream.c index 46841bd..c750c7c 100644 --- a/iostream.c +++ b/iostream.c @@ -110,7 +110,7 @@ value_t fl_buffer(value_t *args, u_int32_t nargs) value_t fl_read(value_t *args, u_int32_t nargs) { - value_t arg; + value_t arg = 0; if (nargs > 1) { argcount("read", nargs, 1); } @@ -160,6 +160,19 @@ value_t fl_ioputc(value_t *args, u_int32_t nargs) return fixnum(ios_pututf8(s, wc)); } +value_t fl_ioungetc(value_t *args, u_int32_t nargs) +{ + argcount("io.ungetc", nargs, 2); + ios_t *s = toiostream(args[0], "io.ungetc"); + if (!iscprim(args[1]) || ((cprim_t*)ptr(args[1]))->type != wchartype) + type_error("io.ungetc", "wchar", args[1]); + uint32_t wc = *(uint32_t*)cp_data((cprim_t*)ptr(args[1])); + if (wc >= 0x80) { + lerror(ArgError, "io_ungetc: unicode not yet supported"); + } + return fixnum(ios_ungetc((int)wc,s)); +} + value_t fl_ioflush(value_t *args, u_int32_t nargs) { argcount("io.flush", nargs, 1); @@ -416,6 +429,7 @@ static builtinspec_t iostreamfunc_info[] = { { "io.seek" , fl_ioseek }, { "io.pos", fl_iopos }, { "io.getc" , fl_iogetc }, + { "io.ungetc", fl_ioungetc }, { "io.putc" , fl_ioputc }, { "io.peekc" , fl_iopeekc }, { "io.discardbuffer", fl_iopurge }, @@ -425,10 +439,11 @@ static builtinspec_t iostreamfunc_info[] = { { "io.readuntil", fl_ioreaduntil }, { "io.copyuntil", fl_iocopyuntil }, { "io.tostring!", fl_iotostring }, + { NULL, NULL } }; -void iostream_init() +void iostream_init(void) { iostreamsym = symbol("iostream"); rdsym = symbol(":read"); diff --git a/print.c b/print.c index 4f673a0..a6c553a 100644 --- a/print.c +++ b/print.c @@ -705,7 +705,7 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, HPOS += ios_printf(f, "#<%s>", symbol_name(type)); } else { - int64_t i64 = conv_to_int64(data, sym_to_numtype(type)); + int64_t i64 = conv_to_int64(data, nt); if (weak || print_princ) HPOS += ios_printf(f, "%lld", i64); else @@ -766,7 +766,7 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, if (i > 0) outc(' ', f); cvalue_printdata(f, data, elsize, eltype, 1); - data += elsize; + data = (char*)data + elsize; } if (!weak) outc(')', f); @@ -804,8 +804,8 @@ static void cvalue_print(ios_t *f, value_t v) void *fptr = *(void**)data; label = (value_t)ptrhash_get(&reverse_dlsym_lookup_table, cv); if (label == (value_t)HT_NOTFOUND) { - HPOS += ios_printf(f, "#", - (unsigned long)(builtin_t)fptr); + HPOS += ios_printf(f, "#", + (size_t)(builtin_t)fptr); } else { if (print_princ) { @@ -829,7 +829,7 @@ static void cvalue_print(ios_t *f, value_t v) } } -static void set_print_width() +static void set_print_width(void) { value_t pw = symbol_value(printwidthsym); if (!isfixnum(pw)) return; diff --git a/read.c b/read.c index 8b08dc0..00fb43b 100644 --- a/read.c +++ b/read.c @@ -94,7 +94,7 @@ static u_int32_t toktype = TOK_NONE; static value_t tokval; static char buf[256]; -static char nextchar() +static char nextchar(void) { int ch; char c; @@ -174,7 +174,7 @@ static int read_token(char c, int digits) static value_t do_read_sexpr(value_t label); -static u_int32_t peek() +static u_int32_t peek(void) { char c, *end; fixnum_t x; @@ -425,14 +425,14 @@ static value_t read_vector(value_t label, u_int32_t closer) return POP(); } -static value_t read_string() +static value_t read_string(void) { char *buf, *temp; char eseq[10]; size_t i=0, j, sz = 64, ndig; int c; value_t s; - u_int32_t wc; + u_int32_t wc=0; buf = malloc(sz); while (1) { @@ -481,7 +481,7 @@ static value_t read_string() if (c!=IOS_EOF) ios_ungetc(c, F); eseq[j] = '\0'; if (j) wc = strtol(eseq, NULL, 16); - else { + if (!j || wc > 0x10ffff) { free(buf); lerror(ParseError, "read: invalid escape sequence"); } diff --git a/string.c b/string.c index 7859d95..b7dae0c 100644 --- a/string.c +++ b/string.c @@ -386,6 +386,14 @@ value_t fl_stringtonumber(value_t *args, uint32_t nargs) return n; } +value_t fl_string_isutf8(value_t *args, u_int32_t nargs) +{ + argcount("string.isutf8", nargs, 1); + char *s = tostring(args[0], "string.isutf8"); + size_t len = cv_len((cvalue_t*)ptr(args[0])); + return u8_isvalid(s, len) ? FL_T : FL_F; +} + static builtinspec_t stringfunc_info[] = { { "string", fl_string }, { "string?", fl_stringp }, @@ -400,6 +408,7 @@ static builtinspec_t stringfunc_info[] = { { "string.reverse", fl_string_reverse }, { "string.encode", fl_string_encode }, { "string.decode", fl_string_decode }, + { "string.isutf8", fl_string_isutf8 }, { "char.upcase", fl_char_upcase }, { "char.downcase", fl_char_downcase }, @@ -410,7 +419,7 @@ static builtinspec_t stringfunc_info[] = { { NULL, NULL } }; -void stringfuncs_init() +void stringfuncs_init(void) { assign_global_builtins(stringfunc_info); } diff --git a/system.lsp b/system.lsp index 1d6cdf8..068c6ea 100644 --- a/system.lsp +++ b/system.lsp @@ -342,8 +342,14 @@ (define (delete-duplicates lst) (if (length> lst 20) (let ((t (table))) - (for-each (lambda (elt) (put! t elt #t)) lst) - (table.keys t)) + (let loop ((l lst) (acc '())) + (if (atom? l) + (reverse! acc) + (if (has? t (car l)) + (loop (cdr l) acc) + (begin + (put! t (car l) #t) + (loop (cdr l) (cons (car l) acc))))))) (if (atom? lst) lst (let ((elt (car lst)) diff --git a/table.c b/table.c index 6a6e0c5..a3638c1 100644 --- a/table.c +++ b/table.c @@ -202,7 +202,7 @@ static builtinspec_t tablefunc_info[] = { { NULL, NULL } }; -void table_init() +void table_init(void) { tablesym = symbol("table"); tabletype = define_opaque_type(tablesym, sizeof(htable_t), diff --git a/types.c b/types.c index fffd887..39ece7f 100644 --- a/types.c +++ b/types.c @@ -83,7 +83,7 @@ fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab, return ft; } -void relocate_typetable() +void relocate_typetable(void) { htable_t *h = &TypeTable; size_t i;