]> git.mxchange.org Git - flightgear.git/blob - Main/fg_getopt.h
Prepairing for C++ integration.
[flightgear.git] / Main / fg_getopt.h
1 /****************************************************************************
2 *
3 *               Copyright (C) 1991-1997 SciTech Software, Inc.
4 *                            All rights reserved.
5 *
6 *  ======================================================================
7 *       This library is free software; you can use it and/or
8 *       modify it under the terms of the SciTech MGL Software License.
9 *
10 *       This library is distributed in the hope that it will be useful,
11 *       but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *       SciTech MGL Software License for more details.
14 *  ======================================================================
15 *
16 * Filename:     $Workfile:   getopt.h  $
17 * Version:      $Revision$
18 *
19 * Language:     ANSI C
20 * Environment:  any
21 *
22 * Description:  Header file for command line parsing module. This module
23 *               contains code to parse the command line, extracting options
24 *               and parameters in standard System V style.
25 *
26 * $Date$ $Author$
27 *
28 * $Id$
29 * (Log is kept at end of this file)
30 *
31 ****************************************************************************/
32
33
34 #ifndef __GETOPT_H
35 #define __GETOPT_H
36
37
38 #ifdef __cplusplus                                                          
39 extern "C" {                            
40 #endif                                   
41
42
43 //#ifndef __DEBUG_H
44 //#include "debug.h"
45 //#endif
46
47 /*---------------------------- Typedef's etc -----------------------------*/
48
49 #define ALLDONE     -1
50 #define PARAMETER   -2
51 #define INVALID     -3
52 #define HELP        -4
53
54 #define MAXARG      80
55
56 /* Option type sepecifiers */
57
58 #define OPT_INTEGER     'd'
59 #define OPT_HEX         'h'
60 #define OPT_OCTAL       'o'
61 #define OPT_UNSIGNED    'u'
62 #define OPT_LINTEGER    'D'
63 #define OPT_LHEX        'H'
64 #define OPT_LOCTAL      'O'
65 #define OPT_LUNSIGNED   'U'
66 #define OPT_FLOAT       'f'
67 #define OPT_DOUBLE      'F'
68 #define OPT_LDOUBLE     'L'
69 #define OPT_STRING      's'
70 #define OPT_SWITCH      '!'
71
72 // I need to generate a typedefs file for this.
73 //
74 #ifndef uchar
75 typedef unsigned char uchar;
76 #endif
77 #ifndef uint
78 typedef unsigned int uint;
79 #endif
80
81 #ifndef ulong
82 typedef unsigned long ulong;
83 #endif
84
85 #ifndef bool
86 #ifndef BOOL
87 typedef int BOOL;
88 #endif
89 typedef BOOL bool;
90 #endif
91
92 #ifndef true
93 #ifndef TRUE
94 #define TRUE 1
95 #define FALSE 0
96 #endif
97 #define true TRUE
98 #define false FALSE
99 #endif
100
101 typedef struct {
102     uchar   opt;                /* The letter to describe the option    */
103     uchar   type;               /* Type descriptor for the option       */
104     void    *arg;               /* Place to store the argument          */
105     char    *desc;              /* Description for this option          */
106     } Option;
107
108 #define NUM_OPT(a)  sizeof(a) / sizeof(Option)
109
110
111 /*--------------------------- Global variables ---------------------------*/
112
113 extern  int     nextargv;
114 extern  char    *nextchar;
115
116 /*------------------------- Function Prototypes --------------------------*/
117
118 // extern int getopt(int argc,char **argv,char *format,char **argument);
119
120 extern int getargs(int argc, char *argv[],int num_opt, Option ** optarr,
121                    int (*do_param)(char *param,int num));
122
123 extern void print_desc(int num_opt, Option **optarr);  // Not original code
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129 #endif
130
131
132 /* $Log$
133 /* Revision 1.2  1998/04/21 17:02:41  curt
134 /* Prepairing for C++ integration.
135 /*
136  * Revision 1.1  1998/02/13 00:23:39  curt
137  * Initial revision.
138  *
139  */