The idea that BASE would be checked for bad radixes during compilation
never occurred to me. I see some of my colleagues thought that was
unnecessarily hindering, others thought it might be ok. I am neutral
on the subject, except to note that Win32Forth and GForth don't have
a problem with using BASE as a temp.
Gary felt I should define a VARIABLE or VALUE to hold the address
of the hidden storage, then change the contents of that item to
protect the hidden storage. And of course that is what I usually have
done.
The reason I beat on this question (to excess) was that I think it
points to a lacuna in the Standard, namely that systems ought to
supply a place to put things, that is neither protected nor accessed
by colon-sys. Probably many will disagree--it wouldn't be Forth
otherwise!
Thanks for all the help and useful suggestions.
--
Julian V. Noble
j...@virginia.edu
"Elegance is for tailors!" -- Ludwig Boltzmann
JVN> The reason I beat on this question (to excess) was that I think it
JVN> points to a lacuna in the Standard, namely that systems ought to
JVN> supply a place to put things, that is neither protected nor
JVN> accessed by colon-sys. Probably many will disagree--it wouldn't be
JVN> Forth otherwise!
The OTA environment introduces a nice idea to manage a general purpose
buffer:
CEXTEND ( n -- a)
Allocate n bytes in the buffer and return start address of allocation.
EXTEND ( n -- a)
Align the buffer and do CEXTEND for n cells.
RELEASE ( a --)
Free buffer back to address.
Error handling to be done via throws by the buffer server. OTA has been
presented to the Forth community at the '97 Rochester Forth Conference.
These came to OTA from the SENDIT project, and they were
taken by Bob Gautier from the facilities available on most C/Unix
systems. As a cheap memory allocation system, it works very well,
is completely deterministic, and is very simple to implement.
--
Stephen Pelc, s...@mpeltd.demon.co.uk
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)2380 631441, fax: +44 (0)2380 339691
web: http://www.mpeltd.demon.co.uk
[snip]
> The reason I beat on this question (to excess) was that I think it
> points to a lacuna in the Standard, namely that systems ought to
> supply a place to put things, that is neither protected nor accessed
> by colon-sys. Probably many will disagree--it wouldn't be Forth
> otherwise!
Would this meet your needs?
some_high_address CONSTANT AP0
VARIABLE AP
: ALLOC0 ( -- ) AP0 AP ! ; \ Initialize allocation area
: FREE ( n -- ) AP +! ;
: ALLOC ( n -- a ) AP -! AP @ ;
: #ALLOC ( -- n ) AP0 AP @ - ;
Allocation grows downward from AP0
Cheers,
Mark W. Humphries
Forth Chat Room on ICQ #37160535
Sent via Deja.com http://www.deja.com/
Before you buy.