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

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

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

revision 868 by johnpye, Fri Sep 29 06:22:21 2006 UTC revision 869 by johnpye, Wed Oct 4 14:03:46 2006 UTC
# Line 30  Line 30 
30  #include <utilities/ascDynaLoad.h>  #include <utilities/ascDynaLoad.h>
31  #include <utilities/ascPanic.h>  #include <utilities/ascPanic.h>
32  #include <utilities/ascEnvVar.h>  #include <utilities/ascEnvVar.h>
33    #include <general/table.h>
34  #include "importhandler.h"  #include "importhandler.h"
35    
36  /*  /*
# Line 44  Line 45 
45  */  */
46  struct ImportHandler **importhandler_library=NULL;  struct ImportHandler **importhandler_library=NULL;
47    
48    /**
49        Table of registered pointers for use in passing GUI data out to external scripts.
50    */
51    struct Table *importhandler_sharedpointers=NULL;
52    
53  ASC_DLLSPEC(int) importhandler_add(struct ImportHandler *handler){  ASC_DLLSPEC(int) importhandler_add(struct ImportHandler *handler){
54      int i;      int i;
55      if(handler==NULL){      if(handler==NULL){
# Line 351  struct FilePath *importhandler_findinpat Line 357  struct FilePath *importhandler_findinpat
357          return NULL;          return NULL;
358      }      }
359    
   
360      searchdata.relativedir = ospath_getdir(fp1);      searchdata.relativedir = ospath_getdir(fp1);
361      if(searchdata.relativedir ==NULL){      if(searchdata.relativedir ==NULL){
362          ERROR_REPORTER_HERE(ASC_PROG_ERR,"unable to retrieve file dir");          ERROR_REPORTER_HERE(ASC_PROG_ERR,"unable to retrieve file dir");
# Line 388  struct FilePath *importhandler_findinpat Line 393  struct FilePath *importhandler_findinpat
393      *handler = searchdata.handler;      *handler = searchdata.handler;
394      return searchdata.foundpath;      return searchdata.foundpath;
395  }  }
396    
397    /*------------------------------------------------------------------------------
398      SHARED POINTER TABLE
399    */
400    
401    int importhandler_createsharedpointertable(){
402        if(importhandler_sharedpointers==NULL){
403            CONSOLE_DEBUG("CREATED SHARED POINTER TABLE");
404            importhandler_sharedpointers = CreateTable(31);
405        }
406        return 0;
407    }
408    
409    int importhandler_setsharedpointer(const char *key, void *ptr){
410        importhandler_createsharedpointertable();
411        if(key==NULL){
412            ERROR_REPORTER_HERE(ASC_PROG_ERR,"key is NULL");
413            return 1;
414        }
415        AddTableData(importhandler_sharedpointers,ptr,key);
416        return 0;
417    }      
418    
419    void *importhandler_getsharedpointer(const char *key){
420        importhandler_createsharedpointertable();
421        if(key==NULL){
422            ERROR_REPORTER_HERE(ASC_PROG_ERR,"key is NULL");
423            return 1;
424        }
425        return LookupTableData(importhandler_sharedpointers,key);
426    }

Legend:
Removed from v.868  
changed lines
  Added in v.869

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