/[ascend]/trunk/base/generic/compiler/extcall.h
ViewVC logotype

Diff of /trunk/base/generic/compiler/extcall.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 53 by ben.allan, Sun Dec 26 20:06:01 2004 UTC revision 54 by jds, Tue Aug 2 11:20:09 2005 UTC
# Line 1  Line 1 
1  /**<  /*
2   *  External Call Module   *  External Call Module
3   *  by Kirk Andre Abbott   *  by Kirk Andre Abbott
4   *  Created: Jun 1, 1995.   *  Created: Jun 1, 1995.
# Line 26  Line 26 
26   *  Mass Ave, Cambridge, MA 02139 USA.  Check the file named COPYING.   *  Mass Ave, Cambridge, MA 02139 USA.  Check the file named COPYING.
27   */   */
28    
29  /**<  /** @file
30     *  External Call Module.
31     *  <pre>
32   *  When #including extcall.h, make sure these files are #included first:   *  When #including extcall.h, make sure these files are #included first:
33     *         #include <stdio.h>
34     *         #include <stdlib.h>
35     *         #include "utilities/ascConfig.h"
36   *         #include "compiler.h"   *         #include "compiler.h"
37     *         #include "ascmalloc.h"
38     *         #include "list.h"
39     *         #include "extfunc.h"
40     *         #include "instance_enum.h"
41     *  </pre>
42     *  @todo Complete documentation of compiler/extcall.h.
43   */   */
44    
   
   
45  #ifndef __EXTCALL_H_SEEN__  #ifndef __EXTCALL_H_SEEN__
46  #define __EXTCALL_H_SEEN__  #define __EXTCALL_H_SEEN__
 /**< requires  
 # #include <stdio.h>  
 # #include <stdlib.h>  
 # #include "compiler.h"  
 # #include "ascmalloc.h"  
 # #include "list.h"  
 # #include "extfunc.h"  
 # #include "instance_enum.h"  
 */  
47    
48    /** External call data structure. */
49  struct ExtCallNode{  struct ExtCallNode{
50    struct ExternalFunc *efunc;    struct ExternalFunc *efunc; /**< Pointer to external function. */
51    struct gl_list_t *arglist;    /**< list of Instance pointers */    struct gl_list_t *arglist;  /**< List of Instance pointers. */
52    struct Instance **data;       /**< a hanlde to additional user data*/    struct Instance **data;     /**< A handle to additional user data. */
53    unsigned long subject;    /**< index into the arglist */    unsigned long subject;      /**< Index into the arglist. */
54    int nodestamp;                /**< a unique id for each call node */    int nodestamp;              /**< A unique id for each call node. */
55  };  };
56    
57  extern struct ExtCallNode *CreateExtCall(struct ExternalFunc *efunc,  extern struct ExtCallNode *CreateExtCall(struct ExternalFunc *efunc,
58        struct gl_list_t *args,                                           struct gl_list_t *args,
59        struct Instance *subject,                                           struct Instance *subject,
60        struct Instance *data);                                           struct Instance *data);
61  /**<  /**<
62   *   *
63   */   */
64    
65  extern void DestroyExtCall(struct ExtCallNode *ext,  extern void DestroyExtCall(struct ExtCallNode *ext,
66        struct Instance *relinst);                             struct Instance *relinst);
67  /**<  /**<
68   *   *
69   */   */
70    
71  extern struct Instance *GetSubjectInstance(struct gl_list_t *,unsigned long);  extern struct Instance *GetSubjectInstance(struct gl_list_t *arglist,
72  extern unsigned long GetSubjectIndex(struct gl_list_t *,struct Instance *);                                             unsigned long varndx);
 extern unsigned long CountNumberOfArgs(struct gl_list_t *,  
            unsigned long, unsigned long);  
