Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #27979

Re: quick review of <BUILDS and CREATE history

From "Rod Pemberton" <dont_use_email@xnohavenotit.cnm>
Newsgroups comp.lang.forth
Subject Re: quick review of <BUILDS and CREATE history
Date 2014-01-20 16:14 -0500
Organization Aioe.org NNTP Server
Message-ID <op.w9z7x2uk5zc71u@localhost> (permalink)
References (2 earlier) <QfadnSaNy6ZL7kHPnZ2dnUVZ_sidnZ2d@supernews.com> <op.w9yu1gm65zc71u@localhost> <samdnZ0iro4aAkHPnZ2dnUVZ_t2dnZ2d@supernews.com> <op.w9yz3nnj5zc71u@localhost> <KbednR9Be4m-VUHPnZ2dnUVZ_rOdnZ2d@supernews.com>

Show all headers | View raw


On Mon, 20 Jan 2014 01:54:25 -0500, Elizabeth D Rather <erather@forth.com>  
wrote:

> On 1/19/2014 7:27 PM, Rod Pemberton wrote:

> I'm baffled. CREATE makes a header; :NONAME doesn't. CREATE
> doesn't turn on the compiler. :NONAME does. These differences
> are critical, not trivial.
>

Based on your post and Mark's, I think my :NONAME is functioning
like :NONAME combined with HEADER.

>>> It sounds as though you have a very
>>> mistaken notion of what :NONAME does.
>>
>> AIUI, :NONAME is the same as : except it doesn't install
>> a name into the dictionary header of the word being defined
>> and it returns an xt.  It's definition is terminated by
>> a ; just like a : definition.  It compiles a definition
>> just like a : definition.
>>
>> In most Forths, : calls CREATE to build the header
>> and insert the name the word being defined.  After
>> CREATE is finished, the colon definition continues
>> compiling until ; .
>
> In most Forths that I'm familiar with, : calls a lower-level word to
> build the header and insert the name. CREATE also calls that. However,
> CREATE does *not* "continue compiling", instead it sets the default
> action of the word just created to DODOES or equivalent with an
> associated data location. : has no associated data location. In other
> words, the only thing both : and CREATE share is a call to the
> lower-level word to make the header.
>

Let me break down what I'm doing currently.
It's been a while since I've read/coded the code,
so hopefully, no misunderstandings/mistakes posted...
This is what :NONAME CREATE : and ; are doing:

:NONAME
-the next few steps creates a dictionary header
--blanks name field area (NFA)
--updates link field address (LFA) with LAST
--updates dictionary bits (part of NFA)
--updates LAST
--updates dictionary pointer (DP) to code field address (CFA)
-puts HERE (at current CFA) on the stack for use as an XT
-compiles ENTER into the definition (at current CFA)
-turns on compiling ]
-SMUDGEs the definition being compiled (turns on)

:
-executes :NONAME
-executes BL WORD to get name of definition
-executes COUNT
-sets up values for CMOVE which consumes :NONAMEs XT
-finds the name field (NFA)
-executes CMOVE to move the definition's name into the name field

