Debian Codegraph @

src/petopt.h

raw symbols SCIP
1 /*
2 ** petopt.h - Command line argument parser header file
3 **
4 ** Copyright (c) 1999 Peter Eriksson <[email protected]>
5 **
6 ** This program is free software; you can redistribute it and/or
7 ** modify it as you wish - as long as you don't claim that you wrote
8 ** it.
9 **
10 ** This program 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.
13 */
14
15 #ifndef PETOPT_H
16 #define PETOPT_Hcxx . . $ `src/petopt.h:16:9`!
17
18 /* Option types and flags */
19 #define POF_TYPEMASKcxx . . $ `src/petopt.h:19:9`! 0x00FF
20
21 #define POF_NONEcxx . . $ `src/petopt.h:21:9`! 0x0000
22 #define POF_INTcxx . . $ `src/petopt.h:22:9`! 0x0001 /* Argument is an 'int' number */
23 #define POF_STRcxx . . $ `src/petopt.h:23:9`! 0x0002 /* Argument is a 'char *' string */
24 #define POF_BOOLcxx . . $ `src/petopt.h:24:9`! 0x0003 /* Argument is a 'int' boolean */
25
26 #define POF_OPTcxx . . $ `src/petopt.h:26:9`! 0x0100 /* Argument is optional */
27 #define POF_DUPcxx . . $ `src/petopt.h:27:9`! 0x0200 /* strdup() the assigned var (if string) */
28
29 /* Global flags */
30 #define POF_SYSLOGcxx . . $ `src/petopt.h:30:9`! 0x1000 /* Send errors to syslog */
31 #define POF_NOERRPRINTcxx . . $ `src/petopt.h:31:9`! 0x2000 /* Do not print errors to stderr */
32 #define POF_PRDEFAULTcxx . . $ `src/petopt.h:32:9`! 0x4000 /* Print default values in usage text */
33
34 /* Error returns */
35 #define POE_EOFcxx . . $ `src/petopt.h:35:9`! -1
36
37 #define POE_OPTIONcxx . . $ `src/petopt.h:37:9`! -2 /* Invalid option */
38 #define POE_MULTIcxx . . $ `src/petopt.h:38:9`! -3 /* Option is not unique */
39 #define POE_MISSINGcxx . . $ `src/petopt.h:39:9`! -4 /* Required argument to option is missing */
40 #define POE_INVALIDcxx . . $ `src/petopt.h:40:9`! -5 /* Invalid argument to option */
41 #define POE_INTERNALcxx . . $ `src/petopt.h:41:9`! -6 /* Internal error */
42
43
44 typedef struct petopt_optioncxx . . $ petopt_option#
45 {
46 int scxx . . $ petopt_option#s.; /* Short option character */
47 int fcxx . . $ petopt_option#f.; /* Argument flags */
48 char *lcxx . . $ petopt_option#l.; /* Long option name */
49 void *vcxx . . $ petopt_option#v.; /* Variable pointer */
50 char *hcxx . . $ petopt_option#h.; /* Help/usage string */
51 } PETOPTScxx . . $ PETOPTS#;
52
53
54 typedef struct petoptcxx . . $ petopt#
55 {
56 int fcxx . . $ petopt#f.;
57 int aicxx . . $ petopt#ai.;
58 int cicxx . . $ petopt#ci.;
59 int saved_aicxx . . $ petopt#saved_ai.;
60 int saved_cicxx . . $ petopt#saved_ci.;
61 int argccxx . . $ petopt#argc.;
62 const char **argvcxx . . $ petopt#argv.;
63 PETOPTScxx . . $ PETOPTS# *povcxx . . $ petopt#pov.;
64 int (*parsecxx . . $ petopt#parse.)(struct petoptcxx . . $ petopt# *pp, PETOPTScxx . . $ PETOPTS# *pov, const char *arg);
65 int (*errprcxx . . $ petopt#errpr.)(struct petoptcxx . . $ petopt# *pp, PETOPTScxx . . $ PETOPTS# *pov, int err, FILE *fp);
66 int oaccxx . . $ petopt#oac.;
67 char **oavcxx . . $ petopt#oav.;
68 } PETOPTcxx . . $ PETOPT#;
69
70
71 extern int
72 petopt_setupcxx . . $ petopt_setup(9cab59fb7568ad4c).(PETOPTcxx . . $ PETOPT# **popp,
73 int f,
74 int argc,
75 char **argv,
76 PETOPTScxx . . $ PETOPTS# *pov,
77 int (*parse)(PETOPTcxx . . $ PETOPT# *pop, PETOPTScxx . . $ PETOPTS# *pov, const char *arg),
78 int (*errpr)(PETOPTcxx . . $ PETOPT# *pop, PETOPTScxx . . $ PETOPTS# *pov, int err, FILE *fp));
79
80
81 extern int
82 petopt_parsecxx . . $ petopt_parse(7260f6448cc115d3).(PETOPTcxx . . $ PETOPT# *pop,
83 int *o_argc,
84 char ***o_argv);
85
86 extern int
87 petopt_print_errorcxx . . $ petopt_print_error(3e3c917375c6672a).(PETOPTcxx . . $ PETOPT# *pop,
88 PETOPTScxx . . $ PETOPTS# *pov,
89 int err,
90 FILE *fp);
91
92 extern int
93 petopt_print_usagecxx . . $ petopt_print_usage(d7c4fb50eb813c46).(PETOPTcxx . . $ PETOPT# *pop,
94 FILE *fp);
95
96 extern int
97 petopt_cleanupcxx . . $ petopt_cleanup(c5237268d77c6cf4).(PETOPTcxx . . $ PETOPT# *pop);
98
99 #endif