add new header fields: d:astack d:fstack & d:descr

FossilOrigin-Name: 849d884ac4162c4c6e06eff900a704b0e02e20bf70e86fccb1d9f9285be97f24
This commit is contained in:
crc 2024-09-11 14:53:40 +00:00
parent a514c52369
commit 586b80b72a
9 changed files with 1962 additions and 1533 deletions

View file

@ -35,6 +35,9 @@
- `s:temp` now truncates strings longer than `TempStringMax` - `s:temp` now truncates strings longer than `TempStringMax`
- `s:filter` now truncates strings longer than `TempStringMax` - `s:filter` now truncates strings longer than `TempStringMax`
- added new `d:stack` field for storing a stack comment - added new `d:stack` field for storing a stack comment
- added new `d:astack` field for storing an address stack comment
- added new `d:fstack` field for storing a float stack comment
- added new `d:descr` field for storing a description
- `sigil:(` extended to store stack comments (with a form of - `sigil:(` extended to store stack comments (with a form of
`(:comment)` `(:comment)`
- add `d:describe` - add `d:describe`

View file

@ -146,7 +146,7 @@ Here's the initial memory map:
r 9999 r 9999
: Heap : Heap
d 1536 d 2048
: Version : Version
d 202409 d 202409
@ -155,7 +155,7 @@ d 202409
r interpret r interpret
r err:notfound r err:notfound
r TIB r TIB
d 1535 d 2048
: HashFunction : HashFunction
d 0 d 0
: RehashFunction : RehashFunction
@ -698,7 +698,10 @@ below.
| class | link to the class handler function | d:class | | class | link to the class handler function | d:class |
| source | source identifier | d:source | | source | source identifier | d:source |
| hash | hash of the word name | d:hash | | hash | hash of the word name | d:hash |
| source | pointer to stack comment | d:stack | | stack | pointer to stack comment | d:stack |
| astack | pointer to addr. stack comment | d:astack |
| fstack | pointer to float stack comment | d:fstack |
| descr | pointer to description | d:descr |
| name | zero terminated string | d:name | | name | zero terminated string | d:name |
The initial dictionary is constructed at the end of this file. The initial dictionary is constructed at the end of this file.
@ -711,6 +714,9 @@ It'll take a form like this:
r source-file r source-file
d 0 d 0
d 0 d 0
d 0
d 0
d 0
s dup s dup
: 0001 : 0001
@ -720,6 +726,9 @@ It'll take a form like this:
r source-file r source-file
d 0 d 0
d 0 d 0
d 0
d 0
d 0
s drop s drop
: 0002 : 0002
@ -728,6 +737,9 @@ It'll take a form like this:
r class:primitive r class:primitive
d 0 d 0
d 0 d 0
d 0
d 0
d 0
s swap s swap
Each entry starts with a pointer to the prior entry (with a Each entry starts with a pointer to the prior entry (with a
@ -770,9 +782,21 @@ d 4
i liadre.. i liadre..
d 5 d 5
: d:name : d:astack
i liadre.. i liadre..
d 6 d 6
: d:fstack
i liadre..
d 7
: d:descr
i liadre..
d 8
: d:name
i liadre..
d 9
~~~ ~~~
A traditional Forth has `create` to make a new dictionary entry A traditional Forth has `create` to make a new dictionary entry
@ -787,31 +811,56 @@ are made using the `:` sigil, or `d:create` (once defined in
the standard library). At some point I may simplify this by the standard library). At some point I may simplify this by
moving `d:create` into Rx and using it in place of `d:add-header`. moving `d:create` into Rx and using it in place of `d:add-header`.
~~~
: empty-stack
s -
~~~
~~~ ~~~
: d:add-header : d:add-header
i liju.... i liju....
r _add-header r _add-header
: _add-header : _add-header
i lifepuli i lifepuli
r Heap r Heap
r Dictionary r Dictionary
i felica.. i felica..
r comma r comma
i lica.... i lica....
r comma r comma
i lica.... i lica....
r comma r comma
i lilica.. i lilica..
d 0 d 0
r comma r comma
i lilica.. i lilica..
d 0 d 0
r comma r comma
i lilica.. i lilica..
d 0 d 0
r comma r comma
i lilica..
r empty-stack
r comma
i lilica..
r empty-stack
r comma
i lilica..
d 0
r comma
i lica.... i lica....
r comma:string r comma:string
i polist.. i polist..
r Dictionary r Dictionary
i lifezr.. i lifezr..
@ -1562,6 +1611,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s dup s dup
: 0001 : 0001
r 0000 r 0000
@ -1570,6 +1622,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s drop s drop
: 0002 : 0002
r 0001 r 0001
@ -1578,6 +1633,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s swap s swap
: 0003 : 0003
r 0002 r 0002
@ -1586,6 +1644,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s call s call
: 0004 : 0004
r 0003 r 0003
@ -1594,6 +1655,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s eq? s eq?
: 0005 : 0005
r 0004 r 0004
@ -1602,6 +1666,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s -eq? s -eq?
: 0006 : 0006
r 0005 r 0005
@ -1610,6 +1677,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s lt? s lt?
: 0007 : 0007
r 0006 r 0006
@ -1618,6 +1688,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s gt? s gt?
: 0008 : 0008
r 0007 r 0007
@ -1626,6 +1699,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s fetch s fetch
: 0009 : 0009
r 0008 r 0008
@ -1634,6 +1710,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s store s store
: 0010 : 0010
r 0009 r 0009
@ -1642,6 +1721,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s + s +
: 0011 : 0011
r 0010 r 0010
@ -1650,6 +1732,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s - s -
: 0012 : 0012
r 0011 r 0011
@ -1658,6 +1743,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s * s *
: 0013 : 0013
r 0012 r 0012
@ -1666,6 +1754,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s /mod s /mod
: 0014 : 0014
r 0013 r 0013
@ -1674,6 +1765,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s and s and
: 0015 : 0015
r 0014 r 0014
@ -1682,6 +1776,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s or s or
: 0016 : 0016
r 0015 r 0015
@ -1690,6 +1787,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s xor s xor
: 0017 : 0017
r 0016 r 0016
@ -1698,6 +1798,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s shift s shift
: 0018 : 0018
r 0017 r 0017
@ -1706,6 +1809,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s push s push
: 0019 : 0019
r 0018 r 0018
@ -1714,6 +1820,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s pop s pop
: 0020 : 0020
r 0019 r 0019
@ -1722,6 +1831,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s 0; s 0;
: 0021 : 0021
r 0020 r 0020
@ -1730,6 +1842,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s fetch-next s fetch-next
: 0022 : 0022
r 0021 r 0021
@ -1738,6 +1853,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s store-next s store-next
: 0023 : 0023
r 0022 r 0022
@ -1746,6 +1864,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s s:to-number s s:to-number
: 0024 : 0024
r 0023 r 0023
@ -1754,6 +1875,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s s:eq? s s:eq?
: 0025 : 0025
r 0024 r 0024
@ -1762,6 +1886,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s s:length s s:length
: 0026 : 0026
r 0025 r 0025
@ -1770,6 +1897,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s choose s choose
: 0027 : 0027
r 0026 r 0026
@ -1778,6 +1908,9 @@ r class:primitive
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s if s if
: 0028 : 0028
r 0027 r 0027
@ -1786,6 +1919,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s -if s -if
: 0029 : 0029
r 0028 r 0028
@ -1794,6 +1930,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s sigil:( s sigil:(
: 0030 : 0030
r 0029 r 0029
@ -1802,6 +1941,9 @@ r class:data
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s Compiler s Compiler
: 0031 : 0031
r 0030 r 0030
@ -1810,6 +1952,9 @@ r class:data
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s Heap s Heap
: 0032 : 0032
r 0031 r 0031
@ -1818,6 +1963,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s , s ,
: 0033 : 0033
r 0032 r 0032
@ -1826,6 +1974,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s s, s s,
: 0034 : 0034
r 0033 r 0033
@ -1834,6 +1985,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s ; s ;
: 0035 : 0035
r 0034 r 0034
@ -1842,6 +1996,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s [ s [
: 0036 : 0036
r 0035 r 0035
@ -1850,6 +2007,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s ] s ]
: 0037 : 0037
r 0036 r 0036
@ -1858,6 +2018,9 @@ r class:data
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s Dictionary s Dictionary
: 0038 : 0038
r 0037 r 0037
@ -1866,6 +2029,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:link s d:link
: 0039 : 0039
r 0038 r 0038
@ -1874,6 +2040,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:xt s d:xt
: 0040 : 0040
r 0039 r 0039
@ -1882,6 +2051,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:class s d:class
: 0041 : 0041
r 0040 r 0040
@ -1890,6 +2062,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:name s d:name
: 0042 : 0042
r 0041 r 0041
@ -1898,6 +2073,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s class:word s class:word
: 0043 : 0043
r 0042 r 0042
@ -1906,6 +2084,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s class:macro s class:macro
: 0044 : 0044
r 0043 r 0043
@ -1914,6 +2095,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s class:data s class:data
: 0045 : 0045
r 0044 r 0044
@ -1922,6 +2106,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:add-header s d:add-header
: 0046 : 0046
r 0045 r 0045
@ -1930,6 +2117,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s sigil:# s sigil:#
: 0047 : 0047
r 0046 r 0046
@ -1938,6 +2128,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s sigil:: s sigil::
: 0048 : 0048
r 0047 r 0047
@ -1946,6 +2139,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s sigil:& s sigil:&
: 0049 : 0049
r 0048 r 0048
@ -1954,6 +2150,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s sigil:$ s sigil:$
: 0050 : 0050
r 0049 r 0049
@ -1962,6 +2161,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s repeat s repeat
: 0051 : 0051
r 0050 r 0050
@ -1970,6 +2172,9 @@ r class:macro
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s again s again
: 0052 : 0052
r 0051 r 0051
@ -1978,6 +2183,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s interpret s interpret
: 0053 : 0053
r 0052 r 0052
@ -1986,6 +2194,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:lookup s d:lookup
: 0054 : 0054
r 0053 r 0053
@ -1994,6 +2205,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s class:primitive s class:primitive
: 0055 : 0055
r 0054 r 0054
@ -2002,6 +2216,9 @@ r class:data
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s Version s Version
: 0056 : 0056
r 0055 r 0055
@ -2010,6 +2227,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s i s i
: 0057 : 0057
r 0056 r 0056
@ -2018,6 +2238,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d s d
: 0058 : 0058
r 0057 r 0057
@ -2026,6 +2249,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s r s r
: 0059 : 0059
r 0058 r 0058
@ -2034,6 +2260,9 @@ r class:data
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s Base s Base
: 0060 : 0060
r 0059 r 0059
@ -2042,6 +2271,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s pack s pack
: 0061 : 0061
r 0060 r 0060
@ -2050,6 +2282,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s unpack s unpack
: 0062 : 0062
r 0061 r 0061
@ -2058,6 +2293,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:source s d:source
: 0063 : 0063
r 0062 r 0062
@ -2066,6 +2304,9 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:hash s d:hash
: 0064 : 0064
r 0063 r 0063
@ -2074,14 +2315,55 @@ r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s d:stack s d:stack
: 9999
: 0065
r 0064 r 0064
r d:astack
r class:word
r source-file
d 0
d 0
r empty-stack
r empty-stack
d 0
s d:astack
: 0066
r 0065
r d:fstack
r class:word
r source-file
d 0
d 0
r empty-stack
r empty-stack
d 0
s d:fstack
: 0067
r 0066
r d:descr
r class:word
r source-file
d 0
d 0
r empty-stack
r empty-stack
d 0
s d:descr
: 9999
r 0067
r err:notfound r err:notfound
r class:word r class:word
r source-file r source-file
d 0 d 0
d 0 d 0
r empty-stack
r empty-stack
d 0
s err:notfound s err:notfound
~~~ ~~~
@ -2155,7 +2437,7 @@ s err:notfound
## Legalities ## Legalities
RETRO Core is Copyright (c) 2016-2022, Charles Childers RETRO Core is Copyright (c) 2016-2024, Charles Childers
Permission to use, copy, modify, and/or distribute this software Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided for any purpose with or without fee is hereby granted, provided

View file

@ -6,7 +6,7 @@ comment format this introduces to add them inline.
~~~ ~~~
{{ {{
:save (s-) :save (s-)
n:inc s:chop here swap s:keep |drop #2 + d:last.name n:dec store ; n:inc s:chop here swap s:keep |drop #2 + d:last.name #4 - store ;
:stack-comment? (s-sf) dup #0 s:fetch $: eq? ; :stack-comment? (s-sf) dup #0 s:fetch $: eq? ;
---reveal--- ---reveal---
:sigil:( stack-comment? &save &drop choose ; immediate :sigil:( stack-comment? &save &drop choose ; immediate
@ -14,11 +14,14 @@ comment format this introduces to add them inline.
:d:describe (:s-) :d:describe (:s-)
d:lookup nl d:lookup nl
dup 'Name:____ s:put d:name s:put nl dup 'Name:_____ s:put d:name s:put nl
dup 'Address:_ s:put d:xt fetch n:put nl dup 'Address:__ s:put d:xt fetch n:put nl
dup 'Class:___ s:put d:class fetch dup n:put d:lookup-xt dup n:-zero? [ sp d:name s:put ] &drop choose nl dup 'Class:____ s:put d:class fetch dup n:put d:lookup-xt dup n:-zero? [ sp d:name s:put ] &drop choose nl
dup 'Source:__ s:put d:source fetch dup n:-zero? &s:put &drop choose nl dup 'Source:___ s:put d:source fetch dup n:-zero? &s:put &drop choose nl
dup 'Stack:___ s:put d:stack fetch dup n:-zero? &s:put &drop choose nl dup 'Stack:____ s:put d:stack fetch dup n:-zero? &s:put &drop choose nl
dup 'A._Stack:_ s:put d:astack fetch dup n:-zero? &s:put &drop choose nl
dup 'Float:____ s:put d:fstack fetch dup n:-zero? &s:put &drop choose nl
dup 'Descr:____ s:put d:descr fetch dup n:-zero? &s:put &drop choose nl
drop ; drop ;
:d:set-stack-comment (:ss-) :d:set-stack-comment (:ss-)

BIN
ngaImage

Binary file not shown.

View file

@ -36,7 +36,10 @@
#define D_OFFSET_SOURCE 3 #define D_OFFSET_SOURCE 3
#define D_OFFSET_HASH 4 #define D_OFFSET_HASH 4
#define D_OFFSET_STACK 5 #define D_OFFSET_STACK 5
#define D_OFFSET_NAME 6 #define D_OFFSET_RSTACK 6
#define D_OFFSET_FSTACK 7
#define D_OFFSET_DESCR 8
#define D_OFFSET_NAME 9
/* These settings can be overridden at compile time. */ /* These settings can be overridden at compile time. */

View file

@ -24,7 +24,7 @@
#endif #endif
#define KiB * 1024 #define KiB * 1024
#define MAX_NAMES 1024 #define MAX_NAMES 4096
#define STRING_LEN 64 #define STRING_LEN 64
#ifndef IMAGE_SIZE #ifndef IMAGE_SIZE

File diff suppressed because it is too large Load diff

View file

@ -50,7 +50,7 @@
#define D_OFFSET_XT 1 /* you change the dictionary fields. */ #define D_OFFSET_XT 1 /* you change the dictionary fields. */
#define D_OFFSET_CLASS 2 #define D_OFFSET_CLASS 2
#define D_OFFSET_STACK 5 #define D_OFFSET_STACK 5
#define D_OFFSET_NAME 6 #define D_OFFSET_NAME 9
#define NUM_DEVICES 1 /* Set the number of I/O devices */ #define NUM_DEVICES 1 /* Set the number of I/O devices */

View file

@ -17,7 +17,7 @@ const
D_OFFSET_LINK = 0; D_OFFSET_LINK = 0;
D_OFFSET_XT = 1; D_OFFSET_XT = 1;
D_OFFSET_CLASS = 2; D_OFFSET_CLASS = 2;
D_OFFSET_NAME = 6; D_OFFSET_NAME = 9;
TIB = 1471; TIB = 1471;
var var