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

At 01:23 PM 3/21/01 -0600, Dennis W. Bulgrien wrote:
> >From what's left over, "CELL CONSTANT CELL", what is the left CELL, an
> EQU (either 2 or 4)?
>
>If so, then will doing "CELL 2 / CONSTANT HCELL" access the EQU CELL or
>the CONSTANT CELL (as if it matters)?
The purpose of CELL CONSTANT CELL is to re-define CELL in a different
scope. The first CELL is executed, like all Forth words encountered
interpretively. It returns a value, which may have been defined as a
CONSTANT or an EQU.
The purpose of defining CELL is to make accessing a cell portable, that is,
if you want to know your cell size regardless of implementation (16-bit
systems have CELL=2, 32-bit systems return 4, 64-bit systems such as the
SPARC return 8). How you define HCELL depends on what kind and level of
portability you want to achieve. The definition CELL 2/ will always
compute half a cell, which may be 1, 2, or 4 in the above cases. If you
want it to always return 2, you should define 2 CONSTANT HCELL or 2 EQU
HCELL, rather than create a dependency on CELL being 4.
As to whether you use CONSTANT or EQU, the difference is that CONSTANT
(assuming you're in TARGET scope) will define a data object in the target
and references to it will execute it. An EQU's definition exists only on
the host; references in TARGET definitions compile it as a literal.
Cheers,
Elizabeth
>-----Original Message-----
>From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
>Of Rick VanNorman
>Sent: Wednesday, March 21, 2001 11:09 AM
>To: swiftx_at_forth.com
>Subject: [swiftx] Re: Making HCELL With -?
>
><snip>
>-? is an over-ride for the non-unique test.
><snip>
>
>On 3/21/2001 at 10:56 AM Dennis W. Bulgrien wrote:
>
><snip>
> >systems, instead of just 2 EQU HCELL. I looked up CELL in
> >core.f and found:
> > -? CELL CONSTANT CELL
><snip>
>----------------------------------------------------------------------
>swiftx_at_forth.com The SwiftX programming discussion email list
>To unsubscribe, send subject "unsubscribe swiftx" 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/swiftx -- check them out!
================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310-491-3356
5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454
Los Angeles, CA 90250
http://www.forth.com
"Forth-based products and Services for real-time
applications since 1973."
================================================
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" 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/swiftx -- check them out!
Received on Wed Mar 21 2001 - 12:09:49 PST
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:22 PST