Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtappbuilder / src / libAButil / abio.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: abio.h /main/5 1995/11/06 18:50:10 rswiston $
26  *
27  * @(#)abio.h   1.21 11 Feb 1994        cde_app_builder/src/libAButil
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  * abio.h
45  *
46  * GUIDE Intermediate Language (GIL) file input / output interface.
47  */
48
49 #ifndef _abio_h
50 #define _abio_h
51
52 #ifndef _POSIX_SOURCE
53 #define _POSIX_SOURCE 1         /* we want to be POSIX-compliant */
54 #endif
55
56 #include <stdio.h>
57 #include <ab_private/AB.h>
58 #include <ab_private/istr.h>
59 #include <ab/util_types.h>
60
61 /*
62  * Public functions.
63  */
64
65
66 /*
67  * Indentation control
68  */
69 int     abio_indent(FILE *text_file);
70 int     abio_outdent(FILE *text_file);
71 int     abio_set_indent(FILE *text_file, int level);
72 int     abio_get_indent(FILE *text_file);
73 int     abio_set_indent_char(FILE *text_file, int indent_char);
74 int     abio_get_indent_char(FILE *text_file);
75 int     abio_set_indent_chars_per_level(FILE *text_file, int chars_per_level);
76 int     abio_get_indent_chars_per_level(FILE *text_file);
77
78
79 int     abio_close_input(FILE *outFile);
80
81 int     abio_close_output(FILE *outFile);
82
83 int     abio_access_file(
84             STRING      name,
85             BOOL        *read_OK,
86             BOOL        *write_OK
87         );
88
89 STRING  abio_comment_string(void);
90
91 STRING  abio_module_string(void);
92
93 STRING  abio_project_string(void);
94
95 int     abio_get_eof(FILE *inFile);
96
97 int     abio_get_file_begin(FILE *inFile);
98
99 int     abio_get_file_end(FILE *inFile);
100
101 int     abio_get_handler(
102             FILE        *inFile, 
103             ISTRING     *stringOut
104         );
105         
106 int     abio_get_integer(
107             FILE        *inFile,
108             int *i
109         );
110
111 int     abio_get_keyword(
112             FILE        *inFile,
113             ISTRING     *stringOut
114         );
115
116 int     abio_get_list(
117             FILE        *inFile,
118             ISTRING     *stringOut
119         );
120
121 int     abio_get_list_begin(FILE *inFile);
122
123 int     abio_get_list_end(FILE *inFile);
124
125 int     abio_gil_get_full_name(
126             FILE        *inFile,
127             ISTRING     *interfaceOut,
128             ISTRING     *parentOut, 
129             ISTRING     *nameOut,
130             ISTRING     *itemOut
131         );
132
133 int     abio_gil_get_object_begin(FILE *inFile);
134
135 int     abio_gil_get_object_end(FILE *inFile);
136
137 int     abio_get_string(
138             FILE        *inFile,
139             ISTRING     *stringOut
140         );
141
142 int     abio_get_string_begin(FILE *inFile);
143
144 int     abio_get_string_end(FILE *inFile);
145
146 STRING  abio_integer_string(
147             int i
148         );
149
150 STRING  abio_keyword_string(
151             STRING s
152         );
153
154 STRING  abio_list_begin_string(void);
155
156 STRING  abio_list_end_string(void);
157
158 STRING  abio_name_string(
159             STRING s
160         );
161
162 STRING  abio_gil_object_begin_string(void);
163
164 STRING  abio_gil_object_end_string(void);
165
166 STRING  abio_open_output(
167             STRING      name,
168             FILE        **pOutFile
169         );
170
171 STRING  abio_open_gil_input(
172             STRING      name,
173             FILE        **pInFile
174         );
175
176 STRING  abio_open_gil_output(
177             STRING      outFileName,
178             FILE        **pOutFile
179         );
180
181 int     abio_open_bil_output(
182             STRING      outfile,
183             STRING      old_file,
184             FILE        **pOutFile
185         );
186
187 STRING  abio_open_proj_input(
188             STRING      name,
189             FILE        **pInFile
190         );
191
192 STRING  abio_open_proj_output(
193             STRING      name,
194             FILE        **pOutFile
195         );
196
197 STRING  abio_open_resfile_input(
198             STRING      name,
199             FILE        **pInFile
200         );
201
202 int
203         abio_printf(
204             FILE * outFile, 
205             STRING fmt,...
206         );
207
208 int
209         abio_print_line(
210             FILE * outFile, 
211             STRING fmt,...
212         );
213
214 int     abio_putc(
215             FILE *outFile,
216             char c
217         );
218
219 int     abio_puts(
220             FILE *outFile,
221             STRING s
222         );
223
224 int     abio_put_float(
225             FILE *outFile,
226             double d
227         );
228
229 int     abio_put_integer(
230             FILE *outFile,
231             int i
232         );
233
234 int     abio_put_keyword(
235             FILE *outFile,
236             AB_OBJECT_TYPE abo_type
237         );
238
239 int     abio_put_keyword_name(
240             FILE *outFile,
241             STRING name
242         );
243 int     abio_put_handler(
244             FILE *outFile,
245             STRING s
246         );
247
248 int     abio_put_full_name(
249             FILE *outFile,
250             STRING parent, 
251             STRING name, 
252             STRING item
253         );
254
255 int     abio_put_proj_full_name(
256             FILE *outFile,
257             STRING itf, 
258             STRING parent, 
259             STRING name, 
260             STRING item
261         );
262
263 int     abio_put_string(
264             FILE *outFile,
265             STRING s
266         );
267
268 int     abio_put_string_to_file(
269             FILE *outFile,
270             STRING s
271         );
272
273 int     abio_put_string_to_buffer(
274             STRING      string,
275             STRING      outBuf, 
276             int         size
277         );
278
279 STRING  abio_string_begin_string(void);
280
281 STRING  abio_string_end_string(void);
282
283 STRING  abio_string_string(
284             STRING
285         );
286
287 int     abio_open_block(FILE *outFile);
288
289 int     abio_close_block(FILE *outFile);
290
291 int     abio_expand_path(
292             STRING path
293         );
294
295 int     abio_expand_file(
296             char    *file,
297             char    *exp_file 
298         );
299
300 /*
301  * BIL functions
302  */
303 int     abio_expand_bil_proj_path(
304             STRING path
305         );
306
307 int     abio_expand_bil_module_path(
308             STRING path
309         );
310
311 int     abio_expand_bil_encapsulated_path(
312             STRING path
313         );
314
315 STRING  abio_open_bil_input(
316             STRING      fileName, 
317             int         *linesRead,
318             FILE        **pInFile
319         );
320
321 float   abio_get_bil_version(
322             FILE *      fp,
323             int         *pLinesRead
324         );
325
326 STRING  abio_bil_object_begin_string(void);
327
328 STRING  abio_bil_object_end_string(void);
329
330 STRING  abio_bil_boolean_string(
331             BOOL        value
332         );
333
334 STRING  abio_bil_true_string(void);
335
336 STRING  abio_bil_false_string(void);
337
338 int     abio_bil_get_boolean(
339             FILE        *inFile,
340             BOOL        *valueOut
341         );
342
343 int     abio_bil_put_boolean(
344             FILE        *outFile,
345             BOOL        value
346         );
347
348 STRING  abio_check_bil_version(
349             float ver,
350             STRING name
351         );
352
353
354
355 /*
356  * GIL functions
357  */
358 int     abio_is_gil_path(
359             STRING path
360         );
361
362 int     abio_gil_expand_path(
363             STRING path
364         );
365
366 int     abio_gil_expand_proj_path(
367             STRING path
368         );
369
370 int     abio_is_gil_proj_path(
371             STRING path
372         );
373
374 int     abio_gil_put_name(
375             FILE *outFile,
376             STRING s
377         );
378
379 int     abio_gil_get_name(
380             FILE        *inFile,
381             ISTRING     *stringOut
382         );
383
384 STRING  abio_gil_boolean_string(
385             BOOL        value
386         );
387
388 STRING  abio_gil_true_string(void);
389
390 STRING  abio_gil_false_string(void);
391
392 int     abio_gil_get_boolean(
393             FILE        *inFile,
394             BOOL        *valueOut
395         );
396
397 int     abio_gil_put_boolean(
398             FILE        *outFile,
399             BOOL        value
400         );
401
402
403 /*****************************************************************
404 **                                                              **
405 **      Inline implementation                                   **
406 **                                                              **
407 *****************************************************************/
408
409
410 #define abio_close_input(fp)  (abio_close_input_impl(&(fp)))
411 int abio_close_input_impl(FILE **pFp);
412
413 #define abio_close_output(fp)  (abio_close_output_impl(&(fp)))
414 int abio_close_output_impl(FILE **pFp);
415
416
417 #endif /* _abio_h */