Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
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 "B::Concise 3" | |
132 | .TH B::Concise 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | B::Concise \- Walk Perl syntax tree, printing concise info about ops | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& perl -MO=Concise[,OPTIONS] foo.pl | |
139 | .Ve | |
140 | .PP | |
141 | .Vb 1 | |
142 | \& use B::Concise qw(set_style add_callback); | |
143 | .Ve | |
144 | .SH "DESCRIPTION" | |
145 | .IX Header "DESCRIPTION" | |
146 | This compiler backend prints the internal OPs of a Perl program's syntax | |
147 | tree in one of several space-efficient text formats suitable for debugging | |
148 | the inner workings of perl or other compiler backends. It can print OPs in | |
149 | the order they appear in the \s-1OP\s0 tree, in the order they will execute, or | |
150 | in a text approximation to their tree structure, and the format of the | |
151 | information displyed is customizable. Its function is similar to that of | |
152 | perl's \fB\-Dx\fR debugging flag or the \fBB::Terse\fR module, but it is more | |
153 | sophisticated and flexible. | |
154 | .SH "EXAMPLE" | |
155 | .IX Header "EXAMPLE" | |
156 | Here's is a short example of output, using the default formatting | |
157 | conventions : | |
158 | .PP | |
159 | .Vb 11 | |
160 | \& % perl -MO=Concise -e '$a = $b + 42' | |
161 | \& 8 <@> leave[t1] vKP/REFC ->(end) | |
162 | \& 1 <0> enter ->2 | |
163 | \& 2 <;> nextstate(main 1 -e:1) v ->3 | |
164 | \& 7 <2> sassign vKS/2 ->8 | |
165 | \& 5 <2> add[t1] sK/2 ->6 | |
166 | \& - <1> ex-rv2sv sK/1 ->4 | |
167 | \& 3 <$> gvsv(*b) s ->4 | |
168 | \& 4 <$> const(IV 42) s ->5 | |
169 | \& - <1> ex-rv2sv sKRM*/1 ->7 | |
170 | \& 6 <$> gvsv(*a) s ->7 | |
171 | .Ve | |
172 | .PP | |
173 | Each line corresponds to an operator. Null ops appear as \f(CW\*(C`ex\-opname\*(C'\fR, | |
174 | where \fIopname\fR is the op that has been optimized away by perl. | |
175 | .PP | |
176 | The number on the first row indicates the op's sequence number. It's | |
177 | given in base 36 by default. | |
178 | .PP | |
179 | The symbol between angle brackets indicates the op's type : for example, | |
180 | <2> is a \s-1BINOP\s0, <@> a \s-1LISTOP\s0, etc. (see \*(L"\s-1OP\s0 class abbreviations\*(R"). | |
181 | .PP | |
182 | The opname may be followed by op-specific information in parentheses | |
183 | (e.g. \f(CW\*(C`gvsv(*b)\*(C'\fR), and by targ information in brackets (e.g. | |
184 | \&\f(CW\*(C`leave[t1]\*(C'\fR). | |
185 | .PP | |
186 | Next come the op flags. The common flags are listed below | |
187 | (\*(L"\s-1OP\s0 flags abbreviations\*(R"). The private flags follow, separated | |
188 | by a slash. For example, \f(CW\*(C`vKP/REFC\*(C'\fR means that the leave op has | |
189 | public flags OPf_WANT_VOID, OPf_KIDS, and OPf_PARENS, and the private | |
190 | flag OPpREFCOUNTED. | |
191 | .PP | |
192 | Finally an arrow points to the sequence number of the next op. | |
193 | .SH "OPTIONS" | |
194 | .IX Header "OPTIONS" | |
195 | Arguments that don't start with a hyphen are taken to be the names of | |
196 | subroutines to print the OPs of; if no such functions are specified, the | |
197 | main body of the program (outside any subroutines, and not including use'd | |
198 | or require'd files) is printed. | |
199 | .IP "\fB\-basic\fR" 4 | |
200 | .IX Item "-basic" | |
201 | Print OPs in the order they appear in the \s-1OP\s0 tree (a preorder | |
202 | traversal, starting at the root). The indentation of each \s-1OP\s0 shows its | |
203 | level in the tree. This mode is the default, so the flag is included | |
204 | simply for completeness. | |
205 | .IP "\fB\-exec\fR" 4 | |
206 | .IX Item "-exec" | |
207 | Print OPs in the order they would normally execute (for the majority | |
208 | of constructs this is a postorder traversal of the tree, ending at the | |
209 | root). In most cases the \s-1OP\s0 that usually follows a given \s-1OP\s0 will | |
210 | appear directly below it; alternate paths are shown by indentation. In | |
211 | cases like loops when control jumps out of a linear path, a 'goto' | |
212 | line is generated. | |
213 | .IP "\fB\-tree\fR" 4 | |
214 | .IX Item "-tree" | |
215 | Print OPs in a text approximation of a tree, with the root of the tree | |
216 | at the left and 'left\-to\-right' order of children transformed into | |
217 | \&'top\-to\-bottom'. Because this mode grows both to the right and down, | |
218 | it isn't suitable for large programs (unless you have a very wide | |
219 | terminal). | |
220 | .IP "\fB\-compact\fR" 4 | |
221 | .IX Item "-compact" | |
222 | Use a tree format in which the minimum amount of space is used for the | |
223 | lines connecting nodes (one character in most cases). This squeezes out | |
224 | a few precious columns of screen real estate. | |
225 | .IP "\fB\-loose\fR" 4 | |
226 | .IX Item "-loose" | |
227 | Use a tree format that uses longer edges to separate \s-1OP\s0 nodes. This format | |
228 | tends to look better than the compact one, especially in \s-1ASCII\s0, and is | |
229 | the default. | |
230 | .IP "\fB\-vt\fR" 4 | |
231 | .IX Item "-vt" | |
232 | Use tree connecting characters drawn from the \s-1VT100\s0 line-drawing set. | |
233 | This looks better if your terminal supports it. | |
234 | .IP "\fB\-ascii\fR" 4 | |
235 | .IX Item "-ascii" | |
236 | Draw the tree with standard \s-1ASCII\s0 characters like \f(CW\*(C`+\*(C'\fR and \f(CW\*(C`|\*(C'\fR. These don't | |
237 | look as clean as the \s-1VT100\s0 characters, but they'll work with almost any | |
238 | terminal (or the horizontal scrolling mode of \fIless\fR\|(1)) and are suitable | |
239 | for text documentation or email. This is the default. | |
240 | .IP "\fB\-main\fR" 4 | |
241 | .IX Item "-main" | |
242 | Include the main program in the output, even if subroutines were also | |
243 | specified. | |
244 | .IP "\fB\-base\fR\fIn\fR" 4 | |
245 | .IX Item "-basen" | |
246 | Print \s-1OP\s0 sequence numbers in base \fIn\fR. If \fIn\fR is greater than 10, the | |
247 | digit for 11 will be 'a', and so on. If \fIn\fR is greater than 36, the digit | |
248 | for 37 will be 'A', and so on until 62. Values greater than 62 are not | |
249 | currently supported. The default is 36. | |
250 | .IP "\fB\-bigendian\fR" 4 | |
251 | .IX Item "-bigendian" | |
252 | Print sequence numbers with the most significant digit first. This is the | |
253 | usual convention for Arabic numerals, and the default. | |
254 | .IP "\fB\-littleendian\fR" 4 | |
255 | .IX Item "-littleendian" | |
256 | Print seqence numbers with the least significant digit first. | |
257 | .IP "\fB\-concise\fR" 4 | |
258 | .IX Item "-concise" | |
259 | Use the author's favorite set of formatting conventions. This is the | |
260 | default, of course. | |
261 | .IP "\fB\-terse\fR" 4 | |
262 | .IX Item "-terse" | |
263 | Use formatting conventions that emulate the ouput of \fBB::Terse\fR. The | |
264 | basic mode is almost indistinguishable from the real \fBB::Terse\fR, and the | |
265 | exec mode looks very similar, but is in a more logical order and lacks | |
266 | curly brackets. \fBB::Terse\fR doesn't have a tree mode, so the tree mode | |
267 | is only vaguely reminiscient of \fBB::Terse\fR. | |
268 | .IP "\fB\-linenoise\fR" 4 | |
269 | .IX Item "-linenoise" | |
270 | Use formatting conventions in which the name of each \s-1OP\s0, rather than being | |
271 | written out in full, is represented by a one\- or two-character abbreviation. | |
272 | This is mainly a joke. | |
273 | .IP "\fB\-debug\fR" 4 | |
274 | .IX Item "-debug" | |
275 | Use formatting conventions reminiscient of \fBB::Debug\fR; these aren't | |
276 | very concise at all. | |
277 | .IP "\fB\-env\fR" 4 | |
278 | .IX Item "-env" | |
279 | Use formatting conventions read from the environment variables | |
280 | \&\f(CW\*(C`B_CONCISE_FORMAT\*(C'\fR, \f(CW\*(C`B_CONCISE_GOTO_FORMAT\*(C'\fR, and \f(CW\*(C`B_CONCISE_TREE_FORMAT\*(C'\fR. | |
281 | .SH "FORMATTING SPECIFICATIONS" | |
282 | .IX Header "FORMATTING SPECIFICATIONS" | |
283 | For each general style ('concise', 'terse', 'linenoise', etc.) there are | |
284 | three specifications: one of how OPs should appear in the basic or exec | |
285 | modes, one of how 'goto' lines should appear (these occur in the exec | |
286 | mode only), and one of how nodes should appear in tree mode. Each has the | |
287 | same format, described below. Any text that doesn't match a special | |
288 | pattern is copied verbatim. | |
289 | .IP "\fB(x(\fR\fIexec_text\fR\fB;\fR\fIbasic_text\fR\fB)x)\fR" 4 | |
290 | .IX Item "(x(exec_text;basic_text)x)" | |
291 | Generates \fIexec_text\fR in exec mode, or \fIbasic_text\fR in basic mode. | |
292 | .IP "\fB(*(\fR\fItext\fR\fB)*)\fR" 4 | |
293 | .IX Item "(*(text)*)" | |
294 | Generates one copy of \fItext\fR for each indentation level. | |
295 | .IP "\fB(*(\fR\fItext1\fR\fB;\fR\fItext2\fR\fB)*)\fR" 4 | |
296 | .IX Item "(*(text1;text2)*)" | |
297 | Generates one fewer copies of \fItext1\fR than the indentation level, followed | |
298 | by one copy of \fItext2\fR if the indentation level is more than 0. | |
299 | .IP "\fB(?(\fR\fItext1\fR\fB#\fR\fIvar\fR\fIText2\fR\fB)?)\fR" 4 | |
300 | .IX Item "(?(text1#varText2)?)" | |
301 | If the value of \fIvar\fR is true (not empty or zero), generates the | |
302 | value of \fIvar\fR surrounded by \fItext1\fR and \fIText2\fR, otherwise | |
303 | nothing. | |
304 | .IP "\fB#\fR\fIvar\fR" 4 | |
305 | .IX Item "#var" | |
306 | Generates the value of the variable \fIvar\fR. | |
307 | .IP "\fB#\fR\fIvar\fR\fIN\fR" 4 | |
308 | .IX Item "#varN" | |
309 | Generates the value of \fIvar\fR, left jutified to fill \fIN\fR spaces. | |
310 | .IP "\fB~\fR" 4 | |
311 | .IX Item "~" | |
312 | Any number of tildes and surrounding whitespace will be collapsed to | |
313 | a single space. | |
314 | .PP | |
315 | The following variables are recognized: | |
316 | .IP "\fB#addr\fR" 4 | |
317 | .IX Item "#addr" | |
318 | The address of the \s-1OP\s0, in hexidecimal. | |
319 | .IP "\fB#arg\fR" 4 | |
320 | .IX Item "#arg" | |
321 | The OP-specific information of the \s-1OP\s0 (such as the \s-1SV\s0 for an \s-1SVOP\s0, the | |
322 | non-local exit pointers for a \s-1LOOP\s0, etc.) enclosed in paretheses. | |
323 | .IP "\fB#class\fR" 4 | |
324 | .IX Item "#class" | |
325 | The B\-determined class of the \s-1OP\s0, in all caps. | |
326 | .IP "\fB#classsym\fR" 4 | |
327 | .IX Item "#classsym" | |
328 | A single symbol abbreviating the class of the \s-1OP\s0. | |
329 | .IP "\fB#coplabel\fR" 4 | |
330 | .IX Item "#coplabel" | |
331 | The label of the statement or block the \s-1OP\s0 is the start of, if any. | |
332 | .IP "\fB#exname\fR" 4 | |
333 | .IX Item "#exname" | |
334 | The name of the \s-1OP\s0, or 'ex\-foo' if the \s-1OP\s0 is a null that used to be a foo. | |
335 | .IP "\fB#extarg\fR" 4 | |
336 | .IX Item "#extarg" | |
337 | The target of the \s-1OP\s0, or nothing for a nulled \s-1OP\s0. | |
338 | .IP "\fB#firstaddr\fR" 4 | |
339 | .IX Item "#firstaddr" | |
340 | The address of the \s-1OP\s0's first child, in hexidecimal. | |
341 | .IP "\fB#flags\fR" 4 | |
342 | .IX Item "#flags" | |
343 | The \s-1OP\s0's flags, abbreviated as a series of symbols. | |
344 | .IP "\fB#flagval\fR" 4 | |
345 | .IX Item "#flagval" | |
346 | The numeric value of the \s-1OP\s0's flags. | |
347 | .IP "\fB#hyphseq\fR" 4 | |
348 | .IX Item "#hyphseq" | |
349 | The sequence number of the \s-1OP\s0, or a hyphen if it doesn't have one. | |
350 | .IP "\fB#label\fR" 4 | |
351 | .IX Item "#label" | |
352 | \&'\s-1NEXT\s0', '\s-1LAST\s0', or '\s-1REDO\s0' if the \s-1OP\s0 is a target of one of those in exec | |
353 | mode, or empty otherwise. | |
354 | .IP "\fB#lastaddr\fR" 4 | |
355 | .IX Item "#lastaddr" | |
356 | The address of the \s-1OP\s0's last child, in hexidecimal. | |
357 | .IP "\fB#name\fR" 4 | |
358 | .IX Item "#name" | |
359 | The \s-1OP\s0's name. | |
360 | .IP "\fB#NAME\fR" 4 | |
361 | .IX Item "#NAME" | |
362 | The \s-1OP\s0's name, in all caps. | |
363 | .IP "\fB#next\fR" 4 | |
364 | .IX Item "#next" | |
365 | The sequence number of the \s-1OP\s0's next \s-1OP\s0. | |
366 | .IP "\fB#nextaddr\fR" 4 | |
367 | .IX Item "#nextaddr" | |
368 | The address of the \s-1OP\s0's next \s-1OP\s0, in hexidecimal. | |
369 | .IP "\fB#noise\fR" 4 | |
370 | .IX Item "#noise" | |
371 | The two-character abbreviation for the \s-1OP\s0's name. | |
372 | .IP "\fB#private\fR" 4 | |
373 | .IX Item "#private" | |
374 | The \s-1OP\s0's private flags, rendered with abbreviated names if possible. | |
375 | .IP "\fB#privval\fR" 4 | |
376 | .IX Item "#privval" | |
377 | The numeric value of the \s-1OP\s0's private flags. | |
378 | .IP "\fB#seq\fR" 4 | |
379 | .IX Item "#seq" | |
380 | The sequence number of the \s-1OP\s0. | |
381 | .IP "\fB#seqnum\fR" 4 | |
382 | .IX Item "#seqnum" | |
383 | The real sequence number of the \s-1OP\s0, as a regular number and not adjusted | |
384 | to be relative to the start of the real program. (This will generally be | |
385 | a fairly large number because all of \fBB::Concise\fR is compiled before | |
386 | your program is). | |
387 | .IP "\fB#sibaddr\fR" 4 | |
388 | .IX Item "#sibaddr" | |
389 | The address of the \s-1OP\s0's next youngest sibling, in hexidecimal. | |
390 | .IP "\fB#svaddr\fR" 4 | |
391 | .IX Item "#svaddr" | |
392 | The address of the \s-1OP\s0's \s-1SV\s0, if it has an \s-1SV\s0, in hexidecimal. | |
393 | .IP "\fB#svclass\fR" 4 | |
394 | .IX Item "#svclass" | |
395 | The class of the \s-1OP\s0's \s-1SV\s0, if it has one, in all caps (e.g., '\s-1IV\s0'). | |
396 | .IP "\fB#svval\fR" 4 | |
397 | .IX Item "#svval" | |
398 | The value of the \s-1OP\s0's \s-1SV\s0, if it has one, in a short human-readable format. | |
399 | .IP "\fB#targ\fR" 4 | |
400 | .IX Item "#targ" | |
401 | The numeric value of the \s-1OP\s0's targ. | |
402 | .IP "\fB#targarg\fR" 4 | |
403 | .IX Item "#targarg" | |
404 | The name of the variable the \s-1OP\s0's targ refers to, if any, otherwise the | |
405 | letter t followed by the \s-1OP\s0's targ in decimal. | |
406 | .IP "\fB#targarglife\fR" 4 | |
407 | .IX Item "#targarglife" | |
408 | Same as \fB#targarg\fR, but followed by the \s-1COP\s0 sequence numbers that delimit | |
409 | the variable's lifetime (or 'end' for a variable in an open scope) for a | |
410 | variable. | |
411 | .IP "\fB#typenum\fR" 4 | |
412 | .IX Item "#typenum" | |
413 | The numeric value of the \s-1OP\s0's type, in decimal. | |
414 | .SH "ABBREVIATIONS" | |
415 | .IX Header "ABBREVIATIONS" | |
416 | .Sh "\s-1OP\s0 flags abbreviations" | |
417 | .IX Subsection "OP flags abbreviations" | |
418 | .Vb 11 | |
419 | \& v OPf_WANT_VOID Want nothing (void context) | |
420 | \& s OPf_WANT_SCALAR Want single value (scalar context) | |
421 | \& l OPf_WANT_LIST Want list of any length (list context) | |
422 | \& K OPf_KIDS There is a firstborn child. | |
423 | \& P OPf_PARENS This operator was parenthesized. | |
424 | \& (Or block needs explicit scope entry.) | |
425 | \& R OPf_REF Certified reference. | |
426 | \& (Return container, not containee). | |
427 | \& M OPf_MOD Will modify (lvalue). | |
428 | \& S OPf_STACKED Some arg is arriving on the stack. | |
429 | \& * OPf_SPECIAL Do something weird for this op (see op.h) | |
430 | .Ve | |
431 | .Sh "\s-1OP\s0 class abbreviations" | |
432 | .IX Subsection "OP class abbreviations" | |
433 | .Vb 11 | |
434 | \& 0 OP (aka BASEOP) An OP with no children | |
435 | \& 1 UNOP An OP with one child | |
436 | \& 2 BINOP An OP with two children | |
437 | \& | LOGOP A control branch OP | |
438 | \& @ LISTOP An OP that could have lots of children | |
439 | \& / PMOP An OP with a regular expression | |
440 | \& $ SVOP An OP with an SV | |
441 | \& " PVOP An OP with a string | |
442 | \& { LOOP An OP that holds pointers for a loop | |
443 | \& ; COP An OP that marks the start of a statement | |
444 | \& # PADOP An OP with a GV on the pad | |
445 | .Ve | |
446 | .SH "Using B::Concise outside of the O framework" | |
447 | .IX Header "Using B::Concise outside of the O framework" | |
448 | It is possible to extend \fBB::Concise\fR by using it outside of the \fBO\fR | |
449 | framework and providing new styles and new variables. | |
450 | .PP | |
451 | .Vb 11 | |
452 | \& use B::Concise qw(set_style add_callback); | |
453 | \& set_style($format, $gotofmt, $treefmt); | |
454 | \& add_callback | |
455 | \& ( | |
456 | \& sub | |
457 | \& { | |
458 | \& my ($h, $op, $level, $format) = @_; | |
459 | \& $h->{variable} = some_func($op); | |
460 | \& } | |
461 | \& ); | |
462 | \& B::Concise::compile(@options)->(); | |
463 | .Ve | |
464 | .PP | |
465 | You can specify a style by calling the \fBset_style\fR subroutine. If you | |
466 | have a new variable in your style, or you want to change the value of an | |
467 | existing variable, you will need to add a callback to specify the value | |
468 | for that variable. | |
469 | .PP | |
470 | This is done by calling \fBadd_callback\fR passing references to any | |
471 | callback subroutines. The subroutines are called in the same order as | |
472 | they are added. Each subroutine is passed four parameters. These are a | |
473 | reference to a hash, the keys of which are the names of the variables | |
474 | and the values of which are their values, the op, the level and the | |
475 | format. | |
476 | .PP | |
477 | To define your own variables, simply add them to the hash, or change | |
478 | existing values if you need to. The level and format are passed in as | |
479 | references to scalars, but it is unlikely that they will need to be | |
480 | changed or even used. | |
481 | .PP | |
482 | To see the output, call the subroutine returned by \fBcompile\fR in the | |
483 | same way that \fBO\fR does. | |
484 | .SH "AUTHOR" | |
485 | .IX Header "AUTHOR" | |
486 | Stephen McCamant, \f(CW\*(C`smcc@CSUA.Berkeley.EDU\*(C'\fR |