case-folding read and string->symbol in (scheme r5rs)

This commit is contained in:
ESL 2024-07-24 20:09:51 -04:00
parent 5f3bd42a6b
commit 3ac77eafab
4 changed files with 179 additions and 141 deletions

View file

@ -739,6 +739,12 @@
; (string->symbol s)
; (symbol=? x y z ...)
(define (string-ci->symbol s) ; + for r5rs environment
(string->symbol (string-foldcase s)))
(define (symbol-append . syms) ; +
(string->symbol (apply-to-list %string-append (%map1 symbol->string syms))))
;---------------------------------------------------------------------------------------------
; Characters
@ -1587,10 +1593,10 @@
[(k) (read-subbytevector k (current-input-port))]
[(k p) (read-subbytevector k p)]))
(define (%read port simple?)
(define (%read port simple? ci?)
(define-syntax r-error
(syntax-rules () [(_ p msg a ...) (read-error msg a ... 'port: p)]))
(define fold-case? (port-fold-case? port))
(define fold-case? (or ci? (port-fold-case? port)))
(define shared '())
(define (make-shared-ref loc) (lambda () (unbox loc)))
(define (shared-ref? form) (procedure? form))
@ -1936,13 +1942,19 @@
(define read
(case-lambda
[() (%read (current-input-port) #f)]
[(p) (%read p #f)]))
[() (%read (current-input-port) #f #f)]
[(p) (%read p #f #f)]))
(define read-simple
(case-lambda
[() (%read (current-input-port) #t)]
[(p) (%read p #t)]))
[() (%read (current-input-port) #t #f)]
[(p) (%read p #t #f)]))
(define read-simple-ci ; + r5rs compatibility
(case-lambda
[() (%read (current-input-port) #t #t)]
[(p) (%read p #t #t)]))
;---------------------------------------------------------------------------------------------

View file

@ -106,9 +106,6 @@
(begin result1 result2 ...)
(sexp-case key clause clauses ...))]))
(define (symbol-append . syms)
(string->symbol (apply string-append (map symbol->string syms))))
; unique symbol generator (poor man's version)
(define gensym
(let ([gsc 0]) ; never goes down! FIXME: extend fixnum range
@ -2228,7 +2225,17 @@
(define (empty-environment id at)
(cond [(new-id? id) (new-id-lookup id at)]
[else #f]))
; patch (scheme r5rs) library to remap string->symbol to hidden string-ci->symbol
(let ([p (assq 'string->symbol (library-exports (find-library-in-env '(scheme r5rs) root-environment)))]
[q (assq 'string-ci->symbol (library-exports (find-library-in-env '(skint hidden) root-environment)))])
(if (and (pair? p) (pair? q)) (set-cdr! p (cdr q))))
; patch (scheme r5rs) library to remap read to read-simple-ci
(let ([p (assq 'read (library-exports (find-library-in-env '(scheme r5rs) root-environment)))]
[q (assq 'read-simple-ci (library-exports (find-library-in-env '(skint hidden) root-environment)))])
(if (and (pair? p) (pair? q)) (set-cdr! p (cdr q))))
(define (make-historic-report-environment listname prefix)
(let* ([loc (name-lookup *root-name-registry* listname #f)]
[l (and loc (location-val loc))] [l (and (val-library? l) l)]

265
s.c
View file

@ -354,6 +354,13 @@ char *s_code[] = {
"P", "rassq",
"%2.1p?{.1a,.0d,.2q?{.0]3}.2d,.2,@(y5:rassq)[32}f]2",
"P", "string-ci->symbol",
"%1.0SfX5]1",
"P", "symbol-append",
"%!0${${.4,@(y14:symbol->string),@(y5:%25map1)[02},@(y14:%25string-appe"
"nd),@(y13:apply-to-list)[02}X5]1",
"P", "substring->list",
"%3n,'1,.4I-,,#0.3,.1,.6,&3{%2:0,.1I<?{.1]2}.1,.1,:2S4c,'1,.2I-,:1^[22}"
".!0.0^_1[32",
@ -878,137 +885,141 @@ char *s_code[] = {
"tevector)[12}%x,&2{|10|21%%}@!(y15:read-bytevector)",
"P", "%read",
"%2,,,,,,,,,,,,,,,,,,,,,,,,#0#1#2#3#4#5#6#7#8#9#(i10)#(i11)#(i12)#(i13)"
"#(i14)#(i15)#(i16)#(i17)#(i18)#(i19)#(i20)#(i21)#(i22)#(i23).(i24)P78."
"!0n.!1&0{%1.0,&1{%0:0z]0}]1}.!2&0{%1.0K0]1}.!3.4,&1{%1.0K0?{${.2[00},:"
"0^[11}.0]1}.!4.5,.5,&2{%1.0p?{.0aK0?{${.2a,:0^[01},.1sa}{${.2a,:1^[01}"
"}.0dK0?{${.2d,:0^[01},.1sd]1}.0d,:1^[11}.0V0?{'0,,#0.2,:0,:1,.3,&4{%1:"
"3V3,.1I<?{.0,:3V4,.0K0?{${.2,:2^[01},.2,:3V5}{${.2,:1^[01}}_1'1,.1I+,:"
"0^[11}]1}.!0.0^_1[11}.0Y2?{.0zK0?{${.2z,:1^[01},.1sz]1}.0z,:1^[11}f]1}"
".!5.5,&1{%1${.2,:0^[01}.0]1}.!6f.!7f.!8f.!9f.!(i10)'(y12:reader-token)"
",l1,.0.!8'(s17:right parenthesis),.1c.!9'(s13:right bracket),.1c.!(i10"
")'(s5:%22 . %22),.1c.!(i11)_1.7,&1{%1.0p?{:0^,.1aq]1}f]1}.!(i11)&0{%1'"
"(s80:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!$%25&*/:<=>?"
"^_~0123456789+-.@),.1S8]1}.!(i12)&0{%1.0X8,'(i48),.1<!?{'(i57),.1>!}{f"
"},.0?{.0]3}'(i65),.2<!?{'(i70),.2>!}{f},.0?{.0]4}'(i97),.3<!?{'(i102),"
".3>!]4}f]4}.!(i13)&0{%1.0C1,.0?{.0]2}'(c)),.2C=,.0?{.0]3}'(c(),.3C=,.0"
"?{.0]4}'(c]),.4C=,.0?{.0]5}'(c[),.5C=,.0?{.0]6}'(c%22),.6C=,.0?{.0]7}'"
"(c;),.7C=]7}.!(i14).(i17),.(i12),&2{%1${.2,:1^[01},.0R8?{.1,'(y5:port:"
"),'(s22:unexpected end of file),@(y10:read-error)[23}${.2,:0^[01}?{.1,"
"'(y5:port:),.2d,'(s17:unexpected token:),@(y10:read-error)[24}.0]2}.!("
"i15).(i15),&1{%1'(c ),.1R1v?{${${.4,@(y9:read-line)[01},@(y22:string-t"
"rim-whitespace)[01}X5]1}.0,:0^[11}.!(i16).9,.(i13),.(i22),.3,.(i20),.("
"i28),.(i23),.(i15),.(i26),.(i28),.(i31),.(i25),.(i15),.(i28),.(i16),.("
"i16),.(i41),&(i17){%1.0R0,.0R8?{.0]2}.0C1?{.1,:(i10)^[21}'(c(),.1C=?{t"
",:9^,.3,.3,:8^[24}'(c)),.1C=?{:9^]2}'(c[),.1C=?{t,:(i16)^,.3,.3,:8^[24"
"}'(c]),.1C=?{:(i16)^]2}'(c'),.1C=?{${.3,:3^[01},'(y5:quote),l2]2}'(c`)"
",.1C=?{${.3,:3^[01},'(y10:quasiquote),l2]2}${.2,:(i15)^[01}?{.1,.1,:(i"
"11)^[22}'(c;),.1C=?{${.3R0,,#0.5,.1,&2{%1.0R8,.0?{.0]2}'(c%0a),.2C=,.0"
"?{.0]3}:1R0,:0^[31}.!0.0^_1[01}.1,:(i10)^[21}'(c,),.1C=?{.1R1,.0R8?{.2"
",'(y5:port:),'(s19:end of file after ,),@(y10:read-error)[33}'(c@),.1C"
"=?{.2R0${.4,:3^[01},'(y16:unquote-splicing),l2]3}${.4,:3^[01},'(y7:unq"
"uote),l2]3}'(c%22),.1C=?{n,,#0.3,:(i14),.2,&3{%1:2R0,.0R8?{:2,'(y5:por"
"t:),'(s27:end of file within a string),@(y10:read-error)[23}'(c%5c),.1"
"C=?{${'(y6:string),:2,:1^[02},.0?{.2,.1c}{.2},:0^[31}'(c%22),.1C=?{.1A"
"9X3]2}.1,.1c,:0^[21}.!0.0^_1[21}'(c|),.1C=?{n,,#0.3,:(i14),.2,&3{%1:2R"
"0,.0R8?{:2,'(y5:port:),'(s29:end of file within a |symbol|),@(y10:read"
"-error)[23}'(c%5c),.1C=?{${'(y6:symbol),:2,:1^[02},.0?{.2,.1c}{.2},:0^"
"[31}'(c|),.1C=?{.1A9X3X5]2}.1,.1c,:0^[21}.!0.0^_1[21}'(c#),.1C=?{.1R1,"
".0R8?{.2,'(y5:port:),'(s19:end of file after #),@(y10:read-error)[33}'"
"(c!),.1C=?{.2R0${.4,:(i12)^[01},.0,'(l2:y9:fold-case;y12:no-fold-case;"
"),.1A1?{'(y9:fold-case),.2q:!(i13):(i13)^,.5P79.4,:(i10)^[51}.1Y0?{.1Y"
"6]5}.4,'(y5:port:),.3,'(s24:unexpected name after #!),@(y10:read-error"
")[54}'(ct),.1Ci=,.0?{.0}{'(cf),.2Ci=}_1?{${.4,:3^[01},.0,'(l2:y1:t;y4:"
"true;),.1A1?{t]5}'(l2:y1:f;y5:false;),.1A1?{f]5}.4,'(y5:port:),.3,'(s2"
"3:unexpected name after #),@(y10:read-error)[54}'(cb),.1Ci=,.0?{.0}{'("
"co),.2Ci=,.0?{.0}{'(cd),.3Ci=,.0?{.0}{'(cx),.4Ci=,.0?{.0}{'(ci),.5Ci=,"
".0?{.0}{'(ce),.6Ci=}_1}_1}_1}_1}_1?{.2,'(c#),:(i11)^[32}'(c&),.1C=?{.2"
"R0${.4,:3^[01}b]3}'(c;),.1C=?{.2R0${.4,:3^[01}.2,:(i10)^[31}'(c|),.1C="
"?{.2R0${,#0.5,.1,&2{%0:1R0,.0R8?{:1,'(y5:port:),'(s25:end of file in #"
"| comment),@(y10:read-error)[13}'(c|),.1C=?{:1R1,.0R8?{:1,'(y5:port:),"
"'(s25:end of file in #| comment),@(y10:read-error)[23}'(c#),.1C=?{:1R0"
"]2}:0^[20}'(c#),.1C=?{:1R1,.0R8?{:1,'(y5:port:),'(s25:end of file in #"
"| comment),@(y10:read-error)[23}'(c|),.1C=?{:1R0${:0^[00}:0^[20}:0^[20"
"}:0^[10}.!0.0^_1[00}.2,:(i10)^[31}'(c(),.1C=?{.2R0${f,:9^,.6,.5,:8^[04"
"}X1]3}'(cu),.1C=?{.2R0'(c8),.3R0q?{'(c(),.3R0q}{f}?{${.4,:7^[01}E1]3}."
"2,'(y5:port:),'(s25:invalid bytevector syntax),@(y10:read-error)[33}'("
"c%5c),.1C=?{.2R0.2R1,.0R8?{.3,'(y5:port:),'(s20:end of file after #%5c"
"),@(y10:read-error)[43}.0,'(cx)C=?{.3R0${.5R1,:5^[01}?{.0]4}f,.4,:6^[4"
"2}.0C4?{${.5,:3^[01},'1,.1X4S3=?{.1]5}.0,'(y4:null),.1v?{'0X9]6}'(y5:s"
"pace),.1v?{'(c )]6}'(y5:alarm),.1v?{'(c%07)]6}'(y9:backspace),.1v?{'(c"
"%08)]6}'(y6:delete),.1v?{'(i127)X9]6}'(y6:escape),.1v?{'(i27)X9]6}'(y3"
":tab),.1v?{'(c%09)]6}'(l2:y7:newline;y8:linefeed;),.1A1?{'(c%0a)]6}'(y"
"4:vtab),.1v?{'(c%0b)]6}'(y4:page),.1v?{'(c%0c)]6}'(y6:return),.1v?{'(c"
"%0d)]6}.5,'(y5:port:),.3,'(s15:unknown #%5c name),@(y10:read-error)[64"
"}.3R0.0]4}.0C5?{:0?{${.4,'(y5:port:),'(s44:#N=/#N# notation is not all"
"owed in this mode),@(y10:read-error)[03}}n,,#0.4,.1,:4,:3,:2,:1,&6{%1:"
"5R0,.0R8?{:5,'(y5:port:),'(s32:end of file within a #N notation),@(y10"
":read-error)[23}.0C5?{.1,.1c,:4^[21}'(c#),.1C=?{.1A9X3,'(i10),.1E9,.0I"
"0?{:0^,.1A3}{f},.0?{.0d]5}'(s22:unknown #n# reference:),'(y5:port:),.4"
",@(y10:read-error)[53}'(c=),.1C=?{.1A9X3,'(i10),.1E9,.0I0~?{${'(s22:in"
"valid #n= reference:),'(y5:port:),.5,@(y10:read-error)[03}}{:0^,.1A3?{"
"${'(s18:duplicate #n= tag:),'(y5:port:),.4,@(y10:read-error)[03}}{f}}f"
"b,:0^,${.3,:1^[01},.3cc:!0${:5,:2^[01},${.2,:3^[01}?{'(s31:#n= has ano"
"ther label as target),'(y5:port:),.5,@(y10:read-error)[63}.0,.2sz.0]6}"
":5,'(y5:port:),'(s34:invalid terminator for #N notation),@(y10:read-er"
"ror)[23}.!0.0^_1[31}.2,'(y5:port:),.2,'(s16:unknown # syntax),@(y10:re"
"ad-error)[34}.1,'(y5:port:),.2,'(s22:illegal character read),@(y10:rea"
"d-error)[24}.!(i17).(i17),.(i12),.(i17),.(i13),&4{%4${.3,:3^[01},:0^,."
"1q?{.2,'(y5:port:),'(s42:missing car -- ( immediately followed by .),@"
"(y10:read-error)[53}.0,,#0.0,.5,:3,:2,.(i10),:1,.(i11),:0,&8{%1.0R8?{:"
"6,'(y5:port:),'(s41:eof inside list -- unbalanced parentheses),@(y10:r"
"ead-error)[13}:1,.1q?{n]1}:0^,.1q?{:3?{${:6,:2^[01},${:6,:5^[01},:1,.1"
"q?{.1]3}:6,'(y5:port:),.2,'(s31:randomness after form after dot),@(y10"
":read-error)[34}:6,'(y5:port:),'(s13:dot in #(...)),@(y10:read-error)["
"13}${.2,:4^[01}?{:6,'(y5:port:),.2d,'(s20:error inside list --),@(y10:"
"read-error)[14}${${:6,:5^[01},:7^[01},.1c]1}.!0.0^_1[51}.!(i18).(i17),"
".9,.(i13),&3{%1${.2,:2^[01},,#0.0,.3,:2,:0,:1,&5{%1.0R8?{:3,'(y5:port:"
"),'(s21:eof inside bytevector),@(y10:read-error)[13}:0^,.1q?{n]1}${.2,"
":1^[01}?{:3,'(y5:port:),.2d,'(s26:error inside bytevector --),@(y10:re"
"ad-error)[14}.0I0~,.0?{.0}{'0,.2I<,.0?{.0}{'(i255),.3I>}_1}_1?{:3,'(y5"
":port:),.2,'(s33:invalid byte inside bytevector --),@(y10:read-error)["
"14}${${:3,:2^[01},:4^[01},.1c]1}.!0.0^_1[11}.!(i19).(i21),&1{%2.0R0,.0"
"R8?{${.3,'(y5:port:),.6,'(s20:end of file within a),@(y10:read-error)["
"04}}'(c%5c),.1C=,.0?{.0}{'(c%22),.2C=,.0?{.0}{'(c|),.3C=}_1}_1?{.0]3}'"
"(ca),.1C=?{'(c%07)]3}'(cb),.1C=?{'(c%08)]3}'(ct),.1C=?{'(c%09)]3}'(cn)"
",.1C=?{'(c%0a)]3}'(cv),.1C=?{'(c%0b)]3}'(cf),.1C=?{'(c%0c)]3}'(cr),.1C"
"=?{'(c%0d)]3}'(cx),.1C=?{t,.2,:0^[32}'(y6:string),.3q?{.0C1}{f}?{.1R1,"
"'(c%0a),.2C=,,#0.0,.5,&2{%2.1R8,.0?{.0}{.2C1~}_1?{.0?{f]2}:0,'(y5:port"
":),'(s32:no newline in line ending escape),@(y10:read-error)[23}.0?{'("
"c%0a),.2C=}{f}?{f]2}:0R0:0R1,.1,.0?{.0}{'(c%0a),.4C=}_1,:1^[22}.!0.0^_"
"1[32}.1,'(y5:port:),.2,'(y1::),.6,'(s22:invalid char escape in),@(y10:"
"read-error)[36}.!(i20).(i14),.(i14),&2{%2,#0.1,&1{%1.0u?{:0,'(y5:port:"
"),'(s31:%5cx escape sequence is too short),@(y10:read-error)[13}'(i16)"
",.1A9X3X7X9]1}.!0'0,n,.3R1,,#0.0,.6,:0,.7,.(i10),:1,&6{%3.0R8?{:1?{:4,"
"'(y5:port:),'(s27:end of file within a string),@(y10:read-error)[33}.1"
",:2^[31}:1?{'(c;),.1C=}{f}?{:4R0.1,:2^[31}:1~?{${.2,:0^[01}}{f}?{.1,:2"
"^[31}${.2,:3^[01}~?{:4,'(y5:port:),.2,'(s37:unexpected char in %5cx es"
"cape sequence),@(y10:read-error)[34}'2,.3>?{:4,'(y5:port:),'(s30:%5cx "
"escape sequence is too long),@(y10:read-error)[33}:4R0'1,.3+,.2,.2c,:4"
"R1,:5^[33}.!0.0^_1[33}.!(i21)&0{%4.0,.0?{.0}{.2C5}_1?{f]4}'(s2:+i),.4S"
"i=,.0?{.0}{'(s2:-i),.5Si=}_1?{f]4}'(s6:+nan.0),.4Si=,.0?{.0}{'(s6:-nan"
".0),.5Si=}_1?{f]4}'(s6:+inf.0),.4Si=,.0?{.0}{'(s6:-inf.0),.5Si=}_1?{f]"
"4}'(c+),.2C=,.0?{.0}{'(c-),.3C=}_1?{.2du?{t]4}'(c.),.3daC=?{.2ddp?{.2d"
"daC5~]4}f]4}.2daC5~]4}'(c.),.2C=?{.2dp?{.2daC5~]4}f]4}f]4}.!(i22).(i14"
"),.(i23),.(i12),.3,.(i16),&5{%2'(c#),.1C=,.1,l1,.3R1,,#0.5,.1,:0,:1,:2"
",:3,:4,&7{%3.0R8,.0?{.0}{${.3,:0^[01}}_1?{.1A9,.0a,.1X3,.5,.0?{.0}{.2C"
"5,.0?{.0}{'(c+),.4C=,.0?{.0}{'(c-),.5C=,.0?{.0}{'(c.),.6C=}_1}_1}_1}_1"
"?{'(s1:.),.1S=?{:2^]6}${.2,.5,.5,.(i10),:1^[04}?{:3^?{.0SfX5]6}.0X5]6}"
"'(i10),.1E9,.0?{.0]7}:6,'(y5:port:),.3,'(s54:unsupported number syntax"
" (implementation restriction)),@(y10:read-error)[74}:3^?{.0SfX5]6}.0X5"
"]6}'(c#),.1C=?{:6R0t,.2,.2c,:6R1,:5^[33}${.2,:4^[01}?{:6R0.2,.2,.2c,:6"
"R1,:5^[33}:6,'(y5:port:),.2,'(s29:unexpected number/symbol char),@(y10"
":read-error)[34}.!0.0^_1[23}.!(i23)${.(i26),.(i20)^[01},${.2,.(i15)^[0"
"1}~?{.2^u?{.0](i27)}.0,.8^[(i27)1}.(i25),'(y5:port:),.2d,'(s17:unexpec"
"ted token:),@(y10:read-error)[(i27)4",
"%3,,,,,,,,,,,,,,,,,,,,,,,,#0#1#2#3#4#5#6#7#8#9#(i10)#(i11)#(i12)#(i13)"
"#(i14)#(i15)#(i16)#(i17)#(i18)#(i19)#(i20)#(i21)#(i22)#(i23).(i26),.0?"
"{.0}{.(i25)P78}_1.!0n.!1&0{%1.0,&1{%0:0z]0}]1}.!2&0{%1.0K0]1}.!3.4,&1{"
"%1.0K0?{${.2[00},:0^[11}.0]1}.!4.5,.5,&2{%1.0p?{.0aK0?{${.2a,:0^[01},."
"1sa}{${.2a,:1^[01}}.0dK0?{${.2d,:0^[01},.1sd]1}.0d,:1^[11}.0V0?{'0,,#0"
".2,:0,:1,.3,&4{%1:3V3,.1I<?{.0,:3V4,.0K0?{${.2,:2^[01},.2,:3V5}{${.2,:"
"1^[01}}_1'1,.1I+,:0^[11}]1}.!0.0^_1[11}.0Y2?{.0zK0?{${.2z,:1^[01},.1sz"
"]1}.0z,:1^[11}f]1}.!5.5,&1{%1${.2,:0^[01}.0]1}.!6f.!7f.!8f.!9f.!(i10)'"
"(y12:reader-token),l1,.0.!8'(s17:right parenthesis),.1c.!9'(s13:right "
"bracket),.1c.!(i10)'(s5:%22 . %22),.1c.!(i11)_1.7,&1{%1.0p?{:0^,.1aq]1"
"}f]1}.!(i11)&0{%1'(s80:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
"vwxyz!$%25&*/:<=>?^_~0123456789+-.@),.1S8]1}.!(i12)&0{%1.0X8,'(i48),.1"
"<!?{'(i57),.1>!}{f},.0?{.0]3}'(i65),.2<!?{'(i70),.2>!}{f},.0?{.0]4}'(i"
"97),.3<!?{'(i102),.3>!]4}f]4}.!(i13)&0{%1.0C1,.0?{.0]2}'(c)),.2C=,.0?{"
".0]3}'(c(),.3C=,.0?{.0]4}'(c]),.4C=,.0?{.0]5}'(c[),.5C=,.0?{.0]6}'(c%2"
"2),.6C=,.0?{.0]7}'(c;),.7C=]7}.!(i14).(i17),.(i12),&2{%1${.2,:1^[01},."
"0R8?{.1,'(y5:port:),'(s22:unexpected end of file),@(y10:read-error)[23"
"}${.2,:0^[01}?{.1,'(y5:port:),.2d,'(s17:unexpected token:),@(y10:read-"
"error)[24}.0]2}.!(i15).(i15),&1{%1'(c ),.1R1v?{${${.4,@(y9:read-line)["
"01},@(y22:string-trim-whitespace)[01}X5]1}.0,:0^[11}.!(i16).9,.(i13),."
"(i22),.3,.(i20),.(i28),.(i23),.(i15),.(i26),.(i28),.(i31),.(i25),.(i15"
"),.(i28),.(i16),.(i16),.(i41),&(i17){%1.0R0,.0R8?{.0]2}.0C1?{.1,:(i10)"
"^[21}'(c(),.1C=?{t,:9^,.3,.3,:8^[24}'(c)),.1C=?{:9^]2}'(c[),.1C=?{t,:("
"i16)^,.3,.3,:8^[24}'(c]),.1C=?{:(i16)^]2}'(c'),.1C=?{${.3,:3^[01},'(y5"
":quote),l2]2}'(c`),.1C=?{${.3,:3^[01},'(y10:quasiquote),l2]2}${.2,:(i1"
"5)^[01}?{.1,.1,:(i11)^[22}'(c;),.1C=?{${.3R0,,#0.5,.1,&2{%1.0R8,.0?{.0"
"]2}'(c%0a),.2C=,.0?{.0]3}:1R0,:0^[31}.!0.0^_1[01}.1,:(i10)^[21}'(c,),."
"1C=?{.1R1,.0R8?{.2,'(y5:port:),'(s19:end of file after ,),@(y10:read-e"
"rror)[33}'(c@),.1C=?{.2R0${.4,:3^[01},'(y16:unquote-splicing),l2]3}${."
"4,:3^[01},'(y7:unquote),l2]3}'(c%22),.1C=?{n,,#0.3,:(i14),.2,&3{%1:2R0"
",.0R8?{:2,'(y5:port:),'(s27:end of file within a string),@(y10:read-er"
"ror)[23}'(c%5c),.1C=?{${'(y6:string),:2,:1^[02},.0?{.2,.1c}{.2},:0^[31"
"}'(c%22),.1C=?{.1A9X3]2}.1,.1c,:0^[21}.!0.0^_1[21}'(c|),.1C=?{n,,#0.3,"
":(i14),.2,&3{%1:2R0,.0R8?{:2,'(y5:port:),'(s29:end of file within a |s"
"ymbol|),@(y10:read-error)[23}'(c%5c),.1C=?{${'(y6:symbol),:2,:1^[02},."
"0?{.2,.1c}{.2},:0^[31}'(c|),.1C=?{.1A9X3X5]2}.1,.1c,:0^[21}.!0.0^_1[21"
"}'(c#),.1C=?{.1R1,.0R8?{.2,'(y5:port:),'(s19:end of file after #),@(y1"
"0:read-error)[33}'(c!),.1C=?{.2R0${.4,:(i12)^[01},.0,'(l2:y9:fold-case"
";y12:no-fold-case;),.1A1?{'(y9:fold-case),.2q:!(i13):(i13)^,.5P79.4,:("
"i10)^[51}.1Y0?{.1Y6]5}.4,'(y5:port:),.3,'(s24:unexpected name after #!"
"),@(y10:read-error)[54}'(ct),.1Ci=,.0?{.0}{'(cf),.2Ci=}_1?{${.4,:3^[01"
"},.0,'(l2:y1:t;y4:true;),.1A1?{t]5}'(l2:y1:f;y5:false;),.1A1?{f]5}.4,'"
"(y5:port:),.3,'(s23:unexpected name after #),@(y10:read-error)[54}'(cb"
"),.1Ci=,.0?{.0}{'(co),.2Ci=,.0?{.0}{'(cd),.3Ci=,.0?{.0}{'(cx),.4Ci=,.0"
"?{.0}{'(ci),.5Ci=,.0?{.0}{'(ce),.6Ci=}_1}_1}_1}_1}_1?{.2,'(c#),:(i11)^"
"[32}'(c&),.1C=?{.2R0${.4,:3^[01}b]3}'(c;),.1C=?{.2R0${.4,:3^[01}.2,:(i"
"10)^[31}'(c|),.1C=?{.2R0${,#0.5,.1,&2{%0:1R0,.0R8?{:1,'(y5:port:),'(s2"
"5:end of file in #| comment),@(y10:read-error)[13}'(c|),.1C=?{:1R1,.0R"
"8?{:1,'(y5:port:),'(s25:end of file in #| comment),@(y10:read-error)[2"
"3}'(c#),.1C=?{:1R0]2}:0^[20}'(c#),.1C=?{:1R1,.0R8?{:1,'(y5:port:),'(s2"
"5:end of file in #| comment),@(y10:read-error)[23}'(c|),.1C=?{:1R0${:0"
"^[00}:0^[20}:0^[20}:0^[10}.!0.0^_1[00}.2,:(i10)^[31}'(c(),.1C=?{.2R0${"
"f,:9^,.6,.5,:8^[04}X1]3}'(cu),.1C=?{.2R0'(c8),.3R0q?{'(c(),.3R0q}{f}?{"
"${.4,:7^[01}E1]3}.2,'(y5:port:),'(s25:invalid bytevector syntax),@(y10"
":read-error)[33}'(c%5c),.1C=?{.2R0.2R1,.0R8?{.3,'(y5:port:),'(s20:end "
"of file after #%5c),@(y10:read-error)[43}.0,'(cx)C=?{.3R0${.5R1,:5^[01"
"}?{.0]4}f,.4,:6^[42}.0C4?{${.5,:3^[01},'1,.1X4S3=?{.1]5}.0,'(y4:null),"
".1v?{'0X9]6}'(y5:space),.1v?{'(c )]6}'(y5:alarm),.1v?{'(c%07)]6}'(y9:b"
"ackspace),.1v?{'(c%08)]6}'(y6:delete),.1v?{'(i127)X9]6}'(y6:escape),.1"
"v?{'(i27)X9]6}'(y3:tab),.1v?{'(c%09)]6}'(l2:y7:newline;y8:linefeed;),."
"1A1?{'(c%0a)]6}'(y4:vtab),.1v?{'(c%0b)]6}'(y4:page),.1v?{'(c%0c)]6}'(y"
"6:return),.1v?{'(c%0d)]6}.5,'(y5:port:),.3,'(s15:unknown #%5c name),@("
"y10:read-error)[64}.3R0.0]4}.0C5?{:0?{${.4,'(y5:port:),'(s44:#N=/#N# n"
"otation is not allowed in this mode),@(y10:read-error)[03}}n,,#0.4,.1,"
":4,:3,:2,:1,&6{%1:5R0,.0R8?{:5,'(y5:port:),'(s32:end of file within a "
"#N notation),@(y10:read-error)[23}.0C5?{.1,.1c,:4^[21}'(c#),.1C=?{.1A9"
"X3,'(i10),.1E9,.0I0?{:0^,.1A3}{f},.0?{.0d]5}'(s22:unknown #n# referenc"
"e:),'(y5:port:),.4,@(y10:read-error)[53}'(c=),.1C=?{.1A9X3,'(i10),.1E9"
",.0I0~?{${'(s22:invalid #n= reference:),'(y5:port:),.5,@(y10:read-erro"
"r)[03}}{:0^,.1A3?{${'(s18:duplicate #n= tag:),'(y5:port:),.4,@(y10:rea"
"d-error)[03}}{f}}fb,:0^,${.3,:1^[01},.3cc:!0${:5,:2^[01},${.2,:3^[01}?"
"{'(s31:#n= has another label as target),'(y5:port:),.5,@(y10:read-erro"
"r)[63}.0,.2sz.0]6}:5,'(y5:port:),'(s34:invalid terminator for #N notat"
"ion),@(y10:read-error)[23}.!0.0^_1[31}.2,'(y5:port:),.2,'(s16:unknown "
"# syntax),@(y10:read-error)[34}.1,'(y5:port:),.2,'(s22:illegal charact"
"er read),@(y10:read-error)[24}.!(i17).(i17),.(i12),.(i17),.(i13),&4{%4"
"${.3,:3^[01},:0^,.1q?{.2,'(y5:port:),'(s42:missing car -- ( immediatel"
"y followed by .),@(y10:read-error)[53}.0,,#0.0,.5,:3,:2,.(i10),:1,.(i1"
"1),:0,&8{%1.0R8?{:6,'(y5:port:),'(s41:eof inside list -- unbalanced pa"
"rentheses),@(y10:read-error)[13}:1,.1q?{n]1}:0^,.1q?{:3?{${:6,:2^[01},"
"${:6,:5^[01},:1,.1q?{.1]3}:6,'(y5:port:),.2,'(s31:randomness after for"
"m after dot),@(y10:read-error)[34}:6,'(y5:port:),'(s13:dot in #(...)),"
"@(y10:read-error)[13}${.2,:4^[01}?{:6,'(y5:port:),.2d,'(s20:error insi"
"de list --),@(y10:read-error)[14}${${:6,:5^[01},:7^[01},.1c]1}.!0.0^_1"
"[51}.!(i18).(i17),.9,.(i13),&3{%1${.2,:2^[01},,#0.0,.3,:2,:0,:1,&5{%1."
"0R8?{:3,'(y5:port:),'(s21:eof inside bytevector),@(y10:read-error)[13}"
":0^,.1q?{n]1}${.2,:1^[01}?{:3,'(y5:port:),.2d,'(s26:error inside bytev"
"ector --),@(y10:read-error)[14}.0I0~,.0?{.0}{'0,.2I<,.0?{.0}{'(i255),."
"3I>}_1}_1?{:3,'(y5:port:),.2,'(s33:invalid byte inside bytevector --),"
"@(y10:read-error)[14}${${:3,:2^[01},:4^[01},.1c]1}.!0.0^_1[11}.!(i19)."
"(i21),&1{%2.0R0,.0R8?{${.3,'(y5:port:),.6,'(s20:end of file within a),"
"@(y10:read-error)[04}}'(c%5c),.1C=,.0?{.0}{'(c%22),.2C=,.0?{.0}{'(c|),"
".3C=}_1}_1?{.0]3}'(ca),.1C=?{'(c%07)]3}'(cb),.1C=?{'(c%08)]3}'(ct),.1C"
"=?{'(c%09)]3}'(cn),.1C=?{'(c%0a)]3}'(cv),.1C=?{'(c%0b)]3}'(cf),.1C=?{'"
"(c%0c)]3}'(cr),.1C=?{'(c%0d)]3}'(cx),.1C=?{t,.2,:0^[32}'(y6:string),.3"
"q?{.0C1}{f}?{.1R1,'(c%0a),.2C=,,#0.0,.5,&2{%2.1R8,.0?{.0}{.2C1~}_1?{.0"
"?{f]2}:0,'(y5:port:),'(s32:no newline in line ending escape),@(y10:rea"
"d-error)[23}.0?{'(c%0a),.2C=}{f}?{f]2}:0R0:0R1,.1,.0?{.0}{'(c%0a),.4C="
"}_1,:1^[22}.!0.0^_1[32}.1,'(y5:port:),.2,'(y1::),.6,'(s22:invalid char"
" escape in),@(y10:read-error)[36}.!(i20).(i14),.(i14),&2{%2,#0.1,&1{%1"
".0u?{:0,'(y5:port:),'(s31:%5cx escape sequence is too short),@(y10:rea"
"d-error)[13}'(i16),.1A9X3X7X9]1}.!0'0,n,.3R1,,#0.0,.6,:0,.7,.(i10),:1,"
"&6{%3.0R8?{:1?{:4,'(y5:port:),'(s27:end of file within a string),@(y10"
":read-error)[33}.1,:2^[31}:1?{'(c;),.1C=}{f}?{:4R0.1,:2^[31}:1~?{${.2,"
":0^[01}}{f}?{.1,:2^[31}${.2,:3^[01}~?{:4,'(y5:port:),.2,'(s37:unexpect"
"ed char in %5cx escape sequence),@(y10:read-error)[34}'2,.3>?{:4,'(y5:"
"port:),'(s30:%5cx escape sequence is too long),@(y10:read-error)[33}:4"
"R0'1,.3+,.2,.2c,:4R1,:5^[33}.!0.0^_1[33}.!(i21)&0{%4.0,.0?{.0}{.2C5}_1"
"?{f]4}'(s2:+i),.4Si=,.0?{.0}{'(s2:-i),.5Si=}_1?{f]4}'(s6:+nan.0),.4Si="
",.0?{.0}{'(s6:-nan.0),.5Si=}_1?{f]4}'(s6:+inf.0),.4Si=,.0?{.0}{'(s6:-i"
"nf.0),.5Si=}_1?{f]4}'(c+),.2C=,.0?{.0}{'(c-),.3C=}_1?{.2du?{t]4}'(c.),"
".3daC=?{.2ddp?{.2ddaC5~]4}f]4}.2daC5~]4}'(c.),.2C=?{.2dp?{.2daC5~]4}f]"
"4}f]4}.!(i22).(i14),.(i23),.(i12),.3,.(i16),&5{%2'(c#),.1C=,.1,l1,.3R1"
",,#0.5,.1,:0,:1,:2,:3,:4,&7{%3.0R8,.0?{.0}{${.3,:0^[01}}_1?{.1A9,.0a,."
"1X3,.5,.0?{.0}{.2C5,.0?{.0}{'(c+),.4C=,.0?{.0}{'(c-),.5C=,.0?{.0}{'(c."
"),.6C=}_1}_1}_1}_1?{'(s1:.),.1S=?{:2^]6}${.2,.5,.5,.(i10),:1^[04}?{:3^"
"?{.0SfX5]6}.0X5]6}'(i10),.1E9,.0?{.0]7}:6,'(y5:port:),.3,'(s54:unsuppo"
"rted number syntax (implementation restriction)),@(y10:read-error)[74}"
":3^?{.0SfX5]6}.0X5]6}'(c#),.1C=?{:6R0t,.2,.2c,:6R1,:5^[33}${.2,:4^[01}"
"?{:6R0.2,.2,.2c,:6R1,:5^[33}:6,'(y5:port:),.2,'(s29:unexpected number/"
"symbol char),@(y10:read-error)[34}.!0.0^_1[23}.!(i23)${.(i26),.(i20)^["
"01},${.2,.(i15)^[01}~?{.2^u?{.0](i28)}.0,.8^[(i28)1}.(i25),'(y5:port:)"
",.2d,'(s17:unexpected token:),@(y10:read-error)[(i28)4",
"C", 0,
"&0{%1f,.1,@(y5:%25read)[12}%x,&0{%0f,Pi,@(y5:%25read)[02}%x,&2{|00|11%"
"%}@!(y4:read)",
"&0{%1f,f,.2,@(y5:%25read)[13}%x,&0{%0f,f,Pi,@(y5:%25read)[03}%x,&2{|00"
"|11%%}@!(y4:read)",
"C", 0,
"&0{%1t,.1,@(y5:%25read)[12}%x,&0{%0t,Pi,@(y5:%25read)[02}%x,&2{|00|11%"
"%}@!(y11:read-simple)",
"&0{%1f,t,.2,@(y5:%25read)[13}%x,&0{%0f,t,Pi,@(y5:%25read)[03}%x,&2{|00"
"|11%%}@!(y11:read-simple)",
"C", 0,
"&0{%1t,t,.2,@(y5:%25read)[13}%x,&0{%0t,t,Pi,@(y5:%25read)[03}%x,&2{|00"
"|11%%}@!(y14:read-simple-ci)",
"P", "write-substring",
"%4.1,,#0.0,.3,.7,.7,&4{%1:0,.1I<!?{]1}:1,.1,:2S4W0'1,.1I+,:3^[11}.!0.0"

16
t.c
View file

@ -59,10 +59,6 @@ char *t_code[] = {
"quote;y3:pat;;y3:key;;l4:y5:begin;y7:result1;y7:result2;y3:...;;l5:y9:"
"sexp-case;y3:key;y6:clause;y7:clauses;y3:...;;;;",
"P", "symbol-append",
"%!0${${.4,@(y14:symbol->string),@(y5:%25map1)[02},@(y14:%25string-appe"
"nd),@(y13:apply-to-list)[02}X5]1",
"C", 0,
"'0,#0.0,&1{%!0'1,:0^I+:!0.0u,.0?{.0}{.1aY0~}_1?{'(i10),:0^X6,'(s1:#)S6"
"X5]1}'(i10),:0^X6,'(s1:#)S6,.1aX4S6X5]1}_1@!(y6:gensym)",
@ -1402,6 +1398,18 @@ char *t_code[] = {
"P", "empty-environment",
"%2.0K0?{.1,.1,@(y13:new-id-lookup)[22}f]2",
"C", 0,
"'1,${@(y16:root-environment),'(l2:y5:skint;y6:hidden;),@(y19:find-libr"
"ary-in-env)[02}V4,'(y17:string-ci->symbol)A3,'1,${@(y16:root-environme"
"nt),'(l2:y6:scheme;y4:r5rs;),@(y19:find-library-in-env)[02}V4,'(y14:st"
"ring->symbol)A3,.0p?{.1p}{f}?{.1d,.1sd}_2",
"C", 0,
"'1,${@(y16:root-environment),'(l2:y5:skint;y6:hidden;),@(y19:find-libr"
"ary-in-env)[02}V4,'(y14:read-simple-ci)A3,'1,${@(y16:root-environment)"
",'(l2:y6:scheme;y4:r5rs;),@(y19:find-library-in-env)[02}V4,'(y4:read)A"
"3,.0p?{.1p}{f}?{.1d,.1sd}_2",
"P", "make-historic-report-environment",
"%2${f,.3,@(y20:*root-name-registry*),@(y11:name-lookup)[03},.0?{.0z}{f"
"},.0V0?{.0}{f},.0?{'1,.1V4}{f},.5,&1{%1.0,:0,@(y13:symbol-append)[12},"