1/* 2 * Copyright 1992, 1993 by TOSHIBA Corp. 3 * 4 * Permission to use, copy, modify, and distribute this software and its 5 * documentation for any purpose and without fee is hereby granted, provided 6 * that the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation, and that the name of TOSHIBA not be used in advertising 9 * or publicity pertaining to distribution of the software without specific, 10 * written prior permission. TOSHIBA make no representations about the 11 * suitability of this software for any purpose. It is provided "as is" 12 * without express or implied warranty. 13 * 14 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 16 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20 * SOFTWARE. 21 * 22 * Author: Katsuhisa Yano TOSHIBA Corp. 23 * mopi@osa.ilab.toshiba.co.jp 24 */ 25 26#ifdef HAVE_CONFIG_H 27#include <config.h> 28#endif 29#include "Xlibint.h" 30#include "Xlcint.h" 31 32XOM 33XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, 34 _Xconst char *res_class) 35{ 36 XLCd lcd = _XOpenLC((char *) NULL); 37 38 if (lcd == NULL) 39 return (XOM) NULL; 40 41 if (lcd->methods->open_om) 42 return (*lcd->methods->open_om)(lcd, dpy, rdb, res_name, res_class); 43 44 return (XOM) NULL; 45} 46 47Status 48XCloseOM(XOM om) 49{ 50 XOC oc, next; 51 XLCd lcd = om->core.lcd; 52 53 next = om->core.oc_list; 54 55 while ((oc = next)) { 56 next = oc->core.next; 57 (*oc->methods->destroy)(oc); 58 } 59 60 om->core.oc_list = NULL; 61 62 _XCloseLC(lcd); 63 64 return (*om->methods->close)(om); 65} 66 67char * 68XSetOMValues(XOM om, ...) 69{ 70 va_list var; 71 XlcArgList args; 72 char *ret; 73 int num_args; 74 75 va_start(var, om); 76 _XlcCountVaList(var, &num_args); 77 va_end(var); 78 79 va_start(var, om); 80 _XlcVaToArgList(var, num_args, &args); 81 va_end(var); 82 83 if (args == (XlcArgList) NULL) 84 return (char *) NULL; 85 86 ret = (*om->methods->set_values)(om, args, num_args); 87 88 Xfree(args); 89 90 return ret; 91} 92 93char * 94XGetOMValues(XOM om, ...) 95{ 96 va_list var; 97 XlcArgList args; 98 char *ret; 99 int num_args; 100 101 va_start(var, om); 102 _XlcCountVaList(var, &num_args); 103 va_end(var); 104 105 va_start(var, om); 106 _XlcVaToArgList(var, num_args, &args); 107 va_end(var); 108 109 if (args == (XlcArgList) NULL) 110 return (char *) NULL; 111 112 ret = (*om->methods->get_values)(om, args, num_args); 113 114 Xfree(args); 115 116 return ret; 117} 118 119Display * 120XDisplayOfOM(XOM om) 121{ 122 return om->core.display; 123} 124 125char * 126XLocaleOfOM(XOM om) 127{ 128 return om->core.lcd->core->name; 129} 130