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