diff options
Diffstat (limited to 'src/xlibi18n/XlcDL.c')
-rw-r--r-- | src/xlibi18n/XlcDL.c | 150 |
1 files changed, 60 insertions, 90 deletions
diff --git a/src/xlibi18n/XlcDL.c b/src/xlibi18n/XlcDL.c index 126cbff..24200f5 100644 --- a/src/xlibi18n/XlcDL.c +++ b/src/xlibi18n/XlcDL.c @@ -41,7 +41,7 @@ interest in or to any trademark, service mark, logo or trade name of Sun Microsystems, Inc. or its licensors is granted. */ -/* $XFree86: xc/lib/X11/XlcDL.c,v 1.9.2.1 2003/03/11 23:18:49 herrb Exp $ */ +/* $XFree86: xc/lib/X11/XlcDL.c,v 1.13 2003/11/17 22:20:10 dawes Exp $ */ #include <stdio.h> #if defined(hpux) @@ -55,18 +55,15 @@ Sun Microsystems, Inc. or its licensors is granted. #include "XlcPublic.h" #include "XlcPubI.h" -#ifdef _LP64 -# if defined(__sparcv9) -# define _MACH64_NAME "sparcv9" -# elif defined(__ia64__) -# undef MACH64_NAME -# else -# error "Unknown architecture" -# endif /* defined(__sparcv9) */ -# ifdef _MACH64_NAME +#if defined(_LP64) && defined(__sparcv9) +# define _MACH64_NAME "sparcv9" +#else +# undef _MACH64_NAME +#endif /* defined(_LP64) && defined(__sparcv9) */ + +#ifdef _MACH64_NAME # define _MACH64_NAME_LEN (sizeof (_MACH64_NAME) - 1) -# endif -#endif /* _LP64 */ +#endif #define XI18N_DLREL 2 @@ -102,10 +99,7 @@ static XI18NObjectsListRec *xi18n_objects_list = NULL; static int lc_count = 0; static int -parse_line(line, argv, argsize) -char *line; -char **argv; -int argsize; +parse_line(char *line, char **argv, int argsize) { int argc = 0; char *p = line; @@ -162,9 +156,7 @@ try_both_dlsym (void *handle, char *name) #endif static void -resolve_object(path, lc_name) -char *path; -char *lc_name; +resolve_object(char *path, const char *lc_name) { char filename[BUFSIZ]; FILE *fp; @@ -235,9 +227,7 @@ Limit the length of path to prevent stack buffer corruption. } static char* -__lc_path(dl_name, lc_dir) -const char *dl_name; -const char *lc_dir; +__lc_path(const char *dl_name, const char *lc_dir) { char *path; size_t len; @@ -313,9 +303,9 @@ const char *lc_dir; * in XLCd */ static Bool -open_object (object, lc_dir) - XI18NObjectsList object; - char *lc_dir; +open_object( + XI18NObjectsList object, + char *lc_dir) { char *path; @@ -339,9 +329,9 @@ open_object (object, lc_dir) } static void * -fetch_symbol (object, symbol) - XI18NObjectsList object; - char *symbol; +fetch_symbol( + XI18NObjectsList object, + char *symbol) { void *result = NULL; #if defined(hpux) @@ -374,8 +364,7 @@ fetch_symbol (object, symbol) } static void -close_object (object) - XI18NObjectsList object; +close_object(XI18NObjectsList object) { object->refcount--; if (object->refcount == 0) @@ -390,16 +379,13 @@ close_object (object) } +typedef XLCd (*dynamicLoadProc)(const char *); + XLCd -#if NeedFunctionPrototypes _XlcDynamicLoad(const char *lc_name) -#else -_XlcDynamicLoad(lc_name) - const char *lc_name; -#endif { XLCd lcd = (XLCd)NULL; - XLCd (*lc_loader)() = (XLCd(*)())NULL; + dynamicLoadProc lc_loader = (dynamicLoadProc)NULL; int count; XI18NObjectsList objects_list; char lc_dir[BUFSIZE]; @@ -419,7 +405,7 @@ _XlcDynamicLoad(lc_name) if (!open_object (objects_list, lc_dir)) continue; - lc_loader = (XLCd(*)())fetch_symbol (objects_list, objects_list->open); + lc_loader = (dynamicLoadProc)fetch_symbol (objects_list, objects_list->open); if (!lc_loader) continue; lcd = (*lc_loader)(lc_name); if (lcd != (XLCd)NULL) { @@ -431,22 +417,17 @@ _XlcDynamicLoad(lc_name) return (XLCd)lcd; } + +typedef XIM (*dynamicOpenProcp)(XLCd, Display *, XrmDatabase, char *, char *); + static XIM -#if NeedFunctionPrototypes _XDynamicOpenIM(XLCd lcd, Display *display, XrmDatabase rdb, char *res_name, char *res_class) -#else -_XDynamicOpenIM(lcd, display, rdb, res_name, res_class) -XLCd lcd; -Display *display; -XrmDatabase rdb; -char *res_name, *res_class; -#endif { XIM im = (XIM)NULL; char lc_dir[BUFSIZE]; char *lc_name; - XIM (*im_openIM)() = (XIM(*)())NULL; + dynamicOpenProcp im_openIM = (dynamicOpenProcp)NULL; int count; XI18NObjectsList objects_list = xi18n_objects_list; @@ -462,7 +443,7 @@ char *res_name, *res_class; if (!open_object (objects_list, lc_dir)) continue; - im_openIM = (XIM(*)())fetch_symbol(objects_list, objects_list->open); + im_openIM = (dynamicOpenProcp)fetch_symbol(objects_list, objects_list->open); if (!im_openIM) continue; im = (*im_openIM)(lcd, display, rdb, res_name, res_class); if (im != (XIM)NULL) { @@ -474,20 +455,22 @@ char *res_name, *res_class; return (XIM)im; } +typedef Bool (*dynamicRegisterCBProcp)( + XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer); + static Bool -_XDynamicRegisterIMInstantiateCallback(lcd, display, rdb, - res_name, res_class, - callback, client_data) -XLCd lcd; -Display *display; -XrmDatabase rdb; -char *res_name, *res_class; -XIMProc callback; -XPointer *client_data; +_XDynamicRegisterIMInstantiateCallback( + XLCd lcd, + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data) { char lc_dir[BUFSIZE]; char *lc_name; - Bool (*im_registerIM)() = (Bool(*)())NULL; + dynamicRegisterCBProcp im_registerIM = (dynamicRegisterCBProcp)NULL; Bool ret_flag = False; int count; XI18NObjectsList objects_list = xi18n_objects_list; @@ -507,7 +490,7 @@ XPointer *client_data; if (!open_object (objects_list, lc_dir)) continue; - im_registerIM = (Bool(*)())fetch_symbol(objects_list, + im_registerIM = (dynamicRegisterCBProcp)fetch_symbol(objects_list, objects_list->im_register); if (!im_registerIM) continue; ret_flag = (*im_registerIM)(lcd, display, rdb, @@ -520,20 +503,22 @@ XPointer *client_data; return (Bool)ret_flag; } +typedef Bool (*dynamicUnregisterProcp)( + XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer); + static Bool -_XDynamicUnRegisterIMInstantiateCallback(lcd, display, rdb, - res_name, res_class, - callback, client_data) -XLCd lcd; -Display *display; -XrmDatabase rdb; -char *res_name, *res_class; -XIMProc callback; -XPointer *client_data; +_XDynamicUnRegisterIMInstantiateCallback( + XLCd lcd, + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data) { char lc_dir[BUFSIZE]; char *lc_name; - Bool (*im_unregisterIM)() = (Bool(*)())NULL; + dynamicUnregisterProcp im_unregisterIM = (dynamicUnregisterProcp)NULL; Bool ret_flag = False; int count; XI18NObjectsList objects_list = xi18n_objects_list; @@ -553,7 +538,7 @@ XPointer *client_data; if (!objects_list->refcount) /* Must already be opened */ continue; - im_unregisterIM = (Bool(*)())fetch_symbol(objects_list, + im_unregisterIM = (dynamicUnregisterProcp)fetch_symbol(objects_list, objects_list->im_unregister); if (!im_unregisterIM) continue; @@ -569,12 +554,7 @@ XPointer *client_data; } Bool -#if NeedFunctionPrototypes _XInitDynamicIM(XLCd lcd) -#else -_XInitDynamicIM(lcd) -XLCd lcd; -#endif { if(lcd == (XLCd)NULL) return False; @@ -584,24 +564,19 @@ XLCd lcd; return True; } + +typedef XOM (*dynamicIOpenProcp)( + XLCd, Display *, XrmDatabase, _Xconst char *, _Xconst char *); + static XOM -#if NeedFunctionPrototypes _XDynamicOpenOM(XLCd lcd, Display *display, XrmDatabase rdb, _Xconst char *res_name, _Xconst char *res_class) -#else -_XDynamicOpenOM(lcd, display, rdb, res_name, res_class) -XLCd lcd; -Display *display; -XrmDatabase rdb; -char *res_name; -char *res_class; -#endif { XOM om = (XOM)NULL; int count; char lc_dir[BUFSIZE]; char *lc_name; - XOM (*om_openOM)() = (XOM(*)())NULL; + dynamicIOpenProcp om_openOM = (dynamicIOpenProcp)NULL; XI18NObjectsList objects_list = xi18n_objects_list; #if defined(hpux) int getsyms_cnt, i; @@ -619,7 +594,7 @@ char *res_class; if (!open_object (objects_list, lc_dir)) continue; - om_openOM = (XOM(*)())fetch_symbol(objects_list, objects_list->open); + om_openOM = (dynamicIOpenProcp)fetch_symbol(objects_list, objects_list->open); if (!om_openOM) continue; om = (*om_openOM)(lcd, display, rdb, res_name, res_class); if (om != (XOM)NULL) { @@ -631,12 +606,7 @@ char *res_class; } Bool -#if NeedFunctionPrototypes _XInitDynamicOM(XLCd lcd) -#else -_XInitDynamicOM(lcd) - XLCd lcd; -#endif { if(lcd == (XLCd)NULL) return False; |