diff --git a/LICENSE.md b/LICENSE.md index 5c4732c..c88fea3 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -21,7 +21,7 @@ RETRO 12 is: Copyright (c) 2008 - 2019, Charles Childers -Portions of the code derive from RETRO 11, which is: +Portions of the code derive from RETRO 11, which was: Copyright (c) 2008 - 2016, Charles Childers Copyright (c) 2012 - 2013, Michal J Wallace diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index bdcb93b..a4120bf 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -42,6 +42,12 @@ June 2019. - improved f:tuck - improved f:over +### Unix + +- add unix:get-cwd +- add unix:count-files-in-cwd +- add unix:for-each-file + ## Nga ## Interfaces diff --git a/doc/Glossary.html b/doc/Glossary.html index 144f9ee..6cb6fcf 100644 --- a/doc/Glossary.html +++ b/doc/Glossary.html @@ -3580,6 +3580,14 @@ '/etc unix:chdir


+

unix:count-files-in-cwd

+

Data: -n
+Addr: -
+Float: -

+
+

Return the number of files (and subdirectories) in the current working directory

+

Class: class:word | Namespace: unix | Interface Layer: rre

+

unix:exec0

Data: s-
Addr: -
@@ -3620,6 +3628,14 @@

Exit the current process, returning the specified return code.

Class: class:word | Namespace: unix | Interface Layer: rre


+

unix:for-each-file

+

Data: q-
+Addr: -
+Float: -

+
+

Run a quote once for each file or subdirectory in the current directory. The quote will receive the file name as a string and should consume this and return nothing on the stack.

+

Class: class:word | Namespace: unix | Interface Layer: rre

+

unix:fork

Data: -n
Addr: -
@@ -3628,6 +3644,14 @@

Fork the current process. Returns a PID.

Class: class:word | Namespace: unix | Interface Layer: rre


+

unix:get-cwd

+

Data: -s
+Addr: -
+Float: -

+
+

Return the current working directory

+

Class: class:word | Namespace: unix | Interface Layer: rre

+

unix:getenv

