diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index 66b5931..e800275 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/circleforth/circle.fs b/circleforth/circle.fs index bf46cad..3a9fc16 100755 --- a/circleforth/circle.fs +++ b/circleforth/circle.fs @@ -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 diff --git a/circleforth/compound.fs b/circleforth/compound.fs index 56f5031..9573137 100644 --- a/circleforth/compound.fs +++ b/circleforth/compound.fs @@ -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 ; diff --git a/reference/eforth.fs b/reference/eforth.fs deleted file mode 100644 index b995dc9..0000000 --- a/reference/eforth.fs +++ /dev/null @@ -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 ; ) - 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 ; ) - >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 ; ) - BL PARSE 31 MIN NP @ OVER - CELL- PACK$ ; -: WORD ( c -- a ; ) 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] ( -- ; ) ' , ; IMMEDIATE -: COMPILE ( -- ) R> DUP @ , CELL+ >R ; -: LITERAL ( w -- ) COMPILE doLIT , ; IMMEDIATE -: $," ( -- ) 34 WORD COUNT ALIGNED CP ! ; -: RECURSE ( -- ) LAST @ NAME> , ; IMMEDIATE - -( Structures ) - -: MARK ( -- A ) HERE 0 , ; -: >RESOLVE ( A -- ) R 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" ( -- ; ) COMPILE abort" $," ; IMMEDIATE -: $" ( -- ; ) COMPILE $"| $," ; IMMEDIATE -: ." ( -- ; ) 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+ - , ; -: : ( -- ; ) TOKEN $,n doLIT doLIST call, ] ; -: IMMEDIATE ( -- ) $80 LAST @ @ OR LAST @ ! ; - -( Defining Words ) - -: USER ( n -- ; ) - TOKEN $,n OVERT - doLIT doLIST COMPILE doUSER , ; -: CREATE ( -- ; ) - TOKEN $,n OVERT - doLIT doLIST COMPILE doVAR ; -: VARIABLE ( -- ; ) 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 ." 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 ( -- ; ) - ' 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 ; - diff --git a/ueforth/Makefile b/ueforth/Makefile index e65c833..6a95980 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -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 $@ diff --git a/ueforth/README.md b/ueforth/README.md new file mode 100644 index 0000000..0a7a3d7 --- /dev/null +++ b/ueforth/README.md @@ -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. diff --git a/ueforth/common/all_tests.fs b/ueforth/common/all_tests.fs index 87c0578..d1a961f 100644 --- a/ueforth/common/all_tests.fs +++ b/ueforth/common/all_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. + include common/testing.fs include common/utils.fs include common/base_tests.fs diff --git a/ueforth/common/ansi.fs b/ueforth/common/ansi.fs index 0d99cfc..b74ed5a 100644 --- a/ueforth/common/ansi.fs +++ b/ueforth/common/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. + ( ANSI Codes ) vocabulary ansi ansi definitions : esc 27 emit ; : bel 7 emit ; diff --git a/ueforth/common/base_tests.fs b/ueforth/common/base_tests.fs index 4aff468..3e23b3f 100644 --- a/ueforth/common/base_tests.fs +++ b/ueforth/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. + ( Tests Base Operations ) : test-empty-stack depth 0= assert ; : test-add 123 111 + 234 = assert ; diff --git a/ueforth/common/blocks.fs b/ueforth/common/blocks.fs index 83ac57c..32edb5c 100644 --- a/ueforth/common/blocks.fs +++ b/ueforth/common/blocks.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. + ( Block Files ) internals definitions : clobber-line ( a -- a' ) dup 63 bl fill 63 + nl over c! 1+ ; diff --git a/ueforth/common/boot.fs b/ueforth/common/boot.fs index 22c86bc..32eaca9 100644 --- a/ueforth/common/boot.fs +++ b/ueforth/common/boot.fs @@ -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 * ; diff --git a/ueforth/common/calling.h b/ueforth/common/calling.h index 2b2597b..1b0c530 100644 --- a/ueforth/common/calling.h +++ b/ueforth/common/calling.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. + #define SET tos = (cell_t) #define n0 tos diff --git a/ueforth/common/calls.h b/ueforth/common/calls.h index 7bf31ed..f974b75 100644 --- a/ueforth/common/calls.h +++ b/ueforth/common/calls.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. + #ifndef CALLTYPE # define CALLTYPE #endif diff --git a/ueforth/common/conditionals.fs b/ueforth/common/conditionals.fs index 72dff5f..f876235 100644 --- a/ueforth/common/conditionals.fs +++ b/ueforth/common/conditionals.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. + ( Interpret time conditionals ) : DEFINED? ( "name" -- xt|0 ) diff --git a/ueforth/common/conditionals_tests.fs b/ueforth/common/conditionals_tests.fs index 405411d..6a212a7 100644 --- a/ueforth/common/conditionals_tests.fs +++ b/ueforth/common/conditionals_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. + ( Interpret time conditionals ) e: test-1[if] diff --git a/ueforth/common/core.h b/ueforth/common/core.h index 07767f3..e301355 100644 --- a/ueforth/common/core.h +++ b/ueforth/common/core.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. + #define PRINT_ERRORS 0 #define CELL_LEN(n) (((n) + sizeof(cell_t) - 1) / sizeof(cell_t)) diff --git a/ueforth/common/doloop_tests.fs b/ueforth/common/doloop_tests.fs index e3b75b7..02a6f35 100644 --- a/ueforth/common/doloop_tests.fs +++ b/ueforth/common/doloop_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. + ( Test DO LOOP Works ) e: test-0doloop diff --git a/ueforth/common/editor.fs b/ueforth/common/editor.fs index 5607ff3..6b49c29 100644 --- a/ueforth/common/editor.fs +++ b/ueforth/common/editor.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. + include posix/termios.fs create keymap diff --git a/ueforth/common/filetools.fs b/ueforth/common/filetools.fs index 40017b5..70d80cd 100644 --- a/ueforth/common/filetools.fs +++ b/ueforth/common/filetools.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. + : 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 diff --git a/ueforth/common/fini.fs b/ueforth/common/fini.fs index c86e62e..19b67da 100644 --- a/ueforth/common/fini.fs +++ b/ueforth/common/fini.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. + internals ( Bring a forth to the top of the vocabulary. ) transfer forth diff --git a/ueforth/common/hide_calls.fs b/ueforth/common/hide_calls.fs index 1fcdbf8..f397abe 100644 --- a/ueforth/common/hide_calls.fs +++ b/ueforth/common/hide_calls.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. + internals definitions transfer{ call0 call1 call2 call3 call4 call5 call6 call7 call8 call9 call10 diff --git a/ueforth/common/highlevel.fs b/ueforth/common/highlevel.fs index 35d32ca..cbb4396 100644 --- a/ueforth/common/highlevel.fs +++ b/ueforth/common/highlevel.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. + ( Including Files ) : included ( a n -- ) r/o open-file dup if nip throw else drop then diff --git a/ueforth/common/interp.h b/ueforth/common/interp.h index 63af230..99ee20f 100644 --- a/ueforth/common/interp.h +++ b/ueforth/common/interp.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. + #define JMPW goto **(void **) w #define NEXT w = *ip++; JMPW #define ADDR_DOCOLON && OP_DOCOLON diff --git a/ueforth/common/locals.fs b/ueforth/common/locals.fs index 6106603..1e9a6e7 100644 --- a/ueforth/common/locals.fs +++ b/ueforth/common/locals.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. + ( Local Variables ) ( NOTE: These are not yet gforth compatible ) diff --git a/ueforth/common/locals_tests.fs b/ueforth/common/locals_tests.fs index d67427b..da95b2b 100644 --- a/ueforth/common/locals_tests.fs +++ b/ueforth/common/locals_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. + ( Testing Locals ) e: test-locals-one diff --git a/ueforth/common/opcodes.h b/ueforth/common/opcodes.h index 2ac7f73..9fc9a4e 100644 --- a/ueforth/common/opcodes.h +++ b/ueforth/common/opcodes.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. + #include #include #include diff --git a/ueforth/common/replace.js b/ueforth/common/replace.js index 403fbf7..61c9cbe 100644 --- a/ueforth/common/replace.js +++ b/ueforth/common/replace.js @@ -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] == '') { + ++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(/^([^=]+)=(.+)$/); diff --git a/ueforth/common/source_to_string.js b/ueforth/common/source_to_string.js index 4d2e5f6..5bbdbd3 100755 --- a/ueforth/common/source_to_string.js +++ b/ueforth/common/source_to_string.js @@ -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]; diff --git a/ueforth/common/streams.fs b/ueforth/common/streams.fs index 9107643..ed5f1f5 100644 --- a/ueforth/common/streams.fs +++ b/ueforth/common/streams.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. + ( Byte Stream / Ring Buffer ) vocabulary streams streams definitions diff --git a/ueforth/common/tasking_tester.fs b/ueforth/common/tasking_tester.fs index 10490d1..974d0a0 100644 --- a/ueforth/common/tasking_tester.fs +++ b/ueforth/common/tasking_tester.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. + ( Trying some things with tasks ) : printer1 42 emit 1000 ms ; diff --git a/ueforth/common/tasks.fs b/ueforth/common/tasks.fs index 8bb0191..35c88fd 100644 --- a/ueforth/common/tasks.fs +++ b/ueforth/common/tasks.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. + ( Cooperative Tasks ) vocabulary tasks tasks definitions diff --git a/ueforth/common/testing.fs b/ueforth/common/testing.fs index d4a2f88..82b1a18 100644 --- a/ueforth/common/testing.fs +++ b/ueforth/common/testing.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. + also ansi also posix ( Support for eval tests ) diff --git a/ueforth/common/utils.fs b/ueforth/common/utils.fs index 66b19f2..330bdc5 100644 --- a/ueforth/common/utils.fs +++ b/ueforth/common/utils.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. + ( Words built after boot ) ( For tests and asserts ) diff --git a/ueforth/common/utils_tests.fs b/ueforth/common/utils_tests.fs index f1dbb2c..a769f94 100644 --- a/ueforth/common/utils_tests.fs +++ b/ueforth/common/utils_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. + ( Tests of utils.fs ) e: test-.s0 .s diff --git a/ueforth/common/vocabulary.fs b/ueforth/common/vocabulary.fs index 7638022..67373c5 100644 --- a/ueforth/common/vocabulary.fs +++ b/ueforth/common/vocabulary.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. + ( Implement Vocabularies ) variable last-vocabulary current @ constant forth-wordlist diff --git a/ueforth/common/vocabulary_tests.fs b/ueforth/common/vocabulary_tests.fs index 6206326..7150d83 100644 --- a/ueforth/common/vocabulary_tests.fs +++ b/ueforth/common/vocabulary_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. + e: test-vocabularies vocabulary foo vocabulary bar diff --git a/ueforth/esp32/autoboot.fs b/ueforth/esp32/autoboot.fs index 9d587cc..179c56c 100644 --- a/ueforth/esp32/autoboot.fs +++ b/ueforth/esp32/autoboot.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. + internals definitions ( Change default block source on arduino ) diff --git a/ueforth/esp32/bindings.fs b/ueforth/esp32/bindings.fs index 1ab0140..1621930 100644 --- a/ueforth/esp32/bindings.fs +++ b/ueforth/esp32/bindings.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. + ( Migrate various words to separate vocabularies, and constants ) vocabulary Wire Wire definitions diff --git a/ueforth/esp32/bterm.fs b/ueforth/esp32/bterm.fs index 57a90b5..a8d7dea 100644 --- a/ueforth/esp32/bterm.fs +++ b/ueforth/esp32/bterm.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. + ( Lazy loaded Bluetooth Serial Terminal ) : bterm r| diff --git a/ueforth/esp32/camera.fs b/ueforth/esp32/camera.fs index 70d2b07..4852f2d 100644 --- a/ueforth/esp32/camera.fs +++ b/ueforth/esp32/camera.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. + ( Handling for ESP32-CAM ) DEFINED? esp_camera_init [IF] diff --git a/ueforth/esp32/camera_server.fs b/ueforth/esp32/camera_server.fs index c188d7f..9e98037 100644 --- a/ueforth/esp32/camera_server.fs +++ b/ueforth/esp32/camera_server.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. + ( Camera Server ) DEFINED? camera [IF] diff --git a/ueforth/esp32/fuse_ino.js b/ueforth/esp32/fuse_ino.js index 93583db..f07756c 100755 --- a/ueforth/esp32/fuse_ino.js +++ b/ueforth/esp32/fuse_ino.js @@ -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; }); diff --git a/ueforth/esp32/highlevel.fs b/ueforth/esp32/highlevel.fs index a47de85..09079dd 100644 --- a/ueforth/esp32/highlevel.fs +++ b/ueforth/esp32/highlevel.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. + ( Words with OS assist ) : allocate ( n -- a ior ) malloc dup 0= ; : free ( a -- ior ) sysfree drop 0 ; diff --git a/ueforth/esp32/platform.fs b/ueforth/esp32/platform.fs index 9c2551a..02f526c 100644 --- a/ueforth/esp32/platform.fs +++ b/ueforth/esp32/platform.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. + ( Add a yielding task so pause yields ) internals definitions transfer{ yield raw-yield }transfer diff --git a/ueforth/esp32/registers.fs b/ueforth/esp32/registers.fs index cc6a187..6c7f1cd 100644 --- a/ueforth/esp32/registers.fs +++ b/ueforth/esp32/registers.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. + vocabulary registers registers definitions ( Tools for working with bit masks ) diff --git a/ueforth/esp32/template.ino b/ueforth/esp32/template.ino index e4326b0..4b77596 100644 --- a/ueforth/esp32/template.ino +++ b/ueforth/esp32/template.ino @@ -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}} diff --git a/ueforth/esp32/timers.fs b/ueforth/esp32/timers.fs index fc98139..c386ab6 100644 --- a/ueforth/esp32/timers.fs +++ b/ueforth/esp32/timers.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. + vocabulary timers timers definitions also registers also interrupts $3ff5f000 constant TIMG_BASE diff --git a/ueforth/esp32/web_interface.fs b/ueforth/esp32/web_interface.fs index 47ad8b0..0f8725a 100644 --- a/ueforth/esp32/web_interface.fs +++ b/ueforth/esp32/web_interface.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. + ( Server Terminal ) also streams also WiFi also web-interface definitions diff --git a/ueforth/posix/autoboot.fs b/ueforth/posix/autoboot.fs index 558930b..723f51b 100644 --- a/ueforth/posix/autoboot.fs +++ b/ueforth/posix/autoboot.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. + ( Include first argument if any ) internals definitions : autoexec diff --git a/ueforth/posix/httpd.fs b/ueforth/posix/httpd.fs index 9d9d0c5..fad3359 100644 --- a/ueforth/posix/httpd.fs +++ b/ueforth/posix/httpd.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. + ( HTTP Daemon ) vocabulary httpd httpd definitions also sockets diff --git a/ueforth/posix/posix.fs b/ueforth/posix/posix.fs index b8991ac..706a703 100644 --- a/ueforth/posix/posix.fs +++ b/ueforth/posix/posix.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. + vocabulary posix posix definitions ( Shared Library Handling ) diff --git a/ueforth/posix/posix_desktop.fs b/ueforth/posix/posix_desktop.fs index 8708cd8..9b8ac6b 100644 --- a/ueforth/posix/posix_desktop.fs +++ b/ueforth/posix/posix_desktop.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. + ( Arguments ) internals definitions : 'argc ( -- a ) 'sys 9 cells + ; diff --git a/ueforth/posix/posix_highlevel.fs b/ueforth/posix/posix_highlevel.fs index fc3d6dc..eba379b 100644 --- a/ueforth/posix/posix_highlevel.fs +++ b/ueforth/posix/posix_highlevel.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. + ( Words with OS assist ) posix : allocate ( n -- a ior ) malloc dup 0= ; diff --git a/ueforth/posix/posix_main.c b/ueforth/posix/posix_main.c index a7fdaf2..7740597 100644 --- a/ueforth/posix/posix_main.c +++ b/ueforth/posix/posix_main.c @@ -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 #include diff --git a/ueforth/posix/pthreads.fs b/ueforth/posix/pthreads.fs index b5a33c4..c7d1a09 100644 --- a/ueforth/posix/pthreads.fs +++ b/ueforth/posix/pthreads.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. + ( pthreads ) posix definitions also internals diff --git a/ueforth/posix/shell.fs b/ueforth/posix/shell.fs index 700469d..aef6399 100644 --- a/ueforth/posix/shell.fs +++ b/ueforth/posix/shell.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. + ( Shell like words ) vocabulary shell shell definitions also posix 512 constant max-path diff --git a/ueforth/posix/sockets.fs b/ueforth/posix/sockets.fs index 062f324..4b2619e 100644 --- a/ueforth/posix/sockets.fs +++ b/ueforth/posix/sockets.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. + ( Sockets ) vocabulary sockets sockets definitions also posix diff --git a/ueforth/posix/telnetd.fs b/ueforth/posix/telnetd.fs index 2fd9ca8..e69cf00 100644 --- a/ueforth/posix/telnetd.fs +++ b/ueforth/posix/telnetd.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. + ( Telnet ) vocabulary telnetd telnetd definitions also sockets diff --git a/ueforth/posix/terminal.fs b/ueforth/posix/terminal.fs index 320a312..e8607bb 100644 --- a/ueforth/posix/terminal.fs +++ b/ueforth/posix/terminal.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. + also posix also termios s" /dev/ttyS3" r/w O_NONBLOCK or open-file throw constant remote 256 constant ICRNL diff --git a/ueforth/posix/termios.fs b/ueforth/posix/termios.fs index 6a0b1e6..5376a77 100644 --- a/ueforth/posix/termios.fs +++ b/ueforth/posix/termios.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. + ( Terminal Handling ) vocabulary termios termios definitions also posix diff --git a/ueforth/posix/web_interface.fs b/ueforth/posix/web_interface.fs index 5973372..b5f4574 100644 --- a/ueforth/posix/web_interface.fs +++ b/ueforth/posix/web_interface.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. + ( Server Terminal ) also streams also httpd diff --git a/ueforth/posix/xlib.fs b/ueforth/posix/xlib.fs index e4f50fb..5d53b1c 100644 --- a/ueforth/posix/xlib.fs +++ b/ueforth/posix/xlib.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. + ( Bindings for Xlib ) also posix vocabulary x11 also x11 definitions diff --git a/ueforth/posix/xlib_test.fs b/ueforth/posix/xlib_test.fs index cd0c32a..86f6368 100644 --- a/ueforth/posix/xlib_test.fs +++ b/ueforth/posix/xlib_test.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. + include posix/xlib.fs also x11 diff --git a/ueforth/site/ESP32forth.html b/ueforth/site/ESP32forth.html index 275e327..d22a48b 100644 --- a/ueforth/site/ESP32forth.html +++ b/ueforth/site/ESP32forth.html @@ -1,4 +1,20 @@ + + ESP32forth diff --git a/ueforth/site/app.yaml b/ueforth/site/app.yaml index afed362..c11c661 100644 --- a/ueforth/site/app.yaml +++ b/ueforth/site/app.yaml @@ -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" diff --git a/ueforth/site/classic.html b/ueforth/site/classic.html index dae946f..67fc799 100644 --- a/ueforth/site/classic.html +++ b/ueforth/site/classic.html @@ -1,4 +1,20 @@ + + Classic EForth diff --git a/ueforth/site/common.html b/ueforth/site/common.html index 5db3a3c..9e51e2d 100644 --- a/ueforth/site/common.html +++ b/ueforth/site/common.html @@ -1,3 +1,19 @@ + +
Null Terminated Strings

As null terminated strings are used throughout C interfaces, diff --git a/ueforth/site/desktop_common.html b/ueforth/site/desktop_common.html index 62b9149..e5e39aa 100644 --- a/ueforth/site/desktop_common.html +++ b/ueforth/site/desktop_common.html @@ -1,3 +1,18 @@ +

Windows & Linux Calling

diff --git a/ueforth/site/eforth.go b/ueforth/site/eforth.go index b82e53d..57edd10 100644 --- a/ueforth/site/eforth.go +++ b/ueforth/site/eforth.go @@ -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 ( diff --git a/ueforth/site/index.html b/ueforth/site/index.html index 5349e98..8289c19 100644 --- a/ueforth/site/index.html +++ b/ueforth/site/index.html @@ -1,4 +1,20 @@ + + EForth diff --git a/ueforth/site/internals.html b/ueforth/site/internals.html index 8b807e9..c0e7444 100644 --- a/ueforth/site/internals.html +++ b/ueforth/site/internals.html @@ -1,4 +1,20 @@ + + µEforth Internals diff --git a/ueforth/site/linux.html b/ueforth/site/linux.html index 2111811..1c3e937 100644 --- a/ueforth/site/linux.html +++ b/ueforth/site/linux.html @@ -1,4 +1,20 @@ + + µEforth for Linux diff --git a/ueforth/site/menu.html b/ueforth/site/menu.html index f900b42..1f8ffb1 100644 --- a/ueforth/site/menu.html +++ b/ueforth/site/menu.html @@ -1,3 +1,19 @@ + +