11ab64890Smrg/*
21ab64890Smrg * Copyright 1992, 1993 by TOSHIBA Corp.
31ab64890Smrg *
41ab64890Smrg * Permission to use, copy, modify, and distribute this software and its
51ab64890Smrg * documentation for any purpose and without fee is hereby granted, provided
61ab64890Smrg * that the above copyright notice appear in all copies and that both that
71ab64890Smrg * copyright notice and this permission notice appear in supporting
81ab64890Smrg * documentation, and that the name of TOSHIBA not be used in advertising
91ab64890Smrg * or publicity pertaining to distribution of the software without specific,
101ab64890Smrg * written prior permission. TOSHIBA make no representations about the
111ab64890Smrg * suitability of this software for any purpose.  It is provided "as is"
121ab64890Smrg * without express or implied warranty.
131ab64890Smrg *
141ab64890Smrg * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
151ab64890Smrg * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
161ab64890Smrg * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
171ab64890Smrg * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
181ab64890Smrg * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
191ab64890Smrg * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
201ab64890Smrg * SOFTWARE.
211ab64890Smrg *
221ab64890Smrg * Author: Katsuhisa Yano	TOSHIBA Corp.
231ab64890Smrg *			   	mopi@osa.ilab.toshiba.co.jp
241ab64890Smrg */
251ab64890Smrg
261ab64890Smrg#ifdef HAVE_CONFIG_H
271ab64890Smrg#include <config.h>
281ab64890Smrg#endif
291ab64890Smrg#include "Xlibint.h"
301ab64890Smrg#include "Xlcint.h"
311ab64890Smrg
321ab64890SmrgXOM
331ab64890SmrgXOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name,
341ab64890Smrg	_Xconst char *res_class)
351ab64890Smrg{
361ab64890Smrg    XLCd lcd = _XOpenLC((char *) NULL);
371ab64890Smrg
381ab64890Smrg    if (lcd == NULL)
391ab64890Smrg	return (XOM) NULL;
401ab64890Smrg
411ab64890Smrg    if (lcd->methods->open_om)
421ab64890Smrg	return (*lcd->methods->open_om)(lcd, dpy, rdb, res_name, res_class);
431ab64890Smrg
441ab64890Smrg    return (XOM) NULL;
451ab64890Smrg}
461ab64890Smrg
471ab64890SmrgStatus
481ab64890SmrgXCloseOM(XOM om)
491ab64890Smrg{
501ab64890Smrg    XOC oc, next;
511ab64890Smrg    XLCd lcd = om->core.lcd;
521ab64890Smrg
531ab64890Smrg    next = om->core.oc_list;
541ab64890Smrg
551ab64890Smrg    while ((oc = next)) {
561ab64890Smrg	next = oc->core.next;
571ab64890Smrg	(*oc->methods->destroy)(oc);
581ab64890Smrg    }
591ab64890Smrg
601ab64890Smrg    om->core.oc_list = NULL;
611ab64890Smrg
621ab64890Smrg    _XCloseLC(lcd);
631ab64890Smrg
641ab64890Smrg    return (*om->methods->close)(om);
651ab64890Smrg}
661ab64890Smrg
671ab64890Smrgchar *
681ab64890SmrgXSetOMValues(XOM om, ...)
691ab64890Smrg{
701ab64890Smrg    va_list var;
711ab64890Smrg    XlcArgList args;
721ab64890Smrg    char *ret;
731ab64890Smrg    int num_args;
741ab64890Smrg
751ab64890Smrg    va_start(var, om);
761ab64890Smrg    _XlcCountVaList(var, &num_args);
771ab64890Smrg    va_end(var);
781ab64890Smrg
791ab64890Smrg    va_start(var, om);
801ab64890Smrg    _XlcVaToArgList(var, num_args, &args);
811ab64890Smrg    va_end(var);
821ab64890Smrg
831ab64890Smrg    if (args == (XlcArgList) NULL)
841ab64890Smrg	return (char *) NULL;
851ab64890Smrg
861ab64890Smrg    ret = (*om->methods->set_values)(om, args, num_args);
871ab64890Smrg
881ab64890Smrg    Xfree(args);
891ab64890Smrg
901ab64890Smrg    return ret;
911ab64890Smrg}
921ab64890Smrg
931ab64890Smrgchar *
941ab64890SmrgXGetOMValues(XOM om, ...)
951ab64890Smrg{
961ab64890Smrg    va_list var;
971ab64890Smrg    XlcArgList args;
981ab64890Smrg    char *ret;
991ab64890Smrg    int num_args;
1001ab64890Smrg
1011ab64890Smrg    va_start(var, om);
1021ab64890Smrg    _XlcCountVaList(var, &num_args);
1031ab64890Smrg    va_end(var);
1041ab64890Smrg
1051ab64890Smrg    va_start(var, om);
1061ab64890Smrg    _XlcVaToArgList(var, num_args, &args);
1071ab64890Smrg    va_end(var);
1081ab64890Smrg
1091ab64890Smrg    if (args == (XlcArgList) NULL)
1101ab64890Smrg	return (char *) NULL;
11161b2299dSmrg
1121ab64890Smrg    ret = (*om->methods->get_values)(om, args, num_args);
1131ab64890Smrg
1141ab64890Smrg    Xfree(args);
1151ab64890Smrg
1161ab64890Smrg    return ret;
1171ab64890Smrg}
1181ab64890Smrg
1191ab64890SmrgDisplay *
1201ab64890SmrgXDisplayOfOM(XOM om)
1211ab64890Smrg{
1221ab64890Smrg    return om->core.display;
1231ab64890Smrg}
1241ab64890Smrg
1251ab64890Smrgchar *
1261ab64890SmrgXLocaleOfOM(XOM om)
1271ab64890Smrg{
1281ab64890Smrg    return om->core.lcd->core->name;
1291ab64890Smrg}
130