Revert "dtudcfonted, dtudcexch: delete from repository"
[oweals/cde.git] / cde / programs / dtudcfonted / libfal / _fallcPubWrap.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* lcPubWrap.c 1.1 - Fujitsu source for CDEnext    95/11/06 20:32:39    */
24 /* $XConsortium: _fallcPubWrap.c /main/1 1996/04/08 15:18:09 cde-fuj $ */
25 /*
26  * Copyright 1992, 1993 by TOSHIBA Corp.
27  *
28  * Permission to use, copy, modify, and distribute this software and its
29  * documentation for any purpose and without fee is hereby granted, provided
30  * that the above copyright notice appear in all copies and that both that
31  * copyright notice and this permission notice appear in supporting
32  * documentation, and that the name of TOSHIBA not be used in advertising
33  * or publicity pertaining to distribution of the software without specific,
34  * written prior permission. TOSHIBA make no representations about the
35  * suitability of this software for any purpose.  It is provided "as is"
36  * without express or implied warranty.
37  *
38  * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40  * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44  * SOFTWARE.
45  *
46  * Author: Katsuhisa Yano       TOSHIBA Corp.
47  *                              mopi@osa.ilab.toshiba.co.jp
48  */
49
50 #include "_fallibint.h"
51 #include "_fallcPubI.h"
52
53 #if NeedVarargsPrototypes
54 char *
55 _falGetLCValues(XLCd lcd, ...)
56 #else
57 char *
58 _falGetLCValues(lcd, va_alist)
59     XLCd lcd;
60     va_dcl
61 #endif
62 {
63     va_list var;
64     XlcArgList args;
65     char *ret;
66     int num_args;
67     XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
68
69     Va_start(var, lcd);
70     _fallcCountVaList(var, &num_args);
71     va_end(var);
72
73     Va_start(var, lcd);
74     _fallcVaToArgList(var, num_args, &args);
75     va_end(var);
76
77     if (args == (XlcArgList) NULL)
78         return (char *) NULL;
79
80     ret = (*methods->get_values)(lcd, args, num_args);
81
82     Xfree(args);
83
84     return ret;
85 }
86
87 void
88 _fallcDestroyLC(lcd)
89     XLCd lcd;
90 {
91     XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods;
92
93     (*methods->pub.destroy)(lcd);
94 }
95
96 XLCd
97 _fallcCreateLC(name, methods)
98     char *name;
99     XLCdMethods methods;
100 {
101     XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods;
102     XLCd lcd;
103
104     lcd = (*pub_methods->pub.create)(name, methods);
105     if (lcd == NULL)
106         return (XLCd) NULL;
107
108     if (lcd->core->name == NULL) {
109         lcd->core->name = (char*) Xmalloc(strlen(name) + 1);
110         if (lcd->core->name == NULL)
111             goto err;
112         strcpy(lcd->core->name, name);
113     }
114
115     if (lcd->methods == NULL)
116         lcd->methods = methods;
117
118     if ((*pub_methods->pub.initialize)(lcd) == False)
119         goto err;
120
121     return lcd;
122
123 err:
124     _fallcDestroyLC(lcd);
125
126     return (XLCd) NULL;
127 }