File: set_args.3m_cli2.html

package info (click to toggle)
fortran-cli2 3.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,856 kB
  • sloc: f90: 6,172; javascript: 3,423; makefile: 189; sh: 25
file content (775 lines) | stat: -rwxr-xr-x 23,908 bytes parent folder | download
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
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
<html> 
<head> 
<title> </title>
<style> 
px {font-family: "Lucida Console", Monaco, monospace }
p { font-size:100%; line-height:1.1em; }
body {xfont-style: sans-serif}
body {
color:#333; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:1em; line-height:1.3em; }
a:visited { color:#666; }
h1,h2,h3,h4,h5,h6 { color:#333; font-family:georgia, verdana, sans-serif; }
h1 { font-size:150%; page-break-before:auto;background-color: #aaaaff}
h2 { font-size:143%;color:teal; }
h3 { font-size:134%;color:blue; }
h4 { font-size:120%;color:gray; }
img { max-width: 55em}
p{ padding: 0;margin:0; }
p{ padding-right:1.4em; }
p{ padding-bottom:0.1em; }
p{ padding-top:1em; }
p{ whitespace: pre-wrap; }
h5,h6 { font-size:100% }
a.nav,a:link.nav, a:visited.nav { background-color:#FFF; color:#000; }
XXtable { border:double #000; border-collapse:collapse; }
XXtable { border-collapse:collapse; }
XXtd { border:thin solid #888; }
XXtd { border:none; }
li { margin-bottom:0.5em; }
blockquote { display:block; font-size:100%; line-height:1.1em; margin:0 0 0.5em; padding:0 2.5em; }
pre { background-color:#DDD; font-size:100%; overflow:auto; padding:1em; }
a,li span { color:#000; }
a:hover, a.nav:hover, a:hover math { background-color:#000; color:#FFF; }
#Container { margin:0 10px; text-align:center; background-color: #BBB}
#Content { border-top:none; margin:auto; padding:0.3em; text-align:left; width:100%; max-width:55em; background:#FFF}
span.webName { font-size:.5em; }
textarea#content { font-size: 1em; line-height: 1.125; }
h1#pageName { line-height:1em; margin:0.2em 0 0.2em 0; padding:0; }
.property { color:#666; font-size:100%; }
a.existingWikiWord[title]{ //border: 1px dashed #BBB; }
.byline { color:#666; font-size:1.0em; font-style:italic; margin-bottom:1em; padding-top:1px; } 
</style> 
</head>
<BODY bgcolor=#F0F0F0 text=#000000 link=#0000ff vlink=#C000C0 alink=#ff0000><A NAME=top></A>
<!--
<h5><a href="https://github.com/urbanjost/M_CLI2">[UP]</a></h5>
<button type="button" onclick="javascript:history.back()">Back</button>
-->
<div id="Container">
<div id="Content">
<CENTER>
<H1><HR><I>Manual Reference Pages &nbsp;-&nbsp;</I><NOBR>set_args (3m_cli2)</NOBR><HR></H1>
</CENTER>
<A name=0>

     <H3>NAME</H3>

</A>
<BLOCKQUOTE>
set_args(3f) - [ARGUMENTS:M_CLI2] command line argument parsing
(LICENSE:PD)
<P>
</BLOCKQUOTE>
<A name=contents></A><H3>CONTENTS</H3></A>
<BLOCKQUOTE>
<A HREF=#1>Synopsis</A><BR>
<A HREF=#2>Description</A><BR>
<A HREF=#3>Options</A><BR>
<A HREF=#4>Defining The Prototype</A><BR>
<A HREF=#5>Usage Notes</A><BR>
<A HREF=#6>Example</A><BR>
<A HREF=#7>Response Files</A><BR>
<A HREF=#8>Specification For Response Files</A><BR>
<A HREF=#9>Author</A><BR>
<A HREF=#10>License</A><BR>
</BLOCKQUOTE>
<A name=11>

     <H3>SYNOPSIS</H3>

</A>
<BLOCKQUOTE>
subroutine set_args(prototype,help_text,version_text,ierr,errmsg)
<P>
<PRE>
     character(len=*),intent(in),optional              :: prototype
     character(len=*),intent(in),optional              :: help_text(:)
     character(len=*),intent(in),optional              :: version_text(:)
     integer,intent(out),optional                      :: ierr
     character(len=:),intent(out),allocatable,optional :: errmsg
</PRE>
</BLOCKQUOTE>
<A name=2>

     <H3>DESCRIPTION</H3>

</A>
<BLOCKQUOTE>
<P>
SET_ARGS(3f) requires a unix-like command prototype which defines
the command-line options and their default values. When the program
is executed this and the command-line options are applied and the
resulting values are placed in an internal table for retrieval via
GET_ARGS(3f).
<P>
The built-in <B>--help</B> and <B>--version</B> options require optional help_text
and version_text values to be provided to be particularly useful.
</BLOCKQUOTE>
<A name=3>

     <H3>OPTIONS</H3>

</A>
<BLOCKQUOTE>
<P>
<TABLE cellpadding=3>
<TR valign=top><TD colspan=2>
<B>PROTOTYPE</B> </TD></TR><TR valign=top><TD width=6%>&nbsp;</TD><TD>
composed of all command arguments concatenated
into a Unix-like command prototype string. For
example:
</TD></TR>
<TR><TD colspan=2>
<PRE>
                call set_args(&#146;-L F --ints 1,2,3 --title "my title" -R 10.3&#146;)
<P>
</PRE>
The following options are predefined for all commands:
</TD></TR>
<TR><TD width=6%>&nbsp;</TD><TD>
<P>
see "DEFINING THE PROTOTYPE" in the next section for
further details.
</TD></TR>
<TR valign=top><TD colspan=2>
<B>HELP_TEXT</B> </TD></TR><TR valign=top><TD width=6%>&nbsp;</TD><TD>
if present, will be displayed when the program is called with
a <B>--help</B> switch, and then the program will terminate. If
help text is not supplied the command line initialization
string will be echoed.
</TD></TR>
<TR valign=top><TD colspan=2>
<B>VERSION_TEXT</B> </TD></TR><TR valign=top><TD width=6%>&nbsp;</TD><TD>
if present, any version text defined will be displayed
when the program is called with a <B>--version</B> switch,
and then the program will terminate.
</TD></TR>
<TR valign=top><TD width=6% nowrap>
<B>IERR</B> </TD><TD valign=bottom>
if present a non-zero option is returned when an
error occurs instead of the program terminating.
</TD></TR>
<TR valign=top><TD width=6% nowrap>
<B>ERRMSG</B> </TD><TD valign=bottom>
a description of the error if ierr is present.
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=4>

     <H3>DEFINING THE PROTOTYPE</H3>

</A>
<BLOCKQUOTE>
<P>
<TABLE cellpadding=3>
<TR valign=top><TD width=3%>
o
</TD><TD>
Keywords start with a single dash for short single-character
keywords, and with two dashes for longer keywords.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
all keywords on the prototype MUST get a value.
<TABLE width=100% cellpadding=3><!-- tsb: all keywords on the prototype MUST get a value.
 -->
<TR></TR><TR></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
logicals must be set to an unquoted F.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
strings must be delimited with double-quotes.
Since internal double-quotes are represented with two
double-quotes the string must be at least one space.
</TD></TR>
<TR></TR></TABLE><!-- .IP \(bu 3 -->
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
numeric keywords are not allowed; but this allows
negative numbers to be used as values.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
lists of values should be comma-delimited unless a
user-specified delimiter is used. The prototype
must use the same array delimiters as the call to
get the value.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
to define a zero-length allocatable array make the
value a delimiter (usually a comma) or an empty set
of braces ("[]").
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; LONG AND SHORT NAMES</H4>
</A>
<BLOCKQUOTE>
<P>
Long keywords start with two dashes followed by more than one letter.
Short keywords are a dash followed by a single letter.
<TABLE cellpadding=3><!-- tsb: Long keywords start with two dashes followed by more than one letter.
 -->
<TR></TR><TR></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
It is recommended long names (<B>--keyword</B>) should be all lowercase
but are case-sensitive by default, unless "set_mode(&#146;ignorecase&#146;)"
is in effect.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
Long names should always be more than one character.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
The recommended way to have short names is to suffix the long
name with :LETTER in the definition.
<P>
If this syntax is used then logical shorts may be combined on the
command line when "set_mode(&#146;strict&#146;)" is in effect.
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; SPECIAL BEHAVIORS</H4>
</A>
<BLOCKQUOTE>
<P>
<TABLE cellpadding=3>
<TR valign=top><TD width=3%>
o
</TD><TD>
A special behavior occurs if a keyword name ends in ::.
When the program is called the next parameter is taken as
a value even if it starts with -. This is not generally
recommended but is useful in rare cases where non-numeric
values starting with a dash are desired.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
If the prototype ends with "--" a special mode is turned
on where anything after "--" on input goes into the variable
REMAINING with values double-quoted and also into the array ARGS
instead of becoming elements in the UNNAMED array. This is not
needed for normal processing, but was needed for a program that
needed this behavior for its subcommands.
<P>
That is, for a normal call all unnamed values go into UNNAMED
and ARGS and REMAINING are ignored. So for
<P>
<PRE>
         call set_args(&#146;-x 10 -y 20 &#146;)
<P>
</PRE>
A program invocation such as
<P>
<PRE>
         xx a b c -- A B C " dd "
<P>
</PRE>
results in
<P>
<PRE>
      UNNAMED= [&#146;a&#146;,&#146;b&#146;,&#146;c&#146;,&#146;A&#146;,&#146;B&#146;,&#146;C&#146;,&#146; dd&#146;]
      REMAINING= &#146;&#146;
      ARGS= [character(len=0) :: ] ! ie, an empty character array
<P>
</PRE>
Whereas
<P>
<PRE>
      call set_args(&#146;-x 10 -y 20 --&#146;)
<P>
</PRE>
generates the following output from the same program execution:
<P>
<PRE>
      UNNAMED= [&#146;a&#146;,&#146;b&#146;,&#146;c&#146;]
      REMAINING= &#146;"A" "B" "C" " dd "&#146;
      ARGS= [&#146;A&#146;,&#146;B&#146;,&#146;C,&#146; dd&#146;]
<P>
</PRE>
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=5>

     <H3>USAGE NOTES</H3>

</A>
<BLOCKQUOTE>
When invoking the program line note the (subject to change)
following restrictions (which often differ between various
command-line parsers):
<TABLE cellpadding=3><!-- tsb: When invoking the program line note the (subject to change)
 -->
<TR></TR><TR></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
values for duplicate keywords are appended together with a space
separator when a command line is executed by default.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
shuffling is not supported. Values immediately follow their
keywords.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
Only short Boolean keywords can be bundled together.
If allowing bundling is desired call "set_mode(&#146;strict&#146;)".
This will require prefixing long names with "--" and short
names with "-". Otherwise M_CLI2 relaxes that requirement
and mostly does not care what prefix is used for a keyword.
But this would make it unclear what was meant by "<B>-ox</B>" if
allowed options were "<B>-o</B> F <B>-x</B> F <B>--ox</B> F " for example, so
"strict" mode is required to remove the ambiguity.
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
if a parameter value of just "-" is supplied it is
converted to the string "stdin".
</TD></TR>
<TR valign=top><TD width=3%>
o
</TD><TD>
values not needed for a keyword value go into the character
array "UNNAMED".
<P>
In addition if the keyword "--" is encountered on the command
line the rest of the command line goes into the character array
"UNNAMED".
</TD></TR>
<TR></TR></TABLE></BLOCKQUOTE>
<A name=6>

     <H3>EXAMPLE</H3>

</A>
<BLOCKQUOTE>
<P>
Sample program:
<P>
<PRE>
    program demo_set_args
    use M_CLI2,  only : filenames=&gt;unnamed, set_args, get_args
    use M_CLI2,  only : get_args_fixed_size
    implicit none
    integer                      :: i
    ! DEFINE ARGS
    real                         :: x, y, z
    real                         :: p(3)
    character(len=:),allocatable :: title
    logical                      :: l, lbig
    integer,allocatable          :: ints(:)
    !
    !  DEFINE COMMAND (TO SET INITIAL VALUES AND ALLOWED KEYWORDS)
    !  AND READ COMMAND LINE
    call set_args(&#146; &
       ! reals
       & -x 1 -y 2.3 -z 3.4e2 &
       ! integer array
       & -p -1,-2,-3 &
       ! always double-quote strings
       & --title "my title" &
       ! string should be a single character at a minimum
       & --label " ", &
       ! set all logical values to F
       & -l F -L F &
       ! set allocatable size to zero if you like by using a delimiter
       & --ints , &
       & &#146;)
    ! ASSIGN VALUES TO ELEMENTS
    !     SCALARS
    call get_args(&#146;x&#146;,x)
    call get_args(&#146;y&#146;,y)
    call get_args(&#146;z&#146;,z)
    call get_args(&#146;l&#146;,l)
    call get_args(&#146;L&#146;,lbig)
    call get_args(&#146;ints&#146;,ints)      ! ALLOCATABLE ARRAY
    call get_args(&#146;title&#146;,title)    ! ALLOCATABLE STRING
    call get_args_fixed_size(&#146;p&#146;,p) ! NON-ALLOCATABLE ARRAY
    ! USE VALUES
    write(*,*)&#146;x=&#146;,x
    write(*,*)&#146;y=&#146;,y
    write(*,*)&#146;z=&#146;,z
    write(*,*)&#146;p=&#146;,p
    write(*,*)&#146;title=&#146;,title
    write(*,*)&#146;ints=&#146;,ints
    write(*,*)&#146;l=&#146;,l
    write(*,*)&#146;L=&#146;,lbig
    ! UNNAMED VALUES
    if(size(filenames) &gt; 0)then
       write(*,&#146;(i6.6,3a)&#146;)(i,&#146;[&#146;,filenames(i),&#146;]&#146;,i=1,size(filenames))
    endif
    end program demo_set_args
<P>
</PRE>
</BLOCKQUOTE>
<A name=7>

     <H3>RESPONSE FILES</H3>

</A>
<BLOCKQUOTE>
<P>
If you have no interest in using external files as abbreviations
you can ignore this section. Otherwise, before calling set_args(3f)
add:
<P>
<PRE>
    use M_CLI2, only : set_mode
    call set_mode(&#146;response_file&#146;)
<P>
</PRE>
M_CLI2 Response files are small files containing CLI (Command Line
Interface) arguments that end with ".rsp" that can be used when command
lines are so long that they would exceed line length limits or so complex
that it is useful to have a platform-independent method of creating
an abbreviation.
<P>
Shell aliases and scripts are often used for similar purposes (and
allow for much more complex conditional execution, of course), but
they generally cannot be used to overcome line length limits and are
typically platform-specific.
<P>
Examples of commands that support similar response files are the Clang
and Intel compilers, although there is no standard format for the files.
<P>
They are read if you add options of the syntax "@NAME" as the FIRST
parameters on your program command line calls. They are not recursive --
that is, an option in a response file cannot be given the value "@NAME2"
to call another response file.
<P>
More than one response name may appear on a command line.
<P>
They are case-sensitive names.
<P>
Note "@" s a special character in Powershell, and requires being escaped
with a grave character.
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; LOCATING RESPONSE FILES</H4>
</A>
<BLOCKQUOTE>
<P>
A search for the response file always starts with the current directory.
The search then proceeds to look in any additional directories specified
with the colon-delimited environment variable CLI_RESPONSE_PATH.
<P>
The first resource file found that results in lines being processed
will be used and processing stops after that first match is found. If
no match is found an error occurs and the program is stopped.
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; RESPONSE FILE SECTIONS</H4>
</A>
<BLOCKQUOTE>
<P>
A simple response file just has options for calling the program in it
prefixed with the word "options".
But they can also contain section headers to denote selections that are
only executed when a specific OS is being used, print messages, and
execute system commands.
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; SEARCHING FOR OSTYPE IN REGULAR FILES</H4>
</A>
<BLOCKQUOTE>
<P>
So assuming the name @NAME was specified on the command line a file
named NAME.rsp will be searched for in all the search directories
and then in that file a string that starts with the string @OSTYPE
(if the environment variables $OS and $OSTYPE are not blank. $OSTYPE
takes precedence over $OS).
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; SEARCHING FOR UNLABELED DIRECTIVES IN REGULAR FILES</H4>
</A>
<BLOCKQUOTE>
<P>
Then, the same files will be searched for lines above any line starting
with "@". That is, if there is no special section for the current OS
it just looks at the top of the file for unlabeled options.
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; SEARCHING FOR OSTYPE AND NAME IN THE COMPOUND FILE</H4>
</A>
<BLOCKQUOTE>
<P>
In addition or instead of files with the same name as the @NAME option
on the command line, you can have one file named after the executable
name that contains multiple abbreviation names.
<P>
So if your program executable is named EXEC you create a single file
called EXEC.rsp and can append all the simple files described above
separating them with lines of the form @OSTYPE@NAME or just @NAME.
<P>
So if no specific file for the abbreviation is found a file called
"EXEC.rsp" is searched for where "EXEC" is the name of the executable.
This file is always a "compound" response file that uses the following format:
<P>
Any compound EXEC.rsp file found in the current or searched directories
will be searched for the string @OSTYPE@NAME first.
<P>
Then if nothing is found, the less specific line @NAME is searched for.
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; THE SEARCH IS OVER</H4>
</A>
<BLOCKQUOTE>
<P>
Sounds complicated but actually works quite intuitively. Make a file in
the current directory and put options in it and it will be used. If that
file ends up needing different cases for different platforms add a line
like "@Linux" to the file and some more lines and that will only be
executed if the environment variable OSTYPE or OS is "Linux". If no match
is found for named sections the lines at the top before any "@" lines
will be used as a default if no match is found.
<P>
If you end up using a lot of files like this you can combine them all
together and put them into a file called "program_name".rsp and just
put lines like @NAME or @OSTYPE@NAME at that top of each selection.
<P>
Now, back to the details on just what you can put in the files.
</BLOCKQUOTE>
<A name=8>

     <H3>SPECIFICATION FOR RESPONSE FILES</H3>

</A>
<BLOCKQUOTE>
<P>
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; SIMPLE RESPONSE FILES</H4>
</A>
<BLOCKQUOTE>
<P>
The first word of a line is special and has the following meanings:
<P>
<PRE>
   options|-  Command options following the rules of the SET_ARGS(3f)
              prototype. So
               o It is preferred to specify a value for all options.
               o double-quote strings.
               o give a blank string value as " ".
               o use F|T for lists of logicals,
               o lists of numbers should be comma-delimited.
               o --usage, --help, --version, --verbose, and unknown
                 options are ignored.
<P>
   comment|#  Line is a comment line
   system|!   System command.
              System commands are executed as a simple call to
              system (so a cd(1) or setting a shell variable
              would not effect subsequent lines, for example)
              BEFORE the command being processed.
   print|&gt;    Message to screen
   stop       display message and stop program.
<P>
</PRE>
NOTE: system commands are executed when encountered, but options are
gathered from multiple option lines and passed together at the end of
processing of the block; so all commands will be executed BEFORE the
command for which options are being supplied no matter where they occur.
<P>
So if a program that does nothing but echos its parameters
<P>
<PRE>
   program testit
   use M_CLI2, only : set_args, rget, sget, lget, set_mode
   implicit none
      real :: x,y                           ; namelist/args/ x,y
      character(len=:),allocatable :: title ; namelist/args/ title
      logical :: big                        ; namelist/args/ big
      call set_mode(&#146;response_file&#146;)
      call set_args(&#146;-x 10.0 -y 20.0 --title "my title" --big F&#146;)
      x=rget(&#146;x&#146;)
      y=rget(&#146;y&#146;)
      title=sget(&#146;title&#146;)
      big=lget(&#146;big&#146;)
      write(*,nml=args)
   end program testit
<P>
</PRE>
And a file in the current directory called "a.rsp" contains
<P>
<PRE>
    # defaults for project A
    options -x 1000 -y 9999
    options --title " "
    options --big T
<P>
</PRE>
The program could be called with
<P>
<PRE>
    $myprog     # normal call
     X=10.0 Y=20.0 TITLE="my title"
<P>
    $myprog @a  # change defaults as specified in "a.rsp"
    X=1000.0 Y=9999.0 TITLE=" "
<P>
    # change defaults but use any option as normal to override defaults
    $myprog @a -y 1234
     X=1000.0 Y=1234.0 TITLE=" "
<P>
</PRE>
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; COMPOUND RESPONSE FILES</H4>
</A>
<BLOCKQUOTE>
<P>
A compound response file has the same basename as the executable with a
".rsp" suffix added. So if your program is named "myprg" the filename
must be "myprg.rsp".
<P>
<PRE>
   Note that here &#145;basename&#145; means the last leaf of the
   name of the program as returned by the Fortran intrinsic
   GET_COMMAND_ARGUMENT(0,&#46;&#46;&#46;) trimmed of anything after a period ("."),
   so it is a good idea not to use hidden files.
<P>
</PRE>
Unlike simple response files compound response files can contain multiple
setting names.
<P>
Specifically in a compound file
if the environment variable $OSTYPE (first) or $OS is set the first search
will be for a line of the form (no leading spaces should be used):
<P>
<PRE>
   @OSTYPE@alias_name
<P>
</PRE>
If no match or if the environment variables $OSTYPE and $OS were not
set or a match is not found then a line of the form
<P>
<PRE>
   @alias_name
<P>
</PRE>
is searched for in simple or compound files. If found subsequent lines
will be ignored that start with "@" until a line not starting with
"@" is encountered. Lines will then be processed until another line
starting with "@" is found or end-of-file is encountered.
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; COMPOUND RESPONSE FILE EXAMPLE</H4>
</A>
<BLOCKQUOTE>
An example compound file
<P>
<PRE>
   #################
   @if
   &gt; RUNNING TESTS USING RELEASE VERSION AND ifort
   options test --release --compiler ifort
   #################
   @gf
   &gt; RUNNING TESTS USING RELEASE VERSION AND gfortran
   options test --release --compiler gfortran
   #################
   @nv
   &gt; RUNNING TESTS USING RELEASE VERSION AND nvfortran
   options test --release --compiler nvfortran
   #################
   @nag
   &gt; RUNNING TESTS USING RELEASE VERSION AND nagfor
   options test --release --compiler nagfor
   #
   #################
   # OS-specific example:
   @Linux@install
   #
   # install executables in directory (assuming install(1) exists)
   #
   system mkdir -p ~/.local/bin
   options run --release T --runner "install -vbp -m 0711 -t ~/.local/bin"
   @install
   STOP INSTALL NOT SUPPORTED ON THIS PLATFORM OR $OSTYPE NOT SET
   #
   #################
   @fpm@testall
   #
   !fpm test --compiler nvfortran
   !fpm test --compiler ifort
   !fpm test --compiler gfortran
   !fpm test --compiler nagfor
   STOP tests complete. Any additional parameters were ignored
   #################
<P>
</PRE>
Would be used like
<P>
<PRE>
   fpm @install
   fpm @nag --
   fpm @testall
<P>
</PRE>
</BLOCKQUOTE>
<A name=>

    <H4>&nbsp; &nbsp; NOTES</H4>
</A>
<BLOCKQUOTE>
<P>
The intel Fortran compiler now calls the response files "indirect
files" and does not add the implied suffix ".rsp" to the files
anymore. It also allows the @NAME syntax anywhere on the command line,
not just at the beginning. -- 20201212
</BLOCKQUOTE>
<A name=9>

     <H3>AUTHOR</H3>

</A>
<BLOCKQUOTE>
John S. Urban, 2019
</BLOCKQUOTE>
<A name=10>

     <H3>LICENSE</H3>

</A>
<BLOCKQUOTE>
Public Domain
</BLOCKQUOTE>
<P><HR>
<TABLE width=100%><TR> <TD width=33%><I>Nemo Release 3.1</I></TD> <TD width=33% align=center>set_args (3m_cli2)</TD> <TD align=right width=33%><I>February 10, 2023</I></TD> </TR></TABLE><FONT SIZE=-1>Generated by <A HREF="http://www.squarebox.co.uk/download/manServer.shtml">manServer 1.08</A> from a623c18e-2bd5-4767-9566-b3d846a4aa55 using man macros.</FONT>
<br><br><center><img src="images/set_args.gif"></center>
</div>
</div>
</body>
</HTML>