File: manopt.h

package info (click to toggle)
segemehl 0.3.4-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,024 kB
  • sloc: ansic: 35,270; makefile: 43; sh: 37
file content (194 lines) | stat: -rw-r--r-- 4,075 bytes parent folder | download | duplicates (3)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
 *   segemehl - a read aligner
 *   Copyright (C) 2008-2017  Steve Hoffmann and Christian Otto
 *
 *   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 3 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
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef MANOPT_H
#define MANOPT_H
/*
 *
 *	manopt.h
 *  declarartions for the option manager    
 * 
 *  @author Steve Hoffmann, steve@bioinf.uni-leipzig.de
 *  @company Bioinformatics, University of Leipzig 
 *  @date 09/01/2008 11:13:03 AM CEST  
 *
 *  Revision of last commit: 
 *  $Rev: 74 $
 *  $Author: steve $
 *  $Date: 2008-10-29 15:03:04 +0100 (Wed, 29 Oct 2008) $
 *
 *
 *  $Id: manopt.h 74 2008-10-29 14:03:04Z steve $ 
 *  $URL: http://www.bioinf.uni-leipzig.de/svn/segemehl/segemehl/branches/esa/trunk/libs/manopt.h $
 *
 */

#define MANOPT_MAXSYNOPSIS 10000

typedef enum{
  FLAG,
  REQSTRINGOPT,
  REQCHAROPT,
  REQINTOPT,
  REQUINTOPT,
  REQDBLOPT,
  MANOPT_ENUMREQUIRED,    /*marker to distinguish required and optional*/
  FILEOPT,
  STRINGOPT,
  CHAROPT,
  INTOPT,
  UINTOPT,
  DBLOPT,
  INTRANGEOPT,
  UINTRANGEOPT,
  DBLRANGEOPT,
  LISTOPT,
  SELECTOPT,
  MANOPT_ENUMSIZE,     /*end of enumeration*/
  MANOPT_BLOCKSEPARATOR,
  TRIPLEINTOPT,
  PAIRINTOPT
} manopt_type;


typedef struct { 
  char *flagname;
  int noofvalues;
  char **values;
} manopt_arg;

typedef struct {
  int noofargs;
  manopt_arg* args;
} manopt_argset;

typedef struct {
  char shortopt;
  char *longopt;
  char *argdesc;
  char *helpmsg;
  char *defaultval;
  unsigned char set;
  unsigned char required;
  manopt_type type;
  void *constraint; 
  manopt_arg arg;
  void *reg_var;
} manopt_option;

typedef struct {
  char *call;
  char *unflagged;
  char *references;
  char *bugs;
  char *version;
  char *description;
  int noofopts;
  manopt_option *opts;
  void *mutually_exclusive_opts;
} manopt_optionset; 

typedef struct {
  int maxlength;
  int minlength;
  int noofitems;
  char** items;
} manopt_listconstraint;

typedef struct {
  int max;
  int min;
  int diff;
} manopt_intconstraint;

typedef struct {
  unsigned int max;
  unsigned int min;
  unsigned int diff;
} manopt_uintconstraint;

typedef struct {
  double max;
  double min;
  double diff;
} manopt_dblconstraint;

int
manopt_parse_commandline(manopt_argset* argset, 
    int argc, 
    char **argv);

void 
manopt(manopt_optionset* set, 
    manopt_type type, 
    unsigned char required,
    char shortopt, 
    char *longopt, 
    char *helpmsg, 
    char *argdesc,
    void *constraints,
    void *reg_var);

manopt_arg*
manopt_getopts(manopt_optionset* set, 
    int argc, 
    char **argv);

char*
getNiceSVNVersion(const char *version);

  char* 
getNiceGitVersion(const char *version, const char *revision, const char *time); 

  void
manopt_destructarg(manopt_arg *arg);

void
manopt_destructoptionset(manopt_optionset *set);
 
void
manopt_dumpoptionset(manopt_optionset *set);

void
manopt_helpmsg(manopt_optionset *set);
 
void
manopt_help(manopt_optionset *set, const char *fmt, ...);

void
manopt_initoptionset(manopt_optionset *set, 
    char *call, char *unflagged, char *description, char *references, char *version, char *bugs);

manopt_option*
manopt_longopt(manopt_optionset *set, char *longopt);

manopt_option*
manopt_shortopt(manopt_optionset *set, char shortopt);

unsigned char
manopt_isset(manopt_optionset *set, char shortopt, char *longopt);
 
void
manopt_blockseparator(manopt_optionset *set, char *blockname);

manopt_arg*
manopt_getarg(manopt_optionset *set, char shortopt, char *longopt);

#endif