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

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

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

revision 533 by johnpye, Sat Apr 22 06:26:23 2006 UTC revision 534 by johnpye, Tue Apr 25 13:25:04 2006 UTC
# Line 146  int Builtins_Init(void) Line 146  int Builtins_Init(void)
146  # ifdef DYNAMIC_PACKAGES  # ifdef DYNAMIC_PACKAGES
147  static char path_var[PATH_MAX];  static char path_var[PATH_MAX];
148    
149    
150    #ifdef __WIN32__
151    # define ASC_PATHSEP ';'
152    # define ASC_SLASH '\\'
153    #else
154    # define ASC_PATHSEP ':'
155    # define ASC_SLASH '/'
156    #endif
157    
158  /**  /**
159      Search the archive library path for a file matching the given      Search the archive library path for a file matching the given
160      (platform specific, with extension?) library filename.      (platform specific, with extension?) library filename.
# Line 163  char *SearchArchiveLibraryPath(CONST cha Line 172  char *SearchArchiveLibraryPath(CONST cha
172    register CONST char *t;    register CONST char *t;
173    register unsigned length;    register unsigned length;
174    register FILE *f;    register FILE *f;
175    /* ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Env var for user packages is '%s'\n",envv); */    CONSOLE_DEBUG("NAME = %s",name);
176    /* ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Search path for user packages is '%s'\n",getenv(envv)); */    CONSOLE_DEBUG("Library being searched for is '%s'\n",name);
177      CONSOLE_DEBUG("Env var for user packages is '%s'\n",envv);
178      CONSOLE_DEBUG("Search path for user packages is '%s'\n",getenv(envv));
179    if ((path=getenv(envv))==NULL)    if ((path=getenv(envv))==NULL)
180      path=dpath;      path=dpath;
181    while(isspace(*path)) path++;    while(isspace(*path)) path++;
182    while(*path!='\0'){    while(*path!='\0'){
183      if (*path==':') path++;      if (*path==ASC_PATHSEP) path++;
184      else{      else{
185        length = 0;        length = 0;
186        /* copy next directory into array */        /* copy next directory into array */
187        while((*path!=':')&&(*path!='\0')&&(!isspace(*path)))        while((*path!=ASC_PATHSEP)&&(*path!='\0')&&(!isspace(*path))){
188          path_var[length++] = *(path++);          if(*path=='/'){
189                path_var[length++] = ASC_SLASH; path++;
190            }else{
191                path_var[length++] = *(path++);
192            }
193          }
194    
195          /* add a trailing slash to the path component */
196        if (path_var[length-1]!='/')        if (path_var[length-1]!='/')
197          path_var[length++]='/';          path_var[length++]=ASC_SLASH;
198    
199        /* copy file name into array */        /* copy file name into array */
200        for(t=name;*t!='\0';){        for(t=name;*t!='\0';){
201          path_var[length++] = *(t++);          if(*t=='/'){
202              path_var[length++] = ASC_SLASH; t++;
203            }else{
204              path_var[length++] = *(t++);
205            }
206        }        }
207        path_var[length]='\0';        path_var[length]='\0';
208    
209        /* ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Searching for for '%s' at '%s'\n",name, path_var); */        ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Searching for '%s' at '%s'\n",name, path_var);
210    
211        if ((f= fopen(path_var,"r"))!=NULL){        if ((f= fopen(path_var,"r"))!=NULL){
212          result = path_var;          result = path_var;
# Line 294  int StaticPackages_Init(void) Line 316  int StaticPackages_Init(void)
316  {  {
317    int result = 0;    int result = 0;
318    
319    char sensitivity_help[] =    result += sensitivity_register();
320      "This function does sensitivity analysis dy/dx. It requires 4 args:\n"    result += kvalues_register();
     "  1. name: name of a reference instance or SELF.\n"  
     "  2. x: x, where x is an array of > solver_var.\n"  
     "  3. y: where y is an array of > solver_var.\n"  
     "  4. dy/dx: which dy_dx[1..n_y][1..n_x].";  
   
   result = CreateUserFunctionMethod("do_solve",  
                   do_solve_eval,  
                   2,NULL); /* was 2,0,null */  
   result += CreateUserFunctionMethod("do_finite_difference",  
                    do_finite_diff_eval,  
                    4,NULL); /* 4,0,null */  
   result += CreateUserFunctionMethod("do_sensitivity",  
                    do_sensitivity_eval,  
                    4,sensitivity_help);  
   result += CreateUserFunctionMethod("do_sensitivity_all",  
                    do_sensitivity_eval_all,  
                    4,"See do_sensitivity_eval for details");  
   
   result += KValues_Init();  
321    
322    return result;    return result;
323  }  }

Legend:
Removed from v.533  
changed lines
  Added in v.534

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