00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00040
00041
00042
00043
00044
00045 #ifndef ASC_EXTCALL_H
00046 #define ASC_EXTCALL_H
00047
00052 #include <utilities/ascConfig.h>
00053 #include <utilities/ascMalloc.h>
00054 #include <general/list.h>
00055 #include <compiler/extfunc.h>
00056 #include "compiler.h"
00057 #include "instance_enum.h"
00058
00064 struct ExtCallNode{
00065 struct ExternalFunc *efunc;
00066 struct gl_list_t *arglist;
00067 struct Instance **data;
00068 unsigned long subject;
00069 int nodestamp;
00070 };
00071
00072 extern struct ExtCallNode *CreateExtCall(struct ExternalFunc *efunc,
00073 struct gl_list_t *args,
00074 struct Instance *subject,
00075 struct Instance *data);
00080 extern void DestroyExtCall(struct ExtCallNode *ext,
00081 struct Instance *relinst);
00086 extern struct Instance *GetSubjectInstance(struct gl_list_t *arglist,
00087 unsigned long varndx);
00088
00089 extern unsigned long GetSubjectIndex(struct gl_list_t *arglist,
00090 struct Instance *subject);
00095 ASC_DLLSPEC unsigned long CountNumberOfArgs(struct gl_list_t *arglist,
00096 unsigned long start, unsigned long end);
00106 extern struct gl_list_t *LinearizeArgList(struct gl_list_t *arglist,
00107 unsigned long start, unsigned long end);
00117 extern struct gl_list_t *CopySpecialList(struct gl_list_t *list);
00122 extern struct gl_list_t *DeepCopySpecialList(struct gl_list_t *list, CopyFunc copy);
00127 extern void DestroySpecialList(struct gl_list_t *list);
00135 extern void DeepDestroySpecialList(struct gl_list_t *list, DestroyFunc dtor);
00144 #ifdef NDEBUG
00145 #define ExternalCallExtFunc(ext) ((ext)->efunc)
00146 #else
00147 #define ExternalCallExtFunc(ext) ExternalCallExtFuncF(ext)
00148 #endif
00149
00155 extern struct ExternalFunc *ExternalCallExtFuncF(struct ExtCallNode *ext);
00163 #ifdef NDEBUG
00164 #define ExternalCallArgList(ext) ((ext)->arglist)
00165 #else
00166 #define ExternalCallArgList(ext) ExternalCallArgListF(ext)
00167 #endif
00168
00175 extern struct gl_list_t *ExternalCallArgListF(struct ExtCallNode *ext);
00183 extern struct Instance *ExternalCallDataInstance(struct ExtCallNode *ext);
00196 #ifdef NDEBUG
00197 #define ExternalCallVarIndex(ext) ((ext)->subject)
00198 #else
00199 #define ExternalCallVarIndex(ext) ExternalCallVarIndexF(ext)
00200 #endif
00201
00207 extern unsigned long ExternalCallVarIndexF(struct ExtCallNode *ext);
00217 extern struct Instance *ExternalCallVarInstance(struct ExtCallNode *ext);
00226 #ifdef NDEBUG
00227 #define ExternalCallNodeStamp(ext) ((ext)->nodestamp)
00228 #else
00229 #define ExternalCallNodeStamp(ext) ExternalCallNodeStampF(ext)
00230 #endif
00231
00246 extern int ExternalCallNodeStampF(struct ExtCallNode *ext);
00254 extern void SetExternalCallNodeStamp(struct ExtCallNode *ext, int nodestamp);
00259
00260
00261 #endif