Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtappbuilder / src / abmf / abmfP.h
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 librararies 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
24 /*
25  *      $XConsortium: abmfP.h /main/3 1995/11/06 18:01:49 rswiston $
26  *
27  * @(#)abmfP.h  3.36 30 Apr 1995        cde_app_builder/src/abmf
28  *
29  *      RESTRICTED CONFIDENTIAL INFORMATION:
30  *      
31  *      The information in this document is subject to special
32  *      restrictions in a confidential disclosure agreement between
33  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
34  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
35  *      Sun's specific written approval.  This document and all copies
36  *      and derivative works thereof must be returned or destroyed at
37  *      Sun's request.
38  *
39  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
40  *
41  */
42
43 /*
44  * abmfP.h - declarations common to all abmf files
45  */
46
47 #ifndef _ABMF_ABMFP_H_
48 #define _ABMF_ABMFP_H_
49
50 #include <assert.h>             /* assert() */
51 #include <stdio.h>              /* FILE*, BUFSIZ */
52 #include <sys/param.h>          /* MAXPATHLEN, ... */
53 #include <nl_types.h>
54 #include <X11/Intrinsic.h>
55 #include <ab_private/obj.h>
56 #include <ab_private/trav.h>
57 #include <ab_private/strlist.h>
58 #include "abmf.h"
59
60 /*
61  * Constants
62  */
63 #define STD_BUF_SIZE    (BUFSIZ)
64 #define MAX_PATH_SIZE   (MAXPATHLEN+1)
65 #define MAX_NAME_SIZE   (MAX_PATH_SIZE)
66
67 #define CGenFlagsNone                   ((CGenFlags)0x0000)
68 #define CGenFlagCompFieldsUnique        ((CGenFlags)0x0001)
69 #define CGenFlagSubstructObjValid       ((CGenFlags)0x0002)
70 #define CGenFlagStructObjValid          ((CGenFlags)0x0004)
71 #define CGenFlagIsStructObjValid        ((CGenFlags)0x0008)
72 #define CGenFlagIsStructObj             ((CGenFlags)0x0010)
73 #define CGenFlagIsSubstructObjValid     ((CGenFlags)0x0020)
74 #define CGenFlagIsSubstructObj          ((CGenFlags)0x0040)
75 #define CGenFlagWriteDefToProjFile      ((CGenFlags)0x0080)
76 #define CGenFlagIsDuplicateDef          ((CGenFlags)0x0100)
77 #define CGenFlagLoadMe                  ((CGenFlags)0x0200)
78 #define CGenFlagIsReferenced            ((CGenFlags)0x0400)
79 #define CGenFlagTreatAsAppShell         ((CGenFlags)0x0800)
80
81 /* specify what type of cgen data is attached to obj */
82 #define CGenFlagDataIsModule            ((CGenFlags)0x2000)
83 #define CGenFlagDataIsObj               ((CGenFlags)0x4000)
84 #define CGenFlagDataIsProj              ((CGenFlags)0x8000)
85
86 typedef FILE            *File;          /* convenience */
87
88 /*
89 typedef struct
90 {
91     ISTRING     field_name;
92     ABObj       struct_obj;
93     ABObj       substruct_obj;
94 } CGenObjDataRec, *CGenObjData;
95 */
96
97 /* Proj info */
98 typedef struct
99 {
100     StringList  callbacks;
101     CGenAnyData children_data;
102     BOOL        has_ui_obj;
103     BOOL        has_terminal;
104     BOOL        has_help;
105     ISTRING     exe_name;
106 } CGenProjDataRec, *CGenProjData;
107
108
109 /* Module info */
110 typedef struct
111 {
112     StringList  callbacks;
113     CGenAnyData children_data;
114 } CGenModuleDataRec, *CGenModuleData;
115
116
117 typedef struct CGEN_ANY_DATA_REC        /* name must match obj.h! */
118 {
119     ISTRING     field_name;
120     ABObj       struct_obj;
121     ABObj       substruct_obj;
122     int         num_auto_callbacks;
123     union
124     {
125         CGenProjData    proj;
126         CGenModuleData  module;
127     } info;
128 } CGenAnyDataRec;
129 typedef CGenAnyDataRec  CGenDataRec;
130 typedef CGenAnyData     CGenData;
131
132 #define return_if_err(_return_code, _return_value) \
133            if ((_return_code) < 0) \
134            { \
135                return_value= (_return_value); \
136                goto epilogue; \
137            }
138
139 #define return_code(_return_code) \
140             {return_value= (_return_code); goto epilogue;}
141
142
143 #define mfobj_flags(obj) ((obj)->cgen_flags)
144
145 #define mfobj_set_flags(obj, _flags)  \
146                 ((obj)->cgen_flags |= ((CGenFlags)(_flags)))
147
148 #define mfobj_clear_flags(obj, _flags) \
149                 (mfobj_flags(obj) &= ~((CGenFlags)(_flags)))
150
151 #define mfobj_has_flags(obj, _flags)  \
152                 ((mfobj_flags(obj) & ((CGenFlags)(_flags))) != 0)
153
154 /*
155  * Get the various types of data from the object
156  */
157 #define mfobj_has_data(obj) \
158         ((obj)->cgen_data != NULL)
159
160 #define mfobj_data(obj) \
161         (obj->cgen_data)
162
163 #define mfobj_set_proj_data(_obj,_data) \
164         ( mfobj_set_flags(_obj, CGenFlagDataIsProj), \
165           ((int)(mfobj_data(_obj)->info.proj = (_data))) \
166         )
167
168 #define mfobj_get_proj_data(obj) \
169         (mfobj_has_flags(obj, CGenFlagDataIsProj)? \
170             (mfobj_data(obj)->info.proj) \
171         : \
172             ((CGenProjData)NULL) \
173         )
174
175 #define mfobj_set_module_data(_obj,_data) \
176         ( mfobj_set_flags(_obj, CGenFlagDataIsModule), \
177           ((int)(mfobj_data(_obj)->info.module = (_data))) \
178         )
179
180 #define mfobj_get_module_data(obj) \
181         (mfobj_has_flags(obj, CGenFlagDataIsModule)? \
182             (mfobj_data(obj)->info.module) \
183         : \
184             ((CGenModuleData)NULL) \
185         )
186
187 /* Internationalization defines and references  */
188 extern nl_catd  Dtb_project_catd;
189
190 #endif /* _ABMF_ABMFP_H_ */