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


Groups > comp.lang.forth > #59000

Re: accessing current xt

Newsgroups comp.lang.forth
Date 2017-05-10 11:16 -0700
References <oevetu$ivi$1@dont-email.me> <88eb352b-b6b9-40a3-a560-14dd76a20a2b@googlegroups.com>
Message-ID <08268674-e2ae-45ab-9347-ceda7cccdc20@googlegroups.com> (permalink)
Subject Re: accessing current xt
From Mark Wills <markwills1970@gmail.com>

Show all headers | View raw


On Wednesday, 10 May 2017 19:11:32 UTC+1, Mark Wills  wrote:
> On Wednesday, 10 May 2017 17:28:54 UTC+1, Andreas Klimas  wrote:
> > is it possible to access the name of the word beeing compiled ?
> > 
> > fictive example
> > 
> > : log current-xt >name .log ; immediate
> > 
> > : foo log   ... ;
> > 
> > 
> > if I don't have access to the current xt, is it possible
> > to define my own : where I can catch the name and
> > may be the comment.
> > 
> > my: foo ( --) any words here ;
> > 
> > or maybe even simpler
> > : foo ... ;
> > comment" ..." where comment will take the name of the last
> > defined word. Or is this all illegal ?
> > the word immediate might do simmilar things ?
> > 
> > thank you
> > best wishes
> > Andreas Klimas
> 
> You might be able to access it via LATEST but it will be specific
> to the system you are using. Not portable at all.
> 
> LATEST will point to the last thing to be built in the dictionary,
> which should (hopefully) be your word that you are currently
> compiling. It may be smudged. You'll generally want to convert
> the address that LATEST @ returns into the XT using some magic
> word. In my system, it's >CFA
> 
> LATEST @ >CFA
> 
> Would give you the XT (suitable for EXECUTE et al) of the last
> word defined. Again, on *my system*, you can read LATEST while
> you're actually compiling (for example in an immediate word)
> and get the XT, or name field etc.
> 
> No guarantees though. Which system are you using?

Try something like this:

: get-XT ( -- ) ." XT of word being built is "
  LATEST @ >CFA . ; IMMEDIATE

: test ( -- ) get-XT 1 2 3 ;

Works on my system. You might need to find the equivalent of >CFA
for your system.

On my system, >CFA takes a dictionary link field address and converts
to the XT/CFA (code field address). LATEST always points to the link
field of the last word built.

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


Thread

accessing current xt Andreas Klimas <klimas@w3group.de> - 2017-05-10 18:28 +0200
  Re: accessing current xt Mark Wills <markwills1970@gmail.com> - 2017-05-10 11:11 -0700
    Re: accessing current xt Mark Wills <markwills1970@gmail.com> - 2017-05-10 11:16 -0700
    Re: accessing current xt Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-10 20:20 +0200
    Re: accessing current xt Andreas Klimas <klimas@w3group.de> - 2017-05-10 21:48 +0200
      Re: accessing current xt pahihu <pahihu@gmail.com> - 2017-05-10 13:12 -0700
        Re: accessing current xt Andreas Klimas <klimas@w3group.de> - 2017-05-11 00:12 +0200
      Re: accessing current xt "Elizabeth D. Rather" <erather@forth.com> - 2017-05-10 15:14 -1000
        Re: accessing current xt Andreas Klimas <klimas@w3group.de> - 2017-05-11 09:57 +0200
          Re: accessing current xt "Elizabeth D. Rather" <erather@forth.com> - 2017-05-11 21:33 -1000
  accessing current xt gwj.nexus@gmail.com - 2017-05-10 12:56 -0700
    Re: accessing current xt Andreas Klimas <klimas@w3group.de> - 2017-05-11 00:12 +0200
      Re: accessing current xt gwj.nexus@gmail.com - 2017-05-10 22:57 -0700
  Re: accessing current xt anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-11 06:39 +0000
  Re: accessing current xt humptydumpty <ouatubi@gmail.com> - 2017-05-11 00:21 -0700
    Re: accessing current xt Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-11 09:38 +0200
      Re: accessing current xt humptydumpty <ouatubi@gmail.com> - 2017-05-11 00:49 -0700
        Re: accessing current xt Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-11 10:38 +0200
          Re: accessing current xt Julian Fondren <julian.fondren@gmail.com> - 2017-05-11 04:11 -0700
            Re: accessing current xt Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-11 14:32 +0200

csiph-web