Dynamic Memory Allocation in a Turnkeyed App

From: Bob Nash <BNash_at_smud.org>
Date: Wed, 19 Jan 2000 11:10:56 -0800

I am trying to allocate a buffer in a turnkeyed application at run time.
Static allocation works fine, but adds to the size of the .EXE (of course).
Can anyone tell me why the following doesn't work (it is based on BuffIO.f)?
Please ignore the lack of CATCH/THROW error handling :-) I assume that I
need to use ADDR or something, but all experiments in that direction have
failed.

32768 constant #tbuf

variable 'tbuf

: //tbuf ( -) #tbuf allocate drop 'tbuf ! ;
: tbuf// ( -) 'tbuf @ free drop 0 'tbuf ! ;

:onenvload //tbuf ; \ why not :onsysload ? What is the
difference?
: onenvexit tbuf// ;

: tbuf ( - adr) 'tbuf @ ;

: /tbuf ( -) tbuf #tbuf erase ;
----------------------------------------------------------------------------
---------------------------------------
Robert Nash Bnash_at_SMUD.org <mailto:Bnash_at_SMUD.org> Tel: 916.732.5150
FAX: 916.732.6846

.
Received on Wed Jan 19 2000 - 11:10:56 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.