blob: 58afaa1643ccfba250564e65ec3f58c63670734d (
plain)
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
|
/*
* Copyright (C) 2016 Andre Noll <maan@tuebingen.mpg.de>
*
* Licensed under the GPL v3, see https://www.gnu.org/licenses/gpl-3.0.html
*/
struct lsg_name {
char *orig;
char *sanitized;
char *capitalized;
};
struct lsg_option {
struct lsg_name name;
char short_opt;
char *summary;
char *arg_info;
char *arg_type;
char *typestr;
bool multiple, required, ignored;
char *default_val;
char *help;
int num_values;
char **values;
char **value_literals;
char **value_ids;
};
struct lsg_command {
struct lsg_name name;
char *purpose;
char *description;
char *closing;
char *non_opts_name;
char *synopsis;
char *aux_info;
struct lsg_option *options;
int num_options;
};
struct lsg_section {
struct lsg_name name;
char *text;
};
struct lsg_suite {
struct lsg_name name;
char *caption; /* additional section heading (.SH), default: empty */
char *title; /* defaults to suite name */
char *mansect; /* default: 1 */
char *date; /* default: current date */
char *version_string; /* default: empty */
char *manual_title; /* default: User commands */
char *aux_info_prefix;
char *aux_info_default;
char *introduction, *conclusion;
/* supercommand is #0, subcommands start at index 1 */
struct lsg_command *commands;
int num_subcommands;
struct lsg_section *sections;
int num_sections;
};
extern struct lsg_suite suite;
#ifndef STAGE1
#define OPT_RESULT(_name, _lpr) ((_lpr)->opt_result + LSG_LOPSUBGEN_LOPSUBGEN_OPT_ ## _name)
#define OPT_GIVEN(_name, _lpr) (OPT_RESULT(_name, (_lpr))->given)
#define OPT_STRING_VAL(_name, _lpr) (OPT_RESULT(_name, (_lpr))->value[0].string_val)
#endif /* STAGE1 */
|