Frequently Used TypeDef Structures and Variables: Difference between revisions

From NARS2000
Jump to navigationJump to search
(created page, general outline, LPPL_YYSTYPE - Frequently Used TypeDef Structures and Variables)
 
Line 35: Line 35:
             lptkRhtBrace;          // 40:  ...              right ...
             lptkRhtBrace;          // 40:  ...              right ...
                                     // 44:  Length
                                     // 44:  Length
} PL_YYSTYPE, *LPPL_YYSTYPE;        // Data type of yacc stack
} PL_YYSTYPE, *LPPL_YYSTYPE;        // Data type of yacc stack; most frequently used is LPPL_YYSTYPE, long pointer to the above structure.
</pre>
</pre>


LPPL_YYSTYPE is customarily variable-type for the following:<br>
LPPL_YYSTYPE is customarily variable-type for the following:<br>
     LPPL_YYSTYPE lpYYRes = NULL,    // initialize, Ptr to result of a ⎕ quad system function call
     LPPL_YYSTYPE lpYYRes = NULL,    // initialize, will be Ptr to result of a ⎕ quad System Function call
and macro call:<br>
and macro call:<br>
     lpYYRes = YYAlloc ();          // Allocate free memory, fill LPPL_YYSTYPE memory structure with default setup/values
     lpYYRes = YYAlloc ();          // Allocate free memory, fill LPPL_YYSTYPE memory structure with default setup/values

Revision as of 18:53, 6 August 2015

NARS C Source Code Frequently Used TypeDef Structures and Variables:

NARS has multiple frequently used TypeDefs, Structures, Type-Variables and Variables. Familiarity with these structures, including variables employed, is essential toward gaining increased understanding of how NARS C source code works, including insight into C program flow.

TypeDefs

LPPL_YYSTYPE

The full definition for typedef LPPL_YYTYPE is found in file <pl_parse.h>. Partial, extracted, compiler-directives-excluded/simplified definition:

typedef struct tagPL_YYSTYPE        // YYSTYPE for ParseLine
{
    // N.B.:  The first item in this struct *MUST* be the TOKEN
    //   because when we pass it as an argument to an LPPRIMFNS
    //   we might need it to be an LPPL_YYSTYPE (for a function strand)
    //   or an LPTOKEN (single function).
    TOKEN   tkToken;                // 00:  Token info (28 bytes)
    UINT    TknCount;               // 1C:  Count of adjacent tokens including this one
    UINT    YYInuse:1,              // 20:  00000001:  This entry is in use
            YYIndirect:1,           //      00000002:  Arg is indirect
            YYPerm:1,               //      00000004:  Item is permanent, don't free
            YYStranding:1,          //      00000008:  Item is in the process of being stranded
            :28;                    //      FFFFFFF0:  Available bits

    struct tagPL_YYSTYPE
           *lpYYFcnBase,            // 24:  Ptr to base function/operator
                                    //      Not valid outside the enclosing
                                    //        invocation of ParseLine
           *lpYYStrandBase,         // 28:  Ptr to this token's strand base
           *lpplYYArgCurry,         // 2C:  Ptr to left argument curry
           *lpplYYIdxCurry,         // 30:  Ptr to axis curry
           *lpplYYFcnCurry,         // 34:  ...         function ...
           *lpplYYOpRCurry;         // 38:  ...    right operand ...
    LPTOKEN lptkLftBrace,           // 3C:  Ptr to the AFO's left brace token
            lptkRhtBrace;           // 40:  ...              right ...
                                    // 44:  Length
} PL_YYSTYPE, *LPPL_YYSTYPE;        // Data type of yacc stack; most frequently used is LPPL_YYSTYPE, long pointer to the above structure.

LPPL_YYSTYPE is customarily variable-type for the following:

   LPPL_YYSTYPE lpYYRes = NULL,    // initialize, will be Ptr to result of a ⎕ quad System Function call

and macro call:

   lpYYRes = YYAlloc ();           // Allocate free memory, fill LPPL_YYSTYPE memory structure with default setup/values

Variable Types

Variables