;
-compiles EXIT into a definition
-SMUDGEs the definition being compiled (turns off)
-turns off compiling [

CREATE
-executes :
-places HERE on the stack
-executes ;
-sets the dictionary pointer (DP) to code field address (CFA)
-stores DOVAR into the code field address (CFA)
-resets dictionary pointer (DP) to saved HERE on stack


> Consider the definition:
>
> : CONSTANT ( n -- )   CREATE ,
>     DOES> ( -- n ) @ ;
>
> Here CREATE builds the header and , compiles the value in data space.
> The fact that compiling continues is not due to CREATE, which has
> finished executing, but to : which invoked CREATE and , and continued
> compiling.
>

All the common definitions which use CREATE work correctly.

>> AIUI, all I've done is switch things around to build
>> : up from :NONAME instead of using CREATE.  If it's
>> correct, which I believe it is, <BUILDS can be built
>> from :NONAME also.
>
> <BUILDS and CREATE need to do two things that :NONAME
> does not: build a header, and associate a data space
> address. :NONAME turns on the compiler and records the
> *code space* location of the associated xt,
> neither of which <BUILDS or CREATE do.
>
> They have *nothing* in common.
>
> The distinction between code space and data space is critical
> when you're dealing with RAM/FLASH architectures.
>

Okay, I suspect you're going to tell me to remove the header
creation in :NONAME and place it into a word named HEADER
or (CREATE).  Then, have : call HEADER or (CREATE).

So, then, the rough definition for : would become:
: HEADER :NONAME BL WORD COUNT ... "get NFA" CMOVE ;

I'm assuming the rest is acceptable ... ?

IIRC, :NONAME on my system needed a header for the dictionary
to be linked together correctly.  If so, I'll have to check
into why that is...  It's probably wise to fix the issue.


Rod Pemberton

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-19 13:15 -0500
  Re: quick review of <BUILDS and CREATE history albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-01-19 20:07 +0000
    Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-19 21:45 +0000
  Re: quick review of <BUILDS and CREATE history Coos Haak <chforth@hccnet.nl> - 2014-01-19 22:02 +0100
  Re: quick review of <BUILDS and CREATE history Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-01-19 17:24 -0600
    Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-19 14:54 -1000
      Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-19 22:37 -0500
        Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-19 18:01 -1000
          Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-20 00:27 -0500
            Re: quick review of <BUILDS and CREATE history Elizabeth D Rather <erather@forth.com> - 2014-01-19 20:54 -1000
              Re: quick review of <BUILDS and CREATE history Elizabeth D Rather <erather@forth.com> - 2014-01-19 21:19 -1000
              Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-20 16:14 -0500
                Re: quick review of <BUILDS and CREATE history Elizabeth D Rather <erather@forth.com> - 2014-01-20 12:07 -1000
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-21 11:37 -0500
                Re: quick review of <BUILDS and CREATE history albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-01-21 17:41 +0000
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-21 08:30 -1000
                Re: quick review of <BUILDS and CREATE history oh2aun@gmail.com - 2014-01-21 11:17 -0800
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-21 09:44 -1000
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-21 15:18 -0500
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-21 12:07 -1000
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-21 22:04 -0500
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-21 19:21 -1000
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-22 13:38 +0000
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-22 08:50 -1000
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-23 17:17 -0500
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-23 13:46 -1000
                Re: quick review of <BUILDS and CREATE history Bernd Paysan <bernd.paysan@gmx.de> - 2014-01-24 15:07 +0100
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-25 15:18 +0000
                Re: quick review of <BUILDS and CREATE history Bernd Paysan <bernd.paysan@gmx.de> - 2014-01-25 20:18 +0100
                Re: quick review of <BUILDS and CREATE history Coos Haak <chforth@hccnet.nl> - 2014-01-25 20:44 +0100
                Re: quick review of <BUILDS and CREATE history Bernd Paysan <bernd.paysan@gmx.de> - 2014-01-25 21:41 +0100
                Re: quick review of <BUILDS and CREATE history "Alex McDonald" <blog@rivadpm.com> - 2014-01-25 22:47 +0000
                Re: quick review of <BUILDS and CREATE history Bernd Paysan <bernd.paysan@gmx.de> - 2014-01-26 01:54 +0100
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-27 16:49 +0000
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-27 15:40 +0000
                Re: quick review of <BUILDS and CREATE history Bernd Paysan <bernd.paysan@gmx.de> - 2014-01-27 23:00 +0100
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-27 19:43 -0500
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-28 09:25 +0000
                Re: quick review of <BUILDS and CREATE history Bernd Paysan <bernd.paysan@gmx.de> - 2014-01-28 19:45 +0100
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-30 15:32 +0000
                Re: quick review of <BUILDS and CREATE history albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-01-28 14:20 +0000
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-25 15:28 +0000
                Re: quick review of <BUILDS and CREATE history Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-01-25 13:51 -0600
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-27 15:34 +0000
                Re: quick review of <BUILDS and CREATE history Lars Brinkhoff <lars.spam@nocrew.org> - 2014-01-24 08:11 +0100
                Re: quick review of <BUILDS and CREATE history Mark Wills <markrobertwills@yahoo.co.uk> - 2014-01-24 01:28 -0800
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-24 05:00 -0500
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-24 09:32 -1000
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-24 17:48 -0500
                Re: quick review of <BUILDS and CREATE history "Elizabeth D. Rather" <erather@forth.com> - 2014-01-24 13:14 -1000
                Re: quick review of <BUILDS and CREATE history Mark Wills <markrobertwills@yahoo.co.uk> - 2014-01-24 16:16 -0800
                Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-23 12:13 -0500
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-22 13:32 +0000
            Re: quick review of <BUILDS and CREATE history Mark Wills <markrobertwills@yahoo.co.uk> - 2014-01-20 04:14 -0800
              Re: quick review of <BUILDS and CREATE history Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-01-20 06:31 -0600
                Re: quick review of <BUILDS and CREATE history Elizabeth D Rather <erather@forth.com> - 2014-01-20 08:04 -1000
                Re: quick review of <BUILDS and CREATE history anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-21 14:09 +0000
              Re: quick review of <BUILDS and CREATE history "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-01-20 16:14 -0500
  Re: quick review of <BUILDS and CREATE history trebor.english@gmail.com - 2014-01-22 17:44 -0800
  Re: quick review of <BUILDS and CREATE history trebor.english@gmail.com - 2014-01-22 18:24 -0800
    Re: quick review of <BUILDS and CREATE history albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-01-23 14:00 +0000
      Re: quick review of <BUILDS and CREATE history trebor.english@gmail.com - 2014-01-23 11:06 -0800
        Re: quick review of <BUILDS and CREATE history Paul Rubin <no.email@nospam.invalid> - 2014-01-23 11:33 -0800
          Re: quick review of <BUILDS and CREATE history trebor.english@gmail.com - 2014-01-23 11:42 -0800
        Re: quick review of <BUILDS and CREATE history Mikael Nordman <oh2aun@gmail.com> - 2014-01-23 11:51 -0800

csiph-web