Add infrastructure to build debian packages.
[lopsub.git] / lsg.h
1 /*
2 * Copyright (C) 2016 Andre Noll <maan@tuebingen.mpg.de>
3 *
4 * Licensed under the GPL v3, see http://www.gnu.org/licenses/gpl-3.0.html
5 */
6
7 struct lsg_name {
8 char *orig;
9 char *sanitized;
10 char *capitalized;
11 };
12
13 struct lsg_option {
14 struct lsg_name name;
15 char short_opt;
16 char *summary;
17 char *arg_info;
18 char *arg_type;
19 char *typestr;
20 bool multiple, required, ignored;
21 char *default_val;
22 char *help;
23 int num_values;
24 char **values;
25 char **value_literals;
26 char **value_ids;
27 };
28
29 struct lsg_command {
30 struct lsg_name name;
31 char *purpose;
32 char *description;
33 char *closing;
34 char *non_opts_name;
35 char *synopsis;
36 char *aux_info;
37 struct lsg_option *options;
38 int num_options;
39 };
40
41 struct lsg_section {
42 struct lsg_name name;
43 char *text;
44 };
45
46 struct lsg_suite {
47 struct lsg_name name;
48 char *caption; /* additional section heading (.SH), default: empty */
49 char *title; /* defaults to suite name */
50 char *mansect; /* default: 1 */
51 char *date; /* default: current date */
52 char *version_string; /* default: empty */
53 char *manual_title; /* default: User commands */
54 char *aux_info_prefix;
55 char *aux_info_default;
56 char *introduction, *conclusion;
57 /* supercommand is #0, subcommands start at index 1 */
58 struct lsg_command *commands;
59 int num_subcommands;
60 struct lsg_section *sections;
61 int num_sections;
62 };
63
64 extern struct lsg_suite suite;
65
66 #ifndef STAGE1
67 #define OPT_RESULT(_name, _lpr) ((_lpr)->opt_result + LSG_LOPSUBGEN_LOPSUBGEN_OPT_ ## _name)
68 #define OPT_GIVEN(_name, _lpr) (OPT_RESULT(_name, (_lpr))->given)
69 #define OPT_STRING_VAL(_name, _lpr) (OPT_RESULT(_name, (_lpr))->value[0].string_val)
70 #endif /* STAGE1 */