/[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 911 by johnpye, Thu Oct 26 10:18:53 2006 UTC revision 912 by johnpye, Fri Oct 27 07:18:21 2006 UTC
# Line 241  struct BlackBoxExternalFunc { Line 241  struct BlackBoxExternalFunc {
241  */  */
242  typedef int ExtMethodRun(struct Instance *context, struct gl_list_t *args, void *user_data);  typedef int ExtMethodRun(struct Instance *context, struct gl_list_t *args, void *user_data);
243    
244    /**
245        Setup/teardown, if any needed, for a particular instance.
246    
247        We don't actually support this method anywhere right now, as
248        we're not sure what it can logically be used for that the
249        init function in dlopening shouldn't be doing.
250        In principal, we could add and cache a client-data pointer
251        in each instance so that the external method may be stateful.
252        Presently, the external methods must be clever to do that
253        on their own or must use ascend instances for state instead.
254        @param context the instance on which the method may be run.
255    */
256    typedef int ExtMethodInit( struct Instance *context);
257    
258    /**
259        Destroy function (note comments for ExtMethodInit).
260    
261        This function deallocated user_data for a particular external method.
262        In the case of external python script methods, for example, this will perform
263        Py_DECREF on the external script, so that python can unload it.
264    
265        Couldn't see a way to do this without adding back this function here. -- JP
266    */
267    
268    typedef int ExtMethodDestroyFn( void *user_data);
269    
270    
271  struct MethodExternalFunc {  struct MethodExternalFunc {
272    ExtMethodRun *run; /**< the method invoked. */    ExtMethodRun *run; /**< the method invoked. */
273    void *user_data; /**< I'd anticipate that this would be a function pointer    void *user_data; /**< I'd anticipate that this would be a function pointer
274          implemented in an external scripting language. Should only be accessed          implemented in an external scripting language. Should only be accessed
275          from inside the 'run' function! -- JP          from inside the 'run' function! -- JP */
276    */    ExtMethodDestroyFn *destroyfn;
 #if 0 /* have no use for these currently. */  
   ExtMethodInit *initial; /**< allowed to be null if not needed. */  
   ExtMethodInit *final; /**< allowed to be null if not needed. */  
 #endif  
277  };  };
278    
279  struct ExternalFunc {  struct ExternalFunc {
# Line 353  ASC_DLLSPEC(CONST char*) ExternalFuncNam Line 376  ASC_DLLSPEC(CONST char*) ExternalFuncNam
376    EXTERNAL METHOD STUFF    EXTERNAL METHOD STUFF
377  */  */
378    
 /**  
     Setup/teardown, if any needed, for a particular instance.  
   
     We don't actually support this method anywhere right now, as  
     we're not sure what it can logically be used for that the  
     init function in dlopening shouldn't be doing.  
     In principal, we could add and cache a client-data pointer  
     in each instance so that the external method may be stateful.  
     Presently, the external methods must be clever to do that  
     on their own or must use ascend instances for state instead.  
     @param context the instance on which the method may be run.  
 */  
 typedef int ExtMethodInit( struct Instance *context);  
   
379  ASC_DLLSPEC(int) CreateUserFunctionMethod(CONST char *name  ASC_DLLSPEC(int) CreateUserFunctionMethod(CONST char *name
380          ,ExtMethodRun *run          ,ExtMethodRun *run
381          ,CONST long n_args          ,CONST long n_args
382          ,CONST char *help          ,CONST char *help
383          ,void *user_data          ,void *user_data
384            ,ExtMethodDestroyFn *destroyfn
385  );  );
386  /**<  /**<
387   *  Adds an external method call to the ASCEND system.   *  Adds an external method call to the ASCEND system.
# Line 548  extern ExtEvalFunc **GetDeriv2JumpTable( Line 558  extern ExtEvalFunc **GetDeriv2JumpTable(
558  /** Fetch black initialization function. */  /** Fetch black initialization function. */
559  extern ExtEvalFunc *GetGlassBoxFinal(struct ExternalFunc *efunc);  extern ExtEvalFunc *GetGlassBoxFinal(struct ExternalFunc *efunc);
560    
   
 /** This macro should go away when bboxes done or when user is tired  
 of whinage. */  
 #define BBOXWHINE  
   
   
561  #endif /* ASC_EXTFUNC_H */  #endif /* ASC_EXTFUNC_H */

Legend:
Removed from v.911  
changed lines
  Added in v.912

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