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 $self->defparams ( $token )
78 This method returns the parameter list of the define. This will be
79 defined, but false, if the define does not have arguments.
80
81 $self->defvalue ( $token )
82 This method returns the value of a given define, or prints a
83 warning.
84
85 $self->defvalue_nowarn ( $token )
86 This method returns the value of a given define, or undef.
87
88 $self->depend_files ()
89 Returns reference to list of filenames referenced with file_path,
90 useful for creating dependency lists. With argument, adds that
91 file. With list reference argument, sets the list to the argument.
92
93 $self->file_abs ( $filename )
94 Using the incdir and libext lists, convert the specified module or
95 filename ("foo") to a absolute filename ("include/dir/foo.v").
96
97 $self->file_skip_special ( $filename )
98 Return true if the filename is one that generally should be ignored
99 when recursing directories, such as for example, ".", "CVS", and
100 ".svn".
101
102 $self->file_substitute ( $filename )
103 Removes existing environment variables from the provided filename.
104 Any undefined variables are not substituted nor cause errors.
105
106 $self->incdir ()
107 Returns reference to list of include directories. With argument,
108 adds that directory.
109
110 $self->libext ()
111 Returns reference to list of library extensions. With argument,
112 adds that extension.
113
114 $self->libext_matches (filename)
115 Returns true if the passed filename matches the libext.
116
117 $self->library ()
118 Returns reference to list of libraries. With argument, adds that
119 library.
120
121 $self->module_dir ()
122 Returns reference to list of module directories. With argument,
123 adds that directory.
124
125 $self->remove_defines ( $token )
126 Return string with any definitions in the token removed.
127
128 $self->undef ( $token )
129 Deletes a hash element that is used to fulfill define references.
130 This function may also be called outside parsing to erase a
131 predefined value.
132
134 Verilog-Perl is part of the <http://www.veripool.org/> free Verilog EDA
135 software tool suite. The latest version is available from CPAN and
136 from http://www.veripool.org/verilog-perl
137 <http://www.veripool.org/verilog-perl>.
138
139 Copyright 2000-2009 by Wilson Snyder. This package is free software;
140 you can redistribute it and/or modify it under the terms of either the
141 GNU Lesser General Public License Version 3 or the Perl Artistic
142 License Version 2.0.
143
145 Wilson Snyder <wsnyder@wsnyder.org>
146
148 Verilog-Perl, Verilog::Language
149
150
151
152perl v5.12.0 2009-07-20 Getopt(3)