73    
74  extern struct gl_list_t *LinearizeArgList(struct gl_list_t *,  extern unsigned long GetSubjectIndex(struct gl_list_t *arglist,
75         unsigned long, unsigned long);                                       struct Instance *subject);
76  /**<  
77   *  struct gl_list_t *LinearizeArgList(list,start,end)  extern unsigned long CountNumberOfArgs(struct gl_list_t *arglist,
78   *  struct gl_list_t *list;                                         unsigned long start,
79   *  unsigned long start;                                         unsigned long end);
80   *  unsigned long end;  
81    extern struct gl_list_t *LinearizeArgList(struct gl_list_t *arglist,
82                                              unsigned long start,
83                                              unsigned long end);
84    /**<
85     *  <!--  struct gl_list_t *LinearizeArgList(list,start,end)           -->
86     *  <!--  struct gl_list_t *list;                                      -->
87     *  <!--  unsigned long start;                                         -->
88     *  <!--  unsigned long end;                                           -->
89   *  Given a list of gl_list_t's this function will create a new list which   *  Given a list of gl_list_t's this function will create a new list which
90   *  is a linearized representation,i.e, each of the lists is spliced into   *  is a linearized representation,i.e, each of the lists is spliced into
91   *  the original list, to create one long list. The user now owns the   *  the original list, to create one long list. The user now owns the
# Line 86  extern struct gl_list_t *LinearizeArgLis Line 93  extern struct gl_list_t *LinearizeArgLis
93   *  with the new list.   *  with the new list.
94   */   */
95    
96  extern struct gl_list_t *CopySpecialList(struct gl_list_t *);  extern struct gl_list_t *CopySpecialList(struct gl_list_t *list);
97    
98  extern void DestroySpecialList(struct gl_list_t *);  extern void DestroySpecialList(struct gl_list_t *list);
99  /**<  /**<
100   *  void DestroySpecialList(struct gl_list_t *)   *  <!--  void DestroySpecialList(struct gl_list_t *list)              -->
101   *  struct gl_list_t *list;   *  <!--  struct gl_list_t *list;                                      -->
102   *  Given a list of gl_list_t's, this function will destroy the lists   *  Given a list of gl_list_t's, this function will destroy the lists
103   *  structures associated with this complex list. It *will* not destroy   *  structures associated with this complex list. It *will* not destroy
104   *  the *leaf* data, but it will destroy all the list structures.   *  the *leaf* data, but it will destroy all the list structures.
105   */   */
106    
   
107  #ifdef NDEBUG  #ifdef NDEBUG
108  #define ExternalCallExtFunc(ext) ((ext)->efunc)  #define ExternalCallExtFunc(ext) ((ext)->efunc)
109  #else  #else
110  #define ExternalCallExtFunc(ext) ExternalCallExtFuncF(ext)  #define ExternalCallExtFunc(ext) ExternalCallExtFuncF(ext)
111  #endif  #endif
 extern struct ExternalFunc *ExternalCallExtFuncF(struct ExtCallNode *);  
