VIA - Volumetric Image Analysis

option.h

00001 /*
00002  *  $Id: option.h 3001 2007-11-30 12:42:11Z karstenm $
00003  *
00004  *  Definitions associated with command option and parameter parsing.
00005  */
00006 
00007 #ifndef V_option_h
00008 #define V_option_h 1
00009 
00010 /*
00011  *  Copyright 1993, 1994 University of British Columbia
00012  *
00013  *  Permission to use, copy, modify, distribute, and sell this software and its
00014  *  documentation for any purpose is hereby granted without fee, provided that
00015  *  the above copyright notice appears in all copies and that both that
00016  *  copyright notice and this permission notice appear in supporting
00017  *  documentation. UBC makes no representations about the suitability of this
00018  *  software for any purpose. It is provided "as is" without express or
00019  *  implied warranty.
00020  *
00021  *  Author: Arthur Pope, UBC Laboratory for Computational Intelligence
00022  */
00023 
00024 /* From the Vista library: */
00025 #include "viaio/Vlib.h"
00026 
00027 /* From the standard C library: */
00028 #include <stdio.h>
00029 
00030 /* For portability: */
00031 #include <X11/Xfuncproto.h>
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 
00038 /*
00039  *  Declarations of data structures.
00040  */
00041 
00042 /* Accepted command options are described by a table of these entries: */
00043 typedef struct {
00044     VStringConst keyword;               /* keyword signalling option */
00045     VRepnKind repn;                     /* type of value supplied by option */
00046     int number;                         /* number of values supplied */
00047     VPointer value;                     /* location for storing value(s) */
00048     VBoolean *found;                    /* whether optional arg found */
00049     VDictEntry *dict;                   /* optional dict of value keywords */
00050     VStringConst blurb;                 /* on-line help blurb */
00051 } VOptionDescRec;
00052 
00053 /* Some possible values for the found field: */
00054 #define VRequiredOpt (& V_RequiredOpt)
00055 #define VOptionalOpt (& V_OptionalOpt)
00056 extern VBoolean V_RequiredOpt;
00057 extern VBoolean V_OptionalOpt;
00058 
00059 /* If an option takes multiple values, they are represented by a VArgVector: */
00060 typedef struct {
00061     int number;                         /* number of arguments */
00062     VPointer vector;                    /* vector of arguments */
00063 } VArgVector;
00064 
00065 
00066 /*
00067  *  Declarations of library routines.
00068  */
00069 
00070 /* history management: */
00071 void VHistory (
00072 #if NeedFunctionPrototypes
00073     int,
00074     VOptionDescRec*,
00075     char*,
00076     VAttrList*,
00077     VAttrList*
00078 #endif
00079 );
00080 
00081 VAttrList VReadHistory(
00082 #if NeedFunctionPrototypes
00083     VAttrList*
00084 #endif
00085 );
00086 
00087 void VPrependHistory(
00088 #if NeedFunctionPrototypes
00089 int,
00090 VOptionDescRec *,
00091 char*,
00092 VAttrList*
00093 #endif
00094 );
00095 
00096 char * getVersion();
00097 
00098 
00099 /* From Option.c: */
00100 
00101 VBoolean VIdentifyFiles (
00102 #if NeedFunctionPrototypes
00103     int                 /* noptions */,
00104     VOptionDescRec []   /* options */,
00105     VStringConst        /* keyword */,
00106     int *               /* argc */,
00107     char **             /* argv */,
00108     int                 /* fd */
00109 #endif
00110 );
00111 
00112 VBoolean VParseCommand (
00113 #if NeedFunctionPrototypes
00114     int                 /* noptions */,
00115     VOptionDescRec []   /* options */,
00116     int *               /* argc */,
00117     char **             /* argv */
00118 #endif
00119 );
00120 
00121 VBoolean VParseCommand_nl (
00122 #if NeedFunctionPrototypes
00123     int                 /* noptions */,
00124     VOptionDescRec []   /* options */,
00125     int *               /* argc */,
00126     char **             /* argv */
00127 #endif
00128 );
00129 
00130 void VParseFilterCmd (
00131 #if NeedFunctionPrototypes
00132     int                 /* noptions */,
00133     VOptionDescRec []   /* opts */,
00134     int                 /* argc */,
00135     char **             /* argv */,
00136     FILE **             /* inp */,
00137     FILE **             /* outp */
00138 #endif
00139 );
00140 
00141 void VPrintOptions (
00142 #if NeedFunctionPrototypes
00143     FILE *              /* f */,
00144     int                 /* noptions */,
00145     VOptionDescRec []   /* options */
00146 #endif
00147 );
00148 
00149 int VPrintOptionValue (
00150 #if NeedFunctionPrototypes
00151     FILE *              /* f */,
00152     VOptionDescRec *    /* option */
00153 #endif
00154 );
00155 
00156 void VReportBadArgs (
00157 #if NeedFunctionPrototypes
00158     int                 /* argc */,
00159     char **             /* argv */
00160 #endif
00161 );
00162 
00163 void VReportUsage (
00164 #if NeedFunctionPrototypes
00165     VStringConst        /* program */,
00166     int                 /* noptions */,
00167     VOptionDescRec []   /* options */,
00168     VStringConst        /* other_args */
00169 #endif
00170 );
00171 
00172 void VReportUsage_nl (
00173 #if NeedFunctionPrototypes
00174     VStringConst        /* program */,
00175     int                 /* noptions */,
00176     VOptionDescRec []   /* options */,
00177     VStringConst        /* other_args */
00178 #endif
00179 );
00180 
00181 void VReportValidOptions (
00182 #if NeedFunctionPrototypes
00183     int                 /* noptions */,
00184     VOptionDescRec []   /* options */
00185 #endif
00186 );
00187 
00188 /* From Param.c: */
00189 
00190 VBoolean VLoadParameters (
00191 #if NeedFunctionPrototypes
00192     int                 /* nparams */,
00193     VOptionDescRec []   /* params */,
00194     VStringConst        /* filename */,
00195     VStringConst        /* object */,
00196     VPointer            /* values */,
00197     VBoolean            /* ignore_unrecog */
00198 #endif
00199 );
00200 
00201 VBoolean VParseParamDefn (
00202 #if NeedFunctionPrototypes
00203     VStringConst        /* buf */,
00204     VString             /* name */,
00205     VRepnKind *         /* repn */,
00206     VString             /* value */,
00207     VString             /* comment */
00208 #endif
00209 );
00210 
00211 VBoolean VParseParamOptions (
00212 #if NeedFunctionPrototypes
00213     int                 /* nparams */,
00214     VOptionDescRec []   /* params */,
00215     int *               /* argc */,
00216     char **             /* argv */,
00217     VPointer            /* values */
00218 #endif
00219 );
00220 
00221 void VPrintParameters (
00222 #if NeedFunctionPrototypes
00223     FILE *              /* f */,
00224     int                 /* nparams */,
00225     VOptionDescRec []   /* params */,
00226     VPointer            /* values */
00227 #endif
00228 );
00229 
00230 void VReportValidParamOptions (
00231 #if NeedFunctionPrototypes
00232     int                 /* nparams */,
00233     VOptionDescRec []   /* params */,
00234     VPointer            /* values */
00235 #endif
00236 );
00237 
00238 #ifdef __cplusplus
00239 }
00240 #endif
00241 
00242 #endif /* V_option_h */