summaryrefslogtreecommitdiff
path: root/doc/invoke-getdefs.texi
blob: b07257ca3b0314ddc37a7ce80562146ed2f6e6fd (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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
@node getdefs Invocation
@section Invoking getdefs
@pindex getdefs
@cindex AutoGen Definition Extraction Tool
@ignore
#  -*- buffer-read-only: t -*- vi: set ro:
# 
# DO NOT EDIT THIS FILE   (invoke-getdefs.texi)
# 
# It has been AutoGen-ed  August 11, 2012 at 09:42:23 AM by AutoGen 5.16.2
# From the definitions    ./opts.def
# and the template file   agtexi-cmd
@end ignore

If no @code{input} argument is provided or is set to simply "-", and if
@code{stdin} is not a @code{tty}, then the list of input files will be
read from @code{stdin}.
This program extracts AutoGen definitions from a list of source files.
Definitions are delimited by @code{/*=<entry-type> <entry-name>\n} and
@code{=*/\n}.  From that, this program creates a definition of the following
form:

@example
    #line nnn "source-file-name"
    entry_type = @{
        name = entry_name;
        ...
    @};
@end example

@enumerate
@item
The ellipsis @code{...} is filled in by text found between the two
delimiters.  Each line of text is stripped of anything before the first
asterisk, then leading asterisks, then any leading or trailing white space.

@item
If what is left starts with what looks like a name followed by a colon, then
it is interpreted as a name followed by a value.

@item
If the first character of the value is either a single or double quote, then
you are responsible for quoting the text as it gets inserted into the output
definitions.  So, if you want whitespace at the beginnings of the lines of
text, you must do something like this:

@example
 * mumble:
 * "  this is some\n"
 * "  indented text."
@end example

@item
If the @code{<entry-name>} is followed by a comma, the word @code{ifdef} (or
@code{ifndef}) and a name @code{if_name}, then the above entry will be under
@code{ifdef} control.

@example
/*=group entry_name, ifdef FOO
 * attr: attribute value
=*/
@end example

Will produce the following:

@example
#ifdef FOO
#line nnn "source-file-name"
group = @{
    name = entry_name;
    attr = 'attribute value';
@};
#endif
@end example

@item
If you use of the @code{subblock} option, you can specify a nested
value, @xref{getdefs subblock}.  That is, this text:

@example
 * arg:  int, this, what-it-is
@end example

with the @code{--subblock=arg=type,name,doc} option would yield:

@example
arg = @{ type = int; name = this; doc = what-it-is; @};
@end example
@end enumerate

This section was generated by @strong{AutoGen},
using the @code{agtexi-cmd} template and the option descriptions for the @code{getdefs} program.
This software is released under the GNU General Public License, version 3 or later.

@menu
* getdefs usage::                  getdefs help/usage (@option{help})
* getdefs def-selection::          def-selection options
* getdefs enumerating::            enumerating options
* getdefs doc-insert::             doc-insert options
* getdefs input-files::            input-files options
* getdefs doc-output::             doc-output options
* getdefs config::                 presetting/configuring getdefs
* getdefs exit status::            exit status
* getdefs See Also::               See Also
@end menu

@node getdefs usage
@subsection getdefs help/usage (@option{help})
@cindex getdefs help

This is the automatically generated usage text for getdefs.

The text printed is the same whether selected with the @code{help} option
(@option{help}) or the @code{more-help} option (@option{more-help}).  @code{more-help} will print
the usage text by passing it through a pager program.
@code{more-help} is disabled on platforms without a working
@code{fork(2)} function.  The @code{PAGER} environment variable is
used to select the program, defaulting to @file{more}.  Both will exit
with a status code of 0.

@exampleindent 0
@example
getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
USAGE:  getdefs [ <option-name>[@{=| @}<val>] ]...

Specify which definitions are of interest and what to say about them:

   Arg Option-Name    Description
   Str defs-to-get    Regexp to look for after the "/*="
   Str subblock       subblock definition names
                                - may appear multiple times
   Str listattr       attribute with list of values
                                - may appear multiple times

specify how to number the definitions:

   Arg Option-Name    Description
   opt ordering       Alphabetize or use named file
                                - disabled as --no-ordering
                                - enabled by default
   Num first-index    The first index to apply to groups

Definition insertion options:

   Arg Option-Name    Description
   opt filelist       Insert source file names into defs
   Str assign         Global assignments
                                - may appear multiple times
   Str common-assign  Assignments common to all blocks
                                - may appear multiple times
   Str copy           File(s) to copy into definitions
                                - may appear multiple times
   opt srcfile        Insert source file name into each def
   opt linenum        Insert source line number into each def

specify which files to search for markers:

   Arg Option-Name    Description
   Str input          Input file to search for defs
                                - may appear multiple times
                                - default option for unnamed options

Definition output disposition options::

   Arg Option-Name    Description
   Str output         Output file to open
                                - an alternate for autogen
   opt autogen        Invoke AutoGen with defs
                                - disabled as --no-autogen
                                - enabled by default
   Str template       Template Name
   Str agarg          AutoGen Argument
                                - prohibits these options:
                                output
                                - may appear multiple times
   Str base-name      Base name for output file(s)
                                - prohibits these options:
                                output

version, usage and configuration options:

   Arg Option-Name    Description
   opt version        Output version information and exit
   no  help           Display extended usage information and exit
   no  more-help      Extended usage information passed thru pager
   opt save-opts      Save the option state to a config file
   Str load-opts      Load options from a config file
                                - disabled as --no-load-opts
                                - may appear multiple times

All arguments are named options.

If no ``input'' argument is provided or is set to simply "-", and if
``stdin'' is not a ``tty'', then the list of input files will be read from
``stdin''.

The following option preset mechanisms are supported:
 - reading file /dev/null

This program extracts AutoGen definitions from a list of source files.
Definitions are delimited by ``/*=<entry-type> <entry-name>\n'' and
``=*/\n''.
Packaged by Bruce (2012-08-11)
Report getdefs bugs to bkorb@@gnu.org
@end example
@exampleindent 4

@node getdefs def-selection
@subsection def-selection options
Specify which definitions are of interest and what to say about them.
@subsubheading defs-to-get option.
@anchor{getdefs defs-to-get}
@cindex getdefs-defs-to-get

This is the ``regexp to look for after the "/*="'' option.
This option takes an argument string @file{reg-ex}.
If you want definitions only from a particular category, or even
with names matching particular patterns, then specify this regular
expression for the text that must follow the @code{/*=}.
@subsubheading subblock option.
@anchor{getdefs subblock}
@cindex getdefs-subblock

This is the ``subblock definition names'' option.
This option takes an argument string @file{sub-def}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

This option is used to create shorthand entries for nested definitions.
For example, with:
@table @r
@item using subblock thus
@code{--subblock=arg=argname,type,null}
@item and defining an @code{arg} thus
@code{arg: this, char *}
@item will then expand to:
@code{arg = @{ argname = this; type = "char *"; @};}
@end table
The "this, char *" string is separated at the commas, with the
white space removed.  You may use characters other than commas by
starting the value string with a punctuation character other than
a single or double quote character.  You may also omit intermediate
values by placing the commas next to each other with no intervening
white space.  For example, "+mumble++yes+" will expand to:
@*
@code{arg = @{ argname = mumble; null = "yes"; @};}.
@subsubheading listattr option.
@anchor{getdefs listattr}
@cindex getdefs-listattr

This is the ``attribute with list of values'' option.
This option takes an argument string @file{def}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

This option is used to create shorthand entries for definitions
that generally appear several times.  That is, they tend to be
a list of values.  For example, with:
@*
@code{listattr=foo} defined, the text:
@*
@code{foo: this, is, a, multi-list} will then expand to:
@*
@code{foo = 'this', 'is', 'a', 'multi-list';}
@*
The texts are separated by the commas, with the
white space removed.  You may use characters other than commas by
starting the value string with a punctuation character other than
a single or double quote character.
@node getdefs enumerating
@subsection enumerating options
specify how to number the definitions.
@subsubheading ordering option.
@anchor{getdefs ordering}
@cindex getdefs-ordering

This is the ``alphabetize or use named file'' option.
This option takes an optional argument string @file{file-name}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
is enabled by default.
@end itemize

By default, ordering is alphabetical by the entry name.  Use,
@code{no-ordering} if order is unimportant.  Use @code{ordering}
with no argument to order without case sensitivity.  Use
@code{ordering=<file-name>} if chronological order is important.
getdefs will maintain the text content of @code{file-name}.
@code{file-name} need not exist.
@subsubheading first-index option.
@anchor{getdefs first-index}
@cindex getdefs-first-index

This is the ``the first index to apply to groups'' option.
This option takes an argument number @file{first-index}.
By default, the first occurrence of a named definition will have an
index of zero.  Sometimes, that needs to be a reserved value.  Provide
this option to specify a different starting point.
@node getdefs doc-insert
@subsection doc-insert options
Definition insertion options.
@subsubheading filelist option.
@anchor{getdefs filelist}
@cindex getdefs-filelist

This is the ``insert source file names into defs'' option.
This option takes an optional argument string @file{file}.
Inserts the name of each input file into the output definitions.
If no argument is supplied, the format will be:
@example
infile = '%s';
@end example
If an argument is supplied, that string will be used for the entry
name instead of @var{infile}.
@subsubheading assign option.
@anchor{getdefs assign}
@cindex getdefs-assign

This is the ``global assignments'' option.
This option takes an argument string @file{ag-def}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

The argument to each copy of this option will be inserted into
the output definitions, with only a semicolon attached.
@subsubheading common-assign option.
@anchor{getdefs common-assign}
@cindex getdefs-common-assign

This is the ``assignments common to all blocks'' option.
This option takes an argument string @file{ag-def}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

The argument to each copy of this option will be inserted into
each output definition, with only a semicolon attached.
@subsubheading copy option.
@anchor{getdefs copy}
@cindex getdefs-copy

This is the ``file(s) to copy into definitions'' option.
This option takes an argument string @file{file}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

The content of each file named by these options will be inserted into
the output definitions.
@subsubheading srcfile option.
@anchor{getdefs srcfile}
@cindex getdefs-srcfile

This is the ``insert source file name into each def'' option.
This option takes an optional argument string @file{file}.
Inserts the name of the input file where a definition was found
into the output definition.
If no argument is supplied, the format will be:
@example
srcfile = '%s';
@end example
If an argument is supplied, that string will be used for the entry
name instead of @var{srcfile}.
@subsubheading linenum option.
@anchor{getdefs linenum}
@cindex getdefs-linenum

This is the ``insert source line number into each def'' option.
This option takes an optional argument string @file{def-name}.
Inserts the line number in the input file where a definition
was found into the output definition.
If no argument is supplied, the format will be:
@example
linenum = '%s';
@end example
If an argument is supplied, that string will be used for the entry
name instead of @var{linenum}.
@node getdefs input-files
@subsection input-files options
specify which files to search for markers.
@subsubheading input option.
@anchor{getdefs input}
@cindex getdefs-input

This is the ``input file to search for defs'' option.
This option takes an argument string @file{src-file}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@end itemize

All files that are to be searched for definitions must be named on
the command line or read from @code{stdin}.  If there is only one
@code{input} option and it is the string, "-", then the input file
list is read from @code{stdin}.  If a command line argument is not
an option name and does not contain an assignment operator
(@code{=}), then it defaults to being an input file name.
At least one input file must be specified.
@node getdefs doc-output
@subsection doc-output options
Definition output disposition options:.
@subsubheading output option.
@anchor{getdefs output}
@cindex getdefs-output

This is the ``output file to open'' option.
This option takes an argument string @file{file}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
is a member of the autogen class of options.
@end itemize

If you are not sending the output to an AutoGen process,
you may name an output file instead.
@subsubheading autogen option.
@anchor{getdefs autogen}
@cindex getdefs-autogen

This is the ``invoke autogen with defs'' option.
This option takes an optional argument string @file{ag-cmd}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
is enabled by default.
@item
is a member of the autogen class of options.
@end itemize

This is the default output mode.  Specifying @code{no-autogen} is
equivalent to @code{output=-}.  If you supply an argument to this
option, that program will be started as if it were AutoGen and
its standard in will be set to the output definitions of this program.
@subsubheading template option.
@anchor{getdefs template}
@cindex getdefs-template

This is the ``template name'' option.
This option takes an argument string @file{file}.
Specifies the template name to be used for generating the final output.
@subsubheading agarg option.
@anchor{getdefs agarg}
@cindex getdefs-agarg

This is the ``autogen argument'' option.
This option takes an argument string @file{ag-opt}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
may appear an unlimited number of times.
@item
must not appear in combination with any of the following options:
output.
@end itemize

This is a pass-through argument.  It allows you to specify any
arbitrary argument to be passed to AutoGen.
@subsubheading base-name option.
@anchor{getdefs base-name}
@cindex getdefs-base-name

This is the ``base name for output file(s)'' option.
This option takes an argument string @file{name}.

@noindent
This option has some usage constraints.  It:
@itemize @bullet
@item
must not appear in combination with any of the following options:
output.
@end itemize

When output is going to AutoGen, a base name must either be supplied
or derived.  If this option is not supplied, then it is taken from
the @code{template} option.  If that is not provided either, then
it is set to the base name of the current directory.


@node getdefs config
@subsection presetting/configuring getdefs

Any option that is not marked as @i{not presettable} may be preset by
loading values from configuration ("rc" or "ini") files.


@noindent
@code{libopts} will search in @file{/dev/null} for configuration (option) data.
If this is a plain file, it is simply processed.
If it is a directory, then a file named @file{.getdefsrc} is searched for within that directory.

Configuration files may be in a wide variety of formats.
The basic format is an option name followed by a value (argument) on the
same line.  Values may be separated from the option name with a colon,
equal sign or simply white space.  Values may be continued across multiple
lines by escaping the newline with a backslash.

Multiple programs may also share the same initialization file.
Common options are collected at the top, followed by program specific
segments.  The segments are separated by lines like:
@example
[GETDEFS]
@end example
@noindent
or by
@example
<?program getdefs>
@end example
@noindent
Do not mix these styles within one configuration file.

Compound values and carefully constructed string values may also be
specified using XML syntax:
@example
<option-name>
   <sub-opt>...&lt;...&gt;...</sub-opt>
</option-name>
@end example
@noindent
yielding an @code{option-name.sub-opt} string value of
@example
"...<...>..."
@end example
@code{AutoOpts} does not track suboptions.  You simply note that it is a
hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
the associated name/value pair list (see: optionFindValue).

The command line options relating to configuration and/or usage help are:

@subsubheading version

Print the program version to standard out, optionally with licensing
information, then exit 0.  The optional argument specifies how much licensing
detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.  Only the
first letter of the argument is examined:

@table @samp
@item version
Only print the version.  This is the default.
@item copyright
Name the copyright usage licensing terms.
@item verbose
Print the full copyright usage licensing terms.
@end table

@node getdefs exit status
@subsection getdefs exit status

One of the following exit values will be returned:
@table @samp
@item 0 (EXIT_SUCCESS)
Successful program execution.
@item 1 (EXIT_FAILURE)
The operation failed or the command syntax was not valid.
@item 66 (EX_NOINPUT)
A specified configuration file could not be loaded.
@item 70 (EX_SOFTWARE)
libopts had an internal operational error.  Please report
it to autogen-users@@lists.sourceforge.net.  Thank you.
@end table
@node getdefs See Also
@subsection getdefs See Also
This program is documented more fully in the Getdefs section
of the Add-On chapter in the @code{AutoGen} Info system documentation.