forked from unpaper/unpaper
/
parse.h
65 lines (47 loc) · 1.85 KB
/
parse.h
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
/*
* This file is part of Unpaper.
*
* Copyright © 2005-2007 Jens Gulden
* Copyright © 2011-2011 Diego Elio Pettenò
*
* Unpaper 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, version 2 of the License.
*
* Unpaper 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 PARSE_H
#define PARSE_H
/* --- tool functions for parameter parsing and verbose output ------------ */
int parseDirections(char* s);
const char *getDirections(int d);
int parseEdges(char* s);
void printEdges(int d);
void parseInts(char* s, int i[2]);
void parseSize(char* s, int i[2], int dpi);
int parseColor(char* s);
void parseFloats(char* s, float f[2]);
char* implode(char* buf, const char* s[], int cnt);
struct MultiIndex {
int count;
int *indexes;
};
void parseMultiIndex(const char *optarg, struct MultiIndex *multiIndex);
bool isInMultiIndex(int index, struct MultiIndex multiIndex);
/**
* Tests whether 'index' is either part of multiIndex or excludeIndex.
* (Throughout the application, excludeIndex generalizes several individual
* multi-indices: if an entry is part of excludeIndex, it is treated as being
* an entry of all other multiIndices, too.)
*/
static inline bool isExcluded(int index, struct MultiIndex multiIndex, struct MultiIndex excludeIndex) {
return ( isInMultiIndex(index, excludeIndex) || isInMultiIndex(index, multiIndex) );
}
void printMultiIndex(struct MultiIndex multiIndex);
#endif /* PARSE_H */