112  /**<  /**<
113   *  struct ExternalFunc *ExternalCallExtFunc(ext);   *  Return the external function pointer of an external call.
114   *  struct ExtCallNode *ext;   *  @param ext <code>struct ExtCallNode*</code>, node to query.
115   *  Return the external function pointer of an external call;   *  @return Returns the external function as a <code>struct ExternalFunc*</code>.
116     *  @see ExternalCallExtFuncF()
117     */
118    extern struct ExternalFunc *ExternalCallExtFuncF(struct ExtCallNode *ext);
119    /**<
120     *  <!--  struct ExternalFunc *ExternalCallExtFunc(ext);               -->
121     *  <!--  struct ExtCallNode *ext;                                     -->
122     *  <!--  Return the external function pointer of an external call;    -->
123     *  Implementation function for ExternalCallExtFunc().  Do not call this
124     *  function directly - call ExternalCallExtFunc() instead.
125   */   */
126    
127  #ifdef NDEBUG  #ifdef NDEBUG
# Line 115  extern struct ExternalFunc *ExternalCall Line 129  extern struct ExternalFunc *ExternalCall
129  #else  #else
130  #define ExternalCallArgList(ext) ExternalCallArgListF(ext)  #define ExternalCallArgList(ext) ExternalCallArgListF(ext)
131  #endif  #endif
132    /**<
133     *  Return the argument list.  This is a List of Lists of struct
134     *  Instances, for an external call.
135     *  @param ext <code>struct ExtCallNode*</code>, node to query.
136     *  @return Returns the arguments as a <code>struct gl_list_t*</code>.
137     *  @see ExternalCallArgListF()
138     */
139  extern struct gl_list_t *ExternalCallArgListF(struct ExtCallNode *ext);  extern struct gl_list_t *ExternalCallArgListF(struct ExtCallNode *ext);
140  /**<  /**<
141   *  struct gl_list_t *ExternalCallArgList(ext);   *  <!--  struct gl_list_t *ExternalCallArgList(ext);                  -->
142   *  struct relation_ExternalCall;   *  <!--  struct relation_ExternalCall;                                -->
143   *  Return the arguement list, which is a List of Lists of struct   *  <!--  Return the arguement list, which is a List of Lists of struct -->
144   *  Instances, for an external call;   *  <!--  Instances, for an external call;                             -->
145     *  Implementation function for ExternalCallArgList().  Do not call this
146     *  function directly - call ExternalCallArgList() instead.
147   */   */
148    
149  extern struct Instance *ExternalCallDataInstance(struct ExtCallNode *);  extern struct Instance *ExternalCallDataInstance(struct ExtCallNode *ext);
150  /**<  /**<
151   *  struct Instance *ExternalCallDataInstance(ext);   *  <!--  struct Instance *ExternalCallDataInstance(ext);              -->
152   *  struct ExtCallNode *ext;   *  <!--  struct ExtCallNode *ext;                                     -->
153   *  Return the 'data' instance for an external call. This 'data'   *  Return the 'data' instance for an external call.  This 'data'
154   *  instance can has to be a MODEL_INST. It is used to convey additional   *  instance can has to be a MODEL_INST. It is used to convey additional
155   *  information to a client who may need it. A NULL result means that no   *  information to a client who may need it. A NULL result means that no
156   *  additional information was requested and is a valid result.   *  additional information was requested and is a valid result.
# Line 138  extern struct Instance *ExternalCallData Line 161  extern struct Instance *ExternalCallData
161  #else  #else
162  #define ExternalCallVarIndex(ext) ExternalCallVarIndexF(ext)  #define ExternalCallVarIndex(ext) ExternalCallVarIndexF(ext)
163  #endif  #endif
 extern unsigned long ExternalCallVarIndexF(struct ExtCallNode *ext);  
164  /**<  /**<
165   *  unsigned long ExternalCallSubjectVarNdx(ext);   *  Return the index in the argument list of the subject variable.
166   *  struct ExtCallNode *ext;   *  @param ext <code>struct ExtCallNode*</code>, node to query.
167   *  Return the index in the arguement list of the subject variable.   *  @return Returns the index as an <code>unsigned long</code>.
168   *  This function uses the primitives GetWhichVar etc.   *  @see ExternalCallVarIndexF()
169     */
170    extern unsigned long ExternalCallVarIndexF(struct ExtCallNode *ext);
171    /**<
172     *  <!--  unsigned long ExternalCallSubjectVarNdx(ext);                -->
173     *  <!--  struct ExtCallNode *ext;                                     -->
174     *  <!--  Return the index in the argument list of the subject variable. -->
175     *  <!--  This function uses the primitives GetWhichVar etc.           -->
176     *  Implementation function for ExternalCallVarIndex().  Do not call this
177     *  function directly - call ExternalCallVarIndex() instead.
178   */   */
179    
180  extern struct Instance *ExternalCallVarInstance(struct ExtCallNode *ext);  extern struct Instance *ExternalCallVarInstance(struct ExtCallNode *ext);
181  /**<  /**<
182   *  struct Instance *ExternalCallSubjectVar(ext);   *  <!--  struct Instance *ExternalCallSubjectVar(ext);                -->
183   *  struct ExtCallNode *ext;   *  <!--  struct ExtCallNode *ext;                                     -->
184   *  Return the "subject" variable instance of the external call. This is   *  Return the "subject" variable instance of the external call. This is
185   *  the variable that relation was constructed wrt. If NULL, then a user   *  the variable that relation was constructed wrt. If NULL, then a user
186   *  should consider this as an error.   *  should consider this as an error.
# Line 160  extern struct Instance *ExternalCallVarI Line 191  extern struct Instance *ExternalCallVarI
191  #else  #else
192  #define ExternalCallNodeStamp(ext) ExternalCallNodeStampF(ext)  #define ExternalCallNodeStamp(ext) ExternalCallNodeStampF(ext)
193  #endif  #endif
 extern int ExternalCallNodeStampF(struct ExtCallNode *ext);  
194  /**<  /**<
195   *  int ExternalCallNodeStamp(ext);   *  Return the nodestamp for the given external node.
196   *  struct ExtCallNode *ext;   *  Valid results are >= 0.
197   *  Return the nodestamp for the given external node. Valid results   *  @param ext <code>struct ExtCallNode*</code>, node to query.
198   *  are >= 0.   *  @return Returns the node stamp as an <code>int</code>.
199     *  @see ExternalCallNodeStampF()
200     */
201    extern int ExternalCallNodeStampF(struct ExtCallNode *ext);
202    /**<
203     *  <!--  int ExternalCallNodeStamp(ext);                              -->
204     *  <!--  struct ExtCallNode *ext;                                     -->
205     *  <!--  Return the nodestamp for the given external node. Valid results -->
206     *  <!--  are >= 0.                                                    -->
207     *  Implementation function for ExternalCallNodeStamp().  Do not call this
208     *  function directly - call ExternalCallNodeStamp() instead.
209   */   */
210    
211  extern void SetExternalCallNodeStamp(struct ExtCallNode *ext,  extern void SetExternalCallNodeStamp(struct ExtCallNode *ext,
212           int nodestamp);                                       int nodestamp);
213    /**<
214  #endif /**< __EXTCALL_H_SEEN__ */   *  Set the nodestamp for the given external node.
215     */
   
   
   
   
   
   
   
216    
217    #endif /* __EXTCALL_H_SEEN__ */
218    

Legend:
Removed from v.53  
changed lines
  Added in v.54

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22