Implement INCLUDED

30 views
Skip to first unread message

Aleksej Saushev

unread,
Nov 30, 2010, 7:14:52 PM11/30/10
to pfor...@googlegroups.com
Hello!

pForth doesn't implement standard "INCLUDED",
it implements "$INCLUDE" that uses counted string argument instead.
I have converted "$INCLUDE" into "INCLUDED" and removed one now unused
definition for "$MOVE" which is equivalent to "count place".

There's one problem with INCLUDED/INCLUDE implementation,
there's fixed length buffer to hold name for previously included file,
and the length of this buffer is 128 octets. This is damn too few!
I propose to raise it at least to 4096.

I didn't implement buffer length check, because there's some
bikeshedding involved. How do you prefer to handle errors?
I'd rather throw exceptions, but they're a bit problematic for now.


Replace "$INCLUDE" with standard "INCLUDED".
Remove unused definition for "$MOVE" use "PLACE" instead of it.
While here, fix line terminators.

included.diff

Phil Burk

unread,
Nov 30, 2010, 8:49:31 PM11/30/10
to pfor...@googlegroups.com

> Replace "$INCLUDE" with standard "INCLUDED".
> Remove unused definition for "$MOVE" use "PLACE" instead of it.

Whoah! We can add INCLUDED. But we should not remove any existing words
like $INCLUDE or $MOVE. User applications may be using them.

> I propose to raise it at least to 4096.

Remember this is designed for embedded systems with small RAM. Microsoft
often uses a max path size of 256. Is that enough?

Phil

Aleksej Saushev

unread,
Nov 30, 2010, 9:18:31 PM11/30/10
to pfor...@googlegroups.com
Phil Burk <ph...@softsynth.com> writes:

>> Replace "$INCLUDE" with standard "INCLUDED".
>> Remove unused definition for "$MOVE" use "PLACE" instead of it.
>
> Whoah! We can add INCLUDED. But we should not remove any
> existing words like $INCLUDE or $MOVE. User applications may be
> using them.

Could we move them away from system.fth to some other file?
Perhaps deprecate them? They're not useful that much,
and if they are really needed, they are easy to reimplement
in terms of standard "INCLUDED" and "MOVE":

: $INCLUDE COUNT INCLUDED ;
: $MOVE OVER C@ 1+ CHARS MOVE ;

>> I propose to raise it at least to 4096.
>
> Remember this is designed for embedded systems with small RAM.
> Microsoft often uses a max path size of 256. Is that enough?

locate / | awk '{if (a < length($0)) {a = length($0)}} END {print a}'

Here it reports 205.

One of files with name longer than 200 is this:

/home/asau/.wine/drive_c/windows/profiles/asau/Application Data/OpenOffice.org/3/user/uno_packages/cache/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/registered_packages.db

Brought by:

locate / | awk 'length($0) > 200'

(If you don't have "locate", try replacing it with "find /".
But that will be slow.)

I'm afraid, 256 is rather few. What about 2048?
2048 is minimal textual line length required by POSIX, AFAIR.


(Should I send modified patch or are modifications trivial enough to implement?)


--
HE CE3OH...

Reply all
Reply to author
Forward
0 new messages