Shop OBEX P1 Docs P2 Docs Learn Events
P2 Taqoz V2.8: Include for SD-files — Parallax Forums

P2 Taqoz V2.8: Include for SD-files

like so many things in Forth here is a solution so simple, that it might be too trivial to post. But perhaps it might come handy?

The parent-file contains

The child must end with
to go back to the parent.

(Tested with version _BOOT_P2.BIX in in
forth/files/TAQOZ/binaries/ . )
Have Fun! Christof

long incDepth   incDepth ~

pre include \ <filename>
   incDepth ++
   filesect @ >L
   _fread @ >L
   [C] FOPEN

: endInclude \ resume to the including file
   incDepth @ 0exit
   incDepth --
   L> _fread !
   L> filesect !
   get$ drop \ drop the file name

include test2.fth

." Welcome back from test1.fth"

\ test2.fth
." Hello from test2!"




  • I like trivial Christof , whenever you have these thoughts put it out there I will sit and read all you have to tell, ty.

Sign In or Register to comment.