Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / man / man3 / ExtUtils::Constant::Base.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "ExtUtils::Constant::Base 3"
132.TH ExtUtils::Constant::Base 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134ExtUtils::Constant::Base \- base class for ExtUtils::Constant objects
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 2
138\& require ExtUtils::Constant::Base;
139\& @ISA = 'ExtUtils::Constant::Base';
140.Ve
141.SH "DESCRIPTION"
142.IX Header "DESCRIPTION"
143ExtUtils::Constant::Base provides a base implementation of methods to
144generate C code to give fast constant value lookup by named string. Currently
145it's mostly used ExtUtils::Constant::XS, which generates the lookup code
146for the \fIconstant()\fR subroutine found in many \s-1XS\s0 modules.
147.SH "USAGE"
148.IX Header "USAGE"
149ExtUtils::Constant::Base exports no subroutines. The following methods are
150available
151.IP "header" 4
152.IX Item "header"
153A method returning a scalar containing definitions needed, typically for a
154C header file.
155.IP "memEQ_clause args_hashref" 4
156.IX Item "memEQ_clause args_hashref"
157A method to return a suitable C \f(CW\*(C`if\*(C'\fR statement to check whether \fIname\fR
158is equal to the C variable \f(CW\*(C`name\*(C'\fR. If \fIchecked_at\fR is defined, then it
159is used to avoid \f(CW\*(C`memEQ\*(C'\fR for short names, or to generate a comment to
160highlight the position of the character in the \f(CW\*(C`switch\*(C'\fR statement.
161.Sp
162If i<checked_at> is a reference to a scalar, then instead it gives
163the characters pre-checked at the beginning, (and the number of chars by
164which the C variable name has been advanced. These need to be chopped from
165the front of \fIname\fR).
166.IP "dump_names arg_hashref, \s-1ITEM\s0..." 4
167.IX Item "dump_names arg_hashref, ITEM..."
168An internal function to generate the embedded perl code that will regenerate
169the constant subroutines. \fIdefault_type\fR, \fItypes\fR and \fI\s-1ITEM\s0\fRs are the
170same as for C_constant. \fIindent\fR is treated as number of spaces to indent
171by. If \f(CW\*(C`declare_types\*(C'\fR is true a \f(CW$types\fR is always declared in the perl
172code generated, if defined and false never declared, and if undefined \f(CW$types\fR
173is only declared if the values in \fItypes\fR as passed in cannot be inferred from
174\&\fIdefault_types\fR and the \fI\s-1ITEM\s0\fRs.
175.IP "assign arg_hashref, \s-1VALUE\s0..." 4
176.IX Item "assign arg_hashref, VALUE..."
177A method to return a suitable assignment clause. If \fItype\fR is aggregate
178(eg \fI\s-1PVN\s0\fR expects both pointer and length) then there should be multiple
179\&\fI\s-1VALUE\s0\fRs for the components. \fIpre\fR and \fIpost\fR if defined give snippets
180of C code to proceed and follow the assignment. \fIpre\fR will be at the start
181of a block, so variables may be defined in it.
182.IP "return_clause arg_hashref, \s-1ITEM\s0" 4
183.IX Item "return_clause arg_hashref, ITEM"
184A method to return a suitable \f(CW\*(C`#ifdef\*(C'\fR clause. \fI\s-1ITEM\s0\fR is a hashref
185(as passed to \f(CW\*(C`C_constant\*(C'\fR and \f(CW\*(C`match_clause\*(C'\fR. \fIindent\fR is the number
186of spaces to indent, defaulting to 6.
187.IP "switch_clause arg_hashref, \s-1NAMELEN\s0, \s-1ITEMHASH\s0, \s-1ITEM\s0..." 4
188.IX Item "switch_clause arg_hashref, NAMELEN, ITEMHASH, ITEM..."
189An internal method to generate a suitable \f(CW\*(C`switch\*(C'\fR clause, called by
190\&\f(CW\*(C`C_constant\*(C'\fR \fI\s-1ITEM\s0\fRs are in the hash ref format as given in the description
191of \f(CW\*(C`C_constant\*(C'\fR, and must all have the names of the same length, given by
192\&\fI\s-1NAMELEN\s0\fR. \fI\s-1ITEMHASH\s0\fR is a reference to a hash, keyed by name, values being
193the hashrefs in the \fI\s-1ITEM\s0\fR list. (No parameters are modified, and there can
194be keys in the \fI\s-1ITEMHASH\s0\fR that are not in the list of \fI\s-1ITEM\s0\fRs without
195causing problems \- the hash is passed in to save generating it afresh for
196each call).
197.IP "params \s-1WHAT\s0" 4
198.IX Item "params WHAT"
199An \*(L"internal\*(R" method, subject to change, currently called to allow an
200overriding class to cache information that will then be passed into all
201the \f(CW\*(C`*param*\*(C'\fR calls. (Yes, having to read the source to make sense of this is
202considered a known bug). \fI\s-1WHAT\s0\fR is be a hashref of types the constant
203function will return. In ExtUtils::Constant::XS this method is used to
204returns a hashref keyed \s-1IV\s0 \s-1NV\s0 \s-1PV\s0 \s-1SV\s0 to show which combination of pointers will
205be needed in the C argument list generated by
206C_constant_other_params_definition and C_constant_other_params
207.IP "dogfood arg_hashref, \s-1ITEM\s0..." 4
208.IX Item "dogfood arg_hashref, ITEM..."
209An internal function to generate the embedded perl code that will regenerate
210the constant subroutines. Parameters are the same as for C_constant.
211.Sp
212Currently the base class does nothing and returns an empty string.
213.IP "C_constant arg_hashref, \s-1ITEM\s0..." 4
214.IX Item "C_constant arg_hashref, ITEM..."
215A function that returns a \fBlist\fR of C subroutine definitions that return
216the value and type of constants when passed the name by the \s-1XS\s0 wrapper.
217\&\fI\s-1ITEM\s0...\fR gives a list of constant names. Each can either be a string,
218which is taken as a C macro name, or a reference to a hash with the following
219keys
220.RS 4
221.IP "name" 8
222.IX Item "name"
223The name of the constant, as seen by the perl code.
224.IP "type" 8
225.IX Item "type"
226The type of the constant (\fI\s-1IV\s0\fR, \fI\s-1NV\s0\fR etc)
227.IP "value" 8
228.IX Item "value"
229A C expression for the value of the constant, or a list of C expressions if
230the type is aggregate. This defaults to the \fIname\fR if not given.
231.IP "macro" 8
232.IX Item "macro"
233The C pre-processor macro to use in the \f(CW\*(C`#ifdef\*(C'\fR. This defaults to the
234\&\fIname\fR, and is mainly used if \fIvalue\fR is an \f(CW\*(C`enum\*(C'\fR. If a reference an
235array is passed then the first element is used in place of the \f(CW\*(C`#ifdef\*(C'\fR
236line, and the second element in place of the \f(CW\*(C`#endif\*(C'\fR. This allows
237pre-processor constructions such as
238.Sp
239.Vb 5
240\& #if defined (foo)
241\& #if !defined (bar)
242\& ...
243\& #endif
244\& #endif
245.Ve
246.Sp
247to be used to determine if a constant is to be defined.
248.Sp
249A \*(L"macro\*(R" 1 signals that the constant is always defined, so the \f(CW\*(C`#if\*(C'\fR/\f(CW\*(C`#endif\*(C'\fR
250test is omitted.
251.IP "default" 8
252.IX Item "default"
253Default value to use (instead of \f(CW\*(C`croak\*(C'\fRing with \*(L"your vendor has not
254defined...\*(R") to return if the macro isn't defined. Specify a reference to
255an array with type followed by value(s).
256.IP "pre" 8
257.IX Item "pre"
258C code to use before the assignment of the value of the constant. This allows
259you to use temporary variables to extract a value from part of a \f(CW\*(C`struct\*(C'\fR
260and return this as \fIvalue\fR. This C code is places at the start of a block,
261so you can declare variables in it.
262.IP "post" 8
263.IX Item "post"
264C code to place between the assignment of value (to a temporary) and the
265return from the function. This allows you to clear up anything in \fIpre\fR.
266Rarely needed.
267.IP "def_pre" 8
268.IX Item "def_pre"
269.PD 0
270.IP "def_post" 8
271.IX Item "def_post"
272.PD
273Equivalents of \fIpre\fR and \fIpost\fR for the default value.
274.IP "utf8" 8
275.IX Item "utf8"
276Generated internally. Is zero or undefined if name is 7 bit \s-1ASCII\s0,
277\&\*(L"no\*(R" if the name is 8 bit (and so should only match if \fISvUTF8()\fR is false),
278\&\*(L"yes\*(R" if the name is utf8 encoded.
279.Sp
280The internals automatically clone any name with characters 128\-255 but none
281256+ (ie one that could be either in bytes or utf8) into a second entry
282which is utf8 encoded.
283.IP "weight" 8
284.IX Item "weight"
285Optional sorting weight for names, to determine the order of
286linear testing when multiple names fall in the same case of a switch clause.
287Higher comes earlier, undefined defaults to zero.
288.RE
289.RS 4
290.Sp
291In the argument hashref, \fIpackage\fR is the name of the package, and is only
292used in comments inside the generated C code. \fIsubname\fR defaults to
293\&\f(CW\*(C`constant\*(C'\fR if undefined.
294.Sp
295\&\fIdefault_type\fR is the type returned by \f(CW\*(C`ITEM\*(C'\fRs that don't specify their
296type. It defaults to the value of \f(CW\*(C`default_type()\*(C'\fR. \fItypes\fR should be given
297either as a comma separated list of types that the C subroutine \fIsubname\fR
298will generate or as a reference to a hash. \fIdefault_type\fR will be added to
299the list if not present, as will any types given in the list of \fI\s-1ITEM\s0\fRs. The
300resultant list should be the same list of types that \f(CW\*(C`XS_constant\*(C'\fR is
301given. [Otherwise \f(CW\*(C`XS_constant\*(C'\fR and \f(CW\*(C`C_constant\*(C'\fR may differ in the number of
302parameters to the constant function. \fIindent\fR is currently unused and
303ignored. In future it may be used to pass in information used to change the C
304indentation style used.] The best way to maintain consistency is to pass in a
305hash reference and let this function update it.
306.Sp
307\&\fIbreakout\fR governs when child functions of \fIsubname\fR are generated. If there
308are \fIbreakout\fR or more \fI\s-1ITEM\s0\fRs with the same length of name, then the code
309to switch between them is placed into a function named \fIsubname\fR_\fIlen\fR, for
310example \f(CW\*(C`constant_5\*(C'\fR for names 5 characters long. The default \fIbreakout\fR is
3113. A single \f(CW\*(C`ITEM\*(C'\fR is always inlined.
312.RE
313.SH "BUGS"
314.IX Header "BUGS"
315Not everything is documented yet.
316.PP
317Probably others.
318.SH "AUTHOR"
319.IX Header "AUTHOR"
320Nicholas Clark <nick@ccl4.org> based on the code in \f(CW\*(C`h2xs\*(C'\fR by Larry Wall and
321others