embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Making HCELL With -?

From: Elizabeth D. Rather <erather_at_forth.com>
Date: Wed, 21 Mar 2001 15:51:38 -0800

Try to imagine yourself porting this code to a 64-bit target in a couple of
years. Would the value change? If so, be sure it's totally independent
of your host. Suppose we come out with a version of SwiftX hosted on a Sun
workstation (SPARC, 64 bits), but your target is the unchanged. Would the
value change? If so, it should be host-only; if not, interpreter/target only.

Using CONSTANTs or EQUs to avoid literals sprinkled around in code is good
practice, but it can be disastrous to ignore dependencies, and just as bad
to create inappropriate ones.

Cheers,
Elizabeth

At 05:22 PM 3/21/01 -0600, you wrote:

>I must have been the confused one. I'm just using W2K (CELL= 4) and the
>ColdFire (CELL = 4). I see your point about the danger
>(trouble) of defining half a target cell per the host's cell. Thank you
>for setting me straight on that issue. However, my
>question about the best way to define something in only one place still
>holds for a machine-independent factor, like DOZEN. Now,
>if I need a bakers dozen, 13, I just have to change one number in one
>place rather than several as in the other examples.
>
>HOST
>12 CONSTANT DOZEN
>DOZEN EQU DOZEN
>: DOZENS ( n1 -- n2 ) DOZEN * ;
>INTERPRETER
>: DOZENS ( n1 -- n2 ) DOZEN * ;
>TARGET
>: DOZENS ( n1 -- n2 ) DOZEN * ;
>
>As far as making HOST definitions in SwiftX, we do. We use it some during
>compile for scripting. We also have a HOST program that
>tests the TARGET memory using C!(B) and C@(B). It obviously isn't for the
>end product, but definitely helpful in development.
>
>-----Original Message-----
>From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
>Of Elizabeth D. Rather
>Sent: Wednesday, March 21, 2001 4:52 PM
>To: swiftx_at_forth.com
>Subject: [swiftx] Re: Making HCELL With -?
>
>
>
>Confused. What computer are you programming? Host's cell size and
>target's aren't necessarily the same, nor do they have anything to do with
>each other. In what circumstance do you care at all about the host's cell
>size? I don't understand why you're making any HOST definitions here at
>all. Depending on how you're using this, you may need only INTERPRETER,
>possibly TARGET as well, but probably not HOST. That's only causing
>trouble. One rarely needs to make HOST definitions in SwiftX.
>
>Cheers,
>Elizabeth
>
>At 03:58 PM 3/21/01 -0600, you wrote:
>
> >Would code excerp (3) be the best solution to prevent possible bugs from
> >duplicating the same definition two places, or does
> >somebody else have a better idea?
> >
> >(1) HOST's HCELLS is vulnerable since EQU HCELL is not available in HOST:
> >--------------------------------
> >HOST
> >CELL 2/ EQU HCELL \ NOTE: Change HOST HCELLS as well.
> >: HCELLS ( n1 -- n2 ) CELL 2/ * ;
> >INTERPRETER
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >TARGET
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >
> >
> >(2) TARGET's HCELLS is vulnerable since CONSTANT HCELL is not available in
> >TARGET:
> >--------------------------------
> >HOST
> >CELL 2/ CONSTANT HCELL \ NOTE: Change TARGET HCELLS as well.
> >HOST
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >INTERPRETER
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >TARGET
> >: HCELLS ( n1 -- n2 ) CELL 2/ * ;
> >
> >(3)
> >--------------------------------
> >HOST
> >CELL 2/ CONSTANT HCELL
> >HCELL EQU HCELL
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >INTERPRETER
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >TARGET
> >: HCELLS ( n1 -- n2 ) HCELL * ;
> >
> >-----Original Message-----
> >From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> >Of Elizabeth D. Rather
> >Sent: Wednesday, March 21, 2001 3:25 PM
> >To: swiftx_at_forth.com; swiftx_at_forth.com
> >Subject: [swiftx] Re: Making HCELL With -?
> >
> >Because the purpose of EQU is to make a definition that will be used in
> >constructing target definitions. Therefore, a word defined by EQU isn't
> >available in the HOST scope, only in INTERPRETER, COMPILER, TARGET, and
> >ASSEMBLER.
> >
> >Cheers,
> >Elizabeth
> >
> >At 03:11 PM 3/21/01 -0600, Dennis W. Bulgrien wrote:
> >
> > >Does somebody mind teaching me why the following gives me HCELL ?
> > >
> > >SwiftX ColdFire 2.51.3
> > >HOST ok
> > >CELL 2/ EQU HCELL ok
> > >: HCELLS HCELL * ; HCELL ?
> >
> >----------------------------------------------------------------------
> >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
>Hawthorne, 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!
>
>----------------------------------------------------------------------
>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
Hawthorne, 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 - 15:55:00 PST

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST