~crc_/retroforth

ref: 2022.1 retroforth/package/list.forth -rw-r--r-- 1.5 KiB
6db8a84e — crc update release notes 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Custom Extensions

This is a system for allowing you to easily add your own
extensions to RETRO on Unix systems.

The first extension uses the scripting interface to get source
data for words, and record this as part of the header.

~~~
{{
  'Sources d:create #128 allot
  :known? (s-sf) dup &Sources a:contains/string? ;
  :index  (s-s)  &Sources swap a:index/string
                 &Sources swap a:fetch ;
  :record (s-s)  s:keep dup &Sources v:inc
                 @Sources &Sources + store ;

  [ script:current-file known? [ index ] [ record ] choose
    [ &d:add-header #2 + call ] dip
    d:last d:source store ] &d:add-header set-hook
}}
~~~


There are two options:

## Manual Additions

Add files to include to the code block below. Use a form
like:

    'filename include

You can either put the files (or links to them) into this
directory or use full path names to the files. You can
also use any Retro code directly.

~~~
'dict-words-listing.forth include
~~~

## Automatic Extensions

This does not require manual editing of this file. To use
this:

- copy (or symlink) the extensions into the `extensions` subdirectory
- run `make update-extensions`
- run `make`

This will build RETRO, generate a new `load-extensions.retro` and
then rebuild, including the extensions.

~~~
'load-extensions.retro include
~~~

## Final Bits

Save the image with anything loaded here added in. The
`retro` binary will be rebuilt using the extended image.

~~~
'../rre.image image:save
~~~