2020-12-31 16:04:06 +01:00
|
|
|
# Custom Extensions
|
|
|
|
|
|
|
|
This is a system for allowing you to easily add your own
|
|
|
|
extensions to RETRO on Unix systems.
|
|
|
|
|
2022-01-17 15:43:48 +01:00
|
|
|
The first extension uses the scripting interface to get source
|
|
|
|
data for words, and record this as part of the header.
|
|
|
|
|
2021-08-24 15:10:25 +02:00
|
|
|
~~~
|
2022-01-17 15:43:48 +01:00
|
|
|
{{
|
|
|
|
'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
|
2022-07-19 19:04:03 +02:00
|
|
|
d:last d:source store d:rehash ] &d:add-header set-hook
|
2022-01-17 15:43:48 +01:00
|
|
|
}}
|
2021-08-24 15:10:25 +02:00
|
|
|
~~~
|
|
|
|
|
|
|
|
|
2020-12-31 16:04:06 +01:00
|
|
|
There are two options:
|
|
|
|
|
|
|
|
## Manual Additions
|
|
|
|
|
2019-02-06 14:09:35 +01:00
|
|
|
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.
|
|
|
|
|
|
|
|
~~~
|
2019-04-01 18:49:30 +02:00
|
|
|
'dict-words-listing.forth include
|
2019-02-06 14:09:35 +01:00
|
|
|
~~~
|
|
|
|
|
2020-12-31 16:04:06 +01:00
|
|
|
## 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.
|
2020-10-01 15:28:46 +02:00
|
|
|
|
2020-12-30 21:50:32 +01:00
|
|
|
~~~
|
|
|
|
'load-extensions.retro include
|
|
|
|
~~~
|
|
|
|
|
2020-12-31 16:04:06 +01:00
|
|
|
## Final Bits
|
|
|
|
|
2019-02-06 14:09:35 +01:00
|
|
|
Save the image with anything loaded here added in. The
|
|
|
|
`retro` binary will be rebuilt using the extended image.
|
|
|
|
|
|
|
|
~~~
|
|
|
|
'../rre.image image:save
|
|
|
|
~~~
|