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

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

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

revision 100 by jds, Fri Dec 9 03:49:19 2005 UTC revision 101 by jds, Sat Dec 10 04:22:07 2005 UTC
# Line 117  extern void DestroyExtFuncLibrary(void); Line 117  extern void DestroyExtFuncLibrary(void);
117    
118  extern struct ExternalFunc *CreateExternalFunc(CONST char *name);  extern struct ExternalFunc *CreateExternalFunc(CONST char *name);
119  /**<  /**<
120   *  Creates and returns and ExternalFunc node, with all attributes   *  Creates a new ExternalFunc node having the specified name.  
121   *  initialized to 0 or NULL.   *  All other attributes are initialized to 0 or NULL.  There is
122     *  no checking for the validity or uniqueness of name.
123     *
124     *  @param name The name for the new ExternalFunc.
125     *  @return A pointer to the new ExternalFunc.
126   */   */
127    
128  extern int AddExternalFunc(struct ExternalFunc *efunc, int force);  extern int AddExternalFunc(struct ExternalFunc *efunc, int force);
129  /**<  /**<
130   *  Given an external function node, add it to the external function   *  Adds an external function node to the external function library.
131   *  library. We look up the external function before adding it to the   *  We look up the external function before adding it to the
132   *  library. If force is zero and the function exists then nothing   *  library.  If force is zero and the function exists then nothing
133   *  is done and 0 is returned. If force is true, then the old entry is   *  is done and 0 is returned.  If force is true, then the old entry is
134   *  removed and the new one is added; 1 is returned. If the name is not   *  removed and the new one is added; 1 is returned.  If the name is not
135   *  found then the information is added to the library.   *  found then the information is added to the library.
136   */   */
137    
138  extern struct ExternalFunc *LookupExtFunc(CONST char *funcname);  extern struct ExternalFunc *LookupExtFunc(CONST char *funcname);
139  /**<  /**<
140   *  Returns the external function corresponding to the name, or NULL if   *  Returns the external function having the given name, or NULL if
141   *  not found.   *  not found.
142   */   */
143    
# Line 147  extern int CreateUserFunction(CONST char Line 151  extern int CreateUserFunction(CONST char
151                                CONST unsigned long n_outputs,                                CONST unsigned long n_outputs,
152                                CONST char *help);                                CONST char *help);
153  /**<  /**<
154      @param name name of the function being added (or updated)   *  Adds an external function to the ASCEND system.
155      @param init initialisation function   *  The name of the function is looked up.  If it already exists, the
156      @param value location where pointer to evaluation function can be found???   *  information will be updated.  If the name was not found in the
157      @param deriv location where pointer to first partial derivative function will be returned???   *  external function library, then an external function node will be
158      @param deriv2 location where pointer to second derivative function can be found???   *  created and added to the external function library.  We make a
159     *  *copy* of the help string if it is provided.  We also make a copy
160      This function is used to add external functions to the ASCEND system. The name of the function is looked up. If it already exists, the information will be updated. If the name was not found in the external function library, then an external function node will be created and added to the external function library. We make a *copy* of the help string if it is provided. We also make a copy of the name. Anyone desirous of ASCEND knowing about there functions must use this protocol.   *  of the name.  Anyone desirous of ASCEND knowing about their
161  */   *  functions must use this protocol.
162     *
163     *  @param name Name of the function being added (or updated).
164     *  @param init Pointer to initialisation function, or NULL if none.
165     *  @param value Pointer to a function pointer to the evaluation function,
166     *               or NULL if none.
167     *  @param deriv Pointer to a function pointer to the first partial
168     *               derivative function, or NULL if none.
169     *  @param deriv2 Pointer to a function pointer to the second derivative
170     *                function, or NULL if none.
171     *  @return Returns 0 if the function was successfully added,
172     *          non-zero otherwise.
173     *
174     *  @todo compiler/extfunc:CreateUserFunction() is broken.  The current
175     *        implementation wants to treat value, deriv, and deriv2 as BOTH
176     *        function pointers and arrays of function pointers.  We need to
177     *        decide which they are or else provide a mechanism supporting dual
178     *        roles.  This could be a union in ExternalFunc explicitly allowing
179     *        them to be both.  This would necessitate 2 CreateUserFunction()
180     *        varieties - 1 taking (ExtEvalFunc *) and 1 taking (ExtEvalFunc **)
181     *        to allow the different types of ExternalFunc's to be set up.
182     */
183    
184  extern struct ExternalFunc *RemoveExternalFunc(char *name);  extern struct ExternalFunc *RemoveExternalFunc(char *name);
185  /**<  /**<
186   *  Given the name of an external function will remove it from the   *  Removes the external function having the given name from the
187   *  External function library.   *  External function library.
188   */   */
189    

Legend:
Removed from v.100  
changed lines
  Added in v.101

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