00001 /* ASCEND modelling environment 00002 Copyright (C) 2006 Carnegie Mellon University 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 *//* 00023 by John Pye 00024 Created Sept 7, 2006 00025 */ 00026 00027 #ifndef IMPORTHANDLER_H 00028 #define IMPORTHANDLER_H 00029 00030 #include <utilities/ascConfig.h> 00031 #include <general/ospath.h> 00032 00033 /*------------------------------------------------------------------------------ 00034 DATA STRUCTURES AND TYPES 00035 */ 00036 00045 typedef char *ImportHandlerCreateFilenameFn(const char *partialname); 00046 00060 typedef int ImportHandlerImportFn(const struct FilePath *fp,const char *initfunc, const char *partialpath); 00061 00062 struct ImportHandler{ 00063 const char *name; 00064 ImportHandlerCreateFilenameFn *filenamefn; 00065 ImportHandlerImportFn *importfn; 00066 }; 00067 00072 extern struct ImportHandler **ImportHandlerLibrary; 00073 00078 ASC_DLLSPEC int importhandler_add(struct ImportHandler *handler); 00079 00086 int importhandler_attemptimport(const char *partialname,const char *defaultpath, const char *pathenvvar); 00087 00088 /*------------------------------------------------------------------------------ 00089 FUNCTIONS FOR IMPORT OF DLL/SO external libraries 00090 */ 00091 ImportHandlerCreateFilenameFn importhandler_extlib_filename; 00092 ImportHandlerImportFn importhandler_extlib_import; 00093 00094 /*------------------------------------------------------------------------------ 00095 LIST-BASED FUNCTIONS related to IMPORT handler 'library' 00096 */ 00097 00098 int importhandler_remove(const char *name); 00099 struct ImportHandler *importhandler_lookup(const char *name); 00100 ASC_DLLSPEC int importhandler_destroylibrary(); 00101 int importhandler_createlibrary(); 00102 int importhandler_printlibrary(FILE *fp); 00103 int importhandler_printhandler(FILE *fp, struct ImportHandler *); 00104 00105 /*------------------------------------------------------------------------------ 00106 PATH SEARCH ROUTINES 00107 */ 00108 00122 struct FilePath *importhandler_findinpath(const char *partialname 00123 , char *defaultpath, char *envv, struct ImportHandler **handler 00124 ); 00125 00126 /*------------------------------------------------------------------------------ 00127 SHARED POINTER TABLE 00128 */ 00129 00136 ASC_DLLSPEC int importhandler_createsharedpointertable(); 00137 00146 ASC_DLLSPEC int importhandler_setsharedpointer(const char *key, void *ptr); 00147 00155 ASC_DLLSPEC void *importhandler_getsharedpointer(const char *key); 00156 00157 #endif
1.5.1