File: options.h

package info (click to toggle)
curves 0.8.7
  • links: PTS
  • area: main
  • in suites: slink
  • size: 704 kB
  • ctags: 1,001
  • sloc: cpp: 6,197; ansic: 519; makefile: 270; sh: 192; fortran: 149
file content (86 lines) | stat: -rw-r--r-- 2,401 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* options.h
     $Id: options.h,v 1.2 1996/10/30 09:37:13 elf Exp $

   written by Marc Singer
   20 April 1996
   
   This file is part of the project CurVeS.  See the file README for
   more information.

   Copyright (C) 1996 Marc Singer

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   in a file called COPYING along with this program; if not, write to
   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
   02139, USA.

*/

#ifndef __OPTIONS_H__
#define __OPTIONS_H__

// ----- Inclusions

// ----- Constants

// ----- Typedefs

typedef enum {
  OPTION_F_NONOPTION	= 0x0001,	// Option to use for non-options
  OPTION_F_DEFAULT	= 0x0002,	// Option to use when no other found
  OPTION_F_ARGUMENT	= 0x0004,	// Option has an argument
  OPTION_F_COMMAND	= 0x0008,	// Option is a command, no dash prefix
  OPTION_F_SET_TYPE	= 0x0f00,
  OPTION_F_SET_MASK	= 0xff00,
  OPTION_F_SET_STRING	= 0x0100,
  OPTION_F_SET_INT	= 0x0200,
  OPTION_F_SET_SHORT	= 0x0400,
  OPTION_F_SET_LONG	= 0x0800,
  OPTION_F_CLEAR	= 0x8000,
} E_OPTION_F;

typedef enum {
  OPTION_ERR_OK		= 0,
  OPTION_ERR_FAIL	= 1,		// Option function failed
  OPTION_ERR_UNRECOGNIZED = 2,		// Unrecognized option
  OPTION_ERR_NOARGUMENT	= 3,		// Argument missing
  OPTION_ERR_BADOPTION	= 4,		// Error in option descriptions
  OPTION_ERR_EXIT	= 9,		// Used internally for quick exit
} E_OPTION_ERR;

struct _OPTION;

typedef int (*PFN_OPTION) (struct _OPTION* pOption, const char* pch);

typedef struct _OPTION {
  const char* sz;		// Text of option
  unsigned flags;
  void* pv;			// Pointer to option result
  PFN_OPTION pfn;		// Callback function
} OPTION;

// ----- Classes

// ----- Macros

// ----- Globals / Externals

// ----- Prototypes

char* parse_application (char* pch);
int parse_options (int argc, char** argv, OPTION* rgOptions, int* argc_used);


// ----- Inline

#endif		// __OPTIONS_H__