1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/sourcepawn/compiler/binreloc.h Thu Jan 25 20:08:00 2007 +0000
1.3 @@ -0,0 +1,80 @@
1.4 +/*
1.5 + * BinReloc - a library for creating relocatable executables
1.6 + * Written by: Hongli Lai <[email protected]>
1.7 + * http://autopackage.org/
1.8 + *
1.9 + * This source code is public domain. You can relicense this code
1.10 + * under whatever license you want.
1.11 + *
1.12 + * See http://autopackage.org/docs/binreloc/ for
1.13 + * more information and how to use this.
1.14 + */
1.15 +
1.16 +#ifndef __BINRELOC_H__
1.17 +#define __BINRELOC_H__
1.18 +
1.19 +#ifdef __cplusplus
1.20 +extern "C" {
1.21 +#endif /* __cplusplus */
1.22 +
1.23 +
1.24 +/** These error codes can be returned by br_init(), br_init_lib(), gbr_init() or gbr_init_lib(). */
1.25 +typedef enum {
1.26 + /** Cannot allocate memory. */
1.27 + BR_INIT_ERROR_NOMEM,
1.28 + /** Unable to open /proc/self/maps; see errno for details. */
1.29 + BR_INIT_ERROR_OPEN_MAPS,
1.30 + /** Unable to read from /proc/self/maps; see errno for details. */
1.31 + BR_INIT_ERROR_READ_MAPS,
1.32 + /** The file format of /proc/self/maps is invalid; kernel bug? */
1.33 + BR_INIT_ERROR_INVALID_MAPS,
1.34 + /** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */
1.35 + BR_INIT_ERROR_DISABLED
1.36 +} BrInitError;
1.37 +
1.38 +
1.39 +#ifndef BINRELOC_RUNNING_DOXYGEN
1.40 +/* Mangle symbol names to avoid symbol collisions with other ELF objects. */
1.41 + #define br_init SbCJ22537442193159_br_init
1.42 + #define br_init_lib SbCJ22537442193159_br_init_lib
1.43 + #define br_find_exe SbCJ22537442193159_br_find_exe
1.44 + #define br_find_exe_dir SbCJ22537442193159_br_find_exe_dir
1.45 + #define br_find_prefix SbCJ22537442193159_br_find_prefix
1.46 + #define br_find_bin_dir SbCJ22537442193159_br_find_bin_dir
1.47 + #define br_find_sbin_dir SbCJ22537442193159_br_find_sbin_dir
1.48 + #define br_find_data_dir SbCJ22537442193159_br_find_data_dir
1.49 + #define br_find_locale_dir SbCJ22537442193159_br_find_locale_dir
1.50 + #define br_find_lib_dir SbCJ22537442193159_br_find_lib_dir
1.51 + #define br_find_libexec_dir SbCJ22537442193159_br_find_libexec_dir
1.52 + #define br_find_etc_dir SbCJ22537442193159_br_find_etc_dir
1.53 + #define br_strcat SbCJ22537442193159_br_strcat
1.54 + #define br_build_path SbCJ22537442193159_br_build_path
1.55 + #define br_dirname SbCJ22537442193159_br_dirname
1.56 +
1.57 +
1.58 +#endif
1.59 +int br_init (BrInitError *error);
1.60 +int br_init_lib (BrInitError *error);
1.61 +
1.62 +char *br_find_exe (const char *default_exe);
1.63 +char *br_find_exe_dir (const char *default_dir);
1.64 +char *br_find_prefix (const char *default_prefix);
1.65 +char *br_find_bin_dir (const char *default_bin_dir);
1.66 +char *br_find_sbin_dir (const char *default_sbin_dir);
1.67 +char *br_find_data_dir (const char *default_data_dir);
1.68 +char *br_find_locale_dir (const char *default_locale_dir);
1.69 +char *br_find_lib_dir (const char *default_lib_dir);
1.70 +char *br_find_libexec_dir (const char *default_libexec_dir);
1.71 +char *br_find_etc_dir (const char *default_etc_dir);
1.72 +
1.73 +/* Utility functions */
1.74 +char *br_strcat (const char *str1, const char *str2);
1.75 +char *br_build_path (const char *dir, const char *file);
1.76 +char *br_dirname (const char *path);
1.77 +
1.78 +
1.79 +#ifdef __cplusplus
1.80 +}
1.81 +#endif /* __cplusplus */
1.82 +
1.83 +#endif /* __BINRELOC_H__ */