xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / gcc / m2 / gm2-libs / cgetopt.def
blob5cfb6a1e57c7a45cefdbcc370a5a3a75b7d9bfbd
1 (* getopt.def provides access to the getopt C library.
3 Copyright (C) 2017-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
27 DEFINITION MODULE cgetopt ;
29 FROM SYSTEM IMPORT ADDRESS ;
31 TYPE
32 Options = ADDRESS ;
34 VAR
35 optarg : ADDRESS ;
36 optind, opterr, optopt: INTEGER ;
40 getopt - the getopt() function parses the command-line arguments.
41 Its arguments argc and argv are the argument count and array as
42 passed to the main() function on program invocation. An element of
43 argv that starts with '-' (and is not exactly "-" or "--") is an
44 option element. The characters of this element (aside from the
45 initial '-') are option characters. If getopt() is called
46 repeatedly, it returns successively each of the option characters
47 from each of the option elements.
50 PROCEDURE getopt (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS) : CHAR ;
54 getopt_long - works like getopt() except that it also accepts long options,
55 started with two dashes. (If the program accepts only long
56 options, then optstring should be specified as an empty string (""),
57 not NULL.) Long option names may be abbreviated if the abbreviation
58 is unique or is an exact match for some defined option. A
59 long option may take a parameter, of the form --arg=param or
60 --arg param.
63 PROCEDURE getopt_long (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS;
64 longopts: ADDRESS; VAR longindex: INTEGER) : INTEGER ;
68 getopt_long_only - a wrapper for the C getopt_long_only.
71 PROCEDURE getopt_long_only (argc: INTEGER; argv: ADDRESS; optstring: ADDRESS;
72 longopts: ADDRESS; VAR longindex: INTEGER) : INTEGER ;
76 InitOptions - constructor for empty Options.
79 PROCEDURE InitOptions () : Options ;
83 KillOptions - deconstructor for empty Options.
86 PROCEDURE KillOptions (o: Options) : Options ;
90 SetOption - set option[index] with {name, has_arg, flag, val}.
93 PROCEDURE SetOption (o: Options; index: CARDINAL;
94 name: ADDRESS; has_arg: INTEGER;
95 VAR flag: INTEGER; val: INTEGER) ;
99 GetLongOptionArray - return a pointer to the C array containing all
100 long options.
103 PROCEDURE GetLongOptionArray (o: Options) : ADDRESS ;
106 END cgetopt.