00001 /* Filename: interrogate_request.h 00002 * Created by: drose (01Aug00) 00003 * 00004 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00005 * 00006 * PANDA 3D SOFTWARE 00007 * Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 * 00009 * All use of this software is subject to the terms of the Panda 3d 00010 * Software license. You should have received a copy of this license 00011 * along with this source code; you will also find a current copy of 00012 * the license at http://www.panda3d.org/license.txt . 00013 * 00014 * To contact the maintainers of this program write to 00015 * panda3d@yahoogroups.com . 00016 * 00017 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00018 00019 #ifndef INTERROGATE_REQUEST 00020 #define INTERROGATE_REQUEST 00021 00022 #include <dtoolbase.h> 00023 00024 /* 00025 * The functions here are simple functions that are intended to be 00026 * called during static init time for the various libraries that 00027 * contain interrogate data. They provide interfaces to add the 00028 * module's interrogate data to the main interrogate database. 00029 * 00030 * The interface is entirely C here--no C++--so that it may be called 00031 * from C modules if required. 00032 */ 00033 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 00040 /* 00041 * This is the simplest interface. It just requests that the given 00042 * database filename (*.in) be read in. This makes the interrogate 00043 * data available, but doesn't allow matching the database information 00044 * up with any compiled-in function wrappers or anything. 00045 */ 00046 EXPCL_DTOOLCONFIG void interrogate_request_database(const char *database_filename); 00047 00048 00049 00050 /* The more sophisticated interface uses these structures. */ 00051 00052 typedef struct { 00053 const char *name; 00054 int index_offset; 00055 } InterrogateUniqueNameDef; 00056 00057 typedef struct { 00058 int file_identifier; 00059 00060 const char *library_name; 00061 const char *library_hash_name; 00062 const char *module_name; 00063 const char *database_filename; 00064 00065 InterrogateUniqueNameDef *unique_names; 00066 int num_unique_names; 00067 00068 void **fptrs; 00069 int num_fptrs; 00070 00071 int first_index; 00072 int next_index; 00073 } InterrogateModuleDef; 00074 00075 00076 /* 00077 * This requests that the given module be loaded and made available. 00078 * This includes all of the function pointers and/or unique names that 00079 * might be compiled in. 00080 */ 00081 EXPCL_DTOOLCONFIG void interrogate_request_module(InterrogateModuleDef *def); 00082 00083 #ifdef TRACK_IN_INTERPRETER 00084 /* 00085 * If we're tracking whether we're currently running in Python code 00086 * (mainly for the purpose of debug logging from memory allocation 00087 * callbacks), this variable will record that state. It will be set 00088 * true whenever we return to Python code, and false whenever we are 00089 * entering local C or C++ code. The flag will be toggled off and 00090 * on within each generated Python wrapper function. 00091 * 00092 * This will mis-categorize some code that runs at static 00093 * initialization time, but it will correctly identify the vast 00094 * majority of code. 00095 */ 00096 EXPCL_DTOOLCONFIG extern int in_interpreter; 00097 #endif // TRACK_IN_INTERPRETER 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #endif 00104