VIA - Volumetric Image Analysis
option.h
1 /*
2  * $Id: option.h 3001 2007-11-30 12:42:11Z karstenm $
3  *
4  * Definitions associated with command option and parameter parsing.
5  */
6 
7 #ifndef V_option_h
8 #define V_option_h 1
9 
10 /*
11  * Copyright 1993, 1994 University of British Columbia
12  *
13  * Permission to use, copy, modify, distribute, and sell this software and its
14  * documentation for any purpose is hereby granted without fee, provided that
15  * the above copyright notice appears in all copies and that both that
16  * copyright notice and this permission notice appear in supporting
17  * documentation. UBC makes no representations about the suitability of this
18  * software for any purpose. It is provided "as is" without express or
19  * implied warranty.
20  *
21  * Author: Arthur Pope, UBC Laboratory for Computational Intelligence
22  */
23 
24 /* From the Vista library: */
25 #include "viaio/Vlib.h"
26 
27 /* From the standard C library: */
28 #include <stdio.h>
29 
30 /* For portability: */
31 #include <X11/Xfuncproto.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 /*
39  * Declarations of data structures.
40  */
41 
42 /* Accepted command options are described by a table of these entries: */
43 typedef struct {
44  VStringConst keyword; /* keyword signalling option */
45  VRepnKind repn; /* type of value supplied by option */
46  int number; /* number of values supplied */
47  VPointer value; /* location for storing value(s) */
48  VBoolean *found; /* whether optional arg found */
49  VDictEntry *dict; /* optional dict of value keywords */
50  VStringConst blurb; /* on-line help blurb */
51 } VOptionDescRec;
52 
53 /* Some possible values for the found field: */
54 #define VRequiredOpt (& V_RequiredOpt)
55 #define VOptionalOpt (& V_OptionalOpt)
56 extern VBoolean V_RequiredOpt;
57 extern VBoolean V_OptionalOpt;
58 
59 /* If an option takes multiple values, they are represented by a VArgVector: */
60 typedef struct {
61  int number; /* number of arguments */
62  VPointer vector; /* vector of arguments */
63 } VArgVector;
64 
65 
66 /*
67  * Declarations of library routines.
68  */
69 
70 /* history management: */
71 void VHistory (
72 #if NeedFunctionPrototypes
73  int,
74  VOptionDescRec*,
75  char*,
76  VAttrList*,
77  VAttrList*
78 #endif
79 );
80 
81 VAttrList VReadHistory(
82 #if NeedFunctionPrototypes
83  VAttrList*
84 #endif
85 );
86 
87 void VPrependHistory(
88 #if NeedFunctionPrototypes
89 int,
90 VOptionDescRec *,
91 char*,
92 VAttrList*
93 #endif
94 );
95 
96 char * getVersion();
97 
98 
99 /* From Option.c: */
100 
101 VBoolean VIdentifyFiles (
102 #if NeedFunctionPrototypes
103  int /* noptions */,
104  VOptionDescRec [] /* options */,
105  VStringConst /* keyword */,
106  int * /* argc */,
107  char ** /* argv */,
108  int /* fd */
109 #endif
110 );
111 
112 VBoolean VParseCommand (
113 #if NeedFunctionPrototypes
114  int /* noptions */,
115  VOptionDescRec [] /* options */,
116  int * /* argc */,
117  char ** /* argv */
118 #endif
119 );
120 
121 VBoolean VParseCommand_nl (
122 #if NeedFunctionPrototypes
123  int /* noptions */,
124  VOptionDescRec [] /* options */,
125  int * /* argc */,
126  char ** /* argv */
127 #endif
128 );
129 
130 void VParseFilterCmd (
131 #if NeedFunctionPrototypes
132  int /* noptions */,
133  VOptionDescRec [] /* opts */,
134  int /* argc */,
135  char ** /* argv */,
136  FILE ** /* inp */,
137  FILE ** /* outp */
138 #endif
139 );
140 
141 void VPrintOptions (
142 #if NeedFunctionPrototypes
143  FILE * /* f */,
144  int /* noptions */,
145  VOptionDescRec [] /* options */
146 #endif
147 );
148 
149 int VPrintOptionValue (
150 #if NeedFunctionPrototypes
151  FILE * /* f */,
152  VOptionDescRec * /* option */
153 #endif
154 );
155 
156 void VReportBadArgs (
157 #if NeedFunctionPrototypes
158  int /* argc */,
159  char ** /* argv */
160 #endif
161 );
162 
163 void VReportUsage (
164 #if NeedFunctionPrototypes
165  VStringConst /* program */,
166  int /* noptions */,
167  VOptionDescRec [] /* options */,
168  VStringConst /* other_args */
169 #endif
170 );
171 
172 void VReportUsage_nl (
173 #if NeedFunctionPrototypes
174  VStringConst /* program */,
175  int /* noptions */,
176  VOptionDescRec [] /* options */,
177  VStringConst /* other_args */
178 #endif
179 );
180 
181 void VReportValidOptions (
182 #if NeedFunctionPrototypes
183  int /* noptions */,
184  VOptionDescRec [] /* options */
185 #endif
186 );
187 
188 /* From Param.c: */
189 
190 VBoolean VLoadParameters (
191 #if NeedFunctionPrototypes
192  int /* nparams */,
193  VOptionDescRec [] /* params */,
194  VStringConst /* filename */,
195  VStringConst /* object */,
196  VPointer /* values */,
197  VBoolean /* ignore_unrecog */
198 #endif
199 );
200 
201 VBoolean VParseParamDefn (
202 #if NeedFunctionPrototypes
203  VStringConst /* buf */,
204  VString /* name */,
205  VRepnKind * /* repn */,
206  VString /* value */,
207  VString /* comment */
208 #endif
209 );
210 
211 VBoolean VParseParamOptions (
212 #if NeedFunctionPrototypes
213  int /* nparams */,
214  VOptionDescRec [] /* params */,
215  int * /* argc */,
216  char ** /* argv */,
217  VPointer /* values */
218 #endif
219 );
220 
221 void VPrintParameters (
222 #if NeedFunctionPrototypes
223  FILE * /* f */,
224  int /* nparams */,
225  VOptionDescRec [] /* params */,
226  VPointer /* values */
227 #endif
228 );
229 
230 void VReportValidParamOptions (
231 #if NeedFunctionPrototypes
232  int /* nparams */,
233  VOptionDescRec [] /* params */,
234  VPointer /* values */
235 #endif
236 );
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif /* V_option_h */