programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: An "alias" for a location defined by VALUE

From: Mike Ghan <mikeghan_at_logix-controls.com>
Date: Fri, 11 Jan 2002 09:26:57 -0800

> It would not allow me to pass only one item on the stack to a
routine
> which needed to manipulate the data in CELL 0 and the string
beginning
> at CELL 1 .

Richard, perhaps what you're looking for is a "Cell-Counted" string
where the first cell of a string is the count followed by the string
itself. I just posted a Cell-Counted string toolset to the FAQ at:

http://www.forth.com/cgi-bin/swiftforth?file=155

An example

CREATE MY_STRING 10000 CELL+ /ALLOT

S" Now is the time " MY_STRING L$-PLACE

CR MY_STRING L$-COUNT TYPE

: ADD-MORE-TEXT L" to come to the aid" L$-COUNT MY_STRING L$-APPEND ;

ADD-MORE-TEXT
CR MY_STRING L$-COUNT TYPE

-------------------------------------------------------

> Would ' my_pointer >BODY ... VALUE be any better?

The issue is using an address determined at *compile* time vs.
runtime. This is considered a bad practice in SwiftForth. If the
code is used in a DLL it will reference the wrong address. This is
why I included the code

:ONSYSLOAD my_buffer TO my_pointer ;

to initialize my_pointer to the buffer *address* when the program
starts.

Best Regards,
Mike

----------------------------------------------------------------------
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 Fri Jan 11 2002 - 09:28:42 PST

This archive was generated by hypermail 2.2.0 : Sat Nov 22 2008 - 03:04:21 PST