Simplify terminate + bye + fix build.
This commit is contained in:
@ -93,6 +93,7 @@ e: check-boot
|
|||||||
out: space
|
out: space
|
||||||
out: emit
|
out: emit
|
||||||
out: bye
|
out: bye
|
||||||
|
out: terminate
|
||||||
out: key?
|
out: key?
|
||||||
out: key
|
out: key
|
||||||
out: type
|
out: type
|
||||||
@ -669,7 +670,6 @@ e: check-esp32-builtins
|
|||||||
out: analogRead
|
out: analogRead
|
||||||
out: pulseIn
|
out: pulseIn
|
||||||
out: MS-TICKS
|
out: MS-TICKS
|
||||||
out: TERMINATE
|
|
||||||
check-files-reverse
|
check-files-reverse
|
||||||
check-files-dir-reverse
|
check-files-dir-reverse
|
||||||
out: dacWrite
|
out: dacWrite
|
||||||
|
|||||||
@ -16,7 +16,8 @@
|
|||||||
defer type
|
defer type
|
||||||
defer key
|
defer key
|
||||||
defer key?
|
defer key?
|
||||||
defer bye
|
defer terminate
|
||||||
|
: bye 0 terminate ;
|
||||||
: emit ( n -- ) >r rp@ 1 type rdrop ;
|
: emit ( n -- ) >r rp@ 1 type rdrop ;
|
||||||
: space bl emit ; : cr 13 emit nl emit ;
|
: space bl emit ; : cr 13 emit nl emit ;
|
||||||
|
|
||||||
|
|||||||
@ -14,17 +14,6 @@
|
|||||||
|
|
||||||
also ansi also internals
|
also ansi also internals
|
||||||
|
|
||||||
DEFINED? windows [IF]
|
|
||||||
also windows
|
|
||||||
: sysexit ( n -- ) ExitProcess ;
|
|
||||||
[ELSE]
|
|
||||||
DEFINED? posix [IF]
|
|
||||||
also posix
|
|
||||||
[ELSE]
|
|
||||||
: sysexit ( n -- ) terminate ;
|
|
||||||
[THEN]
|
|
||||||
[THEN]
|
|
||||||
|
|
||||||
( Support for eval tests )
|
( Support for eval tests )
|
||||||
40000 constant expect-limit
|
40000 constant expect-limit
|
||||||
create expect-buffer expect-limit allot
|
create expect-buffer expect-limit allot
|
||||||
@ -117,5 +106,5 @@ variable tests-found variable tests-run variable tests-passed
|
|||||||
: run-tests
|
: run-tests
|
||||||
reset-test-counters ['] count-test for-tests
|
reset-test-counters ['] count-test for-tests
|
||||||
['] run-test for-tests show-test-results
|
['] run-test for-tests show-test-results
|
||||||
tests-passed @ tests-found @ <> sysexit ;
|
tests-passed @ tests-found @ <> terminate ;
|
||||||
only forth
|
only forth
|
||||||
|
|||||||
@ -86,7 +86,7 @@ static cell_t ResizeFile(cell_t fd, cell_t size);
|
|||||||
#define REQUIRED_SYSTEM_SUPPORT \
|
#define REQUIRED_SYSTEM_SUPPORT \
|
||||||
X("MS-TICKS", MS_TICKS, PUSH millis()) \
|
X("MS-TICKS", MS_TICKS, PUSH millis()) \
|
||||||
XV(internals, "RAW-YIELD", RAW_YIELD, yield()) \
|
XV(internals, "RAW-YIELD", RAW_YIELD, yield()) \
|
||||||
Y(TERMINATE, exit(n0))
|
XV(internals, "RAW-TERMINATE", RAW_TERMINATE, exit(n0))
|
||||||
|
|
||||||
#define REQUIRED_SERIAL_SUPPORT \
|
#define REQUIRED_SERIAL_SUPPORT \
|
||||||
XV(serial, "Serial.begin", SERIAL_BEGIN, Serial.begin(tos); DROP) \
|
XV(serial, "Serial.begin", SERIAL_BEGIN, Serial.begin(tos); DROP) \
|
||||||
|
|||||||
@ -21,7 +21,6 @@ forth definitions
|
|||||||
|
|
||||||
( Set up Basic I/O )
|
( Set up Basic I/O )
|
||||||
internals definitions also serial
|
internals definitions also serial
|
||||||
: esp32-bye 0 terminate ;
|
|
||||||
: serial-type ( a n -- ) Serial.write drop ;
|
: serial-type ( a n -- ) Serial.write drop ;
|
||||||
: serial-key ( -- n )
|
: serial-key ( -- n )
|
||||||
begin pause Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ;
|
begin pause Serial.available until 0 >r rp@ 1 Serial.readBytes drop r> ;
|
||||||
@ -33,7 +32,7 @@ also forth definitions
|
|||||||
' default-type is type
|
' default-type is type
|
||||||
' default-key is key
|
' default-key is key
|
||||||
' default-key? is key?
|
' default-key? is key?
|
||||||
' esp32-bye is bye
|
' raw-terminate is terminate
|
||||||
only forth definitions
|
only forth definitions
|
||||||
|
|
||||||
also ledc also serial also SPIFFS
|
also ledc also serial also SPIFFS
|
||||||
|
|||||||
@ -97,7 +97,7 @@ static cell_t *simulated(cell_t *sp, const char *op) {
|
|||||||
} else if (op == STR_SERIAL_AVAILABLE) {
|
} else if (op == STR_SERIAL_AVAILABLE) {
|
||||||
*++sp = 1;
|
*++sp = 1;
|
||||||
return sp;
|
return sp;
|
||||||
} else if (op == STR_TERMINATE) {
|
} else if (op == STR_RAW_TERMINATE) {
|
||||||
exit(*sp--);
|
exit(*sp--);
|
||||||
return sp;
|
return sp;
|
||||||
} else if (op == STR_R_O) {
|
} else if (op == STR_R_O) {
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
\ limitations under the License.
|
\ limitations under the License.
|
||||||
|
|
||||||
( Include first argument if any )
|
( Include first argument if any )
|
||||||
posix also internals definitions
|
internals definitions
|
||||||
: autoexec
|
: autoexec
|
||||||
( Open passed file if any. )
|
( Open passed file if any. )
|
||||||
argc 2 >= if 1 argv ['] included catch if 1 sysexit then exit then
|
argc 2 >= if 1 argv ['] included catch if 1 terminate then exit then
|
||||||
( Open remembered file if any. )
|
( Open remembered file if any. )
|
||||||
['] revive catch drop
|
['] revive catch drop
|
||||||
;
|
;
|
||||||
' autoexec ( leave on dstack for fini.fs )
|
' autoexec ( leave on dstack for fini.fs )
|
||||||
only forth definitions
|
forth definitions
|
||||||
|
|||||||
@ -105,7 +105,6 @@ decimal
|
|||||||
( Hookup I/O )
|
( Hookup I/O )
|
||||||
: stdout-write ( a n -- ) stdout -rot write drop ;
|
: stdout-write ( a n -- ) stdout -rot write drop ;
|
||||||
: stdin-key ( -- n ) 0 >r stdin rp@ 1 read drop r> ;
|
: stdin-key ( -- n ) 0 >r stdin rp@ 1 read drop r> ;
|
||||||
: posix-bye 0 sysexit ;
|
|
||||||
|
|
||||||
also forth definitions
|
also forth definitions
|
||||||
: default-type stdout-write ;
|
: default-type stdout-write ;
|
||||||
@ -113,7 +112,7 @@ also forth definitions
|
|||||||
only posix definitions
|
only posix definitions
|
||||||
' default-type is type
|
' default-type is type
|
||||||
' default-key is key
|
' default-key is key
|
||||||
' posix-bye is bye
|
' sysexit is terminate
|
||||||
|
|
||||||
( I/O Error Helpers )
|
( I/O Error Helpers )
|
||||||
: 0<ior ( n -- ior ) 0< if errno else 0 then ;
|
: 0<ior ( n -- ior ) 0< if errno else 0 then ;
|
||||||
|
|||||||
@ -598,7 +598,7 @@ JSWORD: web-key?-raw { -- f }
|
|||||||
return context.inbuffer.length ? -1 : 0;
|
return context.inbuffer.length ? -1 : 0;
|
||||||
~
|
~
|
||||||
|
|
||||||
JSWORD: terminate { retval }
|
JSWORD: web-terminate { retval }
|
||||||
if (globalObj.quit) {
|
if (globalObj.quit) {
|
||||||
quit(retval);
|
quit(retval);
|
||||||
} else {
|
} else {
|
||||||
@ -918,7 +918,6 @@ JSWORD: random { n -- n }
|
|||||||
|
|
||||||
forth definitions web
|
forth definitions web
|
||||||
|
|
||||||
: bye 0 terminate ;
|
|
||||||
: ms-ticks ms-ticks ;
|
: ms-ticks ms-ticks ;
|
||||||
|
|
||||||
forth definitions
|
forth definitions
|
||||||
|
|||||||
@ -20,6 +20,7 @@ web definitions
|
|||||||
' web-key is key
|
' web-key is key
|
||||||
: web-key? ( -- f ) pause web-key?-raw ;
|
: web-key? ( -- f ) pause web-key?-raw ;
|
||||||
' web-key? is key?
|
' web-key? is key?
|
||||||
|
' web-terminate is terminate
|
||||||
|
|
||||||
: upload-file ( a n -- )
|
: upload-file ( a n -- )
|
||||||
upload-start
|
upload-start
|
||||||
|
|||||||
@ -64,7 +64,6 @@ variable console-mode
|
|||||||
: raw-key ( -- n ) 0 >r stdin rp@ 1 NULL NULL ReadFile drop r> ;
|
: raw-key ( -- n ) 0 >r stdin rp@ 1 NULL NULL ReadFile drop r> ;
|
||||||
: win-key? ( -- f ) stdin 0 WaitForSingleObject 0= ;
|
: win-key? ( -- f ) stdin 0 WaitForSingleObject 0= ;
|
||||||
: win-key ( -- n ) raw-key dup 13 = if drop nl then ;
|
: win-key ( -- n ) raw-key dup 13 = if drop nl then ;
|
||||||
: win-bye ( -- ) 0 ExitProcess drop ;
|
|
||||||
|
|
||||||
also forth definitions
|
also forth definitions
|
||||||
: default-type win-type ;
|
: default-type win-type ;
|
||||||
@ -74,6 +73,6 @@ only windows definitions
|
|||||||
' default-type is type
|
' default-type is type
|
||||||
' default-key is key
|
' default-key is key
|
||||||
' default-key? is key?
|
' default-key? is key?
|
||||||
' win-bye is bye
|
' ExitProcess is terminate
|
||||||
|
|
||||||
only forth definitions
|
only forth definitions
|
||||||
|
|||||||
Reference in New Issue
Block a user