Data: sa-
Addr: -
diff --git a/doc/Glossary.txt b/doc/Glossary.txt index fcd9ecf..0090aeb 100644 --- a/doc/Glossary.txt +++ b/doc/Glossary.txt @@ -4856,6 +4856,17 @@ Example #1: ------------------------------------------------------------------------ +unix:count-files-in-cwd + + Data: -n + Addr: - + Float: - + +Return the number of files (and subdirectories) in the current working directory + +Class: class:word | Namespace: unix | Interface Layer: rre +------------------------------------------------------------------------ + unix:exec0 Data: s- @@ -4911,6 +4922,17 @@ Exit the current process, returning the specified return code. Class: class:word | Namespace: unix | Interface Layer: rre ------------------------------------------------------------------------ +unix:for-each-file + + Data: q- + Addr: - + Float: - + +Run a quote once for each file or subdirectory in the current directory. The quote will receive the file name as a string and should consume this and return nothing on the stack. + +Class: class:word | Namespace: unix | Interface Layer: rre +------------------------------------------------------------------------ + unix:fork Data: -n @@ -4922,6 +4944,17 @@ Fork the current process. Returns a PID. Class: class:word | Namespace: unix | Interface Layer: rre ------------------------------------------------------------------------ +unix:get-cwd + + Data: -s + Addr: - + Float: - + +Return the current working directory + +Class: class:word | Namespace: unix | Interface Layer: rre +------------------------------------------------------------------------ + unix:getenv Data: sa- diff --git a/example/edit.forth b/example/edit.forth index 9ae4e94..e8cfcea 100755 --- a/example/edit.forth +++ b/example/edit.forth @@ -1,4 +1,4 @@ -#!/usr/bin/env rre +#!/usr/bin/env retro # Hua: a text editor written in RETRO diff --git a/interfaces/io/io_unix_syscalls.forth b/interfaces/io/io_unix_syscalls.forth index 6943d82..00ba3ec 100644 --- a/interfaces/io/io_unix_syscalls.forth +++ b/interfaces/io/io_unix_syscalls.forth @@ -109,3 +109,28 @@ seconds. :unix:io:n:put (n-) #17 io:unix-syscall ; :unix:io:s:put (s-) #18 io:unix-syscall ; ~~~ + +~~~ +:unix:get-cwd (-s) + 'pwd file:R unix:popen + dup file:read-line s:trim swap + unix:pclose + #0 sys:argv s:length + '/ s:append ; +~~~ + +~~~ +:unix:count-files-in-cwd (-n) + 'ls_-1_|_wc_-l file:R unix:popen + dup file:read-line s:trim s:to-number swap + unix:pclose ; +~~~ + +~~~ +:unix:for-each-file (q-) + 'ls_-1_-p file:R unix:popen + unix:count-files-in-cwd + [ [ file:read-line s:temp over call ] sip ] times + unix:pclose drop ; +~~~ + + diff --git a/interfaces/ri_image.c b/interfaces/ri_image.c index aa3e6e1..9eb47bb 100644 --- a/interfaces/ri_image.c +++ b/interfaces/ri_image.c @@ -1,6 +1,6 @@ #include -int32_t ngaImageCells = 13533; -int32_t ngaImage[] = { 1793,-1,13524,13532,201906,0,10,1,10,2,10,3,10,4,10,5,10,6,10, +int32_t ngaImageCells = 13708; +int32_t ngaImage[] = { 1793,-1,13699,13707,201906,0,10,1,10,2,10,3,10,4,10,5,10,6,10, 7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10, 17,10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,26,10, 68223234,1,2575,85000450,1,656912,355,339,268505089,66,65,135205121,66,10,101384453,0,9,10,2049,59, @@ -159,7 +159,7 @@ int32_t ngaImage[] = { 1793,-1,13524,13532,201906,0,10,1,10,2,10,3,10,4,10,5,10, 2065,10,1,3112,2049,2065,4,16,10,3093,3146,147,118,58,117,112,100,97,116,101, 45,117,115,105,110,103,0,4,1793,3153,15,4,8,10,1,3149,2049,2077,16,10, 3128,3167,147,99,111,112,121,0,1793,3176,1,59,2049,2065,2049,62,10,1,3169,2049, - 2252,3,3,10,3159,3196,147,83,99,111,112,101,76,105,115,116,0,12543,13386,10, + 2252,3,3,10,3159,3196,147,83,99,111,112,101,76,105,115,116,0,12718,13561,10, 3183,3205,147,123,123,0,2049,1570,2,1,3196,2049,62,16,10,3199,3230,147,45,45, 45,114,101,118,101,97,108,45,45,45,0,2049,1570,1,3196,2049,2908,16,10,3214, 3244,147,125,125,0,1,3196,2049,59,4,15,11,1793,3258,3841,3196,4097,2,10,1, @@ -179,7 +179,7 @@ int32_t ngaImage[] = { 1793,-1,13524,13532,201906,0,10,1,10,2,10,3,10,4,10,5,10, 2065,4097,3312,10,3480,3538,134,84,101,109,112,83,116,114,105,110,103,115,0,32, 3523,3556,134,84,101,109,112,83,116,114,105,110,103,77,97,120,0,512,3539,3568, 147,83,84,82,73,78,71,83,0,2049,1543,3841,3538,3841,3556,19,18,10,3557,3588, - 134,67,117,114,114,101,110,116,0,21,10,3577,3603,147,115,58,112,111,105,110, + 134,67,117,114,114,101,110,116,0,25,10,3577,3603,147,115,58,112,111,105,110, 116,101,114,0,3841,3588,3841,3556,19,2049,3568,17,10,3590,3622,147,115,58,110,101, 120,116,0,1,3588,2049,3009,3841,3588,3841,3538,11,1793,3638,1,0,4097,3588,10,1, 3633,9,10,3557,3652,147,115,58,116,101,109,112,0,2,2049,82,2049,2908,2049,3603, @@ -614,23 +614,31 @@ int32_t ngaImage[] = { 1793,-1,13524,13532,201906,0,10,1,10,2,10,3,10,4,10,5,10, 1,15,2049,11902,10,12204,12238,147,117,110,105,120,58,115,108,101,101,112,0,1, 16,2049,11902,10,12224,12260,147,117,110,105,120,58,105,111,58,110,58,112,117,116, 0,1,17,2049,11902,10,12243,12282,147,117,110,105,120,58,105,111,58,115,58,112, - 117,116,0,1,18,2049,11902,10,12265,12302,147,114,97,110,100,111,109,58,98,121, - 116,101,0,2049,3697,47,100,101,118,47,117,114,97,110,100,111,109,0,1,12304, - 1,0,2049,9321,1,9358,2049,2077,2049,9340,10,12265,12342,147,110,58,114,97,110,100, - 111,109,0,2049,12302,1,-8,24,2049,12302,17,1,-8,24,2049,12302,17,1,8,24, - 2049,12302,17,10,12330,12368,134,107,0,0,12363,12374,134,116,0,0,12369,12381,134,115, - 48,0,0,12375,12388,134,115,49,0,0,12382,12395,134,115,50,0,0,12389,12402,134, - 115,51,0,0,12396,12411,147,115,101,101,100,0,2,4097,12368,2,4097,12374,2,4097, - 12388,2,4097,12395,4097,12402,10,12403,12434,147,114,111,116,108,0,4097,12368,1793,12444,3841, - 12368,2049,2759,24,10,1,12438,1793,12455,1,32,3841,12368,18,24,10,1,12448,2049,2092, - 22,10,12426,12470,147,114,101,115,42,42,0,3841,12381,1,5,19,1,7,2049,12434, - 1,9,19,10,12330,12508,147,114,97,110,100,111,109,58,120,111,114,111,115,104, - 105,114,111,49,50,56,42,42,0,3841,12388,2,1,-9,24,5,3841,12402,3841,12381, - 3841,12395,386269701,1285,386269701,100926980,85394690,386269701,386270726,4097,12395,4097,12388,4097,12381,1,11,2049,12434,4097, - 12402,2049,12470,10,12483,12577,147,114,97,110,100,111,109,58,120,111,114,111,115,104, - 105,114,111,49,50,56,42,42,58,115,101,116,45,115,101,101,100,0,2049,12411, - 1,100,1793,12587,2049,12508,3,10,1,12583,2049,2252,10,12543,12602,134,83,116,97,116, - 101,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 117,116,0,1,18,2049,11902,10,12265,12303,147,117,110,105,120,58,103,101,116,45, + 99,119,100,0,2049,3697,112,119,100,0,1,12305,1,0,2049,12111,2,2049,9724,2049, + 3946,4,2049,12131,1,0,2049,82,17,2049,3697,47,0,1,12330,2049,4005,10,12287,12364, + 147,117,110,105,120,58,99,111,117,110,116,45,102,105,108,101,115,45,105,110, + 45,99,119,100,0,2049,3697,108,115,32,45,49,32,124,32,119,99,32,45,108, + 0,1,12366,1,0,2049,12111,2,2049,9724,2049,3946,2049,221,4,2049,12131,10,12337,12419, + 147,117,110,105,120,58,102,111,114,45,101,97,99,104,45,102,105,108,101,0, + 2049,3697,108,115,32,45,49,32,45,112,0,1,12421,1,0,2049,12111,2049,12364,1793, + 12454,1793,12449,2049,9724,2049,3652,67502597,8,10,1,12442,2049,2077,10,1,12440,2049,2252,2049, + 12131,3,10,12397,12477,147,114,97,110,100,111,109,58,98,121,116,101,0,2049,3697, + 47,100,101,118,47,117,114,97,110,100,111,109,0,1,12479,1,0,2049,9321,1, + 9358,2049,2077,2049,9340,10,12397,12517,147,110,58,114,97,110,100,111,109,0,2049,12477, + 1,-8,24,2049,12477,17,1,-8,24,2049,12477,17,1,8,24,2049,12477,17,10,12505, + 12543,134,107,0,0,12538,12549,134,116,0,0,12544,12556,134,115,48,0,0,12550,12563, + 134,115,49,0,0,12557,12570,134,115,50,0,0,12564,12577,134,115,51,0,0,12571, + 12586,147,115,101,101,100,0,2,4097,12543,2,4097,12549,2,4097,12563,2,4097,12570,4097, + 12577,10,12578,12609,147,114,111,116,108,0,4097,12543,1793,12619,3841,12543,2049,2759,24,10, + 1,12613,1793,12630,1,32,3841,12543,18,24,10,1,12623,2049,2092,22,10,12601,12645,147, + 114,101,115,42,42,0,3841,12556,1,5,19,1,7,2049,12609,1,9,19,10,12505, + 12683,147,114,97,110,100,111,109,58,120,111,114,111,115,104,105,114,111,49,50, + 56,42,42,0,3841,12563,2,1,-9,24,5,3841,12577,3841,12556,3841,12570,386269701,1285,386269701, + 100926980,85394690,386269701,386270726,4097,12570,4097,12563,4097,12556,1,11,2049,12609,4097,12577,2049,12645,10,12658, + 12752,147,114,97,110,100,111,109,58,120,111,114,111,115,104,105,114,111,49,50, + 56,42,42,58,115,101,116,45,115,101,101,100,0,2049,12586,1,100,1793,12762,2049, + 12683,3,10,1,12758,2049,2252,10,12718,12777,134,83,116,97,116,101,115,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,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -661,19 +669,20 @@ int32_t ngaImage[] = { 1793,-1,13524,13532,201906,0,10,1,10,2,10,3,10,4,10,5,10, 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,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,12592,13236,134,73,110,100,101,120,0,0,13227,13246, - 147,114,101,115,101,116,0,1,12602,67502597,2049,2921,17,2,15,1,30,24,4,15, - 23,1,1812433253,19,67502597,17,2049,2541,21,4,1,12602,17,16,10,13237,13288,147,114,97, - 110,100,111,109,105,122,101,100,0,1,1,1793,13302,2,2049,13246,2049,2908,2,1, - 624,14,10,1,13292,2049,2223,3,10,13274,13313,147,121,0,2,2049,2908,1,624,788, - 1,12602,17,15,2049,2541,21,4,1,12602,17,15,1,-31,24,17,10,13308,13347,147, - 97,108,116,101,114,101,100,0,2,2049,13313,2,1,1,21,1,1073741823,19,1793,13375, - 1,2,197652,67502597,1,397,17,1,624,788,1,12602,17,15,23,10,1,13359,2049,2065, - 23,4,1,12602,17,16,10,13336,13399,147,115,99,114,97,109,98,108,101,100,0, - 1,0,1793,13413,2,2049,13347,2049,2908,2,1,624,14,10,1,13403,2049,2223,3,10, - 12543,13447,147,114,97,110,100,111,109,58,109,101,114,115,101,110,110,101,58,115, - 101,116,45,115,101,101,100,0,4097,12602,1,0,4097,13236,2049,13288,10,13419,13475,147, - 114,97,110,100,111,109,58,109,101,114,115,101,110,110,101,0,3841,13236,2049,2567, - 1,13399,9,3841,13236,1,12602,17,15,2,1,11,24,23,2,1,-7,24,1,1073741823, - 21,23,2,1,-15,24,1,2011365376,21,23,2,1,18,24,23,3841,13236,2049,2908,1, - 624,788,4097,13236,10,13456,13531,147,98,121,101,0,10,0 }; + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,12767,13411,134,73,110,100,101,120,0,0,13402,13421,147,114,101,115,101, + 116,0,1,12777,67502597,2049,2921,17,2,15,1,30,24,4,15,23,1,1812433253,19,67502597, + 17,2049,2541,21,4,1,12777,17,16,10,13412,13463,147,114,97,110,100,111,109,105, + 122,101,100,0,1,1,1793,13477,2,2049,13421,2049,2908,2,1,624,14,10,1,13467, + 2049,2223,3,10,13449,13488,147,121,0,2,2049,2908,1,624,788,1,12777,17,15,2049, + 2541,21,4,1,12777,17,15,1,-31,24,17,10,13483,13522,147,97,108,116,101,114, + 101,100,0,2,2049,13488,2,1,1,21,1,1073741823,19,1793,13550,1,2,197652,67502597,1, + 397,17,1,624,788,1,12777,17,15,23,10,1,13534,2049,2065,23,4,1,12777,17, + 16,10,13511,13574,147,115,99,114,97,109,98,108,101,100,0,1,0,1793,13588,2, + 2049,13522,2049,2908,2,1,624,14,10,1,13578,2049,2223,3,10,12718,13622,147,114,97, + 110,100,111,109,58,109,101,114,115,101,110,110,101,58,115,101,116,45,115,101, + 101,100,0,4097,12777,1,0,4097,13411,2049,13463,10,13594,13650,147,114,97,110,100,111, + 109,58,109,101,114,115,101,110,110,101,0,3841,13411,2049,2567,1,13574,9,3841,13411, + 1,12777,17,15,2,1,11,24,23,2,1,-7,24,1,1073741823,21,23,2,1,-15, + 24,1,2011365376,21,23,2,1,18,24,23,3841,13411,2049,2908,1,624,788,4097,13411,10, + 13631,13706,147,98,121,101,0,10,0 }; diff --git a/interfaces/rre_image.c b/interfaces/rre_image.c index d6d3957..77dad3c 100644 --- a/interfaces/rre_image.c +++ b/interfaces/rre_image.c @@ -1,6 +1,6 @@ #include -int32_t ngaImageCells = 14344; -int32_t ngaImage[] = { 1793,14177,14307,14343,201906,0,10,1,10,2,10,3,10,4,10,5,10,6,10, +int32_t ngaImageCells = 14519; +int32_t ngaImage[] = { 1793,14352,14482,14518,201906,0,10,1,10,2,10,3,10,4,10,5,10,6,10, 7,10,8,10,9,10,10,10,11,10,12,10,13,10,14,10,15,10,16,10, 17,10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,10,26,10, 68223234,1,2575,85000450,1,656912,355,339,268505089,66,65,135205121,66,10,101384453,0,9,10,2049,59, @@ -159,7 +159,7 @@ int32_t ngaImage[] = { 1793,14177,14307,14343,201906,0,10,1,10,2,10,3,10,4,10,5, 2065,10,1,3112,2049,2065,4,16,10,3093,3146,147,118,58,117,112,100,97,116,101, 45,117,115,105,110,103,0,4,1793,3153,15,4,8,10,1,3149,2049,2077,16,10, 3128,3167,147,99,111,112,121,0,1793,3176,1,59,2049,2065,2049,62,10,1,3169,2049, - 2252,3,3,10,3159,3196,147,83,99,111,112,101,76,105,115,116,0,14167,14250,10, + 2252,3,3,10,3159,3196,147,83,99,111,112,101,76,105,115,116,0,14342,14425,10, 3183,3205,147,123,123,0,2049,1570,2,1,3196,2049,62,16,10,3199,3230,147,45,45, 45,114,101,118,101,97,108,45,45,45,0,2049,1570,1,3196,2049,2908,16,10,3214, 3244,147,125,125,0,1,3196,2049,59,4,15,11,1793,3258,3841,3196,4097,2,10,1, @@ -179,7 +179,7 @@ int32_t ngaImage[] = { 1793,14177,14307,14343,201906,0,10,1,10,2,10,3,10,4,10,5, 2065,4097,3312,10,3480,3538,134,84,101,109,112,83,116,114,105,110,103,115,0,32, 3523,3556,134,84,101,109,112,83,116,114,105,110,103,77,97,120,0,512,3539,3568, 147,83,84,82,73,78,71,83,0,2049,1543,3841,3538,3841,3556,19,18,10,3557,3588, - 134,67,117,114,114,101,110,116,0,1,10,3577,3603,147,115,58,112,111,105,110, + 134,67,117,114,114,101,110,116,0,5,10,3577,3603,147,115,58,112,111,105,110, 116,101,114,0,3841,3588,3841,3556,19,2049,3568,17,10,3590,3622,147,115,58,110,101, 120,116,0,1,3588,2049,3009,3841,3588,3841,3538,11,1793,3638,1,0,4097,3588,10,1, 3633,9,10,3557,3652,147,115,58,116,101,109,112,0,2,2049,82,2049,2908,2049,3603, @@ -614,23 +614,31 @@ int32_t ngaImage[] = { 1793,14177,14307,14343,201906,0,10,1,10,2,10,3,10,4,10,5, 1,15,2049,11902,10,12204,12238,147,117,110,105,120,58,115,108,101,101,112,0,1, 16,2049,11902,10,12224,12260,147,117,110,105,120,58,105,111,58,110,58,112,117,116, 0,1,17,2049,11902,10,12243,12282,147,117,110,105,120,58,105,111,58,115,58,112, - 117,116,0,1,18,2049,11902,10,12265,12302,147,114,97,110,100,111,109,58,98,121, - 116,101,0,2049,3697,47,100,101,118,47,117,114,97,110,100,111,109,0,1,12304, - 1,0,2049,9321,1,9358,2049,2077,2049,9340,10,12265,12342,147,110,58,114,97,110,100, - 111,109,0,2049,12302,1,-8,24,2049,12302,17,1,-8,24,2049,12302,17,1,8,24, - 2049,12302,17,10,12330,12368,134,107,0,0,12363,12374,134,116,0,0,12369,12381,134,115, - 48,0,0,12375,12388,134,115,49,0,0,12382,12395,134,115,50,0,0,12389,12402,134, - 115,51,0,0,12396,12411,147,115,101,101,100,0,2,4097,12368,2,4097,12374,2,4097, - 12388,2,4097,12395,4097,12402,10,12403,12434,147,114,111,116,108,0,4097,12368,1793,12444,3841, - 12368,2049,2759,24,10,1,12438,1793,12455,1,32,3841,12368,18,24,10,1,12448,2049,2092, - 22,10,12426,12470,147,114,101,115,42,42,0,3841,12381,1,5,19,1,7,2049,12434, - 1,9,19,10,12330,12508,147,114,97,110,100,111,109,58,120,111,114,111,115,104, - 105,114,111,49,50,56,42,42,0,3841,12388,2,1,-9,24,5,3841,12402,3841,12381, - 3841,12395,386269701,1285,386269701,100926980,85394690,386269701,386270726,4097,12395,4097,12388,4097,12381,1,11,2049,12434,4097, - 12402,2049,12470,10,12483,12577,147,114,97,110,100,111,109,58,120,111,114,111,115,104, - 105,114,111,49,50,56,42,42,58,115,101,116,45,115,101,101,100,0,2049,12411, - 1,100,1793,12587,2049,12508,3,10,1,12583,2049,2252,10,12543,12602,134,83,116,97,116, - 101,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 117,116,0,1,18,2049,11902,10,12265,12303,147,117,110,105,120,58,103,101,116,45, + 99,119,100,0,2049,3697,112,119,100,0,1,12305,1,0,2049,12111,2,2049,9724,2049, + 3946,4,2049,12131,1,0,2049,82,17,2049,3697,47,0,1,12330,2049,4005,10,12287,12364, + 147,117,110,105,120,58,99,111,117,110,116,45,102,105,108,101,115,45,105,110, + 45,99,119,100,0,2049,3697,108,115,32,45,49,32,124,32,119,99,32,45,108, + 0,1,12366,1,0,2049,12111,2,2049,9724,2049,3946,2049,221,4,2049,12131,10,12337,12419, + 147,117,110,105,120,58,102,111,114,45,101,97,99,104,45,102,105,108,101,0, + 2049,3697,108,115,32,45,49,32,45,112,0,1,12421,1,0,2049,12111,2049,12364,1793, + 12454,1793,12449,2049,9724,2049,3652,67502597,8,10,1,12442,2049,2077,10,1,12440,2049,2252,2049, + 12131,3,10,12397,12477,147,114,97,110,100,111,109,58,98,121,116,101,0,2049,3697, + 47,100,101,118,47,117,114,97,110,100,111,109,0,1,12479,1,0,2049,9321,1, + 9358,2049,2077,2049,9340,10,12397,12517,147,110,58,114,97,110,100,111,109,0,2049,12477, + 1,-8,24,2049,12477,17,1,-8,24,2049,12477,17,1,8,24,2049,12477,17,10,12505, + 12543,134,107,0,0,12538,12549,134,116,0,0,12544,12556,134,115,48,0,0,12550,12563, + 134,115,49,0,0,12557,12570,134,115,50,0,0,12564,12577,134,115,51,0,0,12571, + 12586,147,115,101,101,100,0,2,4097,12543,2,4097,12549,2,4097,12563,2,4097,12570,4097, + 12577,10,12578,12609,147,114,111,116,108,0,4097,12543,1793,12619,3841,12543,2049,2759,24,10, + 1,12613,1793,12630,1,32,3841,12543,18,24,10,1,12623,2049,2092,22,10,12601,12645,147, + 114,101,115,42,42,0,3841,12556,1,5,19,1,7,2049,12609,1,9,19,10,12505, + 12683,147,114,97,110,100,111,109,58,120,111,114,111,115,104,105,114,111,49,50, + 56,42,42,0,3841,12563,2,1,-9,24,5,3841,12577,3841,12556,3841,12570,386269701,1285,386269701, + 100926980,85394690,386269701,386270726,4097,12570,4097,12563,4097,12556,1,11,2049,12609,4097,12577,2049,12645,10,12658, + 12752,147,114,97,110,100,111,109,58,120,111,114,111,115,104,105,114,111,49,50, + 56,42,42,58,115,101,116,45,115,101,101,100,0,2049,12586,1,100,1793,12762,2049, + 12683,3,10,1,12758,2049,2252,10,12718,12777,134,83,116,97,116,101,115,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,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -661,60 +669,60 @@ int32_t ngaImage[] = { 1793,14177,14307,14343,201906,0,10,1,10,2,10,3,10,4,10,5, 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,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,12592,13236,134,73,110,100,101,120,0,0,13227,13246, - 147,114,101,115,101,116,0,1,12602,67502597,2049,2921,17,2,15,1,30,24,4,15, - 23,1,1812433253,19,67502597,17,2049,2541,21,4,1,12602,17,16,10,13237,13288,147,114,97, - 110,100,111,109,105,122,101,100,0,1,1,1793,13302,2,2049,13246,2049,2908,2,1, - 624,14,10,1,13292,2049,2223,3,10,13274,13313,147,121,0,2,2049,2908,1,624,788, - 1,12602,17,15,2049,2541,21,4,1,12602,17,15,1,-31,24,17,10,13308,13347,147, - 97,108,116,101,114,101,100,0,2,2049,13313,2,1,1,21,1,1073741823,19,1793,13375, - 1,2,197652,67502597,1,397,17,1,624,788,1,12602,17,15,23,10,1,13359,2049,2065, - 23,4,1,12602,17,16,10,13336,13399,147,115,99,114,97,109,98,108,101,100,0, - 1,0,1793,13413,2,2049,13347,2049,2908,2,1,624,14,10,1,13403,2049,2223,3,10, - 12543,13447,147,114,97,110,100,111,109,58,109,101,114,115,101,110,110,101,58,115, - 101,116,45,115,101,101,100,0,4097,12602,1,0,4097,13236,2049,13288,10,13419,13475,147, - 114,97,110,100,111,109,58,109,101,114,115,101,110,110,101,0,3841,13236,2049,2567, - 1,13399,9,3841,13236,1,12602,17,15,2,1,11,24,23,2,1,-7,24,1,1073741823, - 21,23,2,1,-15,24,1,2011365376,21,23,2,1,18,24,23,3841,13236,2049,2908,1, - 624,788,4097,13236,10,13456,13539,134,105,111,58,75,101,121,98,111,97,114,100,0, - 0,13524,13552,147,105,100,101,110,116,105,102,121,0,3841,13539,2049,2567,1793,13619,1, - 1,2049,8857,2,2049,2602,1793,13607,3,2049,3697,73,79,32,68,69,86,73,67,69, - 32,84,89,80,69,32,48,48,48,49,32,78,79,84,32,70,79,85,78,68, - 0,1,13570,2049,8950,2049,8913,10,1,13567,1793,13614,4097,13539,10,1,13611,2049,67,10, - 1,13558,9,10,13456,13632,147,99,58,103,101,116,0,2049,13552,3841,13539,2049,8831,10, - 13623,13655,134,105,111,58,83,99,114,105,112,116,105,110,103,0,0,13639,13668,147, - 105,100,101,110,116,105,102,121,0,3841,13655,2049,2567,1793,13735,1,9,2049,8857,2, - 2049,2602,1793,13723,3,2049,3697,73,79,32,68,69,86,73,67,69,32,84,89,80, - 69,32,48,48,48,57,32,78,79,84,32,70,79,85,78,68,0,1,13686,2049, - 8950,2049,8913,10,1,13683,1793,13730,4097,13655,10,1,13727,2049,67,10,1,13674,9,10, - 13623,13751,147,115,121,115,58,97,114,103,99,0,2049,13668,1,0,3841,13655,2049,8831, - 10,13739,13772,147,115,121,115,58,97,114,103,118,0,2049,3678,4,2049,13668,1,1, - 3841,13655,2049,8831,10,13760,13795,147,105,110,99,108,117,100,101,0,2049,13668,1,2, - 3841,13655,2049,8831,10,13784,13814,134,78,111,69,99,104,111,0,0,13804,13826,147,118, - 101,114,115,105,111,110,0,3841,4,1,100,20,2049,8964,1,46,2049,8900,2049,8964, - 10,13815,13848,147,101,111,108,63,0,1793,13854,1,13,11,10,1,13850,1793,13862,1, - 10,11,10,1,13858,1793,13870,1,32,11,10,1,13866,2049,2129,22,22,10,13840,13887, - 147,118,97,108,105,100,63,0,2,2049,82,2049,2583,10,13877,13899,147,111,107,0, - 3841,13814,2049,2720,25,3,2049,1806,1793,13922,2049,8913,2049,3697,79,107,32,0,1,13913, - 2049,8950,10,1,13909,2049,73,10,13893,13940,147,99,104,101,99,107,45,101,111,102, - 0,2,1793,13947,1,-1,11,10,1,13943,1793,13955,1,4,11,10,1,13951,2049,2092, - 22,1793,13977,2049,3697,98,121,101,0,1,13964,2049,200,2049,161,15,8,10,1,13962, - 9,10,13927,13993,147,99,104,101,99,107,45,98,115,0,2,1793,14000,1,8,11, - 10,1,13996,1793,14008,1,127,11,10,1,14004,2049,2092,22,1793,14021,2049,3407,2049,3407, - 771,10,1,14015,9,10,13981,14034,147,115,58,103,101,116,0,1793,14063,1,1025,2049, - 3475,1793,14054,2049,13632,2,2049,3383,2049,13940,2049,13993,2049,13848,10,1,14042,2049,2223,2049, - 3349,2049,3790,10,1,14036,2049,3499,10,13804,14078,147,98,97,110,110,101,114,0,3841, - 13814,2049,2720,25,3,2049,3697,82,69,84,82,79,32,49,50,32,40,114,120,45, - 0,1,14086,2049,8950,2049,13826,1,41,2049,8900,2049,8913,2049,1543,2049,8964,2049,3697,32, - 77,65,88,44,32,84,73,66,32,64,32,49,48,50,53,44,32,72,101,97, - 112,32,64,32,0,1,14118,2049,8950,2049,1835,2049,8964,2049,8913,10,14068,14162,147,98, - 121,101,0,1,0,2049,12036,10,14155,14177,147,108,105,115,116,101,110,0,2049,13899, - 2049,14034,2049,13887,1793,14190,2049,367,2049,13899,10,1,14185,1793,14196,3,10,1,14194,2049, - 67,1,14179,7,10,14167,14214,147,103,97,116,104,101,114,0,2,1793,14221,1,8, - 11,10,1,14217,1793,14229,1,127,11,10,1,14225,2049,2092,22,1793,14238,3,10,1, - 14236,1793,14245,2049,3383,10,1,14242,2049,67,10,14204,14259,147,99,121,99,108,101,0, - 2049,13632,2049,2055,4,8,2049,2720,25,3,2049,14214,1,14259,7,10,14167,14290,147,112, - 97,114,115,101,45,117,110,116,105,108,0,1793,14302,2049,3678,2049,3475,2049,14259,771, - 2049,3349,10,1,14292,2049,3499,10,14275,14316,147,115,58,103,101,116,0,1793,14338,1793, - 14324,1,10,11,10,1,14320,1793,14332,1,13,11,10,1,14328,2049,2092,22,10,1, - 14318,2049,14290,10,0 }; + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,12767,13411,134,73,110,100,101,120,0,0,13402,13421,147,114,101,115,101, + 116,0,1,12777,67502597,2049,2921,17,2,15,1,30,24,4,15,23,1,1812433253,19,67502597, + 17,2049,2541,21,4,1,12777,17,16,10,13412,13463,147,114,97,110,100,111,109,105, + 122,101,100,0,1,1,1793,13477,2,2049,13421,2049,2908,2,1,624,14,10,1,13467, + 2049,2223,3,10,13449,13488,147,121,0,2,2049,2908,1,624,788,1,12777,17,15,2049, + 2541,21,4,1,12777,17,15,1,-31,24,17,10,13483,13522,147,97,108,116,101,114, + 101,100,0,2,2049,13488,2,1,1,21,1,1073741823,19,1793,13550,1,2,197652,67502597,1, + 397,17,1,624,788,1,12777,17,15,23,10,1,13534,2049,2065,23,4,1,12777,17, + 16,10,13511,13574,147,115,99,114,97,109,98,108,101,100,0,1,0,1793,13588,2, + 2049,13522,2049,2908,2,1,624,14,10,1,13578,2049,2223,3,10,12718,13622,147,114,97, + 110,100,111,109,58,109,101,114,115,101,110,110,101,58,115,101,116,45,115,101, + 101,100,0,4097,12777,1,0,4097,13411,2049,13463,10,13594,13650,147,114,97,110,100,111, + 109,58,109,101,114,115,101,110,110,101,0,3841,13411,2049,2567,1,13574,9,3841,13411, + 1,12777,17,15,2,1,11,24,23,2,1,-7,24,1,1073741823,21,23,2,1,-15, + 24,1,2011365376,21,23,2,1,18,24,23,3841,13411,2049,2908,1,624,788,4097,13411,10, + 13631,13714,134,105,111,58,75,101,121,98,111,97,114,100,0,0,13699,13727,147,105, + 100,101,110,116,105,102,121,0,3841,13714,2049,2567,1793,13794,1,1,2049,8857,2,2049, + 2602,1793,13782,3,2049,3697,73,79,32,68,69,86,73,67,69,32,84,89,80,69, + 32,48,48,48,49,32,78,79,84,32,70,79,85,78,68,0,1,13745,2049,8950, + 2049,8913,10,1,13742,1793,13789,4097,13714,10,1,13786,2049,67,10,1,13733,9,10,13631, + 13807,147,99,58,103,101,116,0,2049,13727,3841,13714,2049,8831,10,13798,13830,134,105,111, + 58,83,99,114,105,112,116,105,110,103,0,0,13814,13843,147,105,100,101,110,116, + 105,102,121,0,3841,13830,2049,2567,1793,13910,1,9,2049,8857,2,2049,2602,1793,13898,3, + 2049,3697,73,79,32,68,69,86,73,67,69,32,84,89,80,69,32,48,48,48, + 57,32,78,79,84,32,70,79,85,78,68,0,1,13861,2049,8950,2049,8913,10,1, + 13858,1793,13905,4097,13830,10,1,13902,2049,67,10,1,13849,9,10,13798,13926,147,115,121, + 115,58,97,114,103,99,0,2049,13843,1,0,3841,13830,2049,8831,10,13914,13947,147,115, + 121,115,58,97,114,103,118,0,2049,3678,4,2049,13843,1,1,3841,13830,2049,8831,10, + 13935,13970,147,105,110,99,108,117,100,101,0,2049,13843,1,2,3841,13830,2049,8831,10, + 13959,13989,134,78,111,69,99,104,111,0,0,13979,14001,147,118,101,114,115,105,111, + 110,0,3841,4,1,100,20,2049,8964,1,46,2049,8900,2049,8964,10,13990,14023,147,101, + 111,108,63,0,1793,14029,1,13,11,10,1,14025,1793,14037,1,10,11,10,1,14033, + 1793,14045,1,32,11,10,1,14041,2049,2129,22,22,10,14015,14062,147,118,97,108,105, + 100,63,0,2,2049,82,2049,2583,10,14052,14074,147,111,107,0,3841,13989,2049,2720,25, + 3,2049,1806,1793,14097,2049,8913,2049,3697,79,107,32,0,1,14088,2049,8950,10,1,14084, + 2049,73,10,14068,14115,147,99,104,101,99,107,45,101,111,102,0,2,1793,14122,1, + -1,11,10,1,14118,1793,14130,1,4,11,10,1,14126,2049,2092,22,1793,14152,2049,3697, + 98,121,101,0,1,14139,2049,200,2049,161,15,8,10,1,14137,9,10,14102,14168,147, + 99,104,101,99,107,45,98,115,0,2,1793,14175,1,8,11,10,1,14171,1793,14183, + 1,127,11,10,1,14179,2049,2092,22,1793,14196,2049,3407,2049,3407,771,10,1,14190,9, + 10,14156,14209,147,115,58,103,101,116,0,1793,14238,1,1025,2049,3475,1793,14229,2049,13807, + 2,2049,3383,2049,14115,2049,14168,2049,14023,10,1,14217,2049,2223,2049,3349,2049,3790,10,1, + 14211,2049,3499,10,13979,14253,147,98,97,110,110,101,114,0,3841,13989,2049,2720,25,3, + 2049,3697,82,69,84,82,79,32,49,50,32,40,114,120,45,0,1,14261,2049,8950, + 2049,14001,1,41,2049,8900,2049,8913,2049,1543,2049,8964,2049,3697,32,77,65,88,44,32, + 84,73,66,32,64,32,49,48,50,53,44,32,72,101,97,112,32,64,32,0, + 1,14293,2049,8950,2049,1835,2049,8964,2049,8913,10,14243,14337,147,98,121,101,0,1,0, + 2049,12036,10,14330,14352,147,108,105,115,116,101,110,0,2049,14074,2049,14209,2049,14062,1793, + 14365,2049,367,2049,14074,10,1,14360,1793,14371,3,10,1,14369,2049,67,1,14354,7,10, + 14342,14389,147,103,97,116,104,101,114,0,2,1793,14396,1,8,11,10,1,14392,1793, + 14404,1,127,11,10,1,14400,2049,2092,22,1793,14413,3,10,1,14411,1793,14420,2049,3383, + 10,1,14417,2049,67,10,14379,14434,147,99,121,99,108,101,0,2049,13807,2049,2055,4, + 8,2049,2720,25,3,2049,14389,1,14434,7,10,14342,14465,147,112,97,114,115,101,45, + 117,110,116,105,108,0,1793,14477,2049,3678,2049,3475,2049,14434,771,2049,3349,10,1,14467, + 2049,3499,10,14450,14491,147,115,58,103,101,116,0,1793,14513,1793,14499,1,10,11,10, + 1,14495,1793,14507,1,13,11,10,1,14503,2049,2092,22,10,1,14493,2049,14465,10,0 }; diff --git a/words.tsv b/words.tsv index 59a1afd..38f9768 100644 --- a/words.tsv +++ b/words.tsv @@ -407,12 +407,15 @@ u:to-f u- - -n Decode an encoded floating point value. class:word {n/a} {n/a} u:zero? u-f - - {n/a} class:word {n/a} {n/a} u rre {n/a} unhook a- - - Reset the hook point in a1 to the default definition. class:word :foo hook #1 ;\n :bar #2 ;\n &bar &foo set-hook\n &foo unhook {n/a} global all unix:chdir s- - - Change the current working directory to the specified one. class:word '/etc unix:chdir {n/a} unix rre +unix:count-files-in-cwd -n - - Return the number of files (and subdirectories) in the current working directory class:word {n/a} {n/a} unix rre unix:exec0 s- - - Execute a process by running the application specified by s. class:word {n/a} {n/a} unix rre unix:exec1 ss- - - Execute a process by running the application specified by s1. Pass s2 as an argument. class:word {n/a} {n/a} unix rre unix:exec2 sss- - - Execute a process by running the application specified by s1. Pass s2 and s3 as arguments. class:word {n/a} {n/a} unix rre unix:exec3 ssss- - - Execute a process by running the application specified by s1. Pass s2, s3, and s4 as arguments. class:word {n/a} {n/a} unix rre unix:exit n- - - Exit the current process, returning the specified return code. class:word {n/a} {n/a} unix rre +unix:for-each-file q- - - Run a quote once for each file or subdirectory in the current directory. The quote will receive the file name as a string and should consume this and return nothing on the stack. class:word {n/a} {n/a} unix rre unix:fork -n - - Fork the current process. Returns a PID. class:word {n/a} {n/a} unix rre +unix:get-cwd -s - - Return the current working directory class:word {n/a} {n/a} unix rre unix:getenv sa- - - Get an environment variable. Provide the name and an address to store it in. class:word 'SHELL s:empty [ unix:getenv ] sip s:put nl {n/a} unix rre unix:getpid -n - - Return the PID of the current process. class:word {n/a} {n/a} unix rre unix:io:n:put n- - - Display a number (in base 10) to the standard output device. This is faster than `n:put`, but not portable. class:word {n/a} {n/a} unix:io rre