Add license under Apache 2.0.
Add copyright + license notice to all files. Enhance scripts to work around / drop license text when composing multiple file. Drop historical EForth reference. Bump version number.
This commit is contained in:
202
LICENSE
Normal file
202
LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@ -2,12 +2,11 @@
|
||||
|
||||
EForth is a delightfully minimalist approach to Forth originated by Bill Muench and Dr. C. H. Ting.
|
||||
|
||||
For more information visit:
|
||||
For documentation visit:
|
||||
|
||||
[https://eforth.appspot.com/](https://eforth.appspot.com/)
|
||||
|
||||
## Directories
|
||||
|
||||
* ueforth/ - µEforth - EForth refactored to allow source boostraping.
|
||||
* circleforth/ - A minimalist Forth modeled after toy Lisps.
|
||||
* reference/ - EForth Reference Material
|
||||
* [ueforth/ - µEforth / ESP32forth](ueforth/README.md) - EForth refactored to allow source boostraping.
|
||||
* [circleforth/ - CircleForth](circleforth/README.md) - A minimalist Forth modeled after toy Lisps.
|
||||
|
||||
@ -1,4 +1,19 @@
|
||||
#! /usr/bin/env gforth
|
||||
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( CircleForth )
|
||||
vocabulary circleforth circleforth definitions
|
||||
|
||||
@ -78,6 +93,7 @@ p: last p: state
|
||||
( Bootstrap )
|
||||
boot
|
||||
: ( 41 parse drop drop ; immediate
|
||||
: \ 10 parse drop drop ; immediate
|
||||
( And now we have comments! )
|
||||
include compound.fs
|
||||
ok
|
||||
|
||||
@ -1,5 +1,19 @@
|
||||
( CircleForth - Compound words )
|
||||
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Useful basic compound words )
|
||||
: 2drop ( n n -- ) drop drop ;
|
||||
: 2dup ( a b -- a b a b ) over over ;
|
||||
|
||||
@ -1,519 +0,0 @@
|
||||
( EForth High Level Definitions )
|
||||
|
||||
( Variables and User Variables )
|
||||
|
||||
: doVAR ( -- a ) R> ;
|
||||
|
||||
VARIABLE UP ( -- a, Pointer to the user area.)
|
||||
|
||||
: doUSER ( -- a, Run time routine for user variables.)
|
||||
R> @ \ retrieve user area offset
|
||||
UP @ + ; \ add to user area base addr
|
||||
: doVOC ( -- ) R> CONTEXT ! ;
|
||||
: FORTH ( -- ) doVOC [ 0 , 0 ,
|
||||
: doUSER ( -- a ) R> @ UP @ + ;
|
||||
|
||||
( User Variables )
|
||||
|
||||
SP0 ( -- a, pointer to bottom of the data stack.)
|
||||
RP0 ( -- a, pointer to bottom of the return stack.)
|
||||
'?KEY ( -- a, execution vector of ?KEY. Default to ?rx.)
|
||||
'EMIT ( -- a, execution vector of EMIT. Default to tx!)
|
||||
'EXPECT ( -- a, execution vector of EXPECT. Default to 'accept'.)
|
||||
'TAP ( -- a, execution vector of TAP. Defulat the kTAP.)
|
||||
'ECHO ( -- a, execution vector of ECHO. Default to tx!.)
|
||||
'PROMPT ( -- a, execution vector of PROMPT. Default to '.ok'.)
|
||||
BASE ( -- a,.radix base for numeric I/O. Default to 10.)
|
||||
tmp ( -- a, a temporary storage location used in parse and find.)
|
||||
SPAN ( -- a, hold character count received by EXPECT.)
|
||||
>IN ( -- a, hold the character pointer while parsing input stream.)
|
||||
#TIB ( -- a, hold the current count and address of the terminal input buffer.
|
||||
Terminal Input Buffer used one cell after #TIB.)
|
||||
CSP ( -- a, hold the stack pointer for error checking.)
|
||||
'EVAL ( -- a, execution vector of EVAL. Default to EVAL.)
|
||||
'NUMBER ( -- a, address of number conversion. Default to NUMBER?.)
|
||||
HLD ( -- a, hold a pointer in building a numeric output string.)
|
||||
HANDLER ( -- a, hold the return stack pointer for error handling.)
|
||||
CONTEXT ( -- a, a area to specify vocabulary search order. Default to FORTH.
|
||||
Vocabulary stack, 8 cells follwing CONTEXT.)
|
||||
CURRENT ( -- a, point to the vocabulary to be extended. Default to FORTH.
|
||||
Vocabulary link uses one cell after CURRENT.)
|
||||
CP ( -- a, point to the top of the code dictionary.)
|
||||
NP ( -- a, point to the bottom of the name dictionary.)
|
||||
LAST ( -- a, point to the last name in the name dictionary.)
|
||||
|
||||
( Common Functions )
|
||||
|
||||
: ?DUP ( w -- w w | 0 ) DUP IF DUP THEN ;
|
||||
: ROT ( w1 w2 w3 -- w2 w3 w1 ) >R SWAP R> SWAP ;
|
||||
: 2DROP ( w w -- ) DROP DROP ;
|
||||
: 2DUP ( w1 w2 -- w1 w2 w1 w2 ) OVER OVER ;
|
||||
: + ( w w -- w ) UM+ DROP ;
|
||||
: NOT ( w -- w ) -1 XOR ;
|
||||
: NEGATE ( n -- -n ) NOT 1 + ;
|
||||
: DNEGATE ( d -- -d ) NOT >R NOT 1 UM+ R> + ;
|
||||
: D+ ( d d -- d ) >R SWAP >R UM+ R> R> + + ;
|
||||
: - ( w w -- w ) NEGATE + ;
|
||||
: ABS ( n -- +n ) DUP 0< IF NEGATE THEN ;
|
||||
|
||||
( Comparison )
|
||||
|
||||
: = ( w w -- t ) XOR IF 0 EXIT THEN -1 ;
|
||||
: U< ( u u -- t ) 2DUP XOR 0< IF SWAP DROP 0< EXIT THEN - 0< ;
|
||||
: < ( n n -- t ) 2DUP XOR 0< IF DROP 0< EXIT THEN - 0< ;
|
||||
: MAX ( n n -- n ) 2DUP < IF SWAP THEN DROP ;
|
||||
: MIN ( n n -- n ) 2DUP SWAP < IF SWAP THEN DROP ;
|
||||
: WITHIN ( u ul uh -- t ) \ ul <= u < uh
|
||||
OVER - >R - R> U< ;
|
||||
|
||||
( Divide )
|
||||
|
||||
: UM/MOD ( ud u -- ur uq )
|
||||
2DUP U<
|
||||
IF NEGATE 15
|
||||
FOR >R DUP UM+ >R >R DUP UM+ R> + DUP
|
||||
R> R@ SWAP >R UM+ R> OR
|
||||
IF >R DROP 1 + R> ELSE DROP THEN R>
|
||||
NEXT DROP SWAP EXIT
|
||||
THEN DROP 2DROP -1 DUP ;
|
||||
: M/MOD ( d n -- r q ) \ floored division
|
||||
DUP 0< DUP >R
|
||||
IF NEGATE >R DNEGATE R>
|
||||
THEN >R DUP 0< IF R@ + THEN R> UM/MOD R>
|
||||
IF SWAP NEGATE SWAP THEN ;
|
||||
: /MOD ( n n -- r q ) OVER 0< SWAP M/MOD ;
|
||||
: MOD ( n n -- r ) /MOD DROP ;
|
||||
: / ( n n -- q ) /MOD SWAP DROP ;
|
||||
|
||||
( Multiply )
|
||||
|
||||
: UM* ( u u -- ud )
|
||||
0 SWAP ( u1 0 u2 ) 15
|
||||
FOR DUP UM+ >R >R DUP UM+ R> + R>
|
||||
IF >R OVER UM+ R> + THEN
|
||||
NEXT ROT DROP ;
|
||||
: * ( n n -- n ) UM* DROP ;
|
||||
: M* ( n n -- d )
|
||||
2DUP XOR 0< >R ABS SWAP ABS UM* R> IF DNEGATE THEN ;
|
||||
: */MOD ( n n n -- r q ) >R M* R> M/MOD ;
|
||||
: */ ( n n n -- q ) */MOD SWAP DROP ;
|
||||
|
||||
( Memory Alignment )
|
||||
|
||||
: CELL- ( a -- a ) -2 + ;
|
||||
: CELL+ ( a -- a ) 2 + ;
|
||||
: CELLS ( n -- n ) 2 * ;
|
||||
: ALIGNED ( b -- a )
|
||||
DUP 0 2 UM/MOD DROP DUP
|
||||
IF 2 SWAP - THEN + ;
|
||||
: BL ( -- 32 ) 32 ;
|
||||
: >CHAR ( c -- c )
|
||||
$7F AND DUP 127 BL WITHIN IF DROP 95 THEN ;
|
||||
: DEPTH ( -- n ) SP@ SP0 @ SWAP - 2 / ;
|
||||
: PICK ( +n -- w ) 1 + CELLS SP@ + @ ;
|
||||
|
||||
( Memory Access )
|
||||
|
||||
: +! ( n a -- ) SWAP OVER @ + SWAP ! ;
|
||||
: 2! ( d a -- ) SWAP OVER ! CELL+ ! ;
|
||||
: 2@ ( a -- d ) DUP CELL+ @ SWAP @ ;
|
||||
: COUNT ( b -- b +n ) DUP 1 + SWAP C@ ;
|
||||
: HERE ( -- a ) CP @ ;
|
||||
: PAD ( -- a ) HERE 80 + ;
|
||||
: TIB ( -- a ) #TIB CELL+ @ ;
|
||||
: @EXECUTE ( a -- ) @ ?DUP IF EXECUTE THEN ;
|
||||
: CMOVE ( b b u -- )
|
||||
FOR AFT >R DUP C@ R@ C! 1 + R> 1 + THEN NEXT 2DROP ;
|
||||
: FILL ( b u c -- )
|
||||
SWAP FOR SWAP AFT 2DUP C! 1 + THEN NEXT 2DROP ;
|
||||
: -TRAILING ( b u -- b u )
|
||||
FOR AFT BL OVER R@ + C@ <
|
||||
IF R> 1 + EXIT THEN THEN
|
||||
NEXT 0 ;
|
||||
: PACK$ ( b u a -- a ) \ null fill
|
||||
ALIGNED DUP >R OVER
|
||||
DUP 0 2 UM/MOD DROP
|
||||
- OVER + 0 SWAP ! 2DUP C! 1 + SWAP CMOVE R> ;
|
||||
|
||||
( Numeric Output )
|
||||
|
||||
: DIGIT ( u -- c ) 9 OVER < 7 AND + 48 + ;
|
||||
: EXTRACT ( n base -- n c ) 0 SWAP UM/MOD SWAP DIGIT ;
|
||||
: <# ( -- ) PAD HLD ! ;
|
||||
: HOLD ( c -- ) HLD @ 1 - DUP HLD ! C! ;
|
||||
: # ( u -- u ) BASE @ EXTRACT HOLD ;
|
||||
: #S ( u -- 0 ) BEGIN # DUP WHILE REPEAT ;
|
||||
: SIGN ( n -- ) 0< IF 45 HOLD THEN ;
|
||||
: #> ( w -- b u ) DROP HLD @ PAD OVER - ;
|
||||
: str ( n -- b u ) DUP >R ABS <# #S R> SIGN #> ;
|
||||
: HEX ( -- ) 16 BASE ! ;
|
||||
: DECIMAL ( -- ) 10 BASE ! ;
|
||||
|
||||
( Number Output )
|
||||
|
||||
: str ( n -- b u )
|
||||
( Convert a signed integer to a numeric string.)
|
||||
DUP >R ( save a copy for sign)
|
||||
ABS ( use absolute of n)
|
||||
<# #S ( convert all digits)
|
||||
R> SIGN ( add sign from n)
|
||||
#> ; ( return number string addr and length)
|
||||
: HEX ( -- )
|
||||
( Use radix 16 as base for numeric conversions.)
|
||||
16 BASE ! ;
|
||||
: DECIMAL ( -- )
|
||||
( Use radix 10 as base for numeric conversions.)
|
||||
10 BASE ! ;
|
||||
: .R ( n +n -- )
|
||||
( Display an integer in a field of n columns, right justified.)
|
||||
>R str ( convert n to a number string)
|
||||
R> OVER - SPACES ( print leading spaces)
|
||||
TYPE ; ( print number in +n column format)
|
||||
: U.R ( u +n -- )
|
||||
( Display an unsigned integer in n column, right justified.)
|
||||
>R ( save column number)
|
||||
<# #S #> R> ( convert unsigned number)
|
||||
OVER - SPACES ( print leading spaces)
|
||||
TYPE ; ( print number in +n columns)
|
||||
: U. ( u -- )
|
||||
( Display an unsigned integer in free format.)
|
||||
<# #S #> ( convert unsigned number)
|
||||
SPACE ( print one leading space)
|
||||
TYPE ; ( print number)
|
||||
: . ( w -- )
|
||||
( Display an integer in free format, preceeded by a space.)
|
||||
BASE @ 10 XOR ( if not in decimal mode)
|
||||
IF U. EXIT THEN ( print unsigned number)
|
||||
str SPACE TYPE ; ( print signed number if decimal)
|
||||
: ? ( a -- )
|
||||
( Display the contents in a memory cell.)
|
||||
@ . ; ( very simple but useful command)
|
||||
|
||||
( Number Input )
|
||||
|
||||
: DIGIT? ( c base -- u t )
|
||||
>R 48 - 9 OVER <
|
||||
IF 7 - DUP 10 < OR THEN DUP R> U< ;
|
||||
: NUMBER? ( a -- n T | a F )
|
||||
BASE @ >R 0 OVER COUNT ( a 0 b n)
|
||||
OVER C@ 36 =
|
||||
IF HEX SWAP 1 + SWAP 1 - THEN ( a 0 b' n')
|
||||
OVER C@ 45 = >R ( a 0 b n)
|
||||
SWAP R@ - SWAP R@ + ( a 0 b" n") ?DUP
|
||||
IF 1 - ( a 0 b n)
|
||||
FOR DUP >R C@ BASE @ DIGIT?
|
||||
WHILE SWAP BASE @ * + R> 1 +
|
||||
NEXT DROP R@ ( b ?sign) IF NEGATE THEN SWAP
|
||||
ELSE R> R> ( b index) 2DROP ( digit number) 2DROP 0
|
||||
THEN DUP
|
||||
THEN R> ( n ?sign) 2DROP R> BASE ! ;
|
||||
|
||||
( Basic I/O )
|
||||
|
||||
: ?KEY ( -- c T | F ) '?KEY @EXECUTE ;
|
||||
: KEY ( -- c ) BEGIN ?KEY UNTIL ;
|
||||
: EMIT ( c -- ) 'EMIT @EXECUTE ;
|
||||
: NUF? ( -- f ) ?KEY DUP IF 2DROP KEY 13 = THEN ;
|
||||
: PACE ( -- ) 11 EMIT ;
|
||||
: SPACE ( -- ) BL EMIT ;
|
||||
: CHARS ( +n c -- ) \ ???ANS conflict
|
||||
SWAP 0 MAX FOR AFT DUP EMIT THEN NEXT DROP ;
|
||||
: SPACES ( +n -- ) BL CHARS ;
|
||||
: TYPE ( b u -- ) FOR AFT DUP C@ EMIT 1 + THEN NEXT DROP ;
|
||||
: CR ( -- ) 13 EMIT 10 EMIT ;
|
||||
: do$ ( -- a )
|
||||
R> R@ R> COUNT + ALIGNED >R SWAP >R ;
|
||||
: $"| ( -- a ) do$ ;
|
||||
: ."| ( -- ) do$ COUNT TYPE ; COMPILE-ONLY
|
||||
: .R ( n +n -- ) >R str R> OVER - SPACES TYPE ;
|
||||
: U.R ( u +n -- ) >R <# #S #> R> OVER - SPACES TYPE ;
|
||||
: U. ( u -- ) <# #S #> SPACE TYPE ;
|
||||
: . ( n -- ) BASE @ 10 XOR IF U. EXIT THEN str SPACE TYPE ;
|
||||
: ? ( a -- ) @ . ;
|
||||
|
||||
( Parsing )
|
||||
|
||||
: parse ( b u c -- b u delta ; <string> )
|
||||
tmp ! OVER >R DUP \ b u u
|
||||
IF 1 - tmp @ BL =
|
||||
IF \ b u' \ 'skip'
|
||||
FOR BL OVER C@ - 0< NOT WHILE 1 +
|
||||
NEXT ( b) R> DROP 0 DUP EXIT \ all delim
|
||||
THEN R>
|
||||
THEN OVER SWAP \ b' b' u' \ 'scan'
|
||||
FOR tmp @ OVER C@ - tmp @ BL =
|
||||
IF 0< THEN WHILE 1 +
|
||||
NEXT DUP >R ELSE R> DROP DUP 1 + >R
|
||||
THEN OVER - R> R> - EXIT
|
||||
THEN ( b u) OVER R> - ;
|
||||
: PARSE ( c -- b u ; <string> )
|
||||
>R TIB >IN @ + #TIB @ >IN @ - R> parse >IN +! ;
|
||||
: .( ( -- ) 41 PARSE TYPE ; IMMEDIATE
|
||||
: ( ( -- ) 41 PARSE 2DROP ; IMMEDIATE
|
||||
: \ ( -- ) #TIB @ >IN ! ; IMMEDIATE
|
||||
: CHAR ( -- c ) BL PARSE DROP C@ ;
|
||||
: TOKEN ( -- a ; <string> )
|
||||
BL PARSE 31 MIN NP @ OVER - CELL- PACK$ ;
|
||||
: WORD ( c -- a ; <string> ) PARSE HERE PACK$ ;
|
||||
|
||||
( Dictionary Search )
|
||||
|
||||
: NAME> ( a -- xt ) CELL- CELL- @ ;
|
||||
: SAME? ( a a u -- a a f \ -0+ )
|
||||
FOR AFT OVER R@ CELLS + @
|
||||
OVER R@ CELLS + @ - ?DUP
|
||||
IF R> DROP EXIT THEN THEN
|
||||
NEXT 0 ;
|
||||
: find ( a va -- xt na | a F )
|
||||
SWAP \ va a
|
||||
DUP C@ 2 / tmp ! \ va a \ get cell count
|
||||
DUP @ >R \ va a \ count byte & 1st char
|
||||
CELL+ SWAP \ a' va
|
||||
BEGIN @ DUP \ a' na na
|
||||
IF DUP @ [ =MASK ] LITERAL AND R@ XOR \ ignore lexicon bits
|
||||
IF CELL+ -1 ELSE CELL+ tmp @ SAME? THEN
|
||||
ELSE R> DROP EXIT
|
||||
THEN
|
||||
WHILE CELL- CELL- \ a' la
|
||||
REPEAT R> DROP SWAP DROP CELL- DUP NAME> SWAP ;
|
||||
: NAME? ( a -- xt na | a F )
|
||||
CONTEXT DUP 2@ XOR IF CELL- THEN >R \ context<>also
|
||||
BEGIN R> CELL+ DUP >R @ ?DUP
|
||||
WHILE find ?DUP
|
||||
UNTIL R> DROP EXIT THEN R> DROP 0 ;
|
||||
|
||||
( Terminal )
|
||||
|
||||
: ^H ( b b b -- b b b ) \ backspace
|
||||
>R OVER R> SWAP OVER XOR
|
||||
IF 8 'ECHO @EXECUTE
|
||||
32 'ECHO @EXECUTE \ distructive
|
||||
8 'ECHO @EXECUTE \ backspace
|
||||
THEN ;
|
||||
: TAP ( bot eot cur c -- bot eot cur )
|
||||
DUP 'ECHO @EXECUTE OVER C! 1 + ;
|
||||
: kTAP ( bot eot cur c -- bot eot cur )
|
||||
DUP 13 XOR
|
||||
IF 8 XOR IF BL TAP ELSE ^H THEN EXIT
|
||||
THEN DROP SWAP DROP DUP ;
|
||||
: accept ( b u -- b u )
|
||||
OVER + OVER
|
||||
BEGIN 2DUP XOR
|
||||
WHILE KEY DUP BL - 95 U<
|
||||
IF TAP ELSE 'TAP @EXECUTE THEN
|
||||
REPEAT DROP OVER - ;
|
||||
: EXPECT ( b u -- ) 'EXPECT @EXECUTE SPAN ! DROP ;
|
||||
: QUERY ( -- )
|
||||
TIB 80 'EXPECT @EXECUTE #TIB ! DROP 0 >IN ! ;
|
||||
|
||||
( Error Handling )
|
||||
|
||||
: CATCH ( ca -- err#/0 )
|
||||
( Execute word at ca and set up an error frame for it.)
|
||||
SP@ >R ( save current stack pointer on return stack )
|
||||
HANDLER @ >R ( save the handler pointer on return stack )
|
||||
RP@ HANDLER ! ( save the handler frame pointer in HANDLER )
|
||||
( ca ) EXECUTE ( execute the assigned word over this safety net )
|
||||
R> HANDLER ! ( normal return from the executed word )
|
||||
( restore HANDLER from the return stack )
|
||||
R> DROP ( discard the saved data stack pointer )
|
||||
0 ; ( push a no-error flag on data stack )
|
||||
: THROW ( err# -- err# )
|
||||
( Reset system to current local error frame an update error flag.)
|
||||
HANDLER @ RP! ( expose latest error handler frame on return stack)
|
||||
R> HANDLER ! ( restore previously saved error handler frame )
|
||||
R> SWAP >R ( retrieve the data stack pointer saved )
|
||||
SP! ( restore the data stack )
|
||||
DROP
|
||||
R> ; ( retrived err# )
|
||||
|
||||
CREATE NULL$ 0 , $," coyote"
|
||||
: ABORT ( -- ) NULL$ THROW ;
|
||||
: abort" ( f -- ) IF do$ THROW THEN do$ DROP ;
|
||||
|
||||
( Text Interpreter )
|
||||
|
||||
: $INTERPRET ( a -- )
|
||||
NAME? ?DUP
|
||||
IF @ $40 AND
|
||||
ABORT" compile ONLY" EXECUTE EXIT
|
||||
THEN 'NUMBER @EXECUTE IF EXIT THEN THROW ;
|
||||
: [ ( -- ) doLIT $INTERPRET 'EVAL ! ; IMMEDIATE
|
||||
: .OK ( -- ) doLIT $INTERPRET 'EVAL @ = IF ." ok" THEN CR ;
|
||||
: ?STACK ( -- ) DEPTH 0< ABORT" underflow" ;
|
||||
: EVAL ( -- )
|
||||
BEGIN TOKEN DUP C@
|
||||
WHILE 'EVAL @EXECUTE ?STACK
|
||||
REPEAT DROP 'PROMPT @EXECUTE ;
|
||||
|
||||
( Shell )
|
||||
|
||||
: PRESET ( -- ) SP0 @ SP! TIB #TIB CELL+ ! ;
|
||||
: xio ( a a a -- ) \ reset 'EXPECT 'TAP 'ECHO 'PROMPT
|
||||
doLIT accept 'EXPECT 2! 'ECHO 2! ; COMPILE-ONLY
|
||||
: FILE ( -- )
|
||||
doLIT PACE doLIT DROP doLIT kTAP xio ;
|
||||
: HAND ( -- )
|
||||
doLIT .OK doLIT EMIT [ kTAP xio ;
|
||||
CREATE I/O ' ?RX , ' TX! , \ defaults
|
||||
: CONSOLE ( -- ) I/O 2@ '?KEY 2! HAND ;
|
||||
|
||||
: QUIT ( -- )
|
||||
RP0 @ RP!
|
||||
BEGIN [COMPILE] [
|
||||
BEGIN QUERY doLIT EVAL CATCH ?DUP
|
||||
UNTIL 'PROMPT @ SWAP CONSOLE NULL$ OVER XOR
|
||||
IF CR #TIB 2@ TYPE
|
||||
CR >IN @ 94 CHARS
|
||||
CR COUNT TYPE ." ? "
|
||||
THEN doLIT .OK XOR
|
||||
IF $1B EMIT THEN
|
||||
PRESET
|
||||
AGAIN ;
|
||||
|
||||
( Interpreter and Compiler )
|
||||
|
||||
: [ ( -- )
|
||||
[ ' $INTERPRET ] LITERAL
|
||||
'EVAL ! ( vector EVAL to $INTERPRET )
|
||||
; IMMEDIATE ( enter into text interpreter mode )
|
||||
|
||||
: ] ( -- )
|
||||
[ ' $COMPILE ] LITERAL
|
||||
'EVAL ! ( vector EVAL to $COMPILE )
|
||||
;
|
||||
|
||||
( Primitive Compiler Words )
|
||||
|
||||
: ' ( -- xt ) TOKEN NAME? IF EXIT THEN THROW ;
|
||||
: ALLOT ( n -- ) CP +! ;
|
||||
: , ( w -- ) HERE DUP CELL+ CP ! ! ; \ ???ALIGNED
|
||||
: [COMPILE] ( -- ; <string> ) ' , ; IMMEDIATE
|
||||
: COMPILE ( -- ) R> DUP @ , CELL+ >R ;
|
||||
: LITERAL ( w -- ) COMPILE doLIT , ; IMMEDIATE
|
||||
: $," ( -- ) 34 WORD COUNT ALIGNED CP ! ;
|
||||
: RECURSE ( -- ) LAST @ NAME> , ; IMMEDIATE
|
||||
|
||||
( Structures )
|
||||
|
||||
: <MARK ( -- a ) HERE ;
|
||||
: <RESOLVE ( a -- ) , ;
|
||||
: >MARK ( -- A ) HERE 0 , ;
|
||||
: >RESOLVE ( A -- ) <MARK SWAP ! ;
|
||||
|
||||
: FOR ( -- a ) COMPILE >R <MARK ; IMMEDIATE
|
||||
: BEGIN ( -- a ) <MARK ; IMMEDIATE
|
||||
: NEXT ( a -- ) COMPILE next <RESOLVE ; IMMEDIATE
|
||||
: UNTIL ( a -- ) COMPILE ?branch <RESOLVE ; IMMEDIATE
|
||||
: AGAIN ( a -- ) COMPILE branch <RESOLVE ; IMMEDIATE
|
||||
: IF ( -- A ) COMPILE ?branch >MARK ; IMMEDIATE
|
||||
: AHEAD ( -- A ) COMPILE branch >MARK ; IMMEDIATE
|
||||
: REPEAT ( A a -- ) [COMPILE] AGAIN >RESOLVE ; IMMEDIATE
|
||||
: THEN ( A -- ) >RESOLVE ; IMMEDIATE
|
||||
: AFT ( a -- a A ) DROP [COMPILE] AHEAD [COMPILE] BEGIN SWAP ; IMMEDIATE
|
||||
: ELSE ( A -- A ) [COMPILE] AHEAD SWAP [COMPILE] THEN ; IMMEDIATE
|
||||
: WHEN ( a A -- a A a ) [COMPILE] IF OVER ; IMMEDIATE
|
||||
: WHILE ( a -- A a ) [COMPILE] IF SWAP ; IMMEDIATE
|
||||
: ABORT" ( -- ; <string> ) COMPILE abort" $," ; IMMEDIATE
|
||||
: $" ( -- ; <string> ) COMPILE $"| $," ; IMMEDIATE
|
||||
: ." ( -- ; <string> ) COMPILE ."| $," ; IMMEDIATE
|
||||
|
||||
( Compiler )
|
||||
|
||||
: ?UNIQUE ( a -- a ) DUP NAME? IF ." reDef " OVER COUNT TYPE THEN DROP ;
|
||||
: $,n ( a -- )
|
||||
DUP C@
|
||||
IF ?UNIQUE
|
||||
( na) DUP LAST ! \ for OVERT
|
||||
( na) HERE ALIGNED SWAP
|
||||
( cp na) CELL-
|
||||
( cp la) CURRENT @ @
|
||||
( cp la na') OVER !
|
||||
( cp la) CELL- DUP NP ! ( ptr) ! EXIT
|
||||
THEN $" name" THROW ;
|
||||
.( FORTH Compiler )
|
||||
: $COMPILE ( a -- )
|
||||
NAME? ?DUP
|
||||
IF @ $80 AND
|
||||
IF EXECUTE ELSE , THEN EXIT
|
||||
THEN 'NUMBER @EXECUTE
|
||||
IF [COMPILE] LITERAL EXIT
|
||||
THEN THROW ;
|
||||
: OVERT ( -- ) LAST @ CURRENT @ ! ;
|
||||
: ; ( -- )
|
||||
COMPILE EXIT [COMPILE] [ OVERT ; IMMEDIATE
|
||||
: ] ( -- ) doLIT $COMPILE 'EVAL ! ;
|
||||
: call, ( xt -- ) \ DTC 8086 relative call
|
||||
$E890 , HERE CELL+ - , ;
|
||||
: : ( -- ; <string> ) TOKEN $,n doLIT doLIST call, ] ;
|
||||
: IMMEDIATE ( -- ) $80 LAST @ @ OR LAST @ ! ;
|
||||
|
||||
( Defining Words )
|
||||
|
||||
: USER ( n -- ; <string> )
|
||||
TOKEN $,n OVERT
|
||||
doLIT doLIST COMPILE doUSER , ;
|
||||
: CREATE ( -- ; <string> )
|
||||
TOKEN $,n OVERT
|
||||
doLIT doLIST COMPILE doVAR ;
|
||||
: VARIABLE ( -- ; <string> ) CREATE 0 , ;
|
||||
|
||||
( Memory Dump )
|
||||
|
||||
: _TYPE ( b u -- )
|
||||
FOR AFT DUP C@ >CHAR EMIT 1 + THEN NEXT DROP ;
|
||||
: dm+ ( b u -- b )
|
||||
OVER 4 U.R SPACE FOR AFT DUP C@ 3 U.R 1 + THEN NEXT ;
|
||||
: DUMP ( b u -- )
|
||||
BASE @ >R HEX 16 /
|
||||
FOR CR 16 2DUP dm+ ROT ROT 2 SPACES _TYPE NUF? NOT WHILE
|
||||
NEXT ELSE R> DROP THEN DROP R> BASE ! ;
|
||||
|
||||
( Stack Tools )
|
||||
|
||||
: .S ( -- ) CR DEPTH FOR AFT R@ PICK . THEN NEXT ." <sp" ;
|
||||
: .BASE ( -- ) BASE @ DECIMAL DUP . BASE ! ;
|
||||
: .FREE ( -- ) CP 2@ - U. ;
|
||||
: !CSP ( -- ) SP@ CSP ! ;
|
||||
: ?CSP ( -- ) SP@ CSP @ XOR ABORT" stack depth" ;
|
||||
|
||||
( Dictionary Dump )
|
||||
|
||||
: >NAME ( xt -- na | F )
|
||||
CURRENT
|
||||
BEGIN CELL+ @ ?DUP WHILE 2DUP
|
||||
BEGIN @ DUP WHILE 2DUP NAME> XOR
|
||||
WHILE CELL-
|
||||
REPEAT THEN SWAP DROP ?DUP
|
||||
UNTIL SWAP DROP SWAP DROP EXIT THEN DROP 0 ;
|
||||
: .ID ( a -- )
|
||||
?DUP IF COUNT $01F AND _TYPE EXIT THEN ." {noName}" ;
|
||||
: SEE ( -- ; <string> )
|
||||
' CR CELL+
|
||||
BEGIN CELL+ DUP @ DUP IF >NAME THEN ?DUP
|
||||
IF SPACE .ID ELSE DUP @ U. THEN NUF?
|
||||
UNTIL DROP ;
|
||||
: WORDS ( -- )
|
||||
CR CONTEXT @
|
||||
BEGIN @ ?DUP
|
||||
WHILE DUP SPACE .ID CELL- NUF?
|
||||
UNTIL DROP THEN ;
|
||||
|
||||
( Startup )
|
||||
|
||||
: VER ( -- u ) $101 ;
|
||||
: hi ( -- )
|
||||
!IO BASE @ HEX \ initialize IO device & sign on
|
||||
CR ." eFORTH V" VER <# # # 46 HOLD # #> TYPE
|
||||
CR ;
|
||||
: EMPTY ( -- )
|
||||
FORTH CONTEXT @ DUP CURRENT 2! 6 CP 3 MOVE OVERT ;
|
||||
CREATE 'BOOT ' hi , \ application vector
|
||||
: COLD ( -- )
|
||||
BEGIN
|
||||
U0 UP 74 CMOVE
|
||||
PRESET 'BOOT @EXECUTE
|
||||
FORTH CONTEXT @ DUP CURRENT 2! OVERT
|
||||
QUIT
|
||||
AGAIN ;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
VERSION=7.0.6.1
|
||||
VERSION=7.0.6.2
|
||||
REVISION=$(shell git rev-parse HEAD)
|
||||
REVSHORT=$(shell echo $(REVISION) | head -c 7)
|
||||
|
||||
@ -143,7 +143,7 @@ POSIX_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \
|
||||
posix/autoboot.fs \
|
||||
common/fini.fs
|
||||
$(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN)
|
||||
echo "ok" | cat $(POSIX_BOOT) - | $< boot $(VERSION) $(REVISION) >$@
|
||||
echo "ok" | cat $(POSIX_BOOT) - | cat | $< boot $(VERSION) $(REVISION) >$@
|
||||
|
||||
WINDOWS_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \
|
||||
common/hide_calls.fs common/ansi.fs \
|
||||
@ -152,7 +152,7 @@ WINDOWS_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \
|
||||
common/blocks.fs common/locals.fs \
|
||||
common/fini.fs
|
||||
$(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN)
|
||||
echo "ok" | cat $(WINDOWS_BOOT) - | $< boot $(VERSION) $(REVISION) >$@
|
||||
echo "ok" | cat $(WINDOWS_BOOT) - | cat | $< boot $(VERSION) $(REVISION) >$@
|
||||
|
||||
ESP32_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \
|
||||
common/tasks.fs esp32/platform.fs esp32/highlevel.fs \
|
||||
@ -164,7 +164,7 @@ ESP32_BOOT = common/boot.fs common/conditionals.fs common/vocabulary.fs \
|
||||
esp32/camera.fs esp32/camera_server.fs common/blocks.fs \
|
||||
esp32/autoboot.fs common/fini.fs
|
||||
$(GEN)/esp32_boot.h: common/source_to_string.js $(ESP32_BOOT) | $(GEN)
|
||||
echo "ok" | cat $(ESP32_BOOT) - | $< boot $(VERSION) $(REVISION) >$@
|
||||
echo "ok" | cat $(ESP32_BOOT) - | cat | $< boot $(VERSION) $(REVISION) >$@
|
||||
|
||||
$(GEN)/dump_web_opcodes: web/dump_web_opcodes.c common/opcodes.h | $(GEN)
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
17
ueforth/README.md
Normal file
17
ueforth/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# µEforth / ESP32forth
|
||||
|
||||
This EForth inspired implementation of Forth is bootstraped from a minimalist C kernel.
|
||||
|
||||
## Building from Source
|
||||
|
||||
To build:
|
||||
|
||||
```
|
||||
make
|
||||
```
|
||||
|
||||
The resulting output will have this structure:
|
||||
|
||||
* out/deploy - A copy of the eforth.appspot.com / esp32forth.appspot.com ready to deploy.
|
||||
* out/windows - A build for Windows.
|
||||
* out/linux - A build for Linux.
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
include common/testing.fs
|
||||
include common/utils.fs
|
||||
include common/base_tests.fs
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( ANSI Codes )
|
||||
vocabulary ansi ansi definitions
|
||||
: esc 27 emit ; : bel 7 emit ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Tests Base Operations )
|
||||
: test-empty-stack depth 0= assert ;
|
||||
: test-add 123 111 + 234 = assert ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Block Files )
|
||||
internals definitions
|
||||
: clobber-line ( a -- a' ) dup 63 bl fill 63 + nl over c! 1+ ;
|
||||
|
||||
@ -1,4 +1,19 @@
|
||||
: ( 41 parse drop drop ; immediate
|
||||
: \ 10 parse drop drop ; immediate
|
||||
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Useful Basic Compound Words )
|
||||
: nip ( a b -- b ) swap drop ;
|
||||
@ -26,9 +41,6 @@
|
||||
: 4* 4 * ; : 4/ 4 / ;
|
||||
: +! ( n a -- ) swap over @ + swap ! ;
|
||||
|
||||
( Line Comments )
|
||||
: \ nl parse drop drop ; immediate
|
||||
|
||||
( Cells )
|
||||
: cell+ ( n -- n ) cell + ;
|
||||
: cells ( n -- n ) cell * ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define SET tos = (cell_t)
|
||||
|
||||
#define n0 tos
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef CALLTYPE
|
||||
# define CALLTYPE
|
||||
#endif
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Interpret time conditionals )
|
||||
|
||||
: DEFINED? ( "name" -- xt|0 )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Interpret time conditionals )
|
||||
|
||||
e: test-1[if]
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define PRINT_ERRORS 0
|
||||
|
||||
#define CELL_LEN(n) (((n) + sizeof(cell_t) - 1) / sizeof(cell_t))
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Test DO LOOP Works )
|
||||
|
||||
e: test-0doloop
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
include posix/termios.fs
|
||||
|
||||
create keymap
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
: dump-file ( a n a n -- )
|
||||
w/o create-file if drop ." failed create-file" exit then
|
||||
>r r@ write-file if r> drop ." failed write-file" exit then
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
internals
|
||||
( Bring a forth to the top of the vocabulary. )
|
||||
transfer forth
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
internals definitions
|
||||
transfer{
|
||||
call0 call1 call2 call3 call4 call5 call6 call7 call8 call9 call10
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Including Files )
|
||||
: included ( a n -- )
|
||||
r/o open-file dup if nip throw else drop then
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define JMPW goto **(void **) w
|
||||
#define NEXT w = *ip++; JMPW
|
||||
#define ADDR_DOCOLON && OP_DOCOLON
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Local Variables )
|
||||
|
||||
( NOTE: These are not yet gforth compatible )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Testing Locals )
|
||||
|
||||
e: test-locals-one
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -1,14 +1,49 @@
|
||||
#! /usr/bin/env nodejs
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
function DropCopyright(source) {
|
||||
var lines = source.split('\n');
|
||||
var cleaned = [];
|
||||
for (var i = 0; i < lines.length; ++i) {
|
||||
if (lines[i] == '<!--') {
|
||||
while (lines[i] != '-->') {
|
||||
++i;
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
if (lines[i].search('Copyright') >= 0) {
|
||||
while (lines[i] != '') {
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
cleaned.push(lines[i]);
|
||||
}
|
||||
}
|
||||
return cleaned.join('\n');
|
||||
}
|
||||
|
||||
var source = fs.readFileSync(process.stdin.fd).toString();
|
||||
var replacements = [];
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var item = process.argv[i];
|
||||
var m = item.match(/^([^=]+)=@(.+)$/);
|
||||
if (m) {
|
||||
replacements.push([m[1], fs.readFileSync(m[2]).toString()]);
|
||||
var content = DropCopyright(fs.readFileSync(m[2]).toString());
|
||||
replacements.push([m[1], content]);
|
||||
continue;
|
||||
}
|
||||
var m = item.match(/^([^=]+)=(.+)$/);
|
||||
|
||||
@ -1,8 +1,36 @@
|
||||
#! /usr/bin/env nodejs
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var source = fs.readFileSync(process.stdin.fd).toString();
|
||||
function DropCopyright(source) {
|
||||
var lines = source.split('\n');
|
||||
var cleaned = [];
|
||||
for (var i = 0; i < lines.length; ++i) {
|
||||
if (lines[i].search('Copyright') >= 0) {
|
||||
while (lines[i] != '') {
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
cleaned.push(lines[i]);
|
||||
}
|
||||
}
|
||||
return cleaned.join('\n');
|
||||
}
|
||||
|
||||
var source = DropCopyright(fs.readFileSync(process.stdin.fd).toString());
|
||||
var name = process.argv[2];
|
||||
var version = process.argv[3];
|
||||
var revision = process.argv[4];
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Byte Stream / Ring Buffer )
|
||||
|
||||
vocabulary streams streams definitions
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Trying some things with tasks )
|
||||
|
||||
: printer1 42 emit 1000 ms ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Cooperative Tasks )
|
||||
|
||||
vocabulary tasks tasks definitions
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
also ansi also posix
|
||||
|
||||
( Support for eval tests )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Words built after boot )
|
||||
|
||||
( For tests and asserts )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Tests of utils.fs )
|
||||
e: test-.s0
|
||||
.s
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Implement Vocabularies )
|
||||
variable last-vocabulary
|
||||
current @ constant forth-wordlist
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
e: test-vocabularies
|
||||
vocabulary foo
|
||||
vocabulary bar
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
internals definitions
|
||||
|
||||
( Change default block source on arduino )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Migrate various words to separate vocabularies, and constants )
|
||||
|
||||
vocabulary Wire Wire definitions
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Lazy loaded Bluetooth Serial Terminal )
|
||||
|
||||
: bterm r|
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Handling for ESP32-CAM )
|
||||
DEFINED? esp_camera_init [IF]
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Camera Server )
|
||||
DEFINED? camera [IF]
|
||||
|
||||
|
||||
@ -1,15 +1,43 @@
|
||||
#! /usr/bin/env nodejs
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
function DropCopyright(source) {
|
||||
var lines = source.split('\n');
|
||||
var cleaned = [];
|
||||
for (var i = 0; i < lines.length; ++i) {
|
||||
if (lines[i].search('Copyright') >= 0) {
|
||||
while (lines[i] != '') {
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
cleaned.push(lines[i]);
|
||||
}
|
||||
}
|
||||
return cleaned.join('\n');
|
||||
}
|
||||
|
||||
var version = process.argv[2];
|
||||
var revision = process.argv[3];
|
||||
var code = fs.readFileSync(process.argv[4]).toString();
|
||||
var opcodes = fs.readFileSync(process.argv[5]).toString();
|
||||
var calling = fs.readFileSync(process.argv[6]).toString();
|
||||
var core = fs.readFileSync(process.argv[7]).toString();
|
||||
var interp = fs.readFileSync(process.argv[8]).toString();
|
||||
var boot = fs.readFileSync(process.argv[9]).toString();
|
||||
var opcodes = DropCopyright(fs.readFileSync(process.argv[5]).toString());
|
||||
var calling = DropCopyright(fs.readFileSync(process.argv[6]).toString());
|
||||
var core = DropCopyright(fs.readFileSync(process.argv[7]).toString());
|
||||
var interp = DropCopyright(fs.readFileSync(process.argv[8]).toString());
|
||||
var boot = DropCopyright(fs.readFileSync(process.argv[9]).toString());
|
||||
|
||||
code = code.replace('{{VERSION}}', function() { return version; });
|
||||
code = code.replace('{{REVISION}}', function() { return revision; });
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Words with OS assist )
|
||||
: allocate ( n -- a ior ) malloc dup 0= ;
|
||||
: free ( a -- ior ) sysfree drop 0 ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Add a yielding task so pause yields )
|
||||
internals definitions
|
||||
transfer{ yield raw-yield }transfer
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
vocabulary registers registers definitions
|
||||
|
||||
( Tools for working with bit masks )
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2021 Bradley D. Nelson
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ESP32forth v{{VERSION}}
|
||||
* Revision: {{REVISION}}
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
vocabulary timers timers definitions also registers also interrupts
|
||||
|
||||
$3ff5f000 constant TIMG_BASE
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Server Terminal )
|
||||
|
||||
also streams also WiFi also web-interface definitions
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Include first argument if any )
|
||||
internals definitions
|
||||
: autoexec
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( HTTP Daemon )
|
||||
vocabulary httpd httpd definitions also sockets
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
vocabulary posix posix definitions
|
||||
|
||||
( Shared Library Handling )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Arguments )
|
||||
internals definitions
|
||||
: 'argc ( -- a ) 'sys 9 cells + ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Words with OS assist )
|
||||
posix
|
||||
: allocate ( n -- a ior ) malloc dup 0= ;
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( pthreads )
|
||||
posix definitions also internals
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Shell like words )
|
||||
vocabulary shell shell definitions also posix
|
||||
512 constant max-path
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Sockets )
|
||||
vocabulary sockets sockets definitions also posix
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Telnet )
|
||||
|
||||
vocabulary telnetd telnetd definitions also sockets
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
also posix also termios
|
||||
s" /dev/ttyS3" r/w O_NONBLOCK or open-file throw constant remote
|
||||
256 constant ICRNL
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Terminal Handling )
|
||||
|
||||
vocabulary termios termios definitions also posix
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Server Terminal )
|
||||
|
||||
also streams also httpd
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Bindings for Xlib )
|
||||
also posix
|
||||
vocabulary x11 also x11 definitions
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
include posix/xlib.fs
|
||||
|
||||
also x11
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ESP32forth</title>
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
runtime: go115
|
||||
|
||||
default_expiration: "1m"
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Classic EForth</title>
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<h5>Null Terminated Strings</h5>
|
||||
<p>
|
||||
As null terminated strings are used throughout C interfaces,
|
||||
|
||||
@ -1,3 +1,18 @@
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<h3>Windows & Linux Calling</h3>
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>EForth</title>
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>µEforth Internals</title>
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>µEforth for Linux</title>
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<div class="menu">
|
||||
<span><a href="https://esp32forth.appspot.com/ESP32forth.html">ESP32forth</a></span>
|
||||
<span><a href="https://eforth.appspot.com/linux.html">Linux</a></span>
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<h5>Web Interface</h5>
|
||||
These words are inside the <code>web-interface</code> vocabulary.
|
||||
<pre>
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
body {
|
||||
max-width: 800px;
|
||||
margin-top: 0px;
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>µEforth for Windows</title>
|
||||
|
||||
@ -1,4 +1,17 @@
|
||||
#! /usr/bin/env python
|
||||
# Copyright 2021 Bradley D. Nelson
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -1,4 +1,17 @@
|
||||
#! /usr/bin/env nodejs
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var fs = require('fs');
|
||||
var code = fs.readFileSync(process.argv[2]).toString();
|
||||
|
||||
@ -1,4 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright 2021 Bradley D. Nelson
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script src="ueforth.js"></script>
|
||||
<script type="forth">
|
||||
needs ansi.fs
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict';
|
||||
|
||||
(function() {
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
also windows
|
||||
s" \\.\COM3" r/w open-file throw constant remote
|
||||
: remote-type ( a n -- ) remote write-file throw ;
|
||||
|
||||
@ -1 +1,15 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
IDI_MAIN_ICON ICON "out/resources/eforth.ico"
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
vocabulary windows windows definitions
|
||||
|
||||
( DLL Handling )
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Words with OS assist )
|
||||
windows
|
||||
z" GetProcessHeap" 0 Kernel32 GetProcessHeap
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define NEXT goto next
|
||||
#define JMPW goto work
|
||||
#define ADDR_DOCOLON ((void *) OP_DOCOLON)
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
// Copyright 2021 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define _USING_V110_SDK71_ 1
|
||||
#include "windows.h"
|
||||
#include <immintrin.h>
|
||||
|
||||
Reference in New Issue
Block a user