X-Git-Url: http://git.subgeniuskitty.com/pforth/.git/blobdiff_plain/e0d21c12cf924ad826eb0e73a10c5167f0195f65..5a30561336c83c45b348c1dc59fb9dc4dd15237c:/fth/require.fth diff --git a/fth/require.fth b/fth/require.fth new file mode 100644 index 0000000..c18d8c4 --- /dev/null +++ b/fth/require.fth @@ -0,0 +1,35 @@ +\ REQUIRE and REQUIRED +\ +\ This code is part of pForth. +\ +\ The pForth software code is dedicated to the public domain, +\ and any third party may reproduce, distribute and modify +\ the pForth software code or any derivative works thereof +\ without any compensation or license. The pForth software +\ code is provided on an "as is" basis without any warranty +\ of any kind, including, without limitation, the implied +\ warranties of merchantability and fitness for a particular +\ purpose and their equivalents under the laws of any jurisdiction. + +private{ + +\ Has the file with name C-ADDR/U already been included? +\ +\ This searches the "::::" marker created by INCLUDED. This +\ works for now, but may break if pForth ever receives wordlists. +: INCLUDED? ( c-addr u -- flag ) + s" ::::" here place ( c-addr u ) + here $append ( ) + here latest findnfa.from ( x found? ) + nip +; + +\ FIXME: use real PARSE-NAME when available +: (PARSE-NAME) ( "word" -- c-addr u ) bl parse-word ; + +}private + +: REQUIRED ( i*x c-addr u -- j*x ) 2dup included? IF 2drop ELSE included THEN ; +: REQUIRE ( i*x "name" -- i*x ) (parse-name) required ; + +privatize