Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 1998 02:32:03 -0800 (PST)
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        mike@smith.net.au
Cc:        current@FreeBSD.ORG
Subject:   Re: BootFORTH - demo floppy 
Message-ID:  <199812211032.CAA11540@newsguy.com>

next in thread | raw e-mail | index | archive | help
At Mon, 21 Dec 1998 01:08:54 -0800, you wrote

>Commonsense suggests the two major problems:

[This is really irrelevant; in particular, my "experience" disagree with the
"common sense" of the second statement; but the first statement must be
correct for the sake of correct use of FICL. IMHO, anyway]

> - the count is usually too small (in the ANS Forth case, it's one byte)

Most string words in Forth take their count from the stack, so it's one cell,
not byte. I suppose FICL uses 32 bits integers as cells, right?

There is *one* word in ANS Forth that takes the count from the memory, as far
as I can remember: count. This word is there for backward compatibility
purposes.

Even then, "it's one byte" it's rather incorrect. Let's see:

"Return the character string specification for the counted string stored at
c-addr1. c-addr2 is the address of the first character after c-addr1. u is the
contents of the character at c-addr1, which is the length in characters of the
string at c-addr2."

Mind you, "character" is not "byte":

"Characters shall be at least one address unit wide, contain at least eight
bits, and have a size less than or equal to cell size. "

Also,

"counted string: 
     A data structure consisting of one character containing a length followed
by zero or more contiguous data characters. Normally, counted strings contain
text. "

"character: 
     Depending on context, either 1) a storage unit capable of holding a
character; or 2) a member of a character set. "

"Table 3.5 - Environmental Query Strings 

String                Value  Constant?       Meaning
                    data type
/COUNTED-STRING         n       yes     maximum size of a counted string,
                                        in characters
...
MAX-CHAR                u       yes     maximum value of any character in the
                                        implementation-defined character set"

So, Unicode Forths would have 65535-sized counted strings. Indeed, some Forths
use 32 bits characters.


Ok, ok, a brief search shows me a little bit incorrect. WORD and C" return
memory-counted strings. C" is core ext and was replaced by S". Though WORD is
core and PARSE is core ext, the same applies here (WORD is for compatibility,
PARSE has been introduced to eliminate the need for count in memory).

--
Daniel C. Sobral
dcs@newsguy.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812211032.CAA11540>