~crc_/retroforth

3417d48ffbb4b5204871cd3c74de792d14339e83 — crc 22 days ago 678a16a
fix missing file issue

FossilOrigin-Name: 14dfeec7f6a9e7b107784e82b545e705640b276a71a8a8d86f553d22637894fc
4 files changed, 50 insertions(+), 17 deletions(-)

M RELEASE-NOTES
M example/amalgamate.retro
A interface/malloc.retro
M vm/nga-c/retro.c
M RELEASE-NOTES => RELEASE-NOTES +20 -0
@@ 2,6 2,18 @@

# Core Language

- new words

  - n:add
  - n:sub
  - n:mul
  - n:div
  - n:divmod
  - n:mod
  - d:hash
  - d:rehash
  - d:Hash-Function

# VM

## nga-c


@@ 10,6 22,7 @@

  - global state now in a struct
  - minimal, functional FFI
  - malloc/free support (from Rick C)

# Documentation



@@ 17,3 30,10 @@

# Examples

- port of retroforth/ilo block editor

----------------------------------------------------------------
Important notes:

- future releases will use 64-bit cells by default
----------------------------------------------------------------

M example/amalgamate.retro => example/amalgamate.retro +9 -3
@@ 19,12 19,18 @@ Include compilation instructions and enable i/o devices.
~~~
'/*_Build_with_`cc_-lm_-O2_retro-unix.c_-o_retro`_*/ s:put nl nl

{ 'FLOATS
'#define_BIT64 s:put nl

{ 'CLOCK
  'FILES
  'UNIX
  'FLOATS
  'MALLOC
  'MULTICORE
  'RNG
  'CLOCK
  'SCRIPTING
  'SIGNALS
  'UNIX
  'UNSIGNED
} [ '#define_ENABLE\_%s s:format s:put nl ] a:for-each nl
~~~


A interface/malloc.retro => interface/malloc.retro +21 -0
@@ 0,0 1,21 @@
# Malloc

~~~

{{
  :mem:invoke #15 io:scan-for io:invoke ;
  #0              'ALLOC  const
  #1              'FREE   const
  #2              'STORE  const
  #3              'FETCH  const

---reveal---

  :mem:alloc (n--aa) ALLOC mem:invoke ;
  :mem:set   (an--)  STORE mem:invoke ;
  :mem:get   (a--n)  FETCH mem:invoke ;
  :mem:free  (aa--)  FREE  mem:invoke ;

}}

~~~

M vm/nga-c/retro.c => vm/nga-c/retro.c +0 -14
@@ 24,11 24,6 @@
#include <time.h>
#include <unistd.h>

#ifdef ENABLE_TERMINAL
#include "linenoise.h"
#include "linenoise.c"
#endif

#ifdef ENABLE_SIGNALS
#include <signal.h>
#endif


@@ 880,15 875,6 @@ void io_filesystem(NgaState *vm) {
}


#ifdef ENABLE_TERMINAL
void query_terminal(NgaState *vm) {
}

void io_termina(NgaState *vm) {
}
#endif


#ifdef ENABLE_UNIX
/*---------------------------------------------------------------------
  `unix_open_pipe()` is like `file_open()`, but for pipes. This pulls