j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: mcayland Date: Sun Oct 17 00:37:31 2010 New Revision: 911 URL: http://tracker.coreboot.org/trac/openbios/changeset/911
Log: Add Forth words 2>r, 2r> and 2r@ as described in the ANSI Forth core extensions as they are required for OpenSolaris.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/forth/bootstrap/bootstrap.fs
Modified: trunk/openbios-devel/forth/bootstrap/bootstrap.fs ============================================================================== --- trunk/openbios-devel/forth/bootstrap/bootstrap.fs Sun Oct 17 00:21:51 2010 (r910) +++ trunk/openbios-devel/forth/bootstrap/bootstrap.fs Sun Oct 17 00:37:31 2010 (r911) @@ -404,6 +404,17 @@
: 2rot >r >r 2swap r> r> 2swap ;
+\ +\ 7.3.1.4 - return stack +\ + +\ Note: these words are not part of the official OF specification, however +\ they are part of the ANSI DPANS94 core extensions (see section 6.2) and +\ so this seems an appropriate place for them. +: 2>r swap >r >r ; +: 2r> r> r> swap ; +: 2r@ r> r> 2dup >r >r swap ; + \ \ 7.3.2.1 - single precision integer arithmetic (part 1) \
On 2010-10-16 6:37 PM, repository service wrote:
[...] +\ Note: these words are not part of the official OF specification, however +\ they are part of the ANSI DPANS94 core extensions (see section 6.2) and +\ so this seems an appropriate place for them. +: 2>r swap>r>r ; +: 2r> r> r> swap ; +: 2r@ r> r> 2dup>r>r swap ;
Are those words correct? The return address from the colon definition will also be on the return stack and will interfere. What I see in various places in Openboot sources is:
: 2>r ( a b -- ) r> -rot swap >r >r >r ; : 2r> ( -- a b ) r> r> r> rot >r swap ;
Tarl Neustädter wrote:
Are those words correct? The return address from the colon definition will also be on the return stack and will interfere. What I see in various places in Openboot sources is:
: 2>r ( a b -- ) r> -rot swap >r >r >r ; : 2r> ( -- a b ) r> r> r> rot >r swap ;
Ah of course - while the standard says that these words are "the semantic equivalent of", they are talking about inline context rather than as standalone words where of course you need to tuck the values under the top-most R-stack item.
This should now be fixed in SVN trunk.
ATB,
Mark.