Debian Codegraph @

options.h

raw symbols SCIP
1 /* options.h
2 $Id: options.h,v 1.3 1997/10/14 09:11:26 elf Exp $
3
4 written by Marc Singer
5 20 April 1996
6
7 This file is part of the project CurVeS. See the file README for
8 more information.
9
10 Copyright (C) 1996 Marc Singer
11
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 in a file called COPYING along with this program; if not, write to
24 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
25 02139, USA.
26
27 */
28
29 #ifndef __OPTIONS_H__
30 #define __OPTIONS_H__
31
32 // ----- Inclusions
33
34 // ----- Constants
35
36 // ----- Typedefs
37
38 typedef enum {
39 OptNonoption = 0x0001, // Option to use for non-options
40 OptDefault = 0x0002, // Option to use when no other found
41 OptArg = 0x0004, // Option has an argument
42 OptCommand = 0x0008, // Option is a command, no dash prefix
43 OptAllDash = 0x0010, // Long option recognized after one dash or two
44 OptSetType = 0x0f00,
45 OptSetMask = 0xff00,
46 OptSetString = 0x0100,
47 OptSetInt = 0x0200,
48 OptSetShort = 0x0400,
49 OptSetLong = 0x0800,
50 OptClear = 0x8000,
51 } E_Opt;
52
53 typedef enum {
54 OptErrOk = 0,
55 OptErrFail = 1, // Option function failed
56 OptErrUnrecognized = 2, // Unrecognized option
57 OptErrNoArgument = 3, // Argument missing
58 OptErrBadOption = 4, // Error in option descriptions
59 OptErrAmbiguous = 5, // Ambiguous partial
60 OptErrExit = 9, // Used internally for quick exit
61 } E_OptErr;
62
63 struct _OPTION;
64
65 typedef int (*PFN_OPTION) (struct _OPTION* pOption, const char* pch);
66
67 typedef struct _OPTION {
68 const char* sz; // Text of option
69 unsigned flags;
70 void* pv; // Pointer to option result
71 PFN_OPTION pfn; // Callback function
72 } OPTION;
73
74 // ----- Classes
75
76 // ----- Macros
77
78 // ----- Globals / Externals
79
80 // ----- Prototypes
81
82 char* parse_application (char* pch);
83 int parse_options (int argc, char** argv, OPTION* rgOptions, int* argc_used);
84
85
86 // ----- Inline
87
88 #endif // __OPTIONS_H__