![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

I am working on a problem which manipulates several VERY long strings
-- typically 1K to 10K with a weird case that may approach 300K.
It logical to consider a contiguous portion of the string either as a
single string or as a concatenation of random length records ( the
offset of each record is known/knowable). A combination of factors makes
it convenient to describe strings with a "start address", "end address +
1" instead of the typical address, count format.
I'm experimenting with a structure created with the following code
fragment:
0 VALUE my_pointer
' my_pointer >BODY
10000 1 CELLS + /ALLOT
DUP CONSTANT my_strange_pointer
1 CELLS + CONSTANT my_buffer
my_buffer TO my_pointer
This allows me to use "my_pointer" | "TO my_pointer" to conveniently
access the next available memory location.
It also allows me to place only one parameter ( my_buffer ) on the stack
prior to executing a word which needs to manipulate both my_pointer and
my_buffer.
That is
1234 TO my_pointer would be equivalent to 1234 my_buffer 1
CELLS - !
or
my_pointer would be equivalent to my_strange_pointer
@
The format would depend on which is easier to read. ( A subjective
judgment as compiled code size and execution speed are irrelevant. )
Am I missing any "gotcha's" ?
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Thu Jan 10 2002 - 12:45:43 PST
This archive was generated by hypermail 2.2.0 : Sat Nov 22 2008 - 03:04:20 PST