/[ascend]/trunk/ascend/compiler/importhandler.c
ViewVC logotype

Diff of /trunk/ascend/compiler/importhandler.c

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

revision 2335 by jpye, Fri Dec 24 05:11:35 2010 UTC revision 2336 by jpye, Sun Dec 26 03:44:24 2010 UTC
# Line 183  int importhandler_extlib_import(const st Line 183  int importhandler_extlib_import(const st
183          result = Asc_DynamicLoad(path,initfunc);          result = Asc_DynamicLoad(path,initfunc);
184      }      }
185    
186    #ifdef IMPORT_DEBUG
187      if(result){      if(result){
188          CONSOLE_DEBUG("FAILED TO IMPORT '%s' (error %d)",partialpath,result);          CONSOLE_DEBUG("FAILED TO IMPORT '%s' (error %d)",partialpath,result);
189      }else{      }else{
# Line 192  int importhandler_extlib_import(const st Line 193  int importhandler_extlib_import(const st
193              CONSOLE_DEBUG("'%s' OK (explicitly named, got file '%s')",initfunc,path);              CONSOLE_DEBUG("'%s' OK (explicitly named, got file '%s')",initfunc,path);
194          }          }
195      }      }
196    #endif
197    
198      ASC_FREE(path);      ASC_FREE(path);
199      return result;      return result;
# Line 253  struct ImportHandler *importhandler_look Line 255  struct ImportHandler *importhandler_look
255  int importhandler_destroylibrary(){  int importhandler_destroylibrary(){
256      int i;      int i;
257      int err = 0, thiserr;      int err = 0, thiserr;
258    #ifdef IMPORT_DEBUG
259      CONSOLE_DEBUG("Destroying importhandler library...");      CONSOLE_DEBUG("Destroying importhandler library...");
260    #endif
261      ///importhandler_printlibrary(stderr);      ///importhandler_printlibrary(stderr);
262      if(importhandler_library!=NULL){      if(importhandler_library!=NULL){
263          for(i=IMPORTHANDLER_MAX - 1; i >= 0; --i){          for(i=IMPORTHANDLER_MAX - 1; i >= 0; --i){
# Line 261  int importhandler_destroylibrary(){ Line 265  int importhandler_destroylibrary(){
265              thiserr = importhandler_destroy(importhandler_library[i]);              thiserr = importhandler_destroy(importhandler_library[i]);
266              if(!thiserr){              if(!thiserr){
267                  importhandler_library[i] = NULL;                  importhandler_library[i] = NULL;
268    #ifdef IMPORT_DEBUG
269                  CONSOLE_DEBUG("Destroyed import handler");                  CONSOLE_DEBUG("Destroyed import handler");
270    #endif
271              }              }
272              err = err | thiserr;              err = err | thiserr;
273          }          }
# Line 347  int importhandler_search_test(struct Fil Line 353  int importhandler_search_test(struct Fil
353    
354          filename = (*(importhandler_library[i]->filenamefn))(searchdata->partialname); /* eg 'myext' -> 'libmyext.so' */          filename = (*(importhandler_library[i]->filenamefn))(searchdata->partialname); /* eg 'myext' -> 'libmyext.so' */
355          if(filename==NULL){          if(filename==NULL){
356    #ifdef SEARCH_DEBUG
357              CONSOLE_DEBUG("Unable to create filename from partialname '%s'",searchdata->partialname);              CONSOLE_DEBUG("Unable to create filename from partialname '%s'",searchdata->partialname);
358    #endif
359              continue;              continue;
360          }          }
361          /* CONSOLE_DEBUG("Filename '%s'",filename); */          /* CONSOLE_DEBUG("Filename '%s'",filename); */
# Line 418  struct FilePath *importhandler_findinpat Line 426  struct FilePath *importhandler_findinpat
426    
427      searchdata.partialname = ospath_getbasefilename(fp1);      searchdata.partialname = ospath_getbasefilename(fp1);
428      if(searchdata.partialname==NULL){      if(searchdata.partialname==NULL){
429    #ifdef FIND_DEBUG
430          CONSOLE_DEBUG("Not a filename");          CONSOLE_DEBUG("Not a filename");
431    #endif
432          ospath_free(fp1);          ospath_free(fp1);
433          return NULL;          return NULL;
434      }      }
# Line 445  struct FilePath *importhandler_findinpat Line 455  struct FilePath *importhandler_findinpat
455    
456          filename = (*(importhandler_library[i]->filenamefn))(searchdata.partialname); /* eg 'myext' -> 'libmyext.so' */          filename = (*(importhandler_library[i]->filenamefn))(searchdata.partialname); /* eg 'myext' -> 'libmyext.so' */
457          if(filename==NULL){          if(filename==NULL){
458    #ifdef FIND_DEBUG
459              CONSOLE_DEBUG("Unable to create filename from partialname '%s'",searchdata.partialname);              CONSOLE_DEBUG("Unable to create filename from partialname '%s'",searchdata.partialname);
460    #endif
461              continue;              continue;
462          }          }
463    
# Line 485  struct FilePath *importhandler_findinpat Line 497  struct FilePath *importhandler_findinpat
497  #endif  #endif
498    
499          if(0==ospath_stat(fp1,&buf) && NULL!=(f = ospath_fopen(fp1,"r"))){          if(0==ospath_stat(fp1,&buf) && NULL!=(f = ospath_fopen(fp1,"r"))){
500    #ifdef FIND_DEBUG
501              CONSOLE_DEBUG("Found in current directory!");              CONSOLE_DEBUG("Found in current directory!");
502    #endif
503              fclose(f);              fclose(f);
504              ASC_FREE(searchdata.partialname);              ASC_FREE(searchdata.partialname);
505              ospath_free(searchdata.relativedir);              ospath_free(searchdata.relativedir);

Legend:
Removed from v.2335  
changed lines
  Added in v.2336

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