00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _PREFIX_H_
00018 #define _PREFIX_H_
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #undef BR_NAMESPACE
00036 #define BR_NAMESPACE(funcName) funcName
00037
00038
00039 #ifdef ENABLE_BINRELOC
00040
00041 #define br_thread_local_store BR_NAMESPACE(br_thread_local_store)
00042 #define br_locate BR_NAMESPACE(br_locate)
00043 #define br_locate_prefix BR_NAMESPACE(br_locate_prefix)
00044 #define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix)
00045
00046 #ifndef BR_NO_MACROS
00047
00048
00049 #undef SELFPATH
00050 #undef PREFIX
00051 #undef PREFIXDIR
00052 #undef BINDIR
00053 #undef SBINDIR
00054 #undef DATADIR
00055 #undef LIBDIR
00056 #undef LIBEXECDIR
00057 #undef ETCDIR
00058 #undef SYSCONFDIR
00059 #undef CONFDIR
00060 #undef LOCALEDIR
00061
00062 #define BR_LOCATE_CHAR( x ) br_locate(const_cast< void * >(static_cast< void const * >( x ) ) )
00063 #define BR_LOCATE_PREFIX_CHAR( x ) br_locate_prefix(const_cast< void * >(static_cast< void const * >( x ) ) )
00064 #define BR_PREPEND_PREFIX_CHAR( x ) br_prepend_prefix(const_cast< void * >(static_cast< void const * >( x ) ) )
00065
00066 #define SELFPATH (br_thread_local_store (BR_LOCATE_CHAR("")))
00067 #define PREFIX (br_thread_local_store (BR_LOCATE_PREFIX_CHAR ((void *) "")))
00068 #define PREFIXDIR (br_thread_local_store (BR_LOCATE_PREFIX_CHAR ((void *) "")))
00069 #define BINDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/bin")))
00070 #define SBINDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/sbin")))
00071 #define DATADIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/share")))
00072 #define LIBDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/lib")))
00073 #define LIBEXECDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/libexec")))
00074 #define ETCDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/etc")))
00075 #define SYSCONFDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/etc")))
00076 #define CONFDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/etc")))
00077 #define LOCALEDIR (br_thread_local_store (BR_PREPEND_PREFIX_CHAR ((void *) "", "/share/locale")))
00078 #endif
00079
00080
00081
00082
00083
00084 char *br_locate (void *symbol);
00085 char *br_locate_prefix (void *symbol);
00086 char *br_prepend_prefix (void *symbol, char *path);
00087
00088 #endif
00089
00090 const char *br_thread_local_store (char *str);
00091
00092
00093
00094
00095
00096
00097 #define br_strcat BR_NAMESPACE(br_strcat)
00098 #define br_extract_dir BR_NAMESPACE(br_extract_dir)
00099 #define br_extract_prefix BR_NAMESPACE(br_extract_prefix)
00100 #define br_set_locate_fallback_func BR_NAMESPACE(br_set_locate_fallback_func)
00101
00102 #ifndef BR_NO_MACROS
00103 #ifndef ENABLE_BINRELOC
00104 #define BR_SELFPATH(suffix) SELFPATH suffix
00105 #define BR_PREFIX(suffix) PREFIX suffix
00106 #define BR_PREFIXDIR(suffix) BR_PREFIX suffix
00107 #define BR_BINDIR(suffix) BINDIR suffix
00108 #define BR_SBINDIR(suffix) SBINDIR suffix
00109 #define BR_DATADIR(suffix) DATADIR suffix
00110 #define BR_LIBDIR(suffix) LIBDIR suffix
00111 #define BR_LIBEXECDIR(suffix) LIBEXECDIR suffix
00112 #define BR_ETCDIR(suffix) ETCDIR suffix
00113 #define BR_SYSCONFDIR(suffix) SYSCONFDIR suffix
00114 #define BR_CONFDIR(suffix) CONFDIR suffix
00115 #define BR_LOCALEDIR(suffix) LOCALEDIR suffix
00116 #else
00117 #define BR_SELFPATH(suffix) (br_thread_local_store (br_strcat (SELFPATH, suffix)))
00118 #define BR_PREFIX(suffix) (br_thread_local_store (br_strcat (PREFIX, suffix)))
00119 #define BR_PREFIXDIR(suffix) (br_thread_local_store (br_strcat (BR_PREFIX, suffix)))
00120 #define BR_BINDIR(suffix) (br_thread_local_store (br_strcat (BINDIR, suffix)))
00121 #define BR_SBINDIR(suffix) (br_thread_local_store (br_strcat (SBINDIR, suffix)))
00122 #define BR_DATADIR(suffix) (br_thread_local_store (br_strcat (DATADIR, suffix)))
00123 #define BR_LIBDIR(suffix) (br_thread_local_store (br_strcat (LIBDIR, suffix)))
00124 #define BR_LIBEXECDIR(suffix) (br_thread_local_store (br_strcat (LIBEXECDIR, suffix)))
00125 #define BR_ETCDIR(suffix) (br_thread_local_store (br_strcat (ETCDIR, suffix)))
00126 #define BR_SYSCONFDIR(suffix) (br_thread_local_store (br_strcat (SYSCONFDIR, suffix)))
00127 #define BR_CONFDIR(suffix) (br_thread_local_store (br_strcat (CONFDIR, suffix)))
00128 #define BR_LOCALEDIR(suffix) (br_thread_local_store (br_strcat (LOCALEDIR, suffix)))
00129 #endif
00130 #endif
00131
00132 char *br_strcat (const char *str1, const char *str2);
00133 char *br_extract_dir (const char *path);
00134 char *br_extract_prefix(const char *path);
00135 typedef char *(*br_locate_fallback_func) (void *symbol, void *data);
00136 void br_set_locate_fallback_func (br_locate_fallback_func func, void *data);
00137
00138
00139 #ifdef __cplusplus
00140 }
00141 #endif
00142
00143 #endif