History

turn all +…+ definitions constant

Sigrid Solveig Haflínudóttir committed 3 months ago

Commit e68cd5f1 parent d6d0d7c4 files · +9 −4Browse files

Unified · Split

4 files
  1. boot/sl.boot +3 −4
  2. src/sl.c +2 −0
  3. src/vm_funcs.c +2 −0
  4. src/vm_jmptbl.c +2 −0
boot/sl.boot+3−4
@@ -276,8 +276,8 @@ group number) "Operations on numbers, mathematical constants." log "Return the · 275 unmodified lines
276(:doc-example . "(subseq '(1 2 3) 0 2)\n; ↳ (1 2)")276(:doc-example . "(subseq '(1 2 3) 0 2)\n; ↳ (1 2)")
277(:doc-example . "(subseq #(a b c) 2)\n; ↳ #(c)") (:doc-group . list) (:doc-see . str-sub) (:doc-see . copy-list)277(:doc-example . "(subseq #(a b c) 2)\n; ↳ #(c)") (:doc-group . list) (:doc-see . str-sub) (:doc-see . copy-list)
278(:doc-see . nthcdr)) set! ((:doc-example . "(def a NIL)\n(def b NIL)\n(def c NIL)\n(set! a 1 b 2 c (+ a b))\n; ↳ 3\na\n; ↳ 1\nb\n; ↳ 2\nc\n; ↳ 3")278(:doc-see . nthcdr)) set! ((:doc-example . "(def a NIL)\n(def b NIL)\n(def c NIL)\n(set! a 1 b 2 c (+ a b))\n; ↳ 3\na\n; ↳ 1\nb\n; ↳ 2\nc\n; ↳ 3")
279(:doc-group . syntax) (:doc-see . set-top-level-value!) (:doc-see . let)) vm-stats ((:doc-group . debug)279(:doc-group . syntax) (:doc-see . set-top-level-value!) (:doc-see . let)) vm-stats ((:doc-group . vm)) ptr ((:doc-group . number)
280(:doc-group . vm)) ptr ((:doc-group . number) (:doc-see . p32) (:doc-see . p64) (:doc-see . ptr?)) caddar ((:doc-group . list)) print-stack-trace ((:doc-group . error)280(:doc-see . p32) (:doc-see . p64) (:doc-see . ptr?)) caddar ((:doc-group . list)) print-stack-trace ((:doc-group . error)
281(:doc-see . stacktrace)) *stdin* ((:doc-group . io) (:doc-see . *stdout*) (:doc-see . *stderr*)) cosh ((:doc-group . number)) values ((:doc-group . syntax)281(:doc-see . stacktrace)) *stdin* ((:doc-group . io) (:doc-see . *stdout*) (:doc-see . *stderr*)) cosh ((:doc-group . number)) values ((:doc-group . syntax)
282(:doc-see . call-with-values) (:doc-see . receive)) < ((:doc-group . compare) (:doc-group . builtin)) copy-tree ((:doc-example . "(def a '(1 (2 3)))\n(def b (copy-tree a))\n(equal? a b)\n; ↳ T\n(eq? a b)\n; ↳ NIL\n(equal? (cadr a) (cadr b))\n; ↳ T\n(eq? (cadr a) (cadr b))\n; ↳ NIL")282(:doc-see . call-with-values) (:doc-see . receive)) < ((:doc-group . compare) (:doc-group . builtin)) copy-tree ((:doc-example . "(def a '(1 (2 3)))\n(def b (copy-tree a))\n(equal? a b)\n; ↳ T\n(eq? a b)\n; ↳ NIL\n(equal? (cadr a) (cadr b))\n; ↳ T\n(eq? (cadr a) (cadr b))\n; ↳ NIL")
283(:doc-group . list) (:doc-see . copy-list)) sin ((:doc-group . number)) f32 ((:doc-group . number)283(:doc-group . list) (:doc-see . copy-list)) sin ((:doc-group . number)) f32 ((:doc-group . number)
@@ -479,8 +479,7 @@ group number) "Operations on numbers, mathematical constants." log "Return the · 195 unmodified lines
479(:doc-example . "(def b (buffer))\n(with-output (s b) (io-write s \"hello\"))\n; ↳ 5\n(length b)\n; ↳ 5")479(:doc-example . "(def b (buffer))\n(with-output (s b) (io-write s \"hello\"))\n; ↳ 5\n(length b)\n; ↳ 5")
480(:doc-group . io) (:doc-see . with-output-to)) cdaar ((:doc-group . list)) cdar ((:doc-group . list)) iota ((:doc-example . "(iota 4)\n; ↳ (0 1 2 3)")480(:doc-group . io) (:doc-see . with-output-to)) cdaar ((:doc-group . list)) cdar ((:doc-group . list)) iota ((:doc-example . "(iota 4)\n; ↳ (0 1 2 3)")
481(:doc-example . "(iota 4 6)\n; ↳ (6 7 8 9)") (:doc-example . "(iota 4 6 -0.5)\n; ↳ (6 5.5 5.0 4.5)")481(:doc-example . "(iota 4 6)\n; ↳ (6 7 8 9)") (:doc-example . "(iota 4 6 -0.5)\n; ↳ (6 5.5 5.0 4.5)")
482(:doc-group . list) (:doc-see . map-int)) caaddr ((:doc-group . list)) environment ((:doc-group . debug)482(:doc-group . list) (:doc-see . map-int)) caaddr ((:doc-group . list)) environment ((:doc-group . vm)
483(:doc-group . vm)
484(:doc-see . print-stack-trace)) getprop ((:doc-example . "(def x '(1 2 3))\n(putprop x 'words \"one two three\")\n; ↳ \"one two three\"\n(getprop x 'words)\n; ↳ \"one two three\"\n(getprop x 'huh)\n; ‼ key not found: huh\n(getprop x 'huh \"fallback\")\n; ↳ \"fallback\"")483(:doc-see . print-stack-trace)) getprop ((:doc-example . "(def x '(1 2 3))\n(putprop x 'words \"one two three\")\n; ↳ \"one two three\"\n(getprop x 'words)\n; ↳ \"one two three\"\n(getprop x 'huh)\n; ‼ key not found: huh\n(getprop x 'huh \"fallback\")\n; ↳ \"fallback\"")
485(:doc-group . prop) (:doc-see . putprop) (:doc-see . remprop)) putprop ((:doc-example . "(def x '(1 2 3))\n(putprop x 'words \"one two three\")\n; ↳ \"one two three\"\n(getprop x 'words)\n; ↳ \"one two three\"")484(:doc-group . prop) (:doc-see . putprop) (:doc-see . remprop)) putprop ((:doc-example . "(def x '(1 2 3))\n(putprop x 'words \"one two three\")\n; ↳ \"one two three\"\n(getprop x 'words)\n; ↳ \"one two three\"")
486(:doc-group . prop) (:doc-see . getprop)485(:doc-group . prop) (:doc-see . getprop)
src/sl.c+2−0
@@ -1546,6 +1546,8 @@ sl_load_system_image(sl_v sys_image_io) · 1545 unmodified lines
1546 sym->binding = car_(e);1546 sym->binding = car_(e);
1547 if(isfn(sym->binding) && !isbuiltin(sym->binding) && fn_name(sym->binding))1547 if(isfn(sym->binding) && !isbuiltin(sym->binding) && fn_name(sym->binding))
1548 fn_name(sym->binding) = s;1548 fn_name(sym->binding) = s;
1549 if(sym->name[0] == '+' && sym->name[1] != 0 && sym->name[strlen(sym->name)-1] == '+')
1550 sym->flags |= FLAG_CONST;
1549 e = cdr_(e);1551 e = cdr_(e);
1550 }1552 }
1551 }1553 }
src/vm_funcs.c+2−0
@@ -795,6 +795,8 @@ MAKE_OP(SETG_) · 794 unmodified lines
795 cthrow(const_error(v), nargs);795 cthrow(const_error(v), nargs);
796 }796 }
797 sym->binding = sl.sp[-1];797 sym->binding = sl.sp[-1];
798 if(sym->name[0] == '+' && sym->name[1] != 0 && sym->name[strlen(sym->name)-1] == '+')
799 sym->flags |= FLAG_CONST;
798 NEXT_OP;800 NEXT_OP;
799}801}
800 802
src/vm_jmptbl.c+2−0
@@ -862,6 +862,8 @@ OP(OP_SETGL) · 861 unmodified lines
862 cthrow(const_error(v), nargs);862 cthrow(const_error(v), nargs);
863 }863 }
864 sym->binding = sl.sp[-1];864 sym->binding = sl.sp[-1];
865 if(sym->name[0] == '+' && sym->name[1] != 0 && sym->name[strlen(sym->name)-1] == '+')
866 sym->flags |= FLAG_CONST;
865 NEXT_OP;867 NEXT_OP;
866}868}
867 869

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t