1Getopt(3) User Contributed Perl Documentation Getopt(3)
2
3
4
6 Verilog::Getopt - Get Verilog command line options
7
9 use Verilog::Getopt;
10
11 my $opt = new Verilog::Getopt;
12 $opt->parameter (qw( +incdir+standard_include_directory ));
13
14 @ARGV = $opt->parameter(@ARGV);
15 ...
16 print "Path to foo.v is ", $opt->file_path('foo.v');
17
19 Verilog::Getopt provides standardized handling of options similar to
20 Verilog/VCS and cc/GCC.
21
23 The new() constructor accepts the following options:
24
25 filename_expansion=>1
26 Enable converting filenames to relative filenames when possible.
27 This option is needed when the -F option will be used. If flags
28 are passed through Getopt which should otherwise not be expanded
29 (e.g. "--out myfile.v") having this option set may undesirably
30 expand myfile.v to an absolute filename.
31
32 gcc_style=>0
33 Disable parsing of GCC-like parameters.
34
35 vcs_style=>0
36 Disable parsing of VCS-like parameters.
37
39 $opt = Verilog::Getopt->new ( opts )
40 Create a new Getopt. See OPTIONS above.
41
42 $self->file_path(filename, [lookup_type])
43 Returns a new path to the filename, using the library directories
44 and search paths to resolve the file. Optional lookup_type is
45 'module', 'include', or 'all', to use only module_dirs, incdirs, or
46 both for the lookup.
47
48 $self->get_parameters()
49 Returns a list of parameters that when passed through
50 $self->parameter() should result in the same state. Often this is
51 used to form command lines for downstream programs that also use
52 Verilog::Getopt.
53
54 $self->parameter(\@params)
55 Parses any recognized parameters in the referenced array, removing
56 the standard parameters from any previous parameters() call, and
57 returning a array with all unparsed parameters.
58
59 The below list shows the VCS-like parameters that are supported,
60 and the functions that are called:
61
62 +libext+I<ext>+I<ext>... libext (I<ext>)
63 +incdir+I<dir> incdir (I<dir>)
64 +define+I<var>=I<value> define (I<var>,I<value>)
65 +define+I<var> define (I<var>,undef)
66 +librescan Ignored
67 -F I<file> Parse parameters in file relatively
68 -f I<file> Parse parameters in file
69 -v I<file> library (I<file>)
70 -y I<dir> module_dir (I<dir>)
71 all others Put in returned list
72
73 The below list shows the GCC-like parameters that are supported,
74 and the functions that are called:
75
76 -DI<var>=I<value> define (I<var>,I<value>)
77 -DI<var> define (I<var>,undef)
78 -UI<var> undefine (I<var>)
79 -II<dir> incdir (I<dir>)
80 -F I<file> Parse parameters in file relatively
81 -f I<file> Parse parameters in file
82 all others Put in returned list
83
84 $self->write_parameters_file(filename)
85 Write the output from get_parameters to the specified file.
86
88 $self->define($token, $value)
89 This method is called when a define is recognized. The default
90 behavior loads a hash that is used to fulfill define references.
91 This function may also be called outside parsing to predefine
92 values.
93
94 An optional third argument specifies parameters to the define, and
95 a fourth argument if true indicates the define was set on the
96 command line and should not be removed by `undefineall.
97
98 $self->define_names_sorted
99 Return sorted list of all define names that currently exist.
100
101 $self->defparams($token)
102 This method returns the parameter list of the define. This will be
103 defined, but false, if the define does not have arguments.
104
105 $self->defvalue($token)
106 This method returns the value of a given define, or prints a
107 warning.
108
109 $self->defvalue_nowarn($token)
110 This method returns the value of a given define, or undef.
111
112 $self->depend_files()
113 Returns reference to list of filenames referenced with file_path,
114 useful for creating dependency lists. With argument, adds that
115 file. With list reference argument, sets the list to the argument.
116
117 $self->file_abs($filename)
118 Using the incdir and libext lists, convert the specified module or
119 filename ("foo") to a absolute filename ("include/dir/foo.v").
120
121 $self->file_skip_special($filename)
122 Return true if the filename is one that generally should be ignored
123 when recursing directories, such as for example, ".", "CVS", and
124 ".svn".
125
126 $self->file_substitute($filename)
127 Removes existing environment variables from the provided filename.
128 Any undefined variables are not substituted nor cause errors.
129
130 $self->incdir
131 Returns reference to list of include directories. With argument,
132 adds that directory.
133
134 $self->libext
135 Returns reference to list of library extensions. With argument,
136 adds that extension.
137
138 $self->libext_matches(filename)
139 Returns true if the passed filename matches the libext.
140
141 $self->library
142 Returns reference to list of libraries. With argument, adds that
143 library.
144
145 $self->module_dir
146 Returns reference to list of module directories. With argument,
147 adds that directory.
148
149 $self->remove_defines($token)
150 Return string with any definitions in the token removed.
151
152 $self->undef($token)
153 Deletes a hash element that is used to fulfill define references.
154 This function may also be called outside parsing to erase a
155 predefined value.
156
157 $self->undefineall
158 Deletes all non-command line definitions, for implementing
159 `undefineall.
160
162 Verilog-Perl is part of the <http://www.veripool.org/> free Verilog EDA
163 software tool suite. The latest version is available from CPAN and
164 from <http://www.veripool.org/verilog-perl>.
165
166 Copyright 2000-2019 by Wilson Snyder. This package is free software;
167 you can redistribute it and/or modify it under the terms of either the
168 GNU Lesser General Public License Version 3 or the Perl Artistic
169 License Version 2.0.
170
172 Wilson Snyder <wsnyder@wsnyder.org>
173
175 Verilog-Perl, Verilog::Language
176
177
178
179perl v5.28.1 2019-05-04 Getopt(3)