Vregs::Rules(3) User Contributed Perl Documentation Vregs::Rules(3)NAMESystemC::Vregs::Rules - Rules for outputting class headers
SYNOPSIS
In a I<package>__rules.pl file:
before_file_body (replace => 1,
text => "#include \"myinclude.h\"\n",);
before_enum_begin ( name => qr/_mine$/,
text => " static const bool MINE = true\n", );
after_enum_end ( name => 'Foo',
prog => sub { fprint " // enum foo\n"; }, );
DESCRIPTION
This package is used to execute Vregs rule files. These files describe
exceptions and additional text to be included in Vregs outputs.
RULE DECLARATIONS
These functions are used to describe a rule. A rule has a number of
rule parameters, generally a name which must match, and a text or prog
parameter.
after_any_file
Specifies a rule to be invoked at the bottom of any type of file.
before_any_file
Specifies a rule to be invoked at the top of any type of file.
after_file_body
Specifies a rule to be invoked at the bottom of the class.h file.
before_file_body
Specifies a rule to be invoked to produce the #include and other
text at the top of the class.h file.
after_class_begin
Specifies a rule to be invoked right after the 'class foo {' line.
before_class_end
Specifies a rule to be invoked right before the '}' ending a class
declaration.
after_class_end
Specifies a rule to be invoked right after the '}' ending a class
declaration.
after_defines_body
Specifies a rule to be invoked at the bottom of the defs.h file.
before_defines_body
Specifies a rule to be invoked at the top of the defs.h file.
after_enum_begin
Specifies a rule to be invoked right after the 'enum foo {' line.
before_enum_end
Specifies a rule to be invoked right before the '}' ending a enum
declaration.
after_enum_end
Specifies a rule to be invoked right after the '}' ending a enum
declaration.
RULE PARAMETERS
name => 'string' =item name => qr/regexp/
Must be either a string which must match for the rule to be
invoked, or a regexp reference (qr/regexp/) which if matches will
invoke the rule.
replace => 1
Generally rules are cumulative, in that defining additional rules
will place additional cases to be tested. With the replace flag,
the rule will replace all existing rules, including default rules.
This is generally useful for replacing the default #include section
with the before_file_body rule.
text => 'text'
A text string to output to the file.
prog => sub { subroutine }
A reference to a subroutine that generates the code for the file.
RULE SUBROUTINES
These functions and variables are useful when writing prog=>
subroutines.
$self
Reference to a SystemC::Vregs::Enum or SystemC::Vregs::Type, as
appropriate. This can be used to get information about the thing
to be printed, for example $self->{name} is the name of the object,
and $self->{attributes}{foo} checks for a specific attribute.
fprint
Print to the file.
fprintf
Formatted print to the file.
DISTRIBUTION
Vregs is part of the <http://www.veripool.org/> free Verilog software
tool suite. The latest version is available from CPAN and from
<http://www.veripool.org/vregs>. /www.veripool.org/>.
Copyright 2001-2009 by Wilson Snyder. This package is free software;
you can redistribute it and/or modify it under the terms of either the
GNU Lesser General Public License Version 3 or the Perl Artistic
License Version 2.0.
AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>
SEE ALSO
vreg, SystemC::Vregs
perl v5.14.1 2009-05-19 Vregs::Rules(3)