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 32XOC 33XCreateOC(XOM om, ...) 34{ 35 va_list var; 36 XlcArgList args; 37 XOC oc; 38 int num_args; 39 40 va_start(var, om); 41 _XlcCountVaList(var, &num_args); 42 va_end(var); 43 44 va_start(var, om); 45 _XlcVaToArgList(var, num_args, &args); 46 va_end(var); 47 48 if (args == (XlcArgList) NULL) 49 return (XOC) NULL; 50 51 oc = (*om->methods->create_oc)(om, args, num_args); 52 53 Xfree(args); 54 55 if (oc) { 56 oc->core.next = om->core.oc_list; 57 om->core.oc_list = oc; 58 } 59 60 return oc; 61} 62 63void 64XDestroyOC(XOC oc) 65{ 66 XOC prev, oc_list; 67 68 prev = oc_list = oc->core.om->core.oc_list; 69 if (oc_list == oc) 70 oc->core.om->core.oc_list = oc_list->core.next; 71 else { 72 while ((oc_list = oc_list->core.next)) { 73 if (oc_list == oc) { 74 prev->core.next = oc_list->core.next; 75 break; 76 } 77 prev = oc_list; 78 } 79 } 80 81 (*oc->methods->destroy)(oc); 82} 83 84XOM 85XOMOfOC(XOC oc) 86{ 87 return oc->core.om; 88} 89 90char * 91XSetOCValues(XOC oc, ...) 92{ 93 va_list var; 94 XlcArgList args; 95 char *ret; 96 int num_args; 97 98 va_start(var, oc); 99 _XlcCountVaList(var, &num_args); 100 va_end(var); 101 102 va_start(var, oc); 103 _XlcVaToArgList(var, num_args, &args); 104 va_end(var); 105 106 if (args == (XlcArgList) NULL) 107 return (char *) NULL; 108 109 ret = (*oc->methods->set_values)(oc, args, num_args); 110 111 Xfree(args); 112 113 return ret; 114} 115 116char * 117XGetOCValues(XOC oc, ...) 118{ 119 va_list var; 120 XlcArgList args; 121 char *ret; 122 int num_args; 123 124 va_start(var, oc); 125 _XlcCountVaList(var, &num_args); 126 va_end(var); 127 128 va_start(var, oc); 129 _XlcVaToArgList(var, num_args, &args); 130 va_end(var); 131 132 if (args == (XlcArgList) NULL) 133 return (char *) NULL; 134 135 ret = (*oc->methods->get_values)(oc, args, num_args); 136 137 Xfree(args); 138 139 return ret; 140} 141