gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with creating word


From: Robert Sander
Subject: problem with creating word
Date: Fri, 10 Apr 2020 08:40:24 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Hello,

I want to create a word and store a generated id and a string in the
datafield.

I have the following words:

variable ma#
68 ma# ! \ just to find the value in the memoy

: ma: ( -- )
        1 ma# +! \ increment ma# - is there a better way?
        create ma# @ , \ reserve space and store the value of ma#
        parse-name 2, \ get next word and store addr and length
        does> ( -- u) @ ;


With the following definition:

ma: robert rs

I expect to see 69 when calling the word robert:

robert . 69  ok

When using the address of the word robert I have to get the address
of the body: 

' robert >body ? 69  ok


Now I want to see the string "rs":

' robert >body 1 cells + 2@ type  c ok

but this does not work.

What am I doing wrong?

--
Robert Sander




reply via email to

[Prev in Thread] Current Thread [Next in Thread]