1Vregs::Rules(3)       User Contributed Perl Documentation      Vregs::Rules(3)
2
3
4

NAME

6       SystemC::Vregs::Rules - Rules for outputting class headers
7

SYNOPSIS

9           In a I<package>__rules.pl file:
10
11           before_file_body    (replace => 1,
12                                text => "#include \"myinclude.h\"\n",);
13           before_enum_begin (  name => qr/_mine$/,
14                                text => "    static const bool  MINE = true\n", );
15           after_enum_end (     name => 'Foo',
16                                prog => sub { fprint "   // enum foo\n"; }, );
17

DESCRIPTION

19       This package is used to execute Vregs rule files.  These files describe
20       exceptions and additional text to be included in Vregs outputs.
21

RULE DECLARATIONS

23       These functions are used to describe a rule.  A rule has a number of
24       rule parameters, generally a name which must match, and a text or prog
25       parameter.
26
27       after_any_file
28           Specifies a rule to be invoked at the bottom of any type of file.
29
30       before_any_file
31           Specifies a rule to be invoked at the top of any type of file.
32
33       after_file_body
34           Specifies a rule to be invoked at the bottom of the class.h file.
35
36       before_file_body
37           Specifies a rule to be invoked to produce the #include and other
38           text at the top of the class.h file.
39
40       after_class_begin
41           Specifies a rule to be invoked right after the 'class foo {' line.
42
43       before_class_end
44           Specifies a rule to be invoked right before the '}' ending a class
45           declaration.
46
47       after_class_end
48           Specifies a rule to be invoked right after the '}' ending a class
49           declaration.
50
51       after_defines_body
52           Specifies a rule to be invoked at the bottom of the defs.h file.
53
54       before_defines_body
55           Specifies a rule to be invoked at the top of the defs.h file.
56
57       after_enum_begin
58           Specifies a rule to be invoked right after the 'enum foo {' line.
59
60       before_enum_end
61           Specifies a rule to be invoked right before the '}' ending a enum
62           declaration.
63
64       after_enum_end
65           Specifies a rule to be invoked right after the '}' ending a enum
66           declaration.
67

RULE PARAMETERS

69       name => 'string' =item name => qr/regexp/
70           Must be either a string which must match for the rule to be
71           invoked, or a regexp reference (qr/regexp/) which if matches will
72           invoke the rule.
73
74       replace => 1
75           Generally rules are cumulative, in that defining additional rules
76           will place additional cases to be tested.  With the replace flag,
77           the rule will replace all existing rules, including default rules.
78           This is generally useful for replacing the default #include section
79           with the before_file_body rule.
80
81       text => 'text'
82           A text string to output to the file.
83
84       prog => sub { subroutine }
85           A reference to a subroutine that generates the code for the file.
86

RULE SUBROUTINES

88       These functions and variables are useful when writing prog=>
89       subroutines.
90
91       $self
92           Reference to a SystemC::Vregs::Enum or SystemC::Vregs::Type, as
93           appropriate.  This can be used to get information about the thing
94           to be printed, for example $self->{name} is the name of the object,
95           and $self->{attributes}{foo} checks for a specific attribute.
96
97       fprint
98           Print to the file.
99
100       fprintf
101           Formatted print to the file.
102

DISTRIBUTION

104       Vregs is part of the <http://www.veripool.org/> free Verilog software
105       tool suite.  The latest version is available from CPAN and from
106       <http://www.veripool.org/vregs>.  /www.veripool.org/>.
107
108       Copyright 2001-2010 by Wilson Snyder.  This package is free software;
109       you can redistribute it and/or modify it under the terms of either the
110       GNU Lesser General Public License Version 3 or the Perl Artistic
111       License Version 2.0.
112

AUTHORS

114       Wilson Snyder <wsnyder@wsnyder.org>
115

SEE ALSO

117       vreg, SystemC::Vregs
118
119
120
121perl v5.36.0                      2022-07-22                   Vregs::Rules(3)
Impressum