
#ifndef LIBRARIES_INSTALLERNGMODULE_H
#define LIBRARIES_INSTALLERNGMODULE_H

/*
**  $VER: installerngmodule.h 37.0 (11.06.2000)
**  (C) by Jens Tröger
**
*/

#include <exec/types.h>
#include <exec/lists.h>
#include <exec/nodes.h>

// the minimum free amount of stack space
#define MINIMUM_FREE_STACKSPACE 8192

// this structure defines the environment for an arbitrary
// program, before it gets executed
struct ModuleEnvironment
{
  struct TreeNode *me_TreeRoot;
  struct List     *me_Procedures;
  struct List     *me_OnErrors;
  struct List     *me_Effects;
  struct List     *me_SymbolTable;
  ULONG           *me_GlobalEnvironment;
  APTR             me_UserData;
};

// a node of the syntax tree can be anything; the value of
// this node is placed in this union
union TreeNodeValue
{
  int   tnv_FunID;
  char *tnv_IdentName;
  char *tnv_String;
  long  tnv_Number;
};

// the structure of one node of the syntax tree
struct TreeNode
{
  struct Node         tn_Brothers;
  struct TreeNode    *tn_Parent;
  struct List         tn_Childs;
  int                 tn_Type;
  int                 tn_SrcLine;
  int                 tn_SrcChar;
  union TreeNodeValue tn_Value;
  WORD                tn_MinNumArg;
  WORD                tn_MaxNumArg;
  APTR                tn_UserData;
};

// the different node types (TreeNode->tn_Type)
enum { NODE_ROOT = 500, NODE_FUNCTION, NODE_IDENT, NODE_FUNIDENT,
       NODE_STRING, NODE_FORMATSTR, NODE_NUMBER, NODE_EXPRLIST,
       NODE_FIRSTEXPR };

// the different function types (TreeNode->tn_Value.tnv_FundID if
// TreeNode->tn_Type==NODE_FUNIDENT)
enum { FUN_ABORT = 1, FUN_COMPLETE, FUN_COPYFILES, FUN_COPYLIB,
       FUN_DEBUG, FUN_DELETE, FUN_EXECUTE, FUN_EXIT, FUN_FOREACH,
       FUN_MAKEASSIGN, FUN_MAKEDIR, FUN_MESSAGE, FUN_ONERROR,
       FUN_PROCEDURE, FUN_PROTECT, FUN_RENAME, FUN_REXX, FUN_RUN,
       FUN_SET, FUN_STARTUP, FUN_TEXTFILE, FUN_TOOLTYPE, FUN_TRAP,
       FUN_USER, FUN_WELCOME, FUN_WORKING, FUN_IF, FUN_UNTIL,
       FUN_WHILE, FUN_EQU, FUN_NE, FUN_GT, FUN_GE, FUN_LT, FUN_LE,
       FUN_ADD, FUN_SUB, FUN_MUL, FUN_DIV, FUN_AND, FUN_OR, FUN_XOR,
       FUN_NOT, FUN_BITAND, FUN_BITOR, FUN_BITXOR, FUN_BITNOT,
       FUN_SHIFTLEFT, FUN_SHIFTRIGHT, FUN_IN, FUN_ASKDIR, FUN_ASKFILE,
       FUN_ASKSTRING, FUN_ASKNUMBER, FUN_ASKCHOICE, FUN_ASKOPTIONS,
       FUN_ASKBOOL, FUN_ASKDISK, FUN_CAT, FUN_DATABASE, FUN_EXISTS,
       FUN_EXPANDPATH, FUN_EARLIER, FUN_FILEONLY, FUN_GETASSIGN,
       FUN_GETDEVICE, FUN_GETDISKSPACE, FUN_GETENV, FUN_GETSIZE,
       FUN_GETSUM, FUN_GETVERSION, FUN_PATHONLY, FUN_PATMATCH, FUN_SELECT,
       FUN_STRLEN, FUN_SUBSTR, FUN_TRANSCRIPT, FUN_TACKON, FUN_ALL,
       FUN_APPEND, FUN_ASSIGNS, FUN_CHOICES, FUN_COMMAND, FUN_CONFIRM,
       FUN_DEFAULT, FUN_DELOPTS, FUN_DEST, FUN_DISK, FUN_FILES, FUN_FONTS,
       FUN_HELP, FUN_INCLUDE, FUN_INFOS, FUN_NEWNAME, FUN_NEWPATH,
       FUN_NOGAUGE, FUN_NOPOSITION, FUN_NOREQ, FUN_OPTIONAL, FUN_PATTERN,
       FUN_PROMPT, FUN_QUIET, FUN_RANGE, FUN_RESIDENT, FUN_SAFE,
       FUN_SETDEFAULTTOOL, FUN_SETSTACK, FUN_SETTOOLTYPE, FUN_SOURCE,
       FUN_SWAPCOLORS, FUN_SYMBOLSET, FUN_SYMBOLVAL, FUN_ICONINFO,
       FUN_SETPOSITION, FUN_GETTOOLTYPE, FUN_GETDEFAULTTOOL, FUN_GETSTACK,
       FUN_GETPOSITION, FUN_SIMULATE_ERROR, FUN_BEEP, FUN_COMPARE,
       FUN_FINDBOARD, FUN_LET, FUN_REBOOT, FUN_DELAY, FUN_SWING, FUN_RANDOM,
       FUN_PUT_PROPERTY, FUN_GET_PROPERTY, FUN_REMOVE_PROPERTY,
       FUN_SAVE_PROPERTY_OBJECT, FUN_READ_PROPERTY_OBJECT, FUN_CAST_INT,
       FUN_CAST_STRING, FUN_NOP, FUN_FLUSHLIBS,

       // new with v44 of the C= installer
       FUN_EFFECT, FUN_SHOWMEDIA, FUN_SETMEDIA, FUN_CLOSEMEDIA, FUN_TRACE,
       FUN_RETRACE, FUN_QUERYDISPLAY, FUN_BACK, FUN_OPENWBOBJECT,
       FUN_SHOWWBOBJECT, FUN_CLOSEWBOBJECT,

       FUN_SETENV };

// the symbol table is actually a hashtable; an entry
// is a structure like this
struct SymbolTableNode
{
  struct Node    sn_Node;
  char           sn_Ident[32];
  long           sn_Value;
  int            sn_Type;
  BOOL           sn_Constant;
  BOOL           sn_LetLocal;
  struct MinList sn_BindingStore;
  struct MinList sn_Properties;
  APTR           sn_UserData;
};

#endif



