From dc0aa0cb21aac313f8088dc0358aad888e360523 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 30 Dec 2020 20:50:32 +0000 Subject: [PATCH] nga-c: work on an easier way to add extensions to the embedded image FossilOrigin-Name: 7b6fae3d092e9255dba1f54115a8c9c347e73b53cbc3b95daa68a9b437bd6367 --- Makefile | 1 + package/extensions/README.retro | 7 +++++++ package/list.forth | 4 ++++ package/load-extensions.retro | 3 +++ tools/generate-extensions-list.retro | 7 +++++++ vm/nga-c/retro-image.c | 4 ++-- 6 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 package/extensions/README.retro create mode 100644 package/load-extensions.retro create mode 100755 tools/generate-extensions-list.retro diff --git a/Makefile b/Makefile index 1734205..6587c19 100644 --- a/Makefile +++ b/Makefile @@ -130,6 +130,7 @@ vm/nga-c/retro-image.c: ngaImage bin/retro-embedimage bin/retro-extend interface bin/retro: vm/nga-c/retro-image.c vm/nga-c/retro-unix.c vm/nga-c/bsd-strl.c vm/nga-c/config.h vm/nga-c/dev-clock.c vm/nga-c/dev-files.c vm/nga-c/dev-floatingpoint.c vm/nga-c/dev-image.c vm/nga-c/dev-rng.c vm/nga-c/dev-sockets.c vm/nga-c/dev-unix.c vm/nga-c/prototypes.h cd vm/nga-c && $(CC) $(OPTIONS) $(CFLAGS) $(LDFLAGS) -o ../../bin/retro retro-unix.c $(LIBM) + cd package/extensions && ../../bin/retro -f ../../tools/generate-extensions-list.retro >../load-extensions.retro cd package && ../bin/retro -f list.forth ./bin/retro-embedimage rre.image >vm/nga-c/retro-image.c rm rre.image diff --git a/package/extensions/README.retro b/package/extensions/README.retro new file mode 100644 index 0000000..ab459a0 --- /dev/null +++ b/package/extensions/README.retro @@ -0,0 +1,7 @@ +Put extensions into this directory. When rebuilding via: + + make clean; make + +Any extensions here will be placed in a file named +`package/load-extensions.retro` for compilation into the +embedded image. diff --git a/package/list.forth b/package/list.forth index f7d83fd..89f6553 100644 --- a/package/list.forth +++ b/package/list.forth @@ -15,6 +15,10 @@ also use any Retro code directly. 'compat.retro include ~~~ +~~~ +'load-extensions.retro include +~~~ + Save the image with anything loaded here added in. The `retro` binary will be rebuilt using the extended image. diff --git a/package/load-extensions.retro b/package/load-extensions.retro new file mode 100644 index 0000000..96c50f6 --- /dev/null +++ b/package/load-extensions.retro @@ -0,0 +1,3 @@ +~~~ +'extensions/README.retro include +~~~ diff --git a/tools/generate-extensions-list.retro b/tools/generate-extensions-list.retro new file mode 100755 index 0000000..edde1b4 --- /dev/null +++ b/tools/generate-extensions-list.retro @@ -0,0 +1,7 @@ +#!/usr/bin/env retro + +~~~ +'~~~ s:put nl +[ ''extensions/%s_include\n s:format s:put ] unix:for-each-file +'~~~ s:put nl +~~~ diff --git a/vm/nga-c/retro-image.c b/vm/nga-c/retro-image.c index e3da582..3883376 100644 --- a/vm/nga-c/retro-image.c +++ b/vm/nga-c/retro-image.c @@ -55,7 +55,7 @@ CELL ngaImage[] = { 1793,14768,15377,15392,202101,0,10,1,10,2,10,3,10,4,10,5,10, 101,114,115,105,111,110,0,975,416,146,105,0,986,107,146,100,0,991,410,146, 114,0,996,339,146,101,114,114,58,110,111,116,102,111,117,110,100,0,0,0, 0,0,0,0,0,0,105,109,97,103,101,58,115,97,118,101,0,103,101,0, - 117,109,101,110,116,0,105,116,104,0,104,0,79,85,78,68,0,125,126,0, + 65,68,77,69,46,114,101,116,114,111,0,0,79,85,78,68,0,125,126,0, 72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -179,7 +179,7 @@ CELL ngaImage[] = { 1793,14768,15377,15392,202101,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,133,84,101,109,112, 83,116,114,105,110,103,115,0,32,3472,3505,133,84,101,109,112,83,116,114,105, 110,103,77,97,120,0,512,3488,3517,146,83,84,82,73,78,71,83,0,2049,1543, - 3841,3487,3841,3505,19,18,10,3506,3537,133,67,117,114,114,101,110,116,0,16,10, + 3841,3487,3841,3505,19,18,10,3506,3537,133,67,117,114,114,101,110,116,0,20,10, 3526,3552,146,115,58,112,111,105,110,116,101,114,0,3841,3537,3841,3505,19,2049,3517, 17,10,3539,3571,146,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,146,115,58,116,101,109,