P4_NEEDS_ENVIRONMENT(3)

NAME
p4_needs_environment - NEEDS ( name -- )

SYNOPSIS

#include <pfe/environ-ext.h>

FCode p4_needs_environment(---);

DESCRIPTION

A self-parsing variant of an environment-query check. It is similar to a simulation like

      : NEEDS PARSE-WORD 2DUP ENVIRONMENT?
        IF DROP ( extra value ) 2DROP ( success - be silent )
        ELSE TYPE ." not available " CR THEN ;

however that would only match those worset-envqueries which return a single extra item under the uppermost TRUE flag in the success case. Instead it works more like

      : NEEDS PARSE-WORD 2DUP ENVIRONMENT-WORDLIST SEARCH-WORDLIST
        IF 2DROP ( success - be silent and just drop the parsed word )
        ELSE TYPE ." not available " CR THEN ;

however we add the same extension as in ENVIRONMENT? as that it can automatically load a wordset module to fullfil a query that looks like "[wordsetname]-ext". Therefore, the following two lines are pretty much identical:

      LOADM floating
      NEEDS floating-ext

the difference between the two: if somebody did provide a forth level implementation of floating-ext then that implementation might have registered a hint "floating-ext" in the environment-wordlist. This extra-hint will inhibit loading of the binary module even if it exists and not been loaded so far. The LOADM however will not check the ENVIRONMENT-WORDLIST and only check its loadlist of binary wordset modules in the system.

It is therefore recommended to use NEEDS instead of LOADM unless you know you want the binary module, quickly and uncondtionally.

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>