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

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

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

revision 751 by johnpye, Wed Jul 5 12:36:29 2006 UTC revision 752 by johnpye, Wed Jul 12 02:50:54 2006 UTC
# Line 51  static struct Table *ExternalFuncLibrary Line 51  static struct Table *ExternalFuncLibrary
51  */  */
52    
53  int CreateUserFunctionBlackBox(CONST char *name,  int CreateUserFunctionBlackBox(CONST char *name,
54                 ExtBBoxInitFunc *init,          ExtBBoxInitFunc *init,
55                 ExtBBoxFunc *value,          ExtBBoxFunc *value,
56                 ExtBBoxFunc *deriv,          ExtBBoxFunc *deriv,
57                 ExtBBoxFunc *deriv2,          ExtBBoxFunc *deriv2,
58                 ExtBBoxInitFunc *final,          ExtBBoxInitFunc *final,
59                 CONST unsigned long n_inputs,          CONST unsigned long n_inputs,
60                 CONST unsigned long n_outputs,          CONST unsigned long n_outputs,
61                 CONST char *help)          CONST char *help
62  {  ){
63    struct ExternalFunc *efunc;    struct ExternalFunc *efunc;
64    int isNew = 0;    int isNew = 0;
65    if (name == NULL) {    if(name == NULL){
66      return 1;      return 1;
67    }    }
68    efunc = LookupExtFunc(name);    efunc = LookupExtFunc(name);
69    if (efunc != NULL) {    if(efunc != NULL){
70      /* CONSOLE_DEBUG("Found efunc at %p",efunc); */      /* CONSOLE_DEBUG("Found efunc at %p",efunc); */
71      /* name has already been seen, so now fill in the details */      /* name has already been seen, so now fill in the details */
72      isNew = 0;      isNew = 0;
# Line 89  int CreateUserFunctionBlackBox(CONST cha Line 89  int CreateUserFunctionBlackBox(CONST cha
89    efunc->u.black.deriv = deriv;    efunc->u.black.deriv = deriv;
90    efunc->u.black.deriv2 = deriv2;    efunc->u.black.deriv2 = deriv2;
91    efunc->u.black.final = final;    efunc->u.black.final = final;
92    if (help) {    if(help){
93      if (efunc->help) ascfree((char *)efunc->help);      if (efunc->help) ascfree((char *)efunc->help);
94      efunc->help = ascstrdup(help);      efunc->help = ascstrdup(help);
95    } else {    }else{
96      efunc->help = NULL;      efunc->help = NULL;
97    }    }
98    
99    if (isNew) {    if(isNew){
100      CONSOLE_DEBUG("NEW BLACKBOX EFUNC %p ('%s', %lu inputs, %lu outputs, type=%d, value func=%p)"      CONSOLE_DEBUG("NEW BLACKBOX EFUNC %p ('%s', %lu inputs, %lu outputs, type=%d, value func=%p)"
101          ,efunc, name, n_inputs, n_outputs, (int)efunc->etype, value          ,efunc, name, n_inputs, n_outputs, (int)efunc->etype, value
102      );      );
# Line 105  int CreateUserFunctionBlackBox(CONST cha Line 105  int CreateUserFunctionBlackBox(CONST cha
105    return 0;    return 0;
106  }  }
107    
   
108  ExtBBoxInitFunc * GetInitFunc(struct ExternalFunc *efunc){  ExtBBoxInitFunc * GetInitFunc(struct ExternalFunc *efunc){
109    asc_assert(efunc!=NULL);    asc_assert(efunc!=NULL);
110    /* return (ExtBBoxInitFunc*)efunc->u.black.init; */    /* return (ExtBBoxInitFunc*)efunc->u.black.init; */
# Line 366  int AddExternalFunc(struct ExternalFunc Line 365  int AddExternalFunc(struct ExternalFunc
365          return 1;          return 1;
366      }else{      }else{
367          /* need to add function to library */          /* need to add function to library */
368          /* CONSOLE_DEBUG("EFUNC not found, adding pointer %p for efunc to table under name '%s'.",efunc,name); */          CONSOLE_DEBUG("Adding external function '%s' (at %p).",name,efunc);
369          AddTableData(ExternalFuncLibrary,(void *)efunc,name);          AddTableData(ExternalFuncLibrary,(void *)efunc,name);
370          return 1;          return 1;
371      }      }

Legend:
Removed from v.751  
changed lines
  Added in v.752

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