00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _H_moduldef
00029 #define _H_moduldef
00030
00031 struct defmodule;
00032 struct portItem;
00033 struct defmoduleItemHeader;
00034 struct moduleItem;
00035
00036 #ifndef _STDIO_INCLUDED_
00037 #include <stdio.h>
00038 #define _STDIO_INCLUDED_
00039 #endif
00040
00041 #ifndef _H_conscomp
00042 #include "conscomp.h"
00043 #endif
00044 #ifndef _H_modulpsr
00045 #include "modulpsr.h"
00046 #endif
00047 #ifndef _H_utility
00048 #include "utility.h"
00049 #endif
00050 #ifndef _H_symbol
00051 #include "symbol.h"
00052 #endif
00053 #ifndef _H_evaluatn
00054 #include "evaluatn.h"
00055 #endif
00056 #ifndef _H_constrct
00057 #include "constrct.h"
00058 #endif
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 struct defmodule
00080 {
00081 struct symbolHashNode *name;
00082 char *ppForm;
00083 struct defmoduleItemHeader **itemsArray;
00084 struct portItem *importList;
00085 struct portItem *exportList;
00086 unsigned visitedFlag;
00087 long bsaveID;
00088 struct userData *usrData;
00089 struct defmodule *next;
00090 };
00091
00092 struct portItem
00093 {
00094 struct symbolHashNode *moduleName;
00095 struct symbolHashNode *constructType;
00096 struct symbolHashNode *constructName;
00097 struct portItem *next;
00098 };
00099
00100 struct defmoduleItemHeader
00101 {
00102 struct defmodule *theModule;
00103 struct constructHeader *firstItem;
00104 struct constructHeader *lastItem;
00105 };
00106
00107 #define MIHS (struct defmoduleItemHeader *)
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 struct moduleItem
00141 {
00142 char *name;
00143 int moduleIndex;
00144 void *(*allocateFunction)(void *);
00145 void (*freeFunction)(void *,void *);
00146 void *(*bloadModuleReference)(void *,int);
00147 void (*constructsToCModuleReference)(void *,FILE *,int,int,int);
00148 void *(*findFunction)(void *,char *);
00149 struct moduleItem *next;
00150 };
00151
00152 typedef struct moduleStackItem
00153 {
00154 intBool changeFlag;
00155 struct defmodule *theModule;
00156 struct moduleStackItem *next;
00157 } MODULE_STACK_ITEM;
00158
00159 #define DEFMODULE_DATA 4
00160
00161 struct defmoduleData
00162 {
00163 struct moduleItem *LastModuleItem;
00164 struct callFunctionItem *AfterModuleChangeFunctions;
00165 MODULE_STACK_ITEM *ModuleStack;
00166 intBool CallModuleChangeFunctions;
00167 struct defmodule *ListOfDefmodules;
00168 struct defmodule *CurrentModule;
00169 struct defmodule *LastDefmodule;
00170 int NumberOfModuleItems;
00171 struct moduleItem *ListOfModuleItems;
00172 long ModuleChangeIndex;
00173 int MainModuleRedefinable;
00174 #if (! RUN_TIME) && (! BLOAD_ONLY)
00175 struct portConstructItem *ListOfPortConstructItems;
00176 long NumberOfDefmodules;
00177 struct callFunctionItem *AfterModuleDefinedFunctions;
00178 #endif
00179 #if CONSTRUCT_COMPILER && (! RUN_TIME)
00180 struct CodeGeneratorItem *DefmoduleCodeItem;
00181 #endif
00182 #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE) && (! RUN_TIME)
00183 long BNumberOfDefmodules;
00184 long NumberOfPortItems;
00185 struct portItem *PortItemArray;
00186 struct defmodule *DefmoduleArray;
00187 #endif
00188 };
00189
00190 #define DefmoduleData(theEnv) ((struct defmoduleData *) GetEnvironmentData(theEnv,DEFMODULE_DATA))
00191
00192 #ifdef LOCALE
00193 #undef LOCALE
00194 #endif
00195
00196 #ifdef _MODULDEF_SOURCE_
00197 #define LOCALE
00198 #else
00199 #define LOCALE extern
00200 #endif
00201
00202 #define FindDefmodule(a) EnvFindDefmodule(GetCurrentEnvironment(),a)
00203 #define GetCurrentModule() EnvGetCurrentModule(GetCurrentEnvironment())
00204 #define GetDefmoduleName(a) EnvGetDefmoduleName(GetCurrentEnvironment(),a)
00205 #define GetDefmodulePPForm(a) EnvGetDefmodulePPForm(GetCurrentEnvironment(),a)
00206 #define GetNextDefmodule(a) EnvGetNextDefmodule(GetCurrentEnvironment(),a)
00207 #define SetCurrentModule(a) EnvSetCurrentModule(GetCurrentEnvironment(),a)
00208
00209 LOCALE void InitializeDefmodules(void *);
00210 LOCALE void *EnvFindDefmodule(void *,char *);
00211 LOCALE char *EnvGetDefmoduleName(void *,void *);
00212 LOCALE char *EnvGetDefmodulePPForm(void *,void *);
00213 LOCALE void *EnvGetNextDefmodule(void *,void *);
00214 LOCALE void RemoveAllDefmodules(void *);
00215 LOCALE int AllocateModuleStorage(void);
00216 LOCALE int RegisterModuleItem(void *,char *,
00217 void *(*)(void *),
00218 void (*)(void *,void *),
00219 void *(*)(void *,int),
00220 void (*)(void *,FILE *,int,int,int),
00221 void *(*)(void *,char *));
00222 LOCALE void *GetModuleItem(void *,struct defmodule *,int);
00223 LOCALE void SetModuleItem(void *,struct defmodule *,int,void *);
00224 LOCALE void *EnvGetCurrentModule(void *);
00225 LOCALE void *EnvSetCurrentModule(void *,void *);
00226 LOCALE void *GetCurrentModuleCommand(void *);
00227 LOCALE void *SetCurrentModuleCommand(void *);
00228 LOCALE int GetNumberOfModuleItems(void *);
00229 LOCALE void CreateMainModule(void *);
00230 LOCALE void SetListOfDefmodules(void *,void *);
00231 LOCALE struct moduleItem *GetListOfModuleItems(void *);
00232 LOCALE struct moduleItem *FindModuleItem(void *,char *);
00233 LOCALE void SaveCurrentModule(void *);
00234 LOCALE void RestoreCurrentModule(void *);
00235 LOCALE void AddAfterModuleChangeFunction(void *,char *,void (*)(void *),int);
00236 LOCALE void IllegalModuleSpecifierMessage(void *);
00237 LOCALE void AllocateDefmoduleGlobals(void *);
00238
00239 #endif
00240
00241