mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
retro-unix: add // for line comments
FossilOrigin-Name: 1ae398864d98ee367638a99cedd0ff5029c3eaa25399e23f6a9cac1e3e840617
This commit is contained in:
parent
b48ae91544
commit
8a6a348d6e
8 changed files with 95 additions and 55 deletions
|
@ -16,3 +16,7 @@ Unix
|
|||
- added `sys:current-file` to return the filename being processed
|
||||
- added `sys:current-line` to return the current line number being
|
||||
processed
|
||||
- added `sys:ignore-to-eol` to support commenting out lines when
|
||||
processing files
|
||||
- added `//` to comment out lines (works with files and at the
|
||||
listener)
|
||||
|
|
|
@ -37,6 +37,9 @@ Execute the quotation if the flag is `FALSE`. If false, also exit the word.
|
|||
/ D: nm-q A: - F: -
|
||||
Divide `n` by `m` and return the integer part of the quotient.
|
||||
|
||||
// D: - A: - F: -
|
||||
Ignore any tokens remaining on the current line. Works with files and the interactive "listener".
|
||||
|
||||
/mod D: nm-rq A: - F: -
|
||||
Divide `n` by `m` and return the integer part of the quotient and remainder.
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ $ D: -c A: - F: -
|
|||
-if D: fq- A: - F: -
|
||||
-if; D: fq- A: - F: -
|
||||
/ D: nm-q A: - F: -
|
||||
// D: - A: - F: -
|
||||
/mod D: nm-rq A: - F: -
|
||||
0; D: n-n || n- A: - F: -
|
||||
; D: - A: - F: -
|
||||
|
|
|
@ -111,6 +111,13 @@
|
|||
</div>
|
||||
<p>Divide `n` by `m` and return the integer part of the quotient.</p>
|
||||
<table><tr><td><b>Class:</b> </td><td>class:word</td></tr><tr><td><b>Namespace:</b> </td><td>global</td></tr><tr><td><b>Interface Layer:</b> </td><td>all</td></tr></table><hr/>
|
||||
<h2>//</h2>
|
||||
<div style='margin-left: 1em;'><p><b>Data:</b> -<br>
|
||||
<b>Addr:</b> -<br>
|
||||
<b>Float:</b> -</p>
|
||||
</div>
|
||||
<p>Ignore any tokens remaining on the current line. Works with files and the interactive "listener".</p>
|
||||
<table><tr><td><b>Class:</b> </td><td>class:word</td></tr><tr><td><b>Namespace:</b> </td><td>global</td></tr><tr><td><b>Interface Layer:</b> </td><td>rre</td></tr></table><hr/>
|
||||
<h2>/mod</h2>
|
||||
<div style='margin-left: 1em;'><p><b>Data:</b> nm-rq<br>
|
||||
<b>Addr:</b> -<br>
|
||||
|
|
|
@ -168,6 +168,17 @@ Divide `n` by `m` and return the integer part of the quotient.
|
|||
Class: class:word | Namespace: global | Interface Layer: all
|
||||
------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
|
||||
Data: -
|
||||
Addr: -
|
||||
Float: -
|
||||
|
||||
Ignore any tokens remaining on the current line. Works with files and the interactive "listener".
|
||||
|
||||
Class: class:word | Namespace: global | Interface Layer: rre
|
||||
------------------------------------------------------------------------
|
||||
|
||||
/mod
|
||||
|
||||
Data: nm-rq
|
||||
|
|
|
@ -11,6 +11,7 @@ $ -c - - Return ASCII:NUL (0). class:macro {n/a} {n/a} global all
|
|||
-if fq- - - Execute the quotation if the flag is `FALSE`. class:word {n/a} {n/a} global all
|
||||
-if; fq- - - Execute the quotation if the flag is `FALSE`. If false, also exit the word. class:word {n/a} {n/a} global all
|
||||
/ nm-q - - Divide `n` by `m` and return the integer part of the quotient. class:word {n/a} {n/a} global all
|
||||
// - - - Ignore any tokens remaining on the current line. Works with files and the interactive "listener". class:word {n/a} {n/a} global rre
|
||||
/mod nm-rq - - Divide `n` by `m` and return the integer part of the quotient and remainder. class:primitive {n/a} {n/a} global all
|
||||
0; n-n || n- - - If `n` is zero, drop `n` and exit the current word. If non-zero, leave `n` alone and allow execution to continue. class:macro {n/a} {n/a} global all
|
||||
; - - - End the current definition. class:macro {n/a} {n/a} global all
|
||||
|
|
Can't render this file because it contains an unexpected character in line 14 and column 96.
|
|
@ -105,10 +105,15 @@ startup flags passed.
|
|||
:bye #0 unix:exit ;
|
||||
|
||||
{{
|
||||
'EOT var
|
||||
FALSE 'Ignoring var-n
|
||||
(-f) :ignoring? @Ignoring ;
|
||||
(-nn) :version @Version #100 /mod ;
|
||||
(c-f) :done? [ ASCII:CR eq? ]
|
||||
(c-f) :done? dup !EOT
|
||||
[ ASCII:CR eq? ]
|
||||
[ ASCII:LF eq? ]
|
||||
[ ASCII:SPACE eq? ] tri or or ;
|
||||
(c-f) :eol? @EOT [ ASCII:CR eq? ] [ ASCII:LF eq? ] bi or ;
|
||||
(s-sf) :valid? dup s:length n:strictly-positive? ;
|
||||
(c-c) :check-eof dup [ #-1 eq? ] [ ASCII:EOT eq? ] bi or &bye if ;
|
||||
:bs buffer:get buffer:get drop-pair ;
|
||||
|
@ -118,8 +123,10 @@ startup flags passed.
|
|||
(q-) :buffer [ TIB buffer:set call buffer:start ] buffer:preserve ;
|
||||
(-s) :read-token [ [ character check done? ] until ] buffer s:chop ;
|
||||
(-sf) :input read-token valid? ;
|
||||
(sf-) :process &interpret &drop choose ;
|
||||
(sf-) :process ignoring? [ drop-pair eol? [ &Ignoring v:off ] if ] if;
|
||||
&interpret &drop choose ;
|
||||
---reveal---
|
||||
:// sys:ignore-to-eol &Ignoring v:on ; immediate
|
||||
:banner version 'RETRO_12_(%n.%n)\n s:format s:put
|
||||
EOM here - here EOM '%n_Max,_%n_Used,_%n_Free\n s:format s:put ;
|
||||
:listen @NoEcho [ banner ] -if repeat input process again ;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#ifndef CELL
|
||||
#define CELL int32_t
|
||||
#endif
|
||||
CELL ngaImageCells = 14955;
|
||||
CELL ngaImage[] = { 1793,14368,14912,14954,202010,0,10,1,10,2,10,3,10,4,10,5,10,6,10,
|
||||
CELL ngaImageCells = 15060;
|
||||
CELL ngaImage[] = { 1793,14473,15017,15059,202010,0,10,1,10,2,10,3,10,4,10,5,10,6,10,
|
||||
7,10,8,10,9,10,10,11,10,12,10,13,10,14,10,15,10,16,10,17,
|
||||
10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,68223234,1,2575,
|
||||
85000450,1,656912,139,138,268505089,63,62,135205121,63,10,101384453,0,9,10,2049,56,25,459011,74,
|
||||
|
@ -160,7 +160,7 @@ CELL ngaImage[] = { 1793,14368,14912,14954,202010,0,10,1,10,2,10,3,10,4,10,5,10,
|
|||
983556,1793,3087,1,21,2049,2100,10,1,3082,2049,2100,4100,10,3065,3105,144,118,58,117,
|
||||
112,100,97,116,101,0,4,1793,3112,15,4,8,10,1,3108,2049,2110,16,10,3093,
|
||||
3126,144,99,111,112,121,0,1793,3135,285278725,1,33951492,268767489,1,6,10,1,3128,2049,2275,
|
||||
771,10,3118,3154,144,83,99,111,112,101,76,105,115,116,0,14818,14870,10,3141,3163,
|
||||
771,10,3118,3154,144,83,99,111,112,101,76,105,115,116,0,14923,14975,10,3141,3163,
|
||||
144,123,123,0,2049,1570,2,1,3154,2049,59,16,10,3157,3188,144,45,45,45,114,
|
||||
101,118,101,97,108,45,45,45,0,2049,1570,1,3154,2049,2890,16,10,3172,3202,144,
|
||||
125,125,0,1,3154,2049,56,4,15,11,1793,3216,3841,3154,4097,2,10,1,3211,1793,
|
||||
|
@ -179,7 +179,7 @@ CELL ngaImage[] = { 1793,14368,14912,14954,202010,0,10,1,10,2,10,3,10,4,10,5,10,
|
|||
21,2049,2100,4097,3256,10,1,3458,2049,2100,4097,3265,10,3433,3487,131,84,101,109,112,
|
||||
83,116,114,105,110,103,115,0,32,3472,3505,131,84,101,109,112,83,116,114,105,
|
||||
110,103,77,97,120,0,512,3488,3517,144,83,84,82,73,78,71,83,0,2049,1543,
|
||||
3841,3487,3841,3505,19,18,10,3506,3537,131,67,117,114,114,101,110,116,0,8,10,
|
||||
3841,3487,3841,3505,19,18,10,3506,3537,131,67,117,114,114,101,110,116,0,12,10,
|
||||
3526,3552,144,115,58,112,111,105,110,116,101,114,0,3841,3537,3841,3505,19,2049,3517,
|
||||
17,10,3539,3571,144,115,58,110,101,120,116,0,1,3537,2049,2988,3841,3537,3841,3487,
|
||||
11,1793,3587,1,0,4097,3537,10,1,3582,9,10,3506,3601,144,115,58,116,101,109,
|
||||
|
@ -702,52 +702,58 @@ CELL ngaImage[] = { 1793,14368,14912,14954,202010,0,10,1,10,2,10,3,10,4,10,5,10,
|
|||
2049,13679,1,6,3841,13666,2049,9122,10,13898,13937,144,99,108,101,97,114,0,1,27,
|
||||
2049,9185,2049,3646,91,50,74,0,1,13943,2049,9235,1,27,2049,9185,2049,3646,91,48,
|
||||
59,48,72,0,1,13957,2049,9235,10,13928,13978,131,78,111,69,99,104,111,0,0,
|
||||
13968,13986,144,98,121,101,0,1,0,2049,12446,10,13979,14002,144,118,101,114,115,105,
|
||||
111,110,0,3841,4,1,100,20,10,13991,14017,144,100,111,110,101,63,0,1793,14023,
|
||||
1,13,11,10,1,14019,1793,14031,1,10,11,10,1,14027,1793,14039,1,32,11,10,
|
||||
1,14035,2049,2159,22,22,10,14008,14056,144,118,97,108,105,100,63,0,2,2049,79,
|
||||
2049,2609,10,14046,14075,144,99,104,101,99,107,45,101,111,102,0,2,1793,14082,1,
|
||||
-1,11,10,1,14078,1793,14090,1,4,11,10,1,14086,2049,2122,22,1,13986,9,10,
|
||||
14062,14105,144,98,115,0,2049,3360,2049,3360,771,10,14099,14123,144,99,104,101,99,107,
|
||||
45,98,115,0,2,1793,14130,1,8,11,10,1,14126,1793,14138,1,127,11,10,1,
|
||||
14134,2049,2122,22,1,14105,9,10,14111,14156,144,99,104,101,99,107,0,2049,14075,2049,
|
||||
14123,10,14147,14174,144,99,104,97,114,97,99,116,101,114,0,2049,13497,2,2049,3336,
|
||||
10,14161,14190,144,98,117,102,102,101,114,0,1793,14200,1,1024,2049,3428,8,2049,3302,
|
||||
10,1,14192,2049,3452,10,14180,14219,144,114,101,97,100,45,116,111,107,101,110,0,
|
||||
1793,14235,1793,14230,2049,14174,2049,14156,2049,14017,10,1,14223,2049,2250,10,1,14221,2049,14190,
|
||||
2049,3724,10,14205,14251,144,105,110,112,117,116,0,2049,14219,2049,14056,10,14242,14267,144,
|
||||
112,114,111,99,101,115,115,0,1,367,1,11,2049,64,10,13979,14284,144,98,97,
|
||||
110,110,101,114,0,2049,14002,2049,3646,82,69,84,82,79,32,49,50,32,40,37,
|
||||
110,46,37,110,41,92,110,0,1,14288,2049,7212,2049,9235,2049,1543,2049,1874,18,2049,
|
||||
1874,2049,1543,2049,3646,37,110,32,77,97,120,44,32,37,110,32,85,115,101,100,
|
||||
44,32,37,110,32,70,114,101,101,92,110,0,1,14324,2049,7212,2049,9235,10,14274,
|
||||
14368,144,108,105,115,116,101,110,0,3841,13978,1793,14375,2049,14284,10,1,14372,2049,70,
|
||||
2049,14251,2049,14267,1,14379,7,10,14358,14396,131,67,108,111,99,107,0,0,14387,14409,
|
||||
144,105,100,101,110,116,105,102,121,0,3841,14396,2049,2527,1793,14476,1,5,2049,9139,
|
||||
2,2049,2562,1793,14464,3,2049,3646,73,79,32,68,69,86,73,67,69,32,84,89,
|
||||
80,69,32,48,48,48,53,32,78,79,84,32,70,79,85,78,68,0,1,14427,
|
||||
2049,9235,2049,9198,10,1,14424,1793,14471,4097,14396,10,1,14468,2049,64,10,1,14415,9,
|
||||
10,14358,14502,144,105,111,58,99,108,111,99,107,45,111,112,101,114,97,116,105,
|
||||
111,110,0,2049,14409,3841,14396,2049,9122,10,14480,14528,144,99,108,111,99,107,58,116,
|
||||
105,109,101,115,116,97,109,112,0,1,0,2049,14502,10,14509,14546,144,99,108,111,
|
||||
99,107,58,100,97,121,0,1,1,2049,14502,10,14533,14566,144,99,108,111,99,107,
|
||||
58,109,111,110,116,104,0,1,2,2049,14502,10,14551,14585,144,99,108,111,99,107,
|
||||
58,121,101,97,114,0,1,3,2049,14502,10,14571,14604,144,99,108,111,99,107,58,
|
||||
104,111,117,114,0,1,4,2049,14502,10,14590,14625,144,99,108,111,99,107,58,109,
|
||||
105,110,117,116,101,0,1,5,2049,14502,10,14609,14646,144,99,108,111,99,107,58,
|
||||
115,101,99,111,110,100,0,1,6,2049,14502,10,14630,14668,144,99,108,111,99,107,
|
||||
58,117,116,99,58,100,97,121,0,1,7,2049,14502,10,14651,14692,144,99,108,111,
|
||||
99,107,58,117,116,99,58,109,111,110,116,104,0,1,8,2049,14502,10,14673,14715,
|
||||
144,99,108,111,99,107,58,117,116,99,58,121,101,97,114,0,1,9,2049,14502,
|
||||
10,14697,14738,144,99,108,111,99,107,58,117,116,99,58,104,111,117,114,0,1,
|
||||
10,2049,14502,10,14720,14763,144,99,108,111,99,107,58,117,116,99,58,109,105,110,
|
||||
117,116,101,0,1,11,2049,14502,10,14743,14788,144,99,108,111,99,107,58,117,116,
|
||||
99,58,115,101,99,111,110,100,0,1,12,2049,14502,10,14768,14804,144,100,58,119,
|
||||
111,114,100,115,0,1793,14813,2049,162,2049,9235,2049,9209,10,1,14806,2049,7441,10,14793,
|
||||
14834,144,100,58,119,111,114,100,115,45,119,105,116,104,0,2049,1874,2049,4648,1793,
|
||||
14865,2049,162,2,2049,1874,2049,4162,1793,14854,2049,9235,2049,9209,10,1,14849,1793,14860,3,
|
||||
10,1,14858,2049,64,10,1,14840,2049,7441,10,14818,14889,144,100,105,115,112,108,97,
|
||||
121,45,105,102,45,108,101,102,116,0,2,2049,1874,2049,4598,1793,14901,2049,9235,2049,
|
||||
9209,10,1,14896,1793,14907,3,10,1,14905,2049,64,10,14818,14938,144,100,58,119,111,
|
||||
114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,
|
||||
1874,2049,4648,1793,14949,2049,162,2049,14889,10,1,14944,2049,7441,10,0 };
|
||||
13968,13986,144,98,121,101,0,1,0,2049,12446,10,13979,13998,131,69,79,84,0,0,
|
||||
13991,14011,131,73,103,110,111,114,105,110,103,0,0,13999,14025,144,105,103,110,111,
|
||||
114,105,110,103,63,0,3841,14011,10,14012,14039,144,118,101,114,115,105,111,110,0,
|
||||
3841,4,1,100,20,10,14028,14054,144,100,111,110,101,63,0,2,4097,13998,1793,14063,
|
||||
1,13,11,10,1,14059,1793,14071,1,10,11,10,1,14067,1793,14079,1,32,11,10,
|
||||
1,14075,2049,2159,22,22,10,14045,14094,144,101,111,108,63,0,3841,13998,1793,14102,1,
|
||||
13,11,10,1,14098,1793,14110,1,10,11,10,1,14106,2049,2122,22,10,14086,14126,144,
|
||||
118,97,108,105,100,63,0,2,2049,79,2049,2609,10,14116,14145,144,99,104,101,99,
|
||||
107,45,101,111,102,0,2,1793,14152,1,-1,11,10,1,14148,1793,14160,1,4,11,
|
||||
10,1,14156,2049,2122,22,1,13986,9,10,14132,14175,144,98,115,0,2049,3360,2049,3360,
|
||||
771,10,14169,14193,144,99,104,101,99,107,45,98,115,0,2,1793,14200,1,8,11,
|
||||
10,1,14196,1793,14208,1,127,11,10,1,14204,2049,2122,22,1,14175,9,10,14181,14226,
|
||||
144,99,104,101,99,107,0,2049,14145,2049,14193,10,14217,14244,144,99,104,97,114,97,
|
||||
99,116,101,114,0,2049,13497,2,2049,3336,10,14231,14260,144,98,117,102,102,101,114,
|
||||
0,1793,14270,1,1024,2049,3428,8,2049,3302,10,1,14262,2049,3452,10,14250,14289,144,114,
|
||||
101,97,100,45,116,111,107,101,110,0,1793,14305,1793,14300,2049,14244,2049,14226,2049,14054,
|
||||
10,1,14293,2049,2250,10,1,14291,2049,14260,2049,3724,10,14275,14321,144,105,110,112,117,
|
||||
116,0,2049,14289,2049,14126,10,14312,14337,144,112,114,111,99,101,115,115,0,2049,14025,
|
||||
1793,14355,771,2049,14094,1793,14351,1,14011,2049,3047,10,1,14346,9,10,1,14341,2049,2653,
|
||||
1,367,1,11,2049,64,10,13979,14372,156,47,47,0,2049,13919,1,14011,2049,3034,10,
|
||||
14366,14389,144,98,97,110,110,101,114,0,2049,14039,2049,3646,82,69,84,82,79,32,
|
||||
49,50,32,40,37,110,46,37,110,41,92,110,0,1,14393,2049,7212,2049,9235,2049,
|
||||
1543,2049,1874,18,2049,1874,2049,1543,2049,3646,37,110,32,77,97,120,44,32,37,110,
|
||||
32,85,115,101,100,44,32,37,110,32,70,114,101,101,92,110,0,1,14429,2049,
|
||||
7212,2049,9235,10,14379,14473,144,108,105,115,116,101,110,0,3841,13978,1793,14480,2049,14389,
|
||||
10,1,14477,2049,70,2049,14321,2049,14337,1,14484,7,10,14463,14501,131,67,108,111,99,
|
||||
107,0,0,14492,14514,144,105,100,101,110,116,105,102,121,0,3841,14501,2049,2527,1793,
|
||||
14581,1,5,2049,9139,2,2049,2562,1793,14569,3,2049,3646,73,79,32,68,69,86,73,
|
||||
67,69,32,84,89,80,69,32,48,48,48,53,32,78,79,84,32,70,79,85,
|
||||
78,68,0,1,14532,2049,9235,2049,9198,10,1,14529,1793,14576,4097,14501,10,1,14573,2049,
|
||||
64,10,1,14520,9,10,14463,14607,144,105,111,58,99,108,111,99,107,45,111,112,
|
||||
101,114,97,116,105,111,110,0,2049,14514,3841,14501,2049,9122,10,14585,14633,144,99,108,
|
||||
111,99,107,58,116,105,109,101,115,116,97,109,112,0,1,0,2049,14607,10,14614,
|
||||
14651,144,99,108,111,99,107,58,100,97,121,0,1,1,2049,14607,10,14638,14671,144,
|
||||
99,108,111,99,107,58,109,111,110,116,104,0,1,2,2049,14607,10,14656,14690,144,
|
||||
99,108,111,99,107,58,121,101,97,114,0,1,3,2049,14607,10,14676,14709,144,99,
|
||||
108,111,99,107,58,104,111,117,114,0,1,4,2049,14607,10,14695,14730,144,99,108,
|
||||
111,99,107,58,109,105,110,117,116,101,0,1,5,2049,14607,10,14714,14751,144,99,
|
||||
108,111,99,107,58,115,101,99,111,110,100,0,1,6,2049,14607,10,14735,14773,144,
|
||||
99,108,111,99,107,58,117,116,99,58,100,97,121,0,1,7,2049,14607,10,14756,
|
||||
14797,144,99,108,111,99,107,58,117,116,99,58,109,111,110,116,104,0,1,8,
|
||||
2049,14607,10,14778,14820,144,99,108,111,99,107,58,117,116,99,58,121,101,97,114,
|
||||
0,1,9,2049,14607,10,14802,14843,144,99,108,111,99,107,58,117,116,99,58,104,
|
||||
111,117,114,0,1,10,2049,14607,10,14825,14868,144,99,108,111,99,107,58,117,116,
|
||||
99,58,109,105,110,117,116,101,0,1,11,2049,14607,10,14848,14893,144,99,108,111,
|
||||
99,107,58,117,116,99,58,115,101,99,111,110,100,0,1,12,2049,14607,10,14873,
|
||||
14909,144,100,58,119,111,114,100,115,0,1793,14918,2049,162,2049,9235,2049,9209,10,1,
|
||||
14911,2049,7441,10,14898,14939,144,100,58,119,111,114,100,115,45,119,105,116,104,0,
|
||||
2049,1874,2049,4648,1793,14970,2049,162,2,2049,1874,2049,4162,1793,14959,2049,9235,2049,9209,10,
|
||||
1,14954,1793,14965,3,10,1,14963,2049,64,10,1,14945,2049,7441,10,14923,14994,144,100,
|
||||
105,115,112,108,97,121,45,105,102,45,108,101,102,116,0,2,2049,1874,2049,4598,
|
||||
1793,15006,2049,9235,2049,9209,10,1,15001,1793,15012,3,10,1,15010,2049,64,10,14923,15043,
|
||||
144,100,58,119,111,114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,
|
||||
105,116,104,0,2049,1874,2049,4648,1793,15054,2049,162,2049,14994,10,1,15049,2049,7441,10,
|
||||
0 };
|
||||
|
|
Loading…
Reference in a new issue