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 |
/* |
/* |
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){ |
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"); |
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 |
|
} |