P4_LOCAL_BUFFER_VAR(3)

NAME
p4_local_buffer_var - LBUFFER: ( size [name] -- )

SYNOPSIS

#include <pfe/locals-ext.h>

FCode p4_local_buffer_var(---);

DESCRIPTION

declares a single local VALUE using (LOCAL) - which will hold the address of an area like BUFFER: but carved from the return-stack (as in C with alloca). This local buffer will be automatically given up at the end of the word. The return-stack-pointer will be increased only at the time of the p4_local_buffer_var function (and the address assigned to the LVALUE) so that the provided size gets determined at runtime. Note that in some configurations the forth-return-stack area is quite small - for large string operations you should consider to use a POCKET-PAD in pfe.

      : LBUFFER:
        STATE @ IF
          BUFFER:
        ELSE
          :NONAME ( size -- rp* ) R&gt; RP@ - DUP RP! SWAP &gt;R ;NONAME
          COMPILE, POSTPONE LVALUE
        THEN
      ; IMMEDIATE

AUTHOR

    • Guido U. Draheim (modified by $Author: guidod $)

COPYRIGHT

Copyright (C) Tektronix, Inc. 1998 - 2001. Copyright (C) 2005 - 2008 Guido U. Draheim <guidod@gmx.de>