13 | | diff -r parrot-trunk/docs/html/docs/book/pct/ch02_getting_started.pod.html parrot/docs/html/docs/book/pct/ch02_getting_started.pod.html |
14 | | 5c5 |
15 | | < <title>Parrot - Getting Started</title> |
16 | | --- |
17 | | > <title>Parrot - Untitled</title> |
18 | | 7c7 |
19 | | < href="../../../../resources/parrot.css" |
20 | | --- |
21 | | > href="/parrot.css" |
22 | | 17c17 |
23 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
24 | | --- |
25 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
26 | | 23c23 |
27 | | < <a href="../../../../html/index.html">Home</a> » Getting Started |
28 | | --- |
29 | | > Untitled |
30 | | 150a151,169 |
| 13 | diff -r parrot/docs/html/docs/book/pct/ch02_getting_started.pod.html parrot-trunk/docs/html/docs/book/pct/ch02_getting_started.pod.html |
| 14 | 5c5 |
| 15 | < <title>Parrot - Untitled</title> |
| 16 | --- |
| 17 | > <title>Parrot - Getting Started</title> |
| 18 | 23c23 |
| 19 | < Untitled |
| 20 | --- |
| 21 | > <a href="../../../../html/index.html">Home</a> » Getting Started |
| 22 | 151,169d150 |
| 23 | < |
| 24 | < <h1><a name="POD_ERRORS" |
| 25 | < >POD ERRORS</a></h1> |
| 26 | < |
| 27 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 28 | < |
| 29 | < <dl> |
| 30 | < <dt><a name="Around_line_9:" |
| 31 | < >Around line 9:</a></dt> |
| 32 | < Deleting unknown formatting code U<>Deleting unknown formatting code U<> |
| 33 | < <dt><a name="Around_line_16:" |
| 34 | < >Around line 16:</a></dt> |
| 35 | < Deleting unknown formatting code U<> |
| 36 | < <dt><a name="Around_line_120:" |
| 37 | < >Around line 120:</a></dt> |
| 38 | < =end for without matching =begin. (Stack: =over) |
| 39 | < <dt><a name="Around_line_131:" |
| 40 | < >Around line 131:</a></dt> |
| 41 | < =end for without matching =begin. (Stack: =over)</dl> |
| 42 | 173c154 |
| 43 | < Copyright © 2002-2010, Parrot Foundation. |
| 44 | --- |
| 45 | > Copyright © 2002-2009, Parrot Foundation. |
| 46 | diff -r parrot/docs/html/docs/book/pct/ch03_compiler_tools.pod.html parrot-trunk/docs/html/docs/book/pct/ch03_compiler_tools.pod.html |
| 47 | 5c5 |
| 48 | < <title>Parrot - Untitled</title> |
| 49 | --- |
| 50 | > <title>Parrot - Parrot Compiler Tools</title> |
| 51 | 23c23 |
| 52 | < Untitled |
| 53 | --- |
| 54 | > <a href="../../../../html/index.html">Home</a> » Parrot Compiler Tools |
| 55 | 339,357d338 |
| 56 | < |
| 57 | < <h1><a name="POD_ERRORS" |
| 58 | < >POD ERRORS</a></h1> |
| 59 | < |
| 60 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 61 | < |
| 62 | < <dl> |
| 63 | < <dt><a name="Around_line_5:" |
| 64 | < >Around line 5:</a></dt> |
| 65 | < A non-empty Z<> |
| 66 | < <dt><a name="Around_line_44:" |
| 67 | < >Around line 44:</a></dt> |
| 68 | < Deleting unknown formatting code N<> |
| 69 | < <dt><a name="Around_line_70:" |
| 70 | < >Around line 70:</a></dt> |
| 71 | < Deleting unknown formatting code N<> |
| 72 | < <dt><a name="Around_line_177:" |
| 73 | < >Around line 177:</a></dt> |
| 74 | < Deleting unknown formatting code N<></dl> |
| 75 | 361c342 |
| 76 | < Copyright © 2002-2010, Parrot Foundation. |
| 77 | --- |
| 78 | > Copyright © 2002-2009, Parrot Foundation. |
| 79 | diff -r parrot/docs/html/docs/book/pct/ch04_pge.pod.html parrot-trunk/docs/html/docs/book/pct/ch04_pge.pod.html |
| 80 | 5c5 |
| 81 | < <title>Parrot - Untitled</title> |
| 82 | --- |
| 83 | > <title>Parrot - Grammar Engine</title> |
| 84 | 23c23 |
| 85 | < Untitled |
| 86 | --- |
| 87 | > <a href="../../../../html/index.html">Home</a> » Grammar Engine |
| 88 | 628,724d627 |
| 89 | < |
| 90 | < <h1><a name="POD_ERRORS" |
| 91 | < >POD ERRORS</a></h1> |
| 92 | < |
| 93 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 94 | < |
| 95 | < <dl> |
| 96 | < <dt><a name="Around_line_32:" |
| 97 | < >Around line 32:</a></dt> |
| 98 | < Deleting unknown formatting code N<> |
| 99 | < <dt><a name="Around_line_117:" |
| 100 | < >Around line 117:</a></dt> |
| 101 | < =end for without matching =begin. (Stack: [empty]) |
| 102 | < <dt><a name="Around_line_318:" |
| 103 | < >Around line 318:</a></dt> |
| 104 | < A non-empty Z<> |
| 105 | < <dt><a name="Around_line_339:" |
| 106 | < >Around line 339:</a></dt> |
| 107 | < Deleting unknown formatting code A<> |
| 108 | < <dt><a name="Around_line_541:" |
| 109 | < >Around line 541:</a></dt> |
| 110 | < A non-empty Z<> |
| 111 | < <dt><a name="Around_line_546:" |
| 112 | < >Around line 546:</a></dt> |
| 113 | < Deleting unknown formatting code R<> |
| 114 | < <dt><a name="Around_line_560:" |
| 115 | < >Around line 560:</a></dt> |
| 116 | < Deleting unknown formatting code A<> |
| 117 | < <dt><a name="Around_line_631:" |
| 118 | < >Around line 631:</a></dt> |
| 119 | < A non-empty Z<> |
| 120 | < <dt><a name="Around_line_653:" |
| 121 | < >Around line 653:</a></dt> |
| 122 | < Deleting unknown formatting code N<> |
| 123 | < <dt><a name="Around_line_675:" |
| 124 | < >Around line 675:</a></dt> |
| 125 | < Deleting unknown formatting code A<> |
| 126 | < <dt><a name="Around_line_780:" |
| 127 | < >Around line 780:</a></dt> |
| 128 | < A non-empty Z<> |
| 129 | < <dt><a name="Around_line_805:" |
| 130 | < >Around line 805:</a></dt> |
| 131 | < Deleting unknown formatting code R<>Deleting unknown formatting code R<> |
| 132 | < <dt><a name="Around_line_809:" |
| 133 | < >Around line 809:</a></dt> |
| 134 | < Deleting unknown formatting code R<>Deleting unknown formatting code R<> |
| 135 | < <dt><a name="Around_line_820:" |
| 136 | < >Around line 820:</a></dt> |
| 137 | < Deleting unknown formatting code R<>Deleting unknown formatting code R<>Deleting unknown formatting code R<>Deleting unknown formatting code R<>Deleting unknown formatting code R<> |
| 138 | < <dt><a name="Around_line_836:" |
| 139 | < >Around line 836:</a></dt> |
| 140 | < Deleting unknown formatting code A<> |
| 141 | < <dt><a name="Around_line_981:" |
| 142 | < >Around line 981:</a></dt> |
| 143 | < A non-empty Z<> |
| 144 | < <dt><a name="Around_line_983:" |
| 145 | < >Around line 983:</a></dt> |
| 146 | < Deleting unknown formatting code A<> |
| 147 | < <dt><a name="Around_line_1076:" |
| 148 | < >Around line 1076:</a></dt> |
| 149 | < A non-empty Z<> |
| 150 | < <dt><a name="Around_line_1078:" |
| 151 | < >Around line 1078:</a></dt> |
| 152 | < Deleting unknown formatting code A<> |
| 153 | < <dt><a name="Around_line_1090:" |
| 154 | < >Around line 1090:</a></dt> |
| 155 | < =end for without matching =begin. (Stack: [empty]) |
| 156 | < <dt><a name="Around_line_1150:" |
| 157 | < >Around line 1150:</a></dt> |
| 158 | < Deleting unknown formatting code N<> |
| 159 | < <dt><a name="Around_line_1159:" |
| 160 | < >Around line 1159:</a></dt> |
| 161 | < =end for without matching =begin. (Stack: [empty]) |
| 162 | < <dt><a name="Around_line_1194:" |
| 163 | < >Around line 1194:</a></dt> |
| 164 | < Deleting unknown formatting code N<> |
| 165 | < <dt><a name="Around_line_1303:" |
| 166 | < >Around line 1303:</a></dt> |
| 167 | < =end for without matching =begin. (Stack: [empty]) |
| 168 | < <dt><a name="Around_line_1372:" |
| 169 | < >Around line 1372:</a></dt> |
| 170 | < =end for without matching =begin. (Stack: [empty]) |
| 171 | < <dt><a name="Around_line_1428:" |
| 172 | < >Around line 1428:</a></dt> |
| 173 | < A non-empty Z<> |
| 174 | < <dt><a name="Around_line_1477:" |
| 175 | < >Around line 1477:</a></dt> |
| 176 | < =end for without matching =begin. (Stack: [empty]) |
| 177 | < <dt><a name="Around_line_1496:" |
| 178 | < >Around line 1496:</a></dt> |
| 179 | < Deleting unknown formatting code N<> |
| 180 | < <dt><a name="Around_line_1502:" |
| 181 | < >Around line 1502:</a></dt> |
| 182 | < Deleting unknown formatting code N<> |
| 183 | < <dt><a name="Around_line_1513:" |
| 184 | < >Around line 1513:</a></dt> |
| 185 | < =end for without matching =begin. (Stack: [empty])</dl> |
| 186 | 728c631 |
| 187 | < Copyright © 2002-2010, Parrot Foundation. |
| 188 | --- |
| 189 | > Copyright © 2002-2009, Parrot Foundation. |
| 190 | diff -r parrot/docs/html/docs/book/pct/ch05_nqp.pod.html parrot-trunk/docs/html/docs/book/pct/ch05_nqp.pod.html |
| 191 | 5c5 |
| 192 | < <title>Parrot - Untitled</title> |
| 193 | --- |
| 194 | > <title>Parrot - Grammar Actions</title> |
| 195 | 23c23 |
| 196 | < Untitled |
| 197 | --- |
| 198 | > <a href="../../../../html/index.html">Home</a> » Grammar Actions |
| 199 | 223,238d222 |
| 200 | < |
| 201 | < <h1><a name="POD_ERRORS" |
| 202 | < >POD ERRORS</a></h1> |
| 203 | < |
| 204 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 205 | < |
| 206 | < <dl> |
| 207 | < <dt><a name="Around_line_29:" |
| 208 | < >Around line 29:</a></dt> |
| 209 | < Deleting unknown formatting code N<> |
| 210 | < <dt><a name="Around_line_106:" |
| 211 | < >Around line 106:</a></dt> |
| 212 | < =end for without matching =begin. (Stack: [empty]) |
| 213 | < <dt><a name="Around_line_190:" |
| 214 | < >Around line 190:</a></dt> |
| 215 | < =end for without matching =begin. (Stack: [empty])</dl> |
| 216 | 242c226 |
| 217 | < Copyright © 2002-2010, Parrot Foundation. |
| 218 | --- |
| 219 | > Copyright © 2002-2009, Parrot Foundation. |
| 220 | diff -r parrot/docs/html/docs/book/pir/ch01_introduction.pod.html parrot-trunk/docs/html/docs/book/pir/ch01_introduction.pod.html |
| 221 | 5c5 |
| 222 | < <title>Parrot - Untitled</title> |
| 223 | --- |
| 224 | > <title>Parrot - Introduction</title> |
| 225 | 23c23 |
| 226 | < Untitled |
| 227 | --- |
| 228 | > <a href="../../../../html/index.html">Home</a> » Introduction |
| 229 | 159,188d158 |
| 230 | < |
| 231 | < <h1><a name="POD_ERRORS" |
| 232 | < >POD ERRORS</a></h1> |
| 233 | < |
| 234 | < <p>Hey! |
| 235 | < <b>The above document had some coding errors, |
| 236 | < which are explained below:</b></p> |
| 237 | < |
| 238 | < <dl> |
| 239 | < <dt><a name="Around_line_12:" |
| 240 | < >Around line 12:</a></dt> |
| 241 | < Deleting unknown formatting code U<> |
| 242 | < <dt><a name="Around_line_29:" |
| 243 | < >Around line 29:</a></dt> |
| 244 | < Deleting unknown formatting code U<> |
| 245 | < <dt><a name="Around_line_39:" |
| 246 | < >Around line 39:</a></dt> |
| 247 | < Deleting unknown formatting code U<> |
| 248 | < <dt><a name="Around_line_50:" |
| 249 | < >Around line 50:</a></dt> |
| 250 | < Deleting unknown formatting code N<>Deleting unknown formatting code U<> |
| 251 | < <dt><a name="Around_line_57:" |
| 252 | < >Around line 57:</a></dt> |
| 253 | < Deleting unknown formatting code U<>Deleting unknown formatting code U<> |
| 254 | < <dt><a name="Around_line_66:" |
| 255 | < >Around line 66:</a></dt> |
| 256 | < Deleting unknown formatting code U<> |
| 257 | < <dt><a name="Around_line_75:" |
| 258 | < >Around line 75:</a></dt> |
| 259 | < Deleting unknown formatting code U<></dl> |
| 260 | 192c162 |
| 261 | < Copyright © 2002-2010, Parrot Foundation. |
| 262 | --- |
| 263 | > Copyright © 2002-2009, Parrot Foundation. |
| 264 | diff -r parrot/docs/html/docs/book/pir/ch02_getting_started.pod.html parrot-trunk/docs/html/docs/book/pir/ch02_getting_started.pod.html |
| 265 | 5c5 |
| 266 | < <title>Parrot - Untitled</title> |
| 267 | --- |
| 268 | > <title>Parrot - Getting Started</title> |
| 269 | 23c23 |
| 270 | < Untitled |
| 271 | --- |
| 272 | > <a href="../../../../html/index.html">Home</a> » Getting Started |
| 273 | 60c60 |
| 274 | < <p>To install Parrot in a different location, use the <code>--prefix</code> option to <em>Configure.pl</em>:</p> |
| 275 | --- |
| 276 | > <p>To install Parrot in a different location, use the <code>--prefix</code> option to <em><a href="../../../Configure.pl.html">Configure.pl</a></em>:</p> |
| 277 | 84,96d83 |
| 278 | < |
| 279 | < <h1><a name="POD_ERRORS" |
| 280 | < >POD ERRORS</a></h1> |
| 281 | < |
| 282 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 283 | < |
| 284 | < <dl> |
| 285 | < <dt><a name="Around_line_5:" |
| 286 | < >Around line 5:</a></dt> |
| 287 | < Deleting unknown formatting code N<>Deleting unknown formatting code U<>Deleting unknown formatting code N<>Deleting unknown formatting code U<>Deleting unknown formatting code U<> |
| 288 | < <dt><a name="Around_line_48:" |
| 289 | < >Around line 48:</a></dt> |
| 290 | < Deleting unknown formatting code N<></dl> |
| 291 | 100c87 |
| 292 | < Copyright © 2002-2010, Parrot Foundation. |
| 293 | --- |
| 294 | > Copyright © 2002-2009, Parrot Foundation. |
| 295 | diff -r parrot/docs/html/docs/book/pir/ch03_basic_syntax.pod.html parrot-trunk/docs/html/docs/book/pir/ch03_basic_syntax.pod.html |
| 296 | 5c5 |
| 297 | < <title>Parrot - Untitled</title> |
| 298 | --- |
| 299 | > <title>Parrot - Basic Syntax</title> |
| 300 | 23c23 |
| 301 | < Untitled |
| 302 | --- |
| 303 | > <a href="../../../../html/index.html">Home</a> » Basic Syntax |
| 304 | 213,231d212 |
| 305 | < |
| 306 | < <h1><a name="POD_ERRORS" |
| 307 | < >POD ERRORS</a></h1> |
| 308 | < |
| 309 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 310 | < |
| 311 | < <dl> |
| 312 | < <dt><a name="Around_line_5:" |
| 313 | < >Around line 5:</a></dt> |
| 314 | < A non-empty Z<> |
| 315 | < <dt><a name="Around_line_62:" |
| 316 | < >Around line 62:</a></dt> |
| 317 | < A non-empty Z<> |
| 318 | < <dt><a name="Around_line_143:" |
| 319 | < >Around line 143:</a></dt> |
| 320 | < Deleting unknown formatting code N<> |
| 321 | < <dt><a name="Around_line_243:" |
| 322 | < >Around line 243:</a></dt> |
| 323 | < Deleting unknown formatting code N<>Deleting unknown formatting code N<></dl> |
| 324 | 235c216 |
| 325 | < Copyright © 2002-2010, Parrot Foundation. |
| 326 | --- |
| 327 | > Copyright © 2002-2009, Parrot Foundation. |
| 328 | diff -r parrot/docs/html/docs/book/pir/ch04_variables.pod.html parrot-trunk/docs/html/docs/book/pir/ch04_variables.pod.html |
| 329 | 5c5 |
| 330 | < <title>Parrot - Untitled</title> |
| 331 | --- |
| 332 | > <title>Parrot - Variables</title> |
| 333 | 23c23 |
| 334 | < Untitled |
| 335 | --- |
| 336 | > <a href="../../../../html/index.html">Home</a> » Variables |
| 337 | 279,284c279,291 |
| 338 | < Both C<and> and C<or> are short-circuiting ops. If they can determine what |
| 339 | < value to return from the first argument, they'll never evaluate the second. |
| 340 | < This is significant only for PMCs, as they might have side effects on |
| 341 | < evaluation.The C<xor>X<xor opcode> opcode returns the first argument if it is the only |
| 342 | < true value, returns the second argument if it is the only true value, and |
| 343 | < returns false if both values are true or both are false:<pre> $I0 = xor 1, 0 # returns 1 |
| 344 | --- |
| 345 | > </pre> |
| 346 | > <p>Both <code>and</code> and <code>or</code> are short-circuiting ops. |
| 347 | > If they can determine what value to return from the first argument, |
| 348 | > they'll never evaluate the second. |
| 349 | > This is significant only for PMCs, |
| 350 | > as they might have side effects on evaluation.</p> |
32 | | > <h1><a name="POD_ERRORS" |
33 | | > >POD ERRORS</a></h1> |
34 | | > |
35 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
36 | | > |
37 | | > <dl> |
38 | | > <dt><a name="Around_line_9:" |
39 | | > >Around line 9:</a></dt> |
40 | | > Deleting unknown formatting code U<>Deleting unknown formatting code U<> |
41 | | > <dt><a name="Around_line_16:" |
42 | | > >Around line 16:</a></dt> |
43 | | > Deleting unknown formatting code U<> |
44 | | > <dt><a name="Around_line_120:" |
45 | | > >Around line 120:</a></dt> |
46 | | > =end for without matching =begin. (Stack: =over) |
47 | | > <dt><a name="Around_line_131:" |
48 | | > >Around line 131:</a></dt> |
49 | | > =end for without matching =begin. (Stack: =over)</dl> |
50 | | 154c173 |
51 | | < Copyright © 2002-2009, Parrot Foundation. |
52 | | --- |
53 | | > Copyright © 2002-2010, Parrot Foundation. |
54 | | diff -r parrot-trunk/docs/html/docs/book/pct/ch03_compiler_tools.pod.html parrot/docs/html/docs/book/pct/ch03_compiler_tools.pod.html |
55 | | 5c5 |
56 | | < <title>Parrot - Parrot Compiler Tools</title> |
57 | | --- |
58 | | > <title>Parrot - Untitled</title> |
59 | | 7c7 |
60 | | < href="../../../../resources/parrot.css" |
61 | | --- |
62 | | > href="/parrot.css" |
63 | | 17c17 |
64 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
65 | | --- |
66 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
67 | | 23c23 |
68 | | < <a href="../../../../html/index.html">Home</a> » Parrot Compiler Tools |
69 | | --- |
70 | | > Untitled |
71 | | 338a339,357 |
72 | | > |
73 | | > <h1><a name="POD_ERRORS" |
74 | | > >POD ERRORS</a></h1> |
75 | | > |
76 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
77 | | > |
78 | | > <dl> |
79 | | > <dt><a name="Around_line_5:" |
80 | | > >Around line 5:</a></dt> |
81 | | > A non-empty Z<> |
82 | | > <dt><a name="Around_line_44:" |
83 | | > >Around line 44:</a></dt> |
84 | | > Deleting unknown formatting code N<> |
85 | | > <dt><a name="Around_line_70:" |
86 | | > >Around line 70:</a></dt> |
87 | | > Deleting unknown formatting code N<> |
88 | | > <dt><a name="Around_line_177:" |
89 | | > >Around line 177:</a></dt> |
90 | | > Deleting unknown formatting code N<></dl> |
91 | | 342c361 |
92 | | < Copyright © 2002-2009, Parrot Foundation. |
93 | | --- |
94 | | > Copyright © 2002-2010, Parrot Foundation. |
95 | | diff -r parrot-trunk/docs/html/docs/book/pct/ch04_pge.pod.html parrot/docs/html/docs/book/pct/ch04_pge.pod.html |
96 | | 5c5 |
97 | | < <title>Parrot - Grammar Engine</title> |
98 | | --- |
99 | | > <title>Parrot - Untitled</title> |
100 | | 7c7 |
101 | | < href="../../../../resources/parrot.css" |
102 | | --- |
103 | | > href="/parrot.css" |
104 | | 17c17 |
105 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
106 | | --- |
107 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
108 | | 23c23 |
109 | | < <a href="../../../../html/index.html">Home</a> » Grammar Engine |
110 | | --- |
111 | | > Untitled |
112 | | 627a628,724 |
113 | | > |
114 | | > <h1><a name="POD_ERRORS" |
115 | | > >POD ERRORS</a></h1> |
116 | | > |
117 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
118 | | > |
119 | | > <dl> |
120 | | > <dt><a name="Around_line_32:" |
121 | | > >Around line 32:</a></dt> |
122 | | > Deleting unknown formatting code N<> |
123 | | > <dt><a name="Around_line_117:" |
124 | | > >Around line 117:</a></dt> |
125 | | > =end for without matching =begin. (Stack: [empty]) |
126 | | > <dt><a name="Around_line_318:" |
127 | | > >Around line 318:</a></dt> |
128 | | > A non-empty Z<> |
129 | | > <dt><a name="Around_line_339:" |
130 | | > >Around line 339:</a></dt> |
131 | | > Deleting unknown formatting code A<> |
132 | | > <dt><a name="Around_line_541:" |
133 | | > >Around line 541:</a></dt> |
134 | | > A non-empty Z<> |
135 | | > <dt><a name="Around_line_546:" |
136 | | > >Around line 546:</a></dt> |
137 | | > Deleting unknown formatting code R<> |
138 | | > <dt><a name="Around_line_560:" |
139 | | > >Around line 560:</a></dt> |
140 | | > Deleting unknown formatting code A<> |
141 | | > <dt><a name="Around_line_631:" |
142 | | > >Around line 631:</a></dt> |
143 | | > A non-empty Z<> |
144 | | > <dt><a name="Around_line_653:" |
145 | | > >Around line 653:</a></dt> |
146 | | > Deleting unknown formatting code N<> |
147 | | > <dt><a name="Around_line_675:" |
148 | | > >Around line 675:</a></dt> |
149 | | > Deleting unknown formatting code A<> |
150 | | > <dt><a name="Around_line_780:" |
151 | | > >Around line 780:</a></dt> |
152 | | > A non-empty Z<> |
153 | | > <dt><a name="Around_line_805:" |
154 | | > >Around line 805:</a></dt> |
155 | | > Deleting unknown formatting code R<>Deleting unknown formatting code R<> |
156 | | > <dt><a name="Around_line_809:" |
157 | | > >Around line 809:</a></dt> |
158 | | > Deleting unknown formatting code R<>Deleting unknown formatting code R<> |
159 | | > <dt><a name="Around_line_820:" |
160 | | > >Around line 820:</a></dt> |
161 | | > Deleting unknown formatting code R<>Deleting unknown formatting code R<>Deleting unknown formatting code R<>Deleting unknown formatting code R<>Deleting unknown formatting code R<> |
162 | | > <dt><a name="Around_line_836:" |
163 | | > >Around line 836:</a></dt> |
164 | | > Deleting unknown formatting code A<> |
165 | | > <dt><a name="Around_line_981:" |
166 | | > >Around line 981:</a></dt> |
167 | | > A non-empty Z<> |
168 | | > <dt><a name="Around_line_983:" |
169 | | > >Around line 983:</a></dt> |
170 | | > Deleting unknown formatting code A<> |
171 | | > <dt><a name="Around_line_1076:" |
172 | | > >Around line 1076:</a></dt> |
173 | | > A non-empty Z<> |
174 | | > <dt><a name="Around_line_1078:" |
175 | | > >Around line 1078:</a></dt> |
176 | | > Deleting unknown formatting code A<> |
177 | | > <dt><a name="Around_line_1090:" |
178 | | > >Around line 1090:</a></dt> |
179 | | > =end for without matching =begin. (Stack: [empty]) |
180 | | > <dt><a name="Around_line_1150:" |
181 | | > >Around line 1150:</a></dt> |
182 | | > Deleting unknown formatting code N<> |
183 | | > <dt><a name="Around_line_1159:" |
184 | | > >Around line 1159:</a></dt> |
185 | | > =end for without matching =begin. (Stack: [empty]) |
186 | | > <dt><a name="Around_line_1194:" |
187 | | > >Around line 1194:</a></dt> |
188 | | > Deleting unknown formatting code N<> |
189 | | > <dt><a name="Around_line_1303:" |
190 | | > >Around line 1303:</a></dt> |
191 | | > =end for without matching =begin. (Stack: [empty]) |
192 | | > <dt><a name="Around_line_1372:" |
193 | | > >Around line 1372:</a></dt> |
194 | | > =end for without matching =begin. (Stack: [empty]) |
195 | | > <dt><a name="Around_line_1428:" |
196 | | > >Around line 1428:</a></dt> |
197 | | > A non-empty Z<> |
198 | | > <dt><a name="Around_line_1477:" |
199 | | > >Around line 1477:</a></dt> |
200 | | > =end for without matching =begin. (Stack: [empty]) |
201 | | > <dt><a name="Around_line_1496:" |
202 | | > >Around line 1496:</a></dt> |
203 | | > Deleting unknown formatting code N<> |
204 | | > <dt><a name="Around_line_1502:" |
205 | | > >Around line 1502:</a></dt> |
206 | | > Deleting unknown formatting code N<> |
207 | | > <dt><a name="Around_line_1513:" |
208 | | > >Around line 1513:</a></dt> |
209 | | > =end for without matching =begin. (Stack: [empty])</dl> |
210 | | 631c728 |
211 | | < Copyright © 2002-2009, Parrot Foundation. |
212 | | --- |
213 | | > Copyright © 2002-2010, Parrot Foundation. |
214 | | diff -r parrot-trunk/docs/html/docs/book/pct/ch05_nqp.pod.html parrot/docs/html/docs/book/pct/ch05_nqp.pod.html |
215 | | 5c5 |
216 | | < <title>Parrot - Grammar Actions</title> |
217 | | --- |
218 | | > <title>Parrot - Untitled</title> |
219 | | 7c7 |
220 | | < href="../../../../resources/parrot.css" |
221 | | --- |
222 | | > href="/parrot.css" |
223 | | 17c17 |
224 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
225 | | --- |
226 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
227 | | 23c23 |
228 | | < <a href="../../../../html/index.html">Home</a> » Grammar Actions |
229 | | --- |
230 | | > Untitled |
231 | | 222a223,238 |
232 | | > |
233 | | > <h1><a name="POD_ERRORS" |
234 | | > >POD ERRORS</a></h1> |
235 | | > |
236 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
237 | | > |
238 | | > <dl> |
239 | | > <dt><a name="Around_line_29:" |
240 | | > >Around line 29:</a></dt> |
241 | | > Deleting unknown formatting code N<> |
242 | | > <dt><a name="Around_line_106:" |
243 | | > >Around line 106:</a></dt> |
244 | | > =end for without matching =begin. (Stack: [empty]) |
245 | | > <dt><a name="Around_line_190:" |
246 | | > >Around line 190:</a></dt> |
247 | | > =end for without matching =begin. (Stack: [empty])</dl> |
248 | | 226c242 |
249 | | < Copyright © 2002-2009, Parrot Foundation. |
250 | | --- |
251 | | > Copyright © 2002-2010, Parrot Foundation. |
252 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch01_introduction.pod.html parrot/docs/html/docs/book/pir/ch01_introduction.pod.html |
253 | | 5c5 |
254 | | < <title>Parrot - Introduction</title> |
255 | | --- |
256 | | > <title>Parrot - Untitled</title> |
257 | | 7c7 |
258 | | < href="../../../../resources/parrot.css" |
259 | | --- |
260 | | > href="/parrot.css" |
261 | | 17c17 |
262 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
263 | | --- |
264 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
265 | | 23c23 |
266 | | < <a href="../../../../html/index.html">Home</a> » Introduction |
267 | | --- |
268 | | > Untitled |
269 | | 158a159,188 |
270 | | > |
271 | | > <h1><a name="POD_ERRORS" |
272 | | > >POD ERRORS</a></h1> |
273 | | > |
274 | | > <p>Hey! |
275 | | > <b>The above document had some coding errors, |
276 | | > which are explained below:</b></p> |
277 | | > |
278 | | > <dl> |
279 | | > <dt><a name="Around_line_12:" |
280 | | > >Around line 12:</a></dt> |
281 | | > Deleting unknown formatting code U<> |
282 | | > <dt><a name="Around_line_29:" |
283 | | > >Around line 29:</a></dt> |
284 | | > Deleting unknown formatting code U<> |
285 | | > <dt><a name="Around_line_39:" |
286 | | > >Around line 39:</a></dt> |
287 | | > Deleting unknown formatting code U<> |
288 | | > <dt><a name="Around_line_50:" |
289 | | > >Around line 50:</a></dt> |
290 | | > Deleting unknown formatting code N<>Deleting unknown formatting code U<> |
291 | | > <dt><a name="Around_line_57:" |
292 | | > >Around line 57:</a></dt> |
293 | | > Deleting unknown formatting code U<>Deleting unknown formatting code U<> |
294 | | > <dt><a name="Around_line_66:" |
295 | | > >Around line 66:</a></dt> |
296 | | > Deleting unknown formatting code U<> |
297 | | > <dt><a name="Around_line_75:" |
298 | | > >Around line 75:</a></dt> |
299 | | > Deleting unknown formatting code U<></dl> |
300 | | 162c192 |
301 | | < Copyright © 2002-2009, Parrot Foundation. |
302 | | --- |
303 | | > Copyright © 2002-2010, Parrot Foundation. |
304 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch02_getting_started.pod.html parrot/docs/html/docs/book/pir/ch02_getting_started.pod.html |
305 | | 5c5 |
306 | | < <title>Parrot - Getting Started</title> |
307 | | --- |
308 | | > <title>Parrot - Untitled</title> |
309 | | 7c7 |
310 | | < href="../../../../resources/parrot.css" |
311 | | --- |
312 | | > href="/parrot.css" |
313 | | 17c17 |
314 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
315 | | --- |
316 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
317 | | 23c23 |
318 | | < <a href="../../../../html/index.html">Home</a> » Getting Started |
319 | | --- |
320 | | > Untitled |
321 | | 60c60 |
322 | | < <p>To install Parrot in a different location, use the <code>--prefix</code> option to <em><a href="../../../Configure.pl.html">Configure.pl</a></em>:</p> |
323 | | --- |
324 | | > <p>To install Parrot in a different location, use the <code>--prefix</code> option to <em>Configure.pl</em>:</p> |
325 | | 83a84,96 |
326 | | > |
327 | | > <h1><a name="POD_ERRORS" |
328 | | > >POD ERRORS</a></h1> |
329 | | > |
330 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
331 | | > |
332 | | > <dl> |
333 | | > <dt><a name="Around_line_5:" |
334 | | > >Around line 5:</a></dt> |
335 | | > Deleting unknown formatting code N<>Deleting unknown formatting code U<>Deleting unknown formatting code N<>Deleting unknown formatting code U<>Deleting unknown formatting code U<> |
336 | | > <dt><a name="Around_line_48:" |
337 | | > >Around line 48:</a></dt> |
338 | | > Deleting unknown formatting code N<></dl> |
339 | | 87c100 |
340 | | < Copyright © 2002-2009, Parrot Foundation. |
341 | | --- |
342 | | > Copyright © 2002-2010, Parrot Foundation. |
343 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch03_basic_syntax.pod.html parrot/docs/html/docs/book/pir/ch03_basic_syntax.pod.html |
344 | | 5c5 |
345 | | < <title>Parrot - Basic Syntax</title> |
346 | | --- |
347 | | > <title>Parrot - Untitled</title> |
348 | | 7c7 |
349 | | < href="../../../../resources/parrot.css" |
350 | | --- |
351 | | > href="/parrot.css" |
352 | | 17c17 |
353 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
354 | | --- |
355 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
356 | | 23c23 |
357 | | < <a href="../../../../html/index.html">Home</a> » Basic Syntax |
358 | | --- |
359 | | > Untitled |
360 | | 212a213,231 |
361 | | > |
362 | | > <h1><a name="POD_ERRORS" |
363 | | > >POD ERRORS</a></h1> |
364 | | > |
365 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
366 | | > |
367 | | > <dl> |
368 | | > <dt><a name="Around_line_5:" |
369 | | > >Around line 5:</a></dt> |
370 | | > A non-empty Z<> |
371 | | > <dt><a name="Around_line_62:" |
372 | | > >Around line 62:</a></dt> |
373 | | > A non-empty Z<> |
374 | | > <dt><a name="Around_line_143:" |
375 | | > >Around line 143:</a></dt> |
376 | | > Deleting unknown formatting code N<> |
377 | | > <dt><a name="Around_line_243:" |
378 | | > >Around line 243:</a></dt> |
379 | | > Deleting unknown formatting code N<>Deleting unknown formatting code N<></dl> |
380 | | 216c235 |
381 | | < Copyright © 2002-2009, Parrot Foundation. |
382 | | --- |
383 | | > Copyright © 2002-2010, Parrot Foundation. |
384 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch04_variables.pod.html parrot/docs/html/docs/book/pir/ch04_variables.pod.html |
385 | | 5c5 |
386 | | < <title>Parrot - Variables</title> |
387 | | --- |
388 | | > <title>Parrot - Untitled</title> |
389 | | 7c7 |
390 | | < href="../../../../resources/parrot.css" |
391 | | --- |
392 | | > href="/parrot.css" |
393 | | 17c17 |
394 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
395 | | --- |
396 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
397 | | 23c23 |
398 | | < <a href="../../../../html/index.html">Home</a> » Variables |
399 | | --- |
400 | | > Untitled |
401 | | 279,291c279,284 |
402 | | < </pre> |
403 | | < <p>Both <code>and</code> and <code>or</code> are short-circuiting ops. |
404 | | < If they can determine what value to return from the first argument, |
405 | | < they'll never evaluate the second. |
406 | | < This is significant only for PMCs, |
407 | | < as they might have side effects on evaluation.</p> |
408 | | < |
409 | | < <p>The <code>xor</code><!-- |
410 | | < INDEX: xor opcode |
411 | | < --> opcode returns the first argument if it is the only true value, |
412 | | < returns the second argument if it is the only true value, |
413 | | < and returns false if both values are true or both are false:</p> |
414 | | < <pre> $I0 = xor 1, 0 # returns 1 |
415 | | --- |
416 | | > Both C<and> and C<or> are short-circuiting ops. If they can determine what |
417 | | > value to return from the first argument, they'll never evaluate the second. |
418 | | > This is significant only for PMCs, as they might have side effects on |
419 | | > evaluation.The C<xor>X<xor opcode> opcode returns the first argument if it is the only |
420 | | > true value, returns the second argument if it is the only true value, and |
421 | | > returns false if both values are true or both are false:<pre> $I0 = xor 1, 0 # returns 1 |
422 | | 296,298c289,290 |
423 | | < <p>The <code>not</code><!-- |
424 | | < INDEX: not opcode |
425 | | < --> opcode returns a true value when the argument is false and a false value if the argument is true:</p> |
426 | | --- |
427 | | > The C<not>X<not opcode> opcode returns a true value when the argument is false |
428 | | > and a false value if the argument is true: |
429 | | 302,316c294,298 |
430 | | < <p><!-- |
431 | | < INDEX: bitwise opcodes |
432 | | < --> The bitwise opcodes operate on their values a single bit at a time. |
433 | | < <code>band</code><!-- |
434 | | < INDEX: band opcode |
435 | | < -->, |
436 | | < <code>bor</code><!-- |
437 | | < INDEX: bor opcode |
438 | | < -->, |
439 | | < and <code>bxor</code><!-- |
440 | | < INDEX: bxor opcode |
441 | | < --> return a value that is the logical AND, |
442 | | < OR, |
443 | | < or XOR of each bit in the source arguments. |
444 | | < They each take two arguments.</p> |
445 | | --- |
446 | | > X<bitwise opcodes> |
447 | | > The bitwise opcodes operate on their values a single bit at a time. |
448 | | > C<band>X<band opcode>, C<bor>X<bor opcode>, and C<bxor>X<bxor opcode> return a |
449 | | > value that is the logical AND, OR, or XOR of each bit in the source arguments. |
450 | | > They each take two arguments. |
451 | | 324,326c306,307 |
452 | | < <p><code>band</code>, |
453 | | < <code>bor</code>, |
454 | | < and <code>bxor</code> also have variants that modify the result in place.</p> |
455 | | --- |
456 | | > C<band>, C<bor>, and C<bxor> also have variants that modify the result |
457 | | > in place. |
458 | | 334,336c315 |
459 | | < <p><code>bnot</code><!-- |
460 | | < INDEX: bnot opcode |
461 | | < --> is the logical NOT of each bit in the source argument.</p> |
462 | | --- |
463 | | > C<bnot>X<bnot opcode> is the logical NOT of each bit in the source argument. |
464 | | 343,349c322,326 |
465 | | < <p><!-- |
466 | | < INDEX: shl opcode |
467 | | < --> <!-- |
468 | | < INDEX: shr opcode |
469 | | < --> <!-- |
470 | | < INDEX: lsr opcode |
471 | | < --> The logical and arithmetic shift operations shift their values by a specified number of bits:</p> |
472 | | --- |
473 | | > X<shl opcode> |
474 | | > X<shr opcode> |
475 | | > X<lsr opcode> |
476 | | > The logical and arithmetic shift operations shift their values by a specified |
477 | | > number of bits: |
478 | | 361,372c338,344 |
479 | | < <p><!-- |
480 | | < INDEX: strings |
481 | | < --> Parrot strings are buffers of variable-sized data. |
482 | | < The most common use of strings is to store text data. |
483 | | < Strings can also hold binary or other non-textual data, |
484 | | < though this is rare.In general, |
485 | | < a custom PMC is more useful. Parrot strings are flexible and powerful, |
486 | | < to handle the complexity of human-readable (and computer-representable) text data. |
487 | | < String operations work with string literals, |
488 | | < variables, |
489 | | < and constants, |
490 | | < and with string-like PMCs.</p> |
491 | | --- |
492 | | > X<strings> |
493 | | > Parrot strings are buffers of variable-sized data. The most common use of |
494 | | > strings is to store text data. Strings can also hold binary or other |
495 | | > non-textual data, though this is rare.N<In general, a custom PMC is more |
496 | | > useful.> Parrot strings are flexible and powerful, to handle the complexity of |
497 | | > human-readable (and computer-representable) text data. String operations work |
498 | | > with string literals, variables, and constants, and with string-like PMCs. |
499 | | 377,381c349,353 |
500 | | < <p><!-- |
501 | | < INDEX: string escapes |
502 | | < --> <!-- |
503 | | < INDEX: escape sequences |
504 | | < --></p> |
505 | | --- |
506 | | > X<string escapes> |
507 | | > X<escape sequences> |
508 | | > |
509 | | > Strings in double-quotes allow escape sequences using backslashes. Strings in |
510 | | > single-quotes only allow escapes for nested quotes: |
511 | | 383,384c355,356 |
512 | | < <p>Strings in double-quotes allow escape sequences using backslashes. |
513 | | < Strings in single-quotes only allow escapes for nested quotes:</p> |
514 | | --- |
515 | | > $S0 = "This string is \n on two lines" |
516 | | > $S0 = 'This is a \n one-line string with a slash in it' |
517 | | 386,387d357 |
518 | | < <pre> $S0 = "This string is \n on two lines" |
519 | | < $S0 = 'This is a \n one-line string with a slash in it'</pre> |
520 | | 389c359,360 |
521 | | < <p>Table 4.1 shows the escape sequences Parrot supports in double-quoted strings.</p> |
522 | | --- |
523 | | > Table 4.1 shows the escape sequences Parrot supports in double-quoted |
524 | | > strings. |
525 | | 394,396c365,375 |
526 | | < <p><!-- |
527 | | < INDEX: heredocs |
528 | | < --> If you need more flexibility in defining a string, use a heredoc string literal. The <code><<</code> operator starts a heredoc. The string terminator immediately follows. All text until the terminator is part of the string. The terminator must appear on its own line, must appear at the beginning of the line, and may not have any trailing whitespace.</p> |
529 | | --- |
530 | | > X<heredocs> |
531 | | > If you need more flexibility in defining a string, use a heredoc string |
532 | | > literal. The C<E<lt>E<lt>> operator starts a heredoc. The string terminator |
533 | | > immediately follows. All text until the terminator is part of the string. The |
534 | | > terminator must appear on its own line, must appear at the beginning of the |
535 | | > line, and may not have any trailing whitespace. |
536 | | > |
537 | | > $S2 = <<"End_Token" |
538 | | > This is a multi-line string literal. Notice that |
539 | | > it doesn't use quotation marks. |
540 | | > End_Token |
541 | | 398,401d376 |
542 | | < <pre> $S2 = <<"End_Token" |
| 352 | > <p>The <code>xor</code><!-- |
| 353 | > INDEX: xor opcode |
| 354 | > --> opcode returns the first argument if it is the only true value, |
| 355 | > returns the second argument if it is the only true value, |
| 356 | > and returns false if both values are true or both are false:</p> |
| 357 | > <pre> $I0 = xor 1, 0 # returns 1 |
| 358 | 289,290c296,298 |
| 359 | < The C<not>X<not opcode> opcode returns a true value when the argument is false |
| 360 | < and a false value if the argument is true: |
| 361 | --- |
| 362 | > <p>The <code>not</code><!-- |
| 363 | > INDEX: not opcode |
| 364 | > --> opcode returns a true value when the argument is false and a false value if the argument is true:</p> |
| 365 | 294,298c302,316 |
| 366 | < X<bitwise opcodes> |
| 367 | < The bitwise opcodes operate on their values a single bit at a time. |
| 368 | < C<band>X<band opcode>, C<bor>X<bor opcode>, and C<bxor>X<bxor opcode> return a |
| 369 | < value that is the logical AND, OR, or XOR of each bit in the source arguments. |
| 370 | < They each take two arguments. |
| 371 | --- |
| 372 | > <p><!-- |
| 373 | > INDEX: bitwise opcodes |
| 374 | > --> The bitwise opcodes operate on their values a single bit at a time. |
| 375 | > <code>band</code><!-- |
| 376 | > INDEX: band opcode |
| 377 | > -->, |
| 378 | > <code>bor</code><!-- |
| 379 | > INDEX: bor opcode |
| 380 | > -->, |
| 381 | > and <code>bxor</code><!-- |
| 382 | > INDEX: bxor opcode |
| 383 | > --> return a value that is the logical AND, |
| 384 | > OR, |
| 385 | > or XOR of each bit in the source arguments. |
| 386 | > They each take two arguments.</p> |
| 387 | 306,307c324,326 |
| 388 | < C<band>, C<bor>, and C<bxor> also have variants that modify the result |
| 389 | < in place. |
| 390 | --- |
| 391 | > <p><code>band</code>, |
| 392 | > <code>bor</code>, |
| 393 | > and <code>bxor</code> also have variants that modify the result in place.</p> |
| 394 | 315c334,336 |
| 395 | < C<bnot>X<bnot opcode> is the logical NOT of each bit in the source argument. |
| 396 | --- |
| 397 | > <p><code>bnot</code><!-- |
| 398 | > INDEX: bnot opcode |
| 399 | > --> is the logical NOT of each bit in the source argument.</p> |
| 400 | 322,326c343,349 |
| 401 | < X<shl opcode> |
| 402 | < X<shr opcode> |
| 403 | < X<lsr opcode> |
| 404 | < The logical and arithmetic shift operations shift their values by a specified |
| 405 | < number of bits: |
| 406 | --- |
| 407 | > <p><!-- |
| 408 | > INDEX: shl opcode |
| 409 | > --> <!-- |
| 410 | > INDEX: shr opcode |
| 411 | > --> <!-- |
| 412 | > INDEX: lsr opcode |
| 413 | > --> The logical and arithmetic shift operations shift their values by a specified number of bits:</p> |
| 414 | 338,344c361,372 |
| 415 | < X<strings> |
| 416 | < Parrot strings are buffers of variable-sized data. The most common use of |
| 417 | < strings is to store text data. Strings can also hold binary or other |
| 418 | < non-textual data, though this is rare.N<In general, a custom PMC is more |
| 419 | < useful.> Parrot strings are flexible and powerful, to handle the complexity of |
| 420 | < human-readable (and computer-representable) text data. String operations work |
| 421 | < with string literals, variables, and constants, and with string-like PMCs. |
| 422 | --- |
| 423 | > <p><!-- |
| 424 | > INDEX: strings |
| 425 | > --> Parrot strings are buffers of variable-sized data. |
| 426 | > The most common use of strings is to store text data. |
| 427 | > Strings can also hold binary or other non-textual data, |
| 428 | > though this is rare.In general, |
| 429 | > a custom PMC is more useful. Parrot strings are flexible and powerful, |
| 430 | > to handle the complexity of human-readable (and computer-representable) text data. |
| 431 | > String operations work with string literals, |
| 432 | > variables, |
| 433 | > and constants, |
| 434 | > and with string-like PMCs.</p> |
| 435 | 349,353c377,381 |
| 436 | < X<string escapes> |
| 437 | < X<escape sequences> |
| 438 | < |
| 439 | < Strings in double-quotes allow escape sequences using backslashes. Strings in |
| 440 | < single-quotes only allow escapes for nested quotes: |
| 441 | --- |
| 442 | > <p><!-- |
| 443 | > INDEX: string escapes |
| 444 | > --> <!-- |
| 445 | > INDEX: escape sequences |
| 446 | > --></p> |
| 447 | 355,356c383,384 |
| 448 | < $S0 = "This string is \n on two lines" |
| 449 | < $S0 = 'This is a \n one-line string with a slash in it' |
| 450 | --- |
| 451 | > <p>Strings in double-quotes allow escape sequences using backslashes. |
| 452 | > Strings in single-quotes only allow escapes for nested quotes:</p> |
| 453 | 357a386,387 |
| 454 | > <pre> $S0 = "This string is \n on two lines" |
| 455 | > $S0 = 'This is a \n one-line string with a slash in it'</pre> |
| 456 | 359,360c389 |
| 457 | < Table 4.1 shows the escape sequences Parrot supports in double-quoted |
| 458 | < strings. |
| 459 | --- |
| 460 | > <p>Table 4.1 shows the escape sequences Parrot supports in double-quoted strings.</p> |
| 461 | 365,375c394,396 |
| 462 | < X<heredocs> |
| 463 | < If you need more flexibility in defining a string, use a heredoc string |
| 464 | < literal. The C<E<lt>E<lt>> operator starts a heredoc. The string terminator |
| 465 | < immediately follows. All text until the terminator is part of the string. The |
| 466 | < terminator must appear on its own line, must appear at the beginning of the |
| 467 | < line, and may not have any trailing whitespace. |
| 468 | < |
| 469 | < $S2 = <<"End_Token" |
545 | | < End_Token</pre> |
546 | | 406,410c381,382 |
547 | | < <p><!-- |
548 | | < INDEX: . operator |
549 | | < --> <!-- |
550 | | < INDEX: strings;concatenation |
551 | | < --></p> |
552 | | --- |
553 | | > X<. operator> |
554 | | > X<strings;concatenation> |
555 | | 412c384,386 |
556 | | < <p>Use the <code>.</code> operator to concatenate strings. The following example concatenates the string "cd" onto the string "ab" and stores the result in <code>$S1</code>.</p> |
557 | | --- |
558 | | > Use the C<.> operator to concatenate strings. The following example |
559 | | > concatenates the string "cd" onto the string "ab" and stores the result in |
560 | | > C<$S1>. |
561 | | 417,419c391,394 |
562 | | < <p><!-- |
563 | | < INDEX: .= operator |
564 | | < --> Concatenation has a <code>.=</code> variant to modify the result in place. In the next example, the <code>.=</code> operation appends "xy" onto the string "abcd" in <code>$S1</code>.</p> |
565 | | --- |
566 | | > X<.= operator> |
567 | | > Concatenation has a C<.=> variant to modify the result in place. In the |
568 | | > next example, the C<.=> operation appends "xy" onto the string "abcd" in |
569 | | > C<$S1>. |
570 | | 426,428c401,402 |
571 | | < <p><!-- |
572 | | < INDEX: repeat opcode |
573 | | < --> The <code>repeat</code> opcode repeats a string a specified number of times:</p> |
574 | | --- |
575 | | > X<repeat opcode> |
576 | | > The C<repeat> opcode repeats a string a specified number of times: |
577 | | 433c407,408 |
578 | | < <p>In this example, <code>repeat</code> generates a new string with "a" repeated five times and stores it in <code>$S1</code>.</p> |
579 | | --- |
580 | | > In this example, C<repeat> generates a new string with "a" repeated five |
581 | | > times and stores it in C<$S1>. |
582 | | 438,440c413,415 |
583 | | < <p><!-- |
584 | | < INDEX: length opcode |
585 | | < --> The <code>length</code> opcode returns the length of a string in characters. This won't be the same as the length in <i>bytes</i> for multibyte encoded strings:</p> |
586 | | --- |
587 | | > X<length opcode> |
588 | | > The C<length> opcode returns the length of a string in characters. This won't |
589 | | > be the same as the length in I<bytes> for multibyte encoded strings: |
590 | | 445c420 |
591 | | < <p><code>length</code> has no equivalent for PMC strings.</p> |
592 | | --- |
593 | | > C<length> has no equivalent for PMC strings. |
594 | | 450,452c425,428 |
595 | | < <p>The simplest version of the <code>substr</code><!-- |
596 | | < INDEX: substr opcode |
597 | | < --> opcode takes three arguments: a source string, an offset position, and a length. It returns a substring of the original string, starting from the offset position (0 is the first character) and spanning the length:</p> |
598 | | --- |
599 | | > The simplest version of the C<substr>X<substr opcode> opcode takes three |
600 | | > arguments: a source string, an offset position, and a length. It returns a |
601 | | > substring of the original string, starting from the offset position (0 is the |
602 | | > first character) and spanning the length: |
603 | | 455,457c431,444 |
604 | | < <p>This example extracts a two-character string from "abcde" at a one-character offset from the beginning of the string (starting with the second character). It generates a new string, "bc", in the destination register <code>$S0</code>.</p> |
605 | | < |
606 | | < <p>When the offset position is negative, it counts backward from the end of the string. Thus an offset of -1 starts at the last character of the string.</p> |
607 | | --- |
608 | | > This example extracts a two-character string from "abcde" at a one-character |
609 | | > offset from the beginning of the string (starting with the second character). |
610 | | > It generates a new string, "bc", in the destination register C<$S0>. |
| 472 | < End_Token |
| 473 | --- |
| 474 | > <p><!-- |
| 475 | > INDEX: heredocs |
| 476 | > --> If you need more flexibility in defining a string, use a heredoc string literal. The <code><<</code> operator starts a heredoc. The string terminator immediately follows. All text until the terminator is part of the string. The terminator must appear on its own line, must appear at the beginning of the line, and may not have any trailing whitespace.</p> |
| 477 | 376a398,401 |
| 478 | > <pre> $S2 = <<"End_Token" |
| 479 | > This is a multi-line string literal. Notice that |
| 480 | > it doesn't use quotation marks. |
| 481 | > End_Token</pre> |
| 482 | 381,382c406,410 |
| 483 | < X<. operator> |
| 484 | < X<strings;concatenation> |
| 485 | --- |
| 486 | > <p><!-- |
| 487 | > INDEX: . operator |
| 488 | > --> <!-- |
| 489 | > INDEX: strings;concatenation |
| 490 | > --></p> |
| 491 | 384,386c412 |
| 492 | < Use the C<.> operator to concatenate strings. The following example |
| 493 | < concatenates the string "cd" onto the string "ab" and stores the result in |
| 494 | < C<$S1>. |
| 495 | --- |
| 496 | > <p>Use the <code>.</code> operator to concatenate strings. The following example concatenates the string "cd" onto the string "ab" and stores the result in <code>$S1</code>.</p> |
| 497 | 391,394c417,419 |
| 498 | < X<.= operator> |
| 499 | < Concatenation has a C<.=> variant to modify the result in place. In the |
| 500 | < next example, the C<.=> operation appends "xy" onto the string "abcd" in |
| 501 | < C<$S1>. |
| 502 | --- |
| 503 | > <p><!-- |
| 504 | > INDEX: .= operator |
| 505 | > --> Concatenation has a <code>.=</code> variant to modify the result in place. In the next example, the <code>.=</code> operation appends "xy" onto the string "abcd" in <code>$S1</code>.</p> |
| 506 | 401,402c426,428 |
| 507 | < X<repeat opcode> |
| 508 | < The C<repeat> opcode repeats a string a specified number of times: |
| 509 | --- |
| 510 | > <p><!-- |
| 511 | > INDEX: repeat opcode |
| 512 | > --> The <code>repeat</code> opcode repeats a string a specified number of times:</p> |
| 513 | 407,408c433 |
| 514 | < In this example, C<repeat> generates a new string with "a" repeated five |
| 515 | < times and stores it in C<$S1>. |
| 516 | --- |
| 517 | > <p>In this example, <code>repeat</code> generates a new string with "a" repeated five times and stores it in <code>$S1</code>.</p> |
| 518 | 413,415c438,440 |
| 519 | < X<length opcode> |
| 520 | < The C<length> opcode returns the length of a string in characters. This won't |
| 521 | < be the same as the length in I<bytes> for multibyte encoded strings: |
| 522 | --- |
| 523 | > <p><!-- |
| 524 | > INDEX: length opcode |
| 525 | > --> The <code>length</code> opcode returns the length of a string in characters. This won't be the same as the length in <i>bytes</i> for multibyte encoded strings:</p> |
| 526 | 420c445 |
| 527 | < C<length> has no equivalent for PMC strings. |
| 528 | --- |
| 529 | > <p><code>length</code> has no equivalent for PMC strings.</p> |
| 530 | 425,428c450,452 |
| 531 | < The simplest version of the C<substr>X<substr opcode> opcode takes three |
| 532 | < arguments: a source string, an offset position, and a length. It returns a |
| 533 | < substring of the original string, starting from the offset position (0 is the |
| 534 | < first character) and spanning the length: |
| 535 | --- |
| 536 | > <p>The simplest version of the <code>substr</code><!-- |
| 537 | > INDEX: substr opcode |
| 538 | > --> opcode takes three arguments: a source string, an offset position, and a length. It returns a substring of the original string, starting from the offset position (0 is the first character) and spanning the length:</p> |
| 539 | 431,444c455,457 |
| 540 | < This example extracts a two-character string from "abcde" at a one-character |
| 541 | < offset from the beginning of the string (starting with the second character). |
| 542 | < It generates a new string, "bc", in the destination register C<$S0>. |
| 543 | < |
| 544 | < When the offset position is negative, it counts backward from the end of the |
| 545 | < string. Thus an offset of -1 starts at the last character of the string. |
| 546 | < |
| 547 | < C<substr> no longer has a four-argument form, as in-place string operations |
| 548 | < have been removed. There is a C<replace> operator which will perform the |
| 549 | < replacement and return a new_string without modifying the old_string. |
| 550 | < The arguments are new_string, old_string, offset, count and |
| 551 | < replacement_string. The old_string is copied to the new_string with the |
| 552 | < replacement_string inserted from offset replacing the content for count |
| 553 | < characters. |
| 554 | --- |
| 555 | > <p>This example extracts a two-character string from "abcde" at a one-character offset from the beginning of the string (starting with the second character). It generates a new string, "bc", in the destination register <code>$S0</code>.</p> |
615 | | > C<substr> no longer has a four-argument form, as in-place string operations |
616 | | > have been removed. There is a C<replace> operator which will perform the |
617 | | > replacement and return a new_string without modifying the old_string. |
618 | | > The arguments are new_string, old_string, offset, count and |
619 | | > replacement_string. The old_string is copied to the new_string with the |
620 | | > replacement_string inserted from offset replacing the content for count |
621 | | > characters. |
622 | | 459,461c446,447 |
623 | | < <p><code>substr</code> no longer has a four-argument form, as in-place string operations have been removed. There is a <code>replace</code> operator which will perform the replacement and return a new_string without modifying the old_string. The arguments are new_string, old_string, offset, count and replacement_string. The old_string is copied to the new_string with the replacement_string inserted from offset replacing the content for count characters.</p> |
624 | | < |
625 | | < <p>This example replaces the substring "bc" in <code>$S1</code> with the string "XYZ", and returns "aXYZde" in <code>$S0</code>, <code>$S1</code> is not changed:</p> |
626 | | --- |
627 | | > This example replaces the substring "bc" in C<$S1> with the string "XYZ", |
628 | | > and returns "aXYZde" in C<$S0>, C<$S1> is not changed: |
629 | | 467c453,456 |
630 | | < <p>When the offset position in a <code>replace</code> is one character beyond the original string length, <code>replace</code> appends the replacement string just like the concatenation operator. If the replacement string is an empty string, the opcode removes the characters from the original string in the new string.</p> |
631 | | --- |
632 | | > When the offset position in a C<replace> is one character beyond the original |
633 | | > string length, C<replace> appends the replacement string just like the |
634 | | > concatenation operator. If the replacement string is an empty string, the |
635 | | > opcode removes the characters from the original string in the new string. |
636 | | 475,479c464,469 |
637 | | < <p>The <code>chr</code><!-- |
638 | | < INDEX: chr opcode |
639 | | < --> opcode takes an integer value and returns the corresponding character in the ASCII character set as a one-character string. The <code>ord</code><!-- |
640 | | < INDEX: ord opcode |
641 | | < --> opcode takes a single character string and returns the integer value of the character at the first position in the string. The integer value of the character will differ depending on the current encoding of the string:</p> |
642 | | --- |
643 | | > The C<chr>X<chr opcode> opcode takes an integer value and returns the |
644 | | > corresponding character in the ASCII character set as a one-character string. |
645 | | > The C<ord>X<ord opcode> opcode takes a single character string and returns the |
646 | | > integer value of the character at the first position in the string. The integer |
647 | | > value of the character will differ depending on the current encoding of the |
648 | | > string: |
649 | | 483c473,475 |
650 | | < <p><code>ord</code> has a two-argument variant that takes a character offset to select a single character from a multicharacter string. The offset must be within the length of the string:</p> |
651 | | --- |
652 | | > C<ord> has a two-argument variant that takes a character offset to select |
653 | | > a single character from a multicharacter string. The offset must be within |
654 | | > the length of the string: |
655 | | 486c478,479 |
656 | | < <p>A negative offset counts backward from the end of the string, so -1 is the last character.</p> |
657 | | --- |
658 | | > A negative offset counts backward from the end of the string, so -1 is |
659 | | > the last character. |
660 | | 492,494c485 |
661 | | < <p><!-- |
662 | | < INDEX: strings;formatting |
663 | | < --></p> |
664 | | --- |
665 | | > X<strings;formatting> |
666 | | 496,498c487,490 |
667 | | < <p>The <code>sprintf</code><!-- |
668 | | < INDEX: sprintf opcode |
669 | | < --> opcode generates a formatted string from a series of values. It takes two arguments: a string specifying the format, and an array PMC containing the values to be formatted. The format string and the result can be either strings or PMCs:</p> |
670 | | --- |
671 | | > The C<sprintf>X<sprintf opcode> opcode generates a formatted string from a |
672 | | > series of values. It takes two arguments: a string specifying the format, and |
673 | | > an array PMC containing the values to be formatted. The format string and the |
674 | | > result can be either strings or PMCs: |
675 | | 502,508c494,510 |
676 | | < <p>The format string is similar to C's <code>sprintf</code> function with extensions for Parrot data types. Each format field in the string starts with a <code>%</code> and ends with a character specifying the output format. Table 4.2 lists the available output format characters.</p> |
677 | | < |
678 | | < <p>Each format field supports several specifier options: flags, width, precision, and size. Table 4.3 lists the format flags.</p> |
679 | | < |
680 | | < <p>The width is a number defining the minimum width of the output from a field. The precision is the maximum width for strings or integers, and the number of decimal places for floating-point fields. If either width or precision is an asterisk (<code>*</code>), it takes its value from the next argument in the PMC.</p> |
681 | | < |
682 | | < <p>The size modifier defines the type of the argument the field takes. Table 4.4 lists the size flags. The values in the aggregate PMC must have a type compatible with the specified size.</p> |
683 | | --- |
684 | | > The format string is similar to C's C<sprintf> function with extensions for |
685 | | > Parrot data types. Each format field in the string starts with a C<%> and ends |
686 | | > with a character specifying the output format. Table 4.2 lists the available |
687 | | > output format characters. |
| 564 | > <p>This example replaces the substring "bc" in <code>$S1</code> with the string "XYZ", and returns "aXYZde" in <code>$S0</code>, <code>$S1</code> is not changed:</p> |
| 565 | 453,456c467 |
| 566 | < When the offset position in a C<replace> is one character beyond the original |
| 567 | < string length, C<replace> appends the replacement string just like the |
| 568 | < concatenation operator. If the replacement string is an empty string, the |
| 569 | < opcode removes the characters from the original string in the new string. |
| 570 | --- |
| 571 | > <p>When the offset position in a <code>replace</code> is one character beyond the original string length, <code>replace</code> appends the replacement string just like the concatenation operator. If the replacement string is an empty string, the opcode removes the characters from the original string in the new string.</p> |
| 572 | 464,469c475,479 |
| 573 | < The C<chr>X<chr opcode> opcode takes an integer value and returns the |
| 574 | < corresponding character in the ASCII character set as a one-character string. |
| 575 | < The C<ord>X<ord opcode> opcode takes a single character string and returns the |
| 576 | < integer value of the character at the first position in the string. The integer |
| 577 | < value of the character will differ depending on the current encoding of the |
| 578 | < string: |
| 579 | --- |
| 580 | > <p>The <code>chr</code><!-- |
| 581 | > INDEX: chr opcode |
| 582 | > --> opcode takes an integer value and returns the corresponding character in the ASCII character set as a one-character string. The <code>ord</code><!-- |
| 583 | > INDEX: ord opcode |
| 584 | > --> opcode takes a single character string and returns the integer value of the character at the first position in the string. The integer value of the character will differ depending on the current encoding of the string:</p> |
| 585 | 473,475c483 |
| 586 | < C<ord> has a two-argument variant that takes a character offset to select |
| 587 | < a single character from a multicharacter string. The offset must be within |
| 588 | < the length of the string: |
| 589 | --- |
| 590 | > <p><code>ord</code> has a two-argument variant that takes a character offset to select a single character from a multicharacter string. The offset must be within the length of the string:</p> |
| 591 | 478,479c486 |
| 592 | < A negative offset counts backward from the end of the string, so -1 is |
| 593 | < the last character. |
| 594 | --- |
| 595 | > <p>A negative offset counts backward from the end of the string, so -1 is the last character.</p> |
| 596 | 485c492,494 |
| 597 | < X<strings;formatting> |
| 598 | --- |
| 599 | > <p><!-- |
| 600 | > INDEX: strings;formatting |
| 601 | > --></p> |
| 602 | 487,490c496,498 |
| 603 | < The C<sprintf>X<sprintf opcode> opcode generates a formatted string from a |
| 604 | < series of values. It takes two arguments: a string specifying the format, and |
| 605 | < an array PMC containing the values to be formatted. The format string and the |
| 606 | < result can be either strings or PMCs: |
| 607 | --- |
| 608 | > <p>The <code>sprintf</code><!-- |
| 609 | > INDEX: sprintf opcode |
| 610 | > --> opcode generates a formatted string from a series of values. It takes two arguments: a string specifying the format, and an array PMC containing the values to be formatted. The format string and the result can be either strings or PMCs:</p> |
| 611 | 494,510c502,508 |
| 612 | < The format string is similar to C's C<sprintf> function with extensions for |
| 613 | < Parrot data types. Each format field in the string starts with a C<%> and ends |
| 614 | < with a character specifying the output format. Table 4.2 lists the available |
| 615 | < output format characters. |
| 616 | < |
| 617 | < Each format field supports several specifier options: R<flags>, R<width>, |
| 618 | < R<precision>, and R<size>. Table 4.3 lists the format flags. |
| 619 | < |
| 620 | < The R<width> is a number defining the minimum width of the output from |
| 621 | < a field. The R<precision> is the maximum width for strings or |
| 622 | < integers, and the number of decimal places for floating-point fields. |
| 623 | < If either R<width> or R<precision> is an asterisk (C<*>), it takes its |
| 624 | < value from the next argument in the PMC. |
| 625 | < |
| 626 | < The R<size> modifier defines the type of the argument the field takes. |
| 627 | < Table 4.4 lists the size flags. The values in the aggregate PMC must |
| 628 | < have a type compatible with the specified R<size>. |
| 629 | --- |
| 630 | > <p>The format string is similar to C's <code>sprintf</code> function with extensions for Parrot data types. Each format field in the string starts with a <code>%</code> and ends with a character specifying the output format. Table 4.2 lists the available output format characters.</p> |
698 | | > The R<size> modifier defines the type of the argument the field takes. |
699 | | > Table 4.4 lists the size flags. The values in the aggregate PMC must |
700 | | > have a type compatible with the specified R<size>. |
701 | | 512c514,519 |
702 | | < <p>The format string of this <code>sprintf</code> example has two format fields. The first, <code>%#Px</code>, extracts a PMC argument (<code>P</code>) from the aggregate <code>$P2</code> and formats it as a hexadecimal integer (<code>x</code>) with a leading 0x (<code>#</code>). The second format field, <code>%+2.3Pf</code>, takes a PMC argument (<code>P</code>) and formats it as a floating-point number (<code>f</code>) with a minimum of two whole digits and a maximum of three decimal places (<code>2.3</code>) and a leading sign (<code>+</code>).</p> |
703 | | --- |
704 | | > The format string of this C<sprintf> example has two format fields. The first, |
705 | | > C<%#Px>, extracts a PMC argument (C<P>) from the aggregate C<$P2> and formats |
706 | | > it as a hexadecimal integer (C<x>) with a leading 0x (C<#>). The second format |
707 | | > field, C<%+2.3Pf>, takes a PMC argument (C<P>) and formats it as a |
708 | | > floating-point number (C<f>) with a minimum of two whole digits and a maximum |
709 | | > of three decimal places (C<2.3>) and a leading sign (C<+>). |
710 | | 514c521,522 |
711 | | < <p>The test files <em><a href="../../../t/op/string.t.html">t/op/string.t</a></em> and <em><a href="../../../t/op/sprintf.t.html">t/op/sprintf.t</a></em> have many more examples of format strings.</p> |
712 | | --- |
713 | | > The test files F<t/op/string.t> and F<t/op/sprintf.t> have many more |
714 | | > examples of format strings. |
715 | | 519,521c527,529 |
716 | | < <p>The <code>join</code><!-- |
717 | | < INDEX: join opcode |
718 | | < --> opcode joins the elements of an array PMC into a single string. The first argument separates the individual elements of the PMC in the final string result.</p> |
719 | | --- |
720 | | > The C<join>X<join opcode> opcode joins the elements of an array PMC into |
721 | | > a single string. The first argument separates the individual elements of |
722 | | > the PMC in the final string result. |
723 | | 531c539,541 |
724 | | < <p>This example builds a <code>Array</code> in <code>$P0</code> with the values <code>"hi"</code>, <code>0</code>, <code>1</code>, <code>0</code>, and <code>"parrot"</code>. It then joins those values (separated by the string <code>"__"</code>) into a single string stored in <code>$S0</code>.</p> |
725 | | --- |
726 | | > This example builds a C<Array> in C<$P0> with the values C<"hi">, C<0>, C<1>, |
727 | | > C<0>, and C<"parrot">. It then joins those values (separated by the string |
728 | | > C<"__">) into a single string stored in C<$S0>. |
729 | | 536c546,547 |
730 | | < <p>Splitting a string yields a new array containing the resulting substrings of the original string.</p> |
731 | | --- |
732 | | > Splitting a string yields a new array containing the resulting substrings of |
733 | | > the original string. |
734 | | 538c549,551 |
735 | | < <p>This example splits the string "abc" into individual characters and stores them in an array in <code>$P0</code>. It then prints out the first and third elements of the array.</p> |
736 | | --- |
737 | | > This example splits the string "abc" into individual characters and stores them |
738 | | > in an array in C<$P0>. It then prints out the first and third elements of the |
739 | | > array. |
740 | | 548,550c561,564 |
741 | | < <p>The <code>index</code><!-- |
742 | | < INDEX: index opcode |
743 | | < --> opcode searches for a substring within a string. If it finds the substring, it returns the position where the substring was found as a character offset from the beginning of the string. If it fails to find the substring, it returns -1:</p> |
744 | | --- |
745 | | > The C<index>X<index opcode> opcode searches for a substring |
746 | | > within a string. If it finds the substring, it returns the position |
747 | | > where the substring was found as a character offset from the beginning |
748 | | > of the string. If it fails to find the substring, it returns -1: |
749 | | 556c570,571 |
750 | | < <p><code>index</code> also has a three-argument version, where the final argument defines an offset position for starting the search.</p> |
751 | | --- |
752 | | > C<index> also has a three-argument version, where the final argument |
753 | | > defines an offset position for starting the search. |
754 | | 560c575,576 |
755 | | < <p>This example finds the second "eb" in "Beeblebrox" instead of the first, because the search skips the first three characters in the string.</p> |
756 | | --- |
757 | | > This example finds the second "eb" in "Beeblebrox" instead of the first, |
758 | | > because the search skips the first three characters in the string. |
759 | | 565,571c581,585 |
760 | | < <p>The numeric bitwise opcodes also have string variants for AND, OR, and XOR: <code>bors</code><!-- |
761 | | < INDEX: bors opcode |
762 | | < -->, <code>bands</code><!-- |
763 | | < INDEX: bands opcode |
764 | | < -->, and <code>bxors</code><!-- |
765 | | < INDEX: bxors opcode |
766 | | < -->. These take string or string-like PMC arguments and perform the logical operation on each byte of the strings to produce the result string. Remember that in-place string operations are no longer available.</p> |
767 | | --- |
768 | | > The numeric bitwise opcodes also have string variants for AND, OR, and XOR: |
769 | | > C<bors>X<bors opcode>, C<bands>X<bands opcode>, and C<bxors>X<bxors opcode>. |
770 | | > These take string or string-like PMC arguments and perform the logical |
771 | | > operation on each byte of the strings to produce the result string. |
772 | | > Remember that in-place string operations are no longer available. |
773 | | 581c595,596 |
774 | | < <p>The bitwise string opcodes produce meaningful results only when used with simple ASCII strings, because Parrot performs bitwise operations per byte.</p> |
775 | | --- |
776 | | > The bitwise string opcodes produce meaningful results only when used with |
777 | | > simple ASCII strings, because Parrot performs bitwise operations per byte. |
778 | | 586,590c601,604 |
779 | | < <p>Strings use copy-on-write (COW)<!-- |
780 | | < INDEX: copy-on-write |
781 | | < --><!-- |
782 | | < INDEX: COW (copy-on-write) |
783 | | < --> optimizations. A call to <code>$S1 = $S0</code> doesn't immediately make a copy of <code>$S0</code>, it only makes both variables point to the same string. Parrot doesn't make a copy of the string until one of two strings is modified.</p> |
784 | | --- |
785 | | > Strings use copy-on-write (COW)X<copy-on-write>X<COW (copy-on-write)> |
786 | | > optimizations. A call to C<$S1 = $S0> doesn't immediately make a copy of |
787 | | > C<$S0>, it only makes both variables point to the same string. Parrot |
788 | | > doesn't make a copy of the string until one of two strings is modified. |
789 | | 597c611,614 |
790 | | < <p>Modifying one of the two variables causes Parrot to create a new string. This example preserves the existing value in <code>$S0</code> and assigns the new value to the new string in <code>$S1</code>. The benefit of copy-on-write is avoiding the cost of copying strings until the copies are necessary.</p> |
791 | | --- |
792 | | > Modifying one of the two variables causes Parrot to create a new string. This |
793 | | > example preserves the existing value in C<$S0> and assigns the new value to the |
794 | | > new string in C<$S1>. The benefit of copy-on-write is avoiding the cost of |
795 | | > copying strings until the copies are necessary. |
796 | | 602,610c619,637 |
797 | | < <p><!-- |
798 | | < INDEX: charset |
799 | | < --> <!-- |
800 | | < INDEX: ASCII character set |
801 | | < --> <!-- |
802 | | < INDEX: encoding |
803 | | < --> Years ago, strings only needed to support the ASCII character set (or charset), a mapping of 128 bit patterns to symbols and English-language characters. This worked as long as everyone using a computer read and wrote English and only used a small handful of punctuation symbols. In other words, it was woefully insufficient. A modern string system must manage charsets in order to make sense out of all the string data in the world. A modern string system must also handle different encodings -- ways to represent various charsets in memory and on disk.</p> |
804 | | < |
805 | | < <p>Every string in Parrot has an associated encoding and character set. The default charset is 8-bit ASCII, which is almost universally supported. Double-quoted string constants can have an optional prefix specifying the string's encoding and charset.As you might suspect, single-quoted strings do not support this. Parrot tracks information about encoding and charset internally, and automatically converts strings when necessary to preserve these characteristics. Strings constants may have prefixes of the form <code>encoding:charset:</code>.</p> |
806 | | --- |
807 | | > X<charset> |
808 | | > X<ASCII character set> |
809 | | > X<encoding> |
810 | | > Years ago, strings only needed to support the ASCII character set (or |
811 | | > charset), a mapping of 128 bit patterns to symbols and English-language |
812 | | > characters. This worked as long as everyone using a computer read and |
813 | | > wrote English and only used a small handful of punctuation symbols. In |
814 | | > other words, it was woefully insufficient. A modern string system must |
815 | | > manage charsets in order to make sense out of all the string data in the |
816 | | > world. A modern string system must also handle different encodings -- |
817 | | > ways to represent various charsets in memory and on disk. |
| 636 | > <p>The size modifier defines the type of the argument the field takes. Table 4.4 lists the size flags. The values in the aggregate PMC must have a type compatible with the specified size.</p> |
| 637 | 514,519c512 |
| 638 | < The format string of this C<sprintf> example has two format fields. The first, |
| 639 | < C<%#Px>, extracts a PMC argument (C<P>) from the aggregate C<$P2> and formats |
| 640 | < it as a hexadecimal integer (C<x>) with a leading 0x (C<#>). The second format |
| 641 | < field, C<%+2.3Pf>, takes a PMC argument (C<P>) and formats it as a |
| 642 | < floating-point number (C<f>) with a minimum of two whole digits and a maximum |
| 643 | < of three decimal places (C<2.3>) and a leading sign (C<+>). |
| 644 | --- |
| 645 | > <p>The format string of this <code>sprintf</code> example has two format fields. The first, <code>%#Px</code>, extracts a PMC argument (<code>P</code>) from the aggregate <code>$P2</code> and formats it as a hexadecimal integer (<code>x</code>) with a leading 0x (<code>#</code>). The second format field, <code>%+2.3Pf</code>, takes a PMC argument (<code>P</code>) and formats it as a floating-point number (<code>f</code>) with a minimum of two whole digits and a maximum of three decimal places (<code>2.3</code>) and a leading sign (<code>+</code>).</p> |
| 646 | 521,522c514 |
| 647 | < The test files F<t/op/string.t> and F<t/op/sprintf.t> have many more |
| 648 | < examples of format strings. |
| 649 | --- |
| 650 | > <p>The test files <em><a href="../../../t/op/string.t.html">t/op/string.t</a></em> and <em><a href="../../../t/op/sprintf.t.html">t/op/sprintf.t</a></em> have many more examples of format strings.</p> |
| 651 | 527,529c519,521 |
| 652 | < The C<join>X<join opcode> opcode joins the elements of an array PMC into |
| 653 | < a single string. The first argument separates the individual elements of |
| 654 | < the PMC in the final string result. |
| 655 | --- |
| 656 | > <p>The <code>join</code><!-- |
| 657 | > INDEX: join opcode |
| 658 | > --> opcode joins the elements of an array PMC into a single string. The first argument separates the individual elements of the PMC in the final string result.</p> |
| 659 | 539,541c531 |
| 660 | < This example builds a C<Array> in C<$P0> with the values C<"hi">, C<0>, C<1>, |
| 661 | < C<0>, and C<"parrot">. It then joins those values (separated by the string |
| 662 | < C<"__">) into a single string stored in C<$S0>. |
| 663 | --- |
| 664 | > <p>This example builds a <code>Array</code> in <code>$P0</code> with the values <code>"hi"</code>, <code>0</code>, <code>1</code>, <code>0</code>, and <code>"parrot"</code>. It then joins those values (separated by the string <code>"__"</code>) into a single string stored in <code>$S0</code>.</p> |
| 665 | 546,547c536 |
| 666 | < Splitting a string yields a new array containing the resulting substrings of |
| 667 | < the original string. |
| 668 | --- |
| 669 | > <p>Splitting a string yields a new array containing the resulting substrings of the original string.</p> |
| 670 | 549,551c538 |
| 671 | < This example splits the string "abc" into individual characters and stores them |
| 672 | < in an array in C<$P0>. It then prints out the first and third elements of the |
| 673 | < array. |
| 674 | --- |
| 675 | > <p>This example splits the string "abc" into individual characters and stores them in an array in <code>$P0</code>. It then prints out the first and third elements of the array.</p> |
| 676 | 561,564c548,550 |
| 677 | < The C<index>X<index opcode> opcode searches for a substring |
| 678 | < within a string. If it finds the substring, it returns the position |
| 679 | < where the substring was found as a character offset from the beginning |
| 680 | < of the string. If it fails to find the substring, it returns -1: |
| 681 | --- |
| 682 | > <p>The <code>index</code><!-- |
| 683 | > INDEX: index opcode |
| 684 | > --> opcode searches for a substring within a string. If it finds the substring, it returns the position where the substring was found as a character offset from the beginning of the string. If it fails to find the substring, it returns -1:</p> |
| 685 | 570,571c556 |
| 686 | < C<index> also has a three-argument version, where the final argument |
| 687 | < defines an offset position for starting the search. |
| 688 | --- |
| 689 | > <p><code>index</code> also has a three-argument version, where the final argument defines an offset position for starting the search.</p> |
| 690 | 575,576c560 |
| 691 | < This example finds the second "eb" in "Beeblebrox" instead of the first, |
| 692 | < because the search skips the first three characters in the string. |
| 693 | --- |
| 694 | > <p>This example finds the second "eb" in "Beeblebrox" instead of the first, because the search skips the first three characters in the string.</p> |
| 695 | 581,585c565,571 |
| 696 | < The numeric bitwise opcodes also have string variants for AND, OR, and XOR: |
| 697 | < C<bors>X<bors opcode>, C<bands>X<bands opcode>, and C<bxors>X<bxors opcode>. |
| 698 | < These take string or string-like PMC arguments and perform the logical |
| 699 | < operation on each byte of the strings to produce the result string. |
| 700 | < Remember that in-place string operations are no longer available. |
| 701 | --- |
| 702 | > <p>The numeric bitwise opcodes also have string variants for AND, OR, and XOR: <code>bors</code><!-- |
| 703 | > INDEX: bors opcode |
| 704 | > -->, <code>bands</code><!-- |
| 705 | > INDEX: bands opcode |
| 706 | > -->, and <code>bxors</code><!-- |
| 707 | > INDEX: bxors opcode |
| 708 | > -->. These take string or string-like PMC arguments and perform the logical operation on each byte of the strings to produce the result string. Remember that in-place string operations are no longer available.</p> |
| 709 | 595,596c581 |
| 710 | < The bitwise string opcodes produce meaningful results only when used with |
| 711 | < simple ASCII strings, because Parrot performs bitwise operations per byte. |
| 712 | --- |
| 713 | > <p>The bitwise string opcodes produce meaningful results only when used with simple ASCII strings, because Parrot performs bitwise operations per byte.</p> |
| 714 | 601,604c586,590 |
| 715 | < Strings use copy-on-write (COW)X<copy-on-write>X<COW (copy-on-write)> |
| 716 | < optimizations. A call to C<$S1 = $S0> doesn't immediately make a copy of |
| 717 | < C<$S0>, it only makes both variables point to the same string. Parrot |
| 718 | < doesn't make a copy of the string until one of two strings is modified. |
| 719 | --- |
| 720 | > <p>Strings use copy-on-write (COW)<!-- |
| 721 | > INDEX: copy-on-write |
| 722 | > --><!-- |
| 723 | > INDEX: COW (copy-on-write) |
| 724 | > --> optimizations. A call to <code>$S1 = $S0</code> doesn't immediately make a copy of <code>$S0</code>, it only makes both variables point to the same string. Parrot doesn't make a copy of the string until one of two strings is modified.</p> |
| 725 | 611,614c597 |
| 726 | < Modifying one of the two variables causes Parrot to create a new string. This |
| 727 | < example preserves the existing value in C<$S0> and assigns the new value to the |
| 728 | < new string in C<$S1>. The benefit of copy-on-write is avoiding the cost of |
| 729 | < copying strings until the copies are necessary. |
| 730 | --- |
| 731 | > <p>Modifying one of the two variables causes Parrot to create a new string. This example preserves the existing value in <code>$S0</code> and assigns the new value to the new string in <code>$S1</code>. The benefit of copy-on-write is avoiding the cost of copying strings until the copies are necessary.</p> |
| 732 | 619,637c602,610 |
| 733 | < X<charset> |
| 734 | < X<ASCII character set> |
| 735 | < X<encoding> |
| 736 | < Years ago, strings only needed to support the ASCII character set (or |
| 737 | < charset), a mapping of 128 bit patterns to symbols and English-language |
| 738 | < characters. This worked as long as everyone using a computer read and |
| 739 | < wrote English and only used a small handful of punctuation symbols. In |
| 740 | < other words, it was woefully insufficient. A modern string system must |
| 741 | < manage charsets in order to make sense out of all the string data in the |
| 742 | < world. A modern string system must also handle different encodings -- |
| 743 | < ways to represent various charsets in memory and on disk. |
| 744 | < |
| 745 | < Every string in Parrot has an associated encoding and character set. The default |
| 746 | < charset is 8-bit ASCII, which is almost universally supported. Double-quoted |
| 747 | < string constants can have an optional prefix specifying the string's encoding |
| 748 | < and charset.N<As you might suspect, single-quoted strings do not support this.> |
| 749 | < Parrot tracks information about encoding and charset internally, and |
| 750 | < automatically converts strings when necessary to preserve these |
| 751 | < characteristics. Strings constants may have prefixes of the form C<encoding:charset:>. |
| 752 | --- |
| 753 | > <p><!-- |
| 754 | > INDEX: charset |
| 755 | > --> <!-- |
| 756 | > INDEX: ASCII character set |
| 757 | > --> <!-- |
| 758 | > INDEX: encoding |
| 759 | > --> Years ago, strings only needed to support the ASCII character set (or charset), a mapping of 128 bit patterns to symbols and English-language characters. This worked as long as everyone using a computer read and wrote English and only used a small handful of punctuation symbols. In other words, it was woefully insufficient. A modern string system must manage charsets in order to make sense out of all the string data in the world. A modern string system must also handle different encodings -- ways to represent various charsets in memory and on disk.</p> |
960 | | > Converting a string to an integer or number only makes sense when the contents |
961 | | > of the string are a number. The C<String> PMC will attempt to extract a number |
962 | | > from the beginning of the string, but otherwise will return a false value. |
963 | | 729,733c773,778 |
964 | | < <p><!-- |
965 | | < INDEX: aggregate PMCs |
966 | | < --> <!-- |
967 | | < INDEX: PMCs (Polymorphic Containers);aggregate |
968 | | < --> PMCs can define complex types that hold multiple values, commonly called aggregates. Two basic aggregate types are ordered arrays and associative arrays. The primary difference between these is that ordered arrays use integer keys for indexes and associative arrays use string keys.</p> |
969 | | --- |
970 | | > X<aggregate PMCs> |
971 | | > X<PMCs (Polymorphic Containers);aggregate> |
972 | | > PMCs can define complex types that hold multiple values, commonly called |
973 | | > aggregates. Two basic aggregate types are ordered arrays and associative |
974 | | > arrays. The primary difference between these is that ordered arrays use integer |
975 | | > keys for indexes and associative arrays use string keys. |
976 | | 735c780,781 |
977 | | < <p>Aggregate PMCs support the use of numeric or string keys. PIR also offers a extensive set of operations for manipulating aggregate data types.</p> |
978 | | --- |
979 | | > Aggregate PMCs support the use of numeric or string keys. PIR also offers a |
980 | | > extensive set of operations for manipulating aggregate data types. |
981 | | 740,748c786,809 |
982 | | < <p><!-- |
983 | | < INDEX: arrays |
984 | | < --> <!-- |
985 | | < INDEX: ordered arrays |
986 | | < --> Parrot provides several ordered array PMCs, differentiated by whether the array should store booleans, integers, numbers, strings, or other PMCs, and whether the array should maintain a fixed size or dynamically resize for the number of elements it stores.</p> |
987 | | < |
988 | | < <p>The core array types are <code>FixedPMCArray</code>, <code>ResizablePMCArray</code>, <code>FixedIntegerArray</code>, <code>ResizableIntegerArray</code>, <code>FixedFloatArray</code>, <code>ResizableFloatArray</code>, <code>FixedStringArray</code>, <code>ResizableStringArray</code>, <code>FixedBooleanArray</code>, and <code>ResizableBooleanArray</code>. The array types that start with "Fixed" have a fixed size and do not allow elements to be added outside their allocated size. The "Resizable" variants automatically extend themselves as more elements are added.With some additional overhead for checking array bounds and reallocating array memory. The array types that include "String", "Integer", or "Boolean" in the name use alternate packing methods for greater memory efficiency.</p> |
989 | | < |
990 | | < <p>Parrot's core ordered array PMCs all have zero-based integer keys. Extracting or inserting an element into the array uses PIR's standard key syntax, with the key in square brackets after the variable name. An lvalue key sets the value for that key. An rvalue key extracts the value for that key in the aggregate to use as the argument value:</p> |
991 | | --- |
992 | | > X<arrays> |
993 | | > X<ordered arrays> |
994 | | > Parrot provides several ordered array PMCs, differentiated by whether |
995 | | > the array should store booleans, integers, numbers, strings, or other |
996 | | > PMCs, and whether the array should maintain a fixed size or dynamically |
997 | | > resize for the number of elements it stores. |
| 898 | > <p>Converting a string to an integer or number only makes sense when the contents of the string are a number. The <code>String</code> PMC will attempt to extract a number from the beginning of the string, but otherwise will return a false value.</p> |
| 899 | 773,778c729,733 |
| 900 | < X<aggregate PMCs> |
| 901 | < X<PMCs (Polymorphic Containers);aggregate> |
| 902 | < PMCs can define complex types that hold multiple values, commonly called |
| 903 | < aggregates. Two basic aggregate types are ordered arrays and associative |
| 904 | < arrays. The primary difference between these is that ordered arrays use integer |
| 905 | < keys for indexes and associative arrays use string keys. |
| 906 | --- |
| 907 | > <p><!-- |
| 908 | > INDEX: aggregate PMCs |
| 909 | > --> <!-- |
| 910 | > INDEX: PMCs (Polymorphic Containers);aggregate |
| 911 | > --> PMCs can define complex types that hold multiple values, commonly called aggregates. Two basic aggregate types are ordered arrays and associative arrays. The primary difference between these is that ordered arrays use integer keys for indexes and associative arrays use string keys.</p> |
| 912 | 780,781c735 |
| 913 | < Aggregate PMCs support the use of numeric or string keys. PIR also offers a |
| 914 | < extensive set of operations for manipulating aggregate data types. |
| 915 | --- |
| 916 | > <p>Aggregate PMCs support the use of numeric or string keys. PIR also offers a extensive set of operations for manipulating aggregate data types.</p> |
| 917 | 786,809c740,748 |
| 918 | < X<arrays> |
| 919 | < X<ordered arrays> |
| 920 | < Parrot provides several ordered array PMCs, differentiated by whether |
| 921 | < the array should store booleans, integers, numbers, strings, or other |
| 922 | < PMCs, and whether the array should maintain a fixed size or dynamically |
| 923 | < resize for the number of elements it stores. |
| 924 | < |
| 925 | < The core array types are C<FixedPMCArray>, C<ResizablePMCArray>, |
| 926 | < C<FixedIntegerArray>, C<ResizableIntegerArray>, C<FixedFloatArray>, |
| 927 | < C<ResizableFloatArray>, C<FixedStringArray>, C<ResizableStringArray>, |
| 928 | < C<FixedBooleanArray>, and C<ResizableBooleanArray>. The array |
| 929 | < types that start with "Fixed" have a fixed size and do not allow |
| 930 | < elements to be added outside their allocated size. The "Resizable" |
| 931 | < variants automatically extend themselves as more elements are |
| 932 | < added.N<With some additional overhead for checking array bounds and |
| 933 | < reallocating array memory.> The array types that include "String", |
| 934 | < "Integer", or "Boolean" in the name use alternate packing methods for |
| 935 | < greater memory efficiency. |
| 936 | < |
| 937 | < Parrot's core ordered array PMCs all have zero-based integer keys. Extracting |
| 938 | < or inserting an element into the array uses PIR's standard key syntax, with the |
| 939 | < key in square brackets after the variable name. An lvalue key sets the value |
| 940 | < for that key. An rvalue key extracts the value for that key in the aggregate |
| 941 | < to use as the argument value: |
| 942 | --- |
| 943 | > <p><!-- |
| 944 | > INDEX: arrays |
| 945 | > --> <!-- |
| 946 | > INDEX: ordered arrays |
| 947 | > --> Parrot provides several ordered array PMCs, differentiated by whether the array should store booleans, integers, numbers, strings, or other PMCs, and whether the array should maintain a fixed size or dynamically resize for the number of elements it stores.</p> |
1011 | | > Parrot's core ordered array PMCs all have zero-based integer keys. Extracting |
1012 | | > or inserting an element into the array uses PIR's standard key syntax, with the |
1013 | | > key in square brackets after the variable name. An lvalue key sets the value |
1014 | | > for that key. An rvalue key extracts the value for that key in the aggregate |
1015 | | > to use as the argument value: |
1016 | | 754c815,817 |
1017 | | < <p>Setting the array to an integer value directly (without a key) sets the number of elements of the array. Assigning an array directly to an integer retrieves the number of elements of the array.</p> |
1018 | | --- |
1019 | | > Setting the array to an integer value directly (without a key) sets the number |
1020 | | > of elements of the array. Assigning an array directly to an integer retrieves |
1021 | | > the number of elements of the array. |
1022 | | 758c821,822 |
1023 | | < <p>This is equivalent to using the <code>elements</code> opcode to retrieve the number of items currently in an array:</p> |
1024 | | --- |
1025 | | > This is equivalent to using the C<elements> opcode to retrieve the number of |
1026 | | > items currently in an array: |
1027 | | 761c825,829 |
1028 | | < <p>Some other useful instructions for working with ordered arrays are <code>push</code>, <code>pop</code>, <code>shift</code>, and <code>unshift</code>, to add or remove elements. <code>push</code> and <code>pop</code> work on the end of the array, the highest numbered index. <code>shift</code> and <code>unshift</code> work on the start of the array, adding or removing the zeroth element, and renumbering all the following elements.</p> |
1029 | | --- |
1030 | | > Some other useful instructions for working with ordered arrays are |
1031 | | > C<push>, C<pop>, C<shift>, and C<unshift>, to add or remove elements. |
1032 | | > C<push> and C<pop> work on the end of the array, the highest numbered |
1033 | | > index. C<shift> and C<unshift> work on the start of the array, adding or |
1034 | | > removing the zeroth element, and renumbering all the following elements. |
1035 | | 771,777c839,847 |
1036 | | < <p><!-- |
1037 | | < INDEX: associative arrays |
1038 | | < --> <!-- |
1039 | | < INDEX: hashes |
1040 | | < --> <!-- |
1041 | | < INDEX: dictionaries |
1042 | | < --> An associative array is an unordered aggregate that uses string keys to identify elements. You may know them as "hash tables", "hashes", "maps", or "dictionaries". Parrot provides one core associative array PMC, called <code>Hash</code>. String keys work very much like integer keys. An lvalue key sets the value of an element, and an rvalue key extracts the value of an element. The string in the key must always be in single or double quotes.</p> |
1043 | | --- |
1044 | | > X<associative arrays> |
1045 | | > X<hashes> |
1046 | | > X<dictionaries> |
1047 | | > An associative array is an unordered aggregate that uses string keys to |
1048 | | > identify elements. You may know them as "hash tables", "hashes", "maps", or |
1049 | | > "dictionaries". Parrot provides one core associative array PMC, called C<Hash>. |
1050 | | > String keys work very much like integer keys. An lvalue key sets the value of |
1051 | | > an element, and an rvalue key extracts the value of an element. The string in |
1052 | | > the key must always be in single or double quotes. |
1053 | | 782,784c852,854 |
1054 | | < <p>Assigning a <code>Hash</code><!-- |
1055 | | < INDEX: Hash PMC |
1056 | | < --> PMC (without a key) to an integer result fetches the number of elements in the hash.You may not set a <code>Hash</code> PMC directly to an integer value.</p> |
1057 | | --- |
1058 | | > Assigning a C<Hash>X<Hash PMC> PMC (without a key) to an integer result |
1059 | | > fetches the number of elements in the hash.N<You may not set a C<Hash> |
1060 | | > PMC directly to an integer value.> |
1061 | | 787,789c857,860 |
1062 | | < <p>The <code>exists</code><!-- |
1063 | | < INDEX: exists opcode |
1064 | | < --> opcode tests whether a keyed value exists in an aggregate. It returns 1 if it finds the key in the aggregate and 0 otherwise. It doesn't care if the value itself is true or false, only that an entry exists for that key:</p> |
1065 | | --- |
1066 | | > The C<exists>X<exists opcode> opcode tests whether a keyed value exists in an |
1067 | | > aggregate. It returns 1 if it finds the key in the aggregate and 0 otherwise. |
1068 | | > It doesn't care if the value itself is true or false, only that an entry exists |
1069 | | > for that key: |
1070 | | 795,797c866,867 |
1071 | | < <p>The <code>delete</code><!-- |
1072 | | < INDEX: delete opcode |
1073 | | < --> opcode removes an element from an associative array:</p> |
1074 | | --- |
1075 | | > The C<delete>X<delete opcode> opcode removes an element from an associative |
1076 | | > array: |
1077 | | 803,807c873,878 |
1078 | | < <p><!-- |
1079 | | < INDEX: iterators |
1080 | | < --> <!-- |
1081 | | < INDEX: PMCs (Polymorphic Containers); iterators |
1082 | | < --> An iterator extracts values from an aggregate PMC one at a time. Iterators are most useful in loops which perform an action on every element in an aggregate. The <code>iter</code> opcode creates a new iterator from an aggregate PMC. It takes one argument, the PMC over which to iterate:</p> |
1083 | | --- |
1084 | | > X<iterators> |
1085 | | > X<PMCs (Polymorphic Containers); iterators> |
1086 | | > An iterator extracts values from an aggregate PMC one at a time. Iterators are |
1087 | | > most useful in loops which perform an action on every element in an aggregate. |
1088 | | > The C<iter> opcode creates a new iterator from an aggregate PMC. It takes one |
1089 | | > argument, the PMC over which to iterate: |
1090 | | 810,812c881 |
1091 | | < <p>The <code>shift</code><!-- |
1092 | | < INDEX: shift opcode |
1093 | | < --> opcode extracts the next value from the iterator.</p> |
1094 | | --- |
1095 | | > The C<shift>X<shift opcode> opcode extracts the next value from the iterator. |
1096 | | 815c884,885 |
1097 | | < <p>Evaluating the iterator PMC as a boolean returns whether the iterator has reached the end of the aggregate:</p> |
1098 | | --- |
1099 | | > Evaluating the iterator PMC as a boolean returns whether the iterator has |
1100 | | > reached the end of the aggregate: |
1101 | | 818,822c888,896 |
1102 | | < <p>Parrot provides predefined constants for working with iterators. <code>.ITERATE_FROM_START</code> and <code>.ITERATE_FROM_END</code> constants select whether an ordered array iterator starts from the beginning or end of the array. These two constants have no effect on associative array iterators, as their elements are unordered.</p> |
1103 | | < |
1104 | | < <p>Load the iterator constants with the <code>.include</code><!-- |
1105 | | < INDEX: .include directive |
1106 | | < --> directive to include the file <em>iterator.pasm</em>. To use them, set the iterator PMC to the value of the constant:</p> |
1107 | | --- |
1108 | | > Parrot provides predefined constants for working with iterators. |
1109 | | > C<.ITERATE_FROM_START> and C<.ITERATE_FROM_END> constants select whether an |
1110 | | > ordered array iterator starts from the beginning or end of the array. These |
1111 | | > two constants have no effect on associative array iterators, as their elements |
1112 | | > are unordered. |
| 951 | > <p>Parrot's core ordered array PMCs all have zero-based integer keys. Extracting or inserting an element into the array uses PIR's standard key syntax, with the key in square brackets after the variable name. An lvalue key sets the value for that key. An rvalue key extracts the value for that key in the aggregate to use as the argument value:</p> |
| 952 | 815,817c754 |
| 953 | < Setting the array to an integer value directly (without a key) sets the number |
| 954 | < of elements of the array. Assigning an array directly to an integer retrieves |
| 955 | < the number of elements of the array. |
| 956 | --- |
| 957 | > <p>Setting the array to an integer value directly (without a key) sets the number of elements of the array. Assigning an array directly to an integer retrieves the number of elements of the array.</p> |
| 958 | 821,822c758 |
| 959 | < This is equivalent to using the C<elements> opcode to retrieve the number of |
| 960 | < items currently in an array: |
| 961 | --- |
| 962 | > <p>This is equivalent to using the <code>elements</code> opcode to retrieve the number of items currently in an array:</p> |
| 963 | 825,829c761 |
| 964 | < Some other useful instructions for working with ordered arrays are |
| 965 | < C<push>, C<pop>, C<shift>, and C<unshift>, to add or remove elements. |
| 966 | < C<push> and C<pop> work on the end of the array, the highest numbered |
| 967 | < index. C<shift> and C<unshift> work on the start of the array, adding or |
| 968 | < removing the zeroth element, and renumbering all the following elements. |
| 969 | --- |
| 970 | > <p>Some other useful instructions for working with ordered arrays are <code>push</code>, <code>pop</code>, <code>shift</code>, and <code>unshift</code>, to add or remove elements. <code>push</code> and <code>pop</code> work on the end of the array, the highest numbered index. <code>shift</code> and <code>unshift</code> work on the start of the array, adding or removing the zeroth element, and renumbering all the following elements.</p> |
| 971 | 839,847c771,777 |
| 972 | < X<associative arrays> |
| 973 | < X<hashes> |
| 974 | < X<dictionaries> |
| 975 | < An associative array is an unordered aggregate that uses string keys to |
| 976 | < identify elements. You may know them as "hash tables", "hashes", "maps", or |
| 977 | < "dictionaries". Parrot provides one core associative array PMC, called C<Hash>. |
| 978 | < String keys work very much like integer keys. An lvalue key sets the value of |
| 979 | < an element, and an rvalue key extracts the value of an element. The string in |
| 980 | < the key must always be in single or double quotes. |
| 981 | --- |
| 982 | > <p><!-- |
| 983 | > INDEX: associative arrays |
| 984 | > --> <!-- |
| 985 | > INDEX: hashes |
| 986 | > --> <!-- |
| 987 | > INDEX: dictionaries |
| 988 | > --> An associative array is an unordered aggregate that uses string keys to identify elements. You may know them as "hash tables", "hashes", "maps", or "dictionaries". Parrot provides one core associative array PMC, called <code>Hash</code>. String keys work very much like integer keys. An lvalue key sets the value of an element, and an rvalue key extracts the value of an element. The string in the key must always be in single or double quotes.</p> |
| 989 | 852,854c782,784 |
| 990 | < Assigning a C<Hash>X<Hash PMC> PMC (without a key) to an integer result |
| 991 | < fetches the number of elements in the hash.N<You may not set a C<Hash> |
| 992 | < PMC directly to an integer value.> |
| 993 | --- |
| 994 | > <p>Assigning a <code>Hash</code><!-- |
| 995 | > INDEX: Hash PMC |
| 996 | > --> PMC (without a key) to an integer result fetches the number of elements in the hash.You may not set a <code>Hash</code> PMC directly to an integer value.</p> |
| 997 | 857,860c787,789 |
| 998 | < The C<exists>X<exists opcode> opcode tests whether a keyed value exists in an |
| 999 | < aggregate. It returns 1 if it finds the key in the aggregate and 0 otherwise. |
| 1000 | < It doesn't care if the value itself is true or false, only that an entry exists |
| 1001 | < for that key: |
| 1002 | --- |
| 1003 | > <p>The <code>exists</code><!-- |
| 1004 | > INDEX: exists opcode |
| 1005 | > --> opcode tests whether a keyed value exists in an aggregate. It returns 1 if it finds the key in the aggregate and 0 otherwise. It doesn't care if the value itself is true or false, only that an entry exists for that key:</p> |
| 1006 | 866,867c795,797 |
| 1007 | < The C<delete>X<delete opcode> opcode removes an element from an associative |
| 1008 | < array: |
| 1009 | --- |
| 1010 | > <p>The <code>delete</code><!-- |
| 1011 | > INDEX: delete opcode |
| 1012 | > --> opcode removes an element from an associative array:</p> |
| 1013 | 873,878c803,807 |
| 1014 | < X<iterators> |
| 1015 | < X<PMCs (Polymorphic Containers); iterators> |
| 1016 | < An iterator extracts values from an aggregate PMC one at a time. Iterators are |
| 1017 | < most useful in loops which perform an action on every element in an aggregate. |
| 1018 | < The C<iter> opcode creates a new iterator from an aggregate PMC. It takes one |
| 1019 | < argument, the PMC over which to iterate: |
| 1020 | --- |
| 1021 | > <p><!-- |
| 1022 | > INDEX: iterators |
| 1023 | > --> <!-- |
| 1024 | > INDEX: PMCs (Polymorphic Containers); iterators |
| 1025 | > --> An iterator extracts values from an aggregate PMC one at a time. Iterators are most useful in loops which perform an action on every element in an aggregate. The <code>iter</code> opcode creates a new iterator from an aggregate PMC. It takes one argument, the PMC over which to iterate:</p> |
| 1026 | 881c810,812 |
| 1027 | < The C<shift>X<shift opcode> opcode extracts the next value from the iterator. |
| 1028 | --- |
| 1029 | > <p>The <code>shift</code><!-- |
| 1030 | > INDEX: shift opcode |
| 1031 | > --> opcode extracts the next value from the iterator.</p> |
| 1032 | 884,885c815 |
| 1033 | < Evaluating the iterator PMC as a boolean returns whether the iterator has |
| 1034 | < reached the end of the aggregate: |
| 1035 | --- |
| 1036 | > <p>Evaluating the iterator PMC as a boolean returns whether the iterator has reached the end of the aggregate:</p> |
| 1037 | 888,896c818,822 |
| 1038 | < Parrot provides predefined constants for working with iterators. |
| 1039 | < C<.ITERATE_FROM_START> and C<.ITERATE_FROM_END> constants select whether an |
| 1040 | < ordered array iterator starts from the beginning or end of the array. These |
| 1041 | < two constants have no effect on associative array iterators, as their elements |
| 1042 | < are unordered. |
| 1043 | < |
| 1044 | < Load the iterator constants with the C<.include>X<.include directive> |
| 1045 | < directive to include the file F<iterator.pasm>. To use them, set the |
| 1046 | < iterator PMC to the value of the constant: |
| 1047 | --- |
| 1048 | > <p>Parrot provides predefined constants for working with iterators. <code>.ITERATE_FROM_START</code> and <code>.ITERATE_FROM_END</code> constants select whether an ordered array iterator starts from the beginning or end of the array. These two constants have no effect on associative array iterators, as their elements are unordered.</p> |
1114 | | > Load the iterator constants with the C<.include>X<.include directive> |
1115 | | > directive to include the file F<iterator.pasm>. To use them, set the |
1116 | | > iterator PMC to the value of the constant: |
1117 | | 829c903,906 |
1118 | | < <p>With all of those separate pieces in one place, this example loads the iterator constants, creates an ordered array of "a", "b", "c", creates an iterator from that array, and then loops over the iterator using a conditional <code>goto</code> to checks the boolean value of the iterator and another unconditional <code>goto</code>:</p> |
1119 | | --- |
1120 | | > With all of those separate pieces in one place, this example loads the iterator |
1121 | | > constants, creates an ordered array of "a", "b", "c", creates an iterator from |
1122 | | > that array, and then loops over the iterator using a conditional C<goto> to |
1123 | | > checks the boolean value of the iterator and another unconditional C<goto>: |
1124 | | 846c923,925 |
1125 | | < <p>Associative array iterators work similarly to ordered array iterators. When iterating over associative arrays, the <code>shift</code> opcode extracts keys instead of values. The key looks up the value in the original hash PMC.</p> |
1126 | | --- |
1127 | | > Associative array iterators work similarly to ordered array iterators. When |
1128 | | > iterating over associative arrays, the C<shift> opcode extracts keys instead of |
1129 | | > values. The key looks up the value in the original hash PMC. |
1130 | | 862c941,951 |
1131 | | < <p>This example creates an associative array <code>$P2</code> that contains three keys "a", "b", and "c", assigning them the values 10, 20, and 30. It creates an iterator (<code>$P1</code>) from the associative array using the <code>iter</code> opcode, and then starts a loop over the iterator. At the start of each loop, the <code>unless</code> instruction checks whether the iterator has any more elements. If there are no more elements, <code>goto</code> jumps to the end of the loop, marked by the label <code>iter_end</code>. If there are more elements, the <code>shift</code> opcode extracts the next key. Keyed assignment stores the integer value of the element indexed by the key in <code>$I9</code>. After printing the integer value, <code>goto</code> jumps back to the start of the loop, marked by <code>iter_loop</code>.</p> |
1132 | | --- |
1133 | | > This example creates an associative array C<$P2> that contains three |
1134 | | > keys "a", "b", and "c", assigning them the values 10, 20, and 30. It |
1135 | | > creates an iterator (C<$P1>) from the associative array using the |
1136 | | > C<iter> opcode, and then starts a loop over the iterator. At the start |
1137 | | > of each loop, the C<unless> instruction checks whether the iterator has |
1138 | | > any more elements. If there are no more elements, C<goto> jumps to the |
1139 | | > end of the loop, marked by the label C<iter_end>. If there are more |
1140 | | > elements, the C<shift> opcode extracts the next key. Keyed assignment |
1141 | | > stores the integer value of the element indexed by the key in C<$I9>. |
1142 | | > After printing the integer value, C<goto> jumps back to the start of the |
1143 | | > loop, marked by C<iter_loop>. |
1144 | | 867,871c956,962 |
1145 | | < <p><!-- |
1146 | | < INDEX: keys |
1147 | | < --> <!-- |
1148 | | < INDEX: multi-level keys |
1149 | | < --> Aggregates can hold any data type, including other aggregates. Accessing elements deep within nested data structures is a common operation, so PIR provides a way to do it in a single instruction. Complex keys specify a series of nested data structures, with each individual key separated by a semicolon.</p> |
1150 | | --- |
1151 | | > X<keys> |
1152 | | > X<multi-level keys> |
1153 | | > Aggregates can hold any data type, including other aggregates. |
1154 | | > Accessing elements deep within nested data structures is a common |
1155 | | > operation, so PIR provides a way to do it in a single instruction. |
1156 | | > Complex keys specify a series of nested data structures, with each |
1157 | | > individual key separated by a semicolon. |
1158 | | 881c972,975 |
1159 | | < <p>This example builds up a data structure of an associative array containing an ordered array. The complex key <code>["answer"; $I1]</code> retrieves an element of the array within the hash. You can also set a value using a complex key:</p> |
1160 | | --- |
1161 | | > This example builds up a data structure of an associative array |
1162 | | > containing an ordered array. The complex key C<["answer"; $I1]> |
1163 | | > retrieves an element of the array within the hash. You can also set a |
1164 | | > value using a complex key: |
1165 | | 884c978,979 |
1166 | | < <p>The individual keys are integer or string literals, or variables with integer or string values.</p> |
1167 | | --- |
1168 | | > The individual keys are integer or string literals, or variables with |
1169 | | > integer or string values. |
1170 | | 889,891c984,989 |
1171 | | < <p><!-- |
1172 | | < INDEX: PMCs (Polymorphic Containers); copying vs. cloning |
1173 | | < --> PMC registers don't directly store the data for a PMC, they only store a pointer to the structure that stores the data. As a result, the <code>=</code> operator doesn't copy the entire PMC, it only copies the pointer to the PMC data. If you later modify the copy of the variable, it will also modify the original.</p> |
1174 | | --- |
1175 | | > X<PMCs (Polymorphic Containers); copying vs. cloning> |
1176 | | > PMC registers don't directly store the data for a PMC, they only store a |
1177 | | > pointer to the structure that stores the data. As a result, the C<=> |
1178 | | > operator doesn't copy the entire PMC, it only copies the pointer to the |
1179 | | > PMC data. If you later modify the copy of the variable, it will also |
1180 | | > modify the original. |
1181 | | 899c997,1000 |
1182 | | < <p>In this example, <code>$P0</code> and <code>$P1</code> are both pointers to the same internal data structure. Setting <code>$P1</code> to the string literal "Zaphod", it overwrites the previous value "Ford". Both <code>$P0</code> and <code>$P1</code> refer to the <code>String</code> PMC "Zaphod".</p> |
1183 | | --- |
1184 | | > In this example, C<$P0> and C<$P1> are both pointers to the same |
1185 | | > internal data structure. Setting C<$P1> to the string literal |
1186 | | > "Zaphod", it overwrites the previous value "Ford". Both C<$P0> and |
1187 | | > C<$P1> refer to the C<String> PMC "Zaphod". |
1188 | | 901,905c1002,1003 |
1189 | | < <p>The <code>clone</code> <!-- |
1190 | | < INDEX: clone opcode |
1191 | | < --> opcode makes a deep copy of a PMC, instead of copying the pointer like <code>=</code><!-- |
1192 | | < INDEX: = operator |
1193 | | < --> does.</p> |
1194 | | --- |
1195 | | > The C<clone> X<clone opcode> opcode makes a deep copy of a PMC, instead |
1196 | | > of copying the pointer like C<=>X<= operator> does. |
1197 | | 913,919c1011,1018 |
1198 | | < <p>This example creates an identical, independent clone of the PMC in <code>$P0</code> and puts it in <code>$P1</code>. Later changes to <code>$P0</code> have no effect on the PMC in <code>$P1</code>.With low-level strings, the copies created by <code>clone</code> are copy-on-write<!-- |
1199 | | < INDEX: copy-on-write |
1200 | | < --> exactly the same as the copy created by <code>=</code>.</p> |
1201 | | < |
1202 | | < <p>To assign the <i>value</i> of one PMC to another PMC that already exists, use the <code>assign</code><!-- |
1203 | | < INDEX: assign opcode |
1204 | | < --> opcode:</p> |
1205 | | --- |
1206 | | > This example creates an identical, independent clone of the PMC in |
1207 | | > C<$P0> and puts it in C<$P1>. Later changes to C<$P0> have no effect on |
1208 | | > the PMC in C<$P1>.N<With low-level strings, the copies created by |
1209 | | > C<clone> are copy-on-writeX<copy-on-write> exactly the same as the copy |
1210 | | > created by C<=>.> |
| 1050 | > <p>Load the iterator constants with the <code>.include</code><!-- |
| 1051 | > INDEX: .include directive |
| 1052 | > --> directive to include the file <em>iterator.pasm</em>. To use them, set the iterator PMC to the value of the constant:</p> |
| 1053 | 903,906c829 |
| 1054 | < With all of those separate pieces in one place, this example loads the iterator |
| 1055 | < constants, creates an ordered array of "a", "b", "c", creates an iterator from |
| 1056 | < that array, and then loops over the iterator using a conditional C<goto> to |
| 1057 | < checks the boolean value of the iterator and another unconditional C<goto>: |
| 1058 | --- |
| 1059 | > <p>With all of those separate pieces in one place, this example loads the iterator constants, creates an ordered array of "a", "b", "c", creates an iterator from that array, and then loops over the iterator using a conditional <code>goto</code> to checks the boolean value of the iterator and another unconditional <code>goto</code>:</p> |
| 1060 | 923,925c846 |
| 1061 | < Associative array iterators work similarly to ordered array iterators. When |
| 1062 | < iterating over associative arrays, the C<shift> opcode extracts keys instead of |
| 1063 | < values. The key looks up the value in the original hash PMC. |
| 1064 | --- |
| 1065 | > <p>Associative array iterators work similarly to ordered array iterators. When iterating over associative arrays, the <code>shift</code> opcode extracts keys instead of values. The key looks up the value in the original hash PMC.</p> |
| 1066 | 941,951c862 |
| 1067 | < This example creates an associative array C<$P2> that contains three |
| 1068 | < keys "a", "b", and "c", assigning them the values 10, 20, and 30. It |
| 1069 | < creates an iterator (C<$P1>) from the associative array using the |
| 1070 | < C<iter> opcode, and then starts a loop over the iterator. At the start |
| 1071 | < of each loop, the C<unless> instruction checks whether the iterator has |
| 1072 | < any more elements. If there are no more elements, C<goto> jumps to the |
| 1073 | < end of the loop, marked by the label C<iter_end>. If there are more |
| 1074 | < elements, the C<shift> opcode extracts the next key. Keyed assignment |
| 1075 | < stores the integer value of the element indexed by the key in C<$I9>. |
| 1076 | < After printing the integer value, C<goto> jumps back to the start of the |
| 1077 | < loop, marked by C<iter_loop>. |
| 1078 | --- |
| 1079 | > <p>This example creates an associative array <code>$P2</code> that contains three keys "a", "b", and "c", assigning them the values 10, 20, and 30. It creates an iterator (<code>$P1</code>) from the associative array using the <code>iter</code> opcode, and then starts a loop over the iterator. At the start of each loop, the <code>unless</code> instruction checks whether the iterator has any more elements. If there are no more elements, <code>goto</code> jumps to the end of the loop, marked by the label <code>iter_end</code>. If there are more elements, the <code>shift</code> opcode extracts the next key. Keyed assignment stores the integer value of the element indexed by the key in <code>$I9</code>. After printing the integer value, <code>goto</code> jumps back to the start of the loop, marked by <code>iter_loop</code>.</p> |
| 1080 | 956,962c867,871 |
| 1081 | < X<keys> |
| 1082 | < X<multi-level keys> |
| 1083 | < Aggregates can hold any data type, including other aggregates. |
| 1084 | < Accessing elements deep within nested data structures is a common |
| 1085 | < operation, so PIR provides a way to do it in a single instruction. |
| 1086 | < Complex keys specify a series of nested data structures, with each |
| 1087 | < individual key separated by a semicolon. |
| 1088 | --- |
| 1089 | > <p><!-- |
| 1090 | > INDEX: keys |
| 1091 | > --> <!-- |
| 1092 | > INDEX: multi-level keys |
| 1093 | > --> Aggregates can hold any data type, including other aggregates. Accessing elements deep within nested data structures is a common operation, so PIR provides a way to do it in a single instruction. Complex keys specify a series of nested data structures, with each individual key separated by a semicolon.</p> |
| 1094 | 972,975c881 |
| 1095 | < This example builds up a data structure of an associative array |
| 1096 | < containing an ordered array. The complex key C<["answer"; $I1]> |
| 1097 | < retrieves an element of the array within the hash. You can also set a |
| 1098 | < value using a complex key: |
| 1099 | --- |
| 1100 | > <p>This example builds up a data structure of an associative array containing an ordered array. The complex key <code>["answer"; $I1]</code> retrieves an element of the array within the hash. You can also set a value using a complex key:</p> |
| 1101 | 978,979c884 |
| 1102 | < The individual keys are integer or string literals, or variables with |
| 1103 | < integer or string values. |
| 1104 | --- |
| 1105 | > <p>The individual keys are integer or string literals, or variables with integer or string values.</p> |
| 1106 | 984,989c889,891 |
| 1107 | < X<PMCs (Polymorphic Containers); copying vs. cloning> |
| 1108 | < PMC registers don't directly store the data for a PMC, they only store a |
| 1109 | < pointer to the structure that stores the data. As a result, the C<=> |
| 1110 | < operator doesn't copy the entire PMC, it only copies the pointer to the |
| 1111 | < PMC data. If you later modify the copy of the variable, it will also |
| 1112 | < modify the original. |
| 1113 | --- |
| 1114 | > <p><!-- |
| 1115 | > INDEX: PMCs (Polymorphic Containers); copying vs. cloning |
| 1116 | > --> PMC registers don't directly store the data for a PMC, they only store a pointer to the structure that stores the data. As a result, the <code>=</code> operator doesn't copy the entire PMC, it only copies the pointer to the PMC data. If you later modify the copy of the variable, it will also modify the original.</p> |
| 1117 | 997,1000c899 |
| 1118 | < In this example, C<$P0> and C<$P1> are both pointers to the same |
| 1119 | < internal data structure. Setting C<$P1> to the string literal |
| 1120 | < "Zaphod", it overwrites the previous value "Ford". Both C<$P0> and |
| 1121 | < C<$P1> refer to the C<String> PMC "Zaphod". |
| 1122 | --- |
| 1123 | > <p>In this example, <code>$P0</code> and <code>$P1</code> are both pointers to the same internal data structure. Setting <code>$P1</code> to the string literal "Zaphod", it overwrites the previous value "Ford". Both <code>$P0</code> and <code>$P1</code> refer to the <code>String</code> PMC "Zaphod".</p> |
| 1124 | 1002,1003c901,905 |
| 1125 | < The C<clone> X<clone opcode> opcode makes a deep copy of a PMC, instead |
| 1126 | < of copying the pointer like C<=>X<= operator> does. |
| 1127 | --- |
| 1128 | > <p>The <code>clone</code> <!-- |
| 1129 | > INDEX: clone opcode |
| 1130 | > --> opcode makes a deep copy of a PMC, instead of copying the pointer like <code>=</code><!-- |
| 1131 | > INDEX: = operator |
| 1132 | > --> does.</p> |
| 1133 | 1011,1018c913,919 |
| 1134 | < This example creates an identical, independent clone of the PMC in |
| 1135 | < C<$P0> and puts it in C<$P1>. Later changes to C<$P0> have no effect on |
| 1136 | < the PMC in C<$P1>.N<With low-level strings, the copies created by |
| 1137 | < C<clone> are copy-on-writeX<copy-on-write> exactly the same as the copy |
| 1138 | < created by C<=>.> |
| 1139 | < |
| 1140 | < To assign the I<value> of one PMC to another PMC that already exists, use the |
| 1141 | < C<assign>X<assign opcode> opcode: |
| 1142 | --- |
| 1143 | > <p>This example creates an identical, independent clone of the PMC in <code>$P0</code> and puts it in <code>$P1</code>. Later changes to <code>$P0</code> have no effect on the PMC in <code>$P1</code>.With low-level strings, the copies created by <code>clone</code> are copy-on-write<!-- |
| 1144 | > INDEX: copy-on-write |
| 1145 | > --> exactly the same as the copy created by <code>=</code>.</p> |
1212 | | > To assign the I<value> of one PMC to another PMC that already exists, use the |
1213 | | > C<assign>X<assign opcode> opcode: |
1214 | | 928c1027,1032 |
1215 | | < <p>This example creates two <code>Integer</code> PMCs, <code>$P1</code> and <code>$P2</code>, and gives the first one the value 42. It then uses <code>assign</code> to pass the same integer value on to <code>$P1</code>. Though <code>$P0</code> increments, <code>$P1</code> doesn't change. The result for <code>assign</code> must have an existing object of the right type in it, because <code>assign</code> neither creates a new duplicate object (as does <code>clone</code>) or reuses the source object (as does <code>=</code>).</p> |
1216 | | --- |
1217 | | > This example creates two C<Integer> PMCs, C<$P1> and C<$P2>, and gives the |
1218 | | > first one the value 42. It then uses C<assign> to pass the same integer value |
1219 | | > on to C<$P1>. Though C<$P0> increments, C<$P1> doesn't change. The result for |
1220 | | > C<assign> must have an existing object of the right type in it, because |
1221 | | > C<assign> neither creates a new duplicate object (as does C<clone>) or reuses |
1222 | | > the source object (as does C<=>). |
1223 | | 933,937c1037,1038 |
1224 | | < <p><!-- |
1225 | | < INDEX: properties |
1226 | | < --> <!-- |
1227 | | < INDEX: PMCs (Polymorphic Containers); properties |
1228 | | < --></p> |
1229 | | --- |
1230 | | > X<properties> |
1231 | | > X<PMCs (Polymorphic Containers); properties> |
1232 | | 939c1040,1041 |
1233 | | < <p>PMCs can have additional values attached to them as "properties" of the PMC. Most properties hold extra metadata about the PMC.</p> |
1234 | | --- |
1235 | | > PMCs can have additional values attached to them as "properties" of the |
1236 | | > PMC. Most properties hold extra metadata about the PMC. |
1237 | | 941,943c1043,1045 |
1238 | | < <p>The <code>setprop</code><!-- |
1239 | | < INDEX: setprop opcode |
1240 | | < --> opcode sets the value of a named property on a PMC. It takes three arguments: the PMC on which to set a property, the name of the property, and a PMC containing the value of the property.</p> |
1241 | | --- |
1242 | | > The C<setprop>X<setprop opcode> opcode sets the value of a named property on a |
1243 | | > PMC. It takes three arguments: the PMC on which to set a property, the name of |
1244 | | > the property, and a PMC containing the value of the property. |
1245 | | 946,948c1048,1050 |
1246 | | < <p>The <code>getprop</code><!-- |
1247 | | < INDEX: getprop opcode |
1248 | | < --> opcode returns the value of a property. It takes two arguments: the name of the property and the PMC from which to retrieve the property value.</p> |
1249 | | --- |
1250 | | > The C<getprop>X<getprop opcode> opcode returns the value of a property. It |
1251 | | > takes two arguments: the name of the property and the PMC from which to |
1252 | | > retrieve the property value. |
1253 | | 951c1053,1056 |
1254 | | < <p>This example creates a <code>String</code> object in <code>$P0</code> and an <code>Integer</code> object with the value 1 in <code>$P1</code>. <code>setprop</code> sets a property named "eric" on the object in <code>$P0</code> and gives the property the value of <code>$P1</code>. <code>getprop</code> retrieves the value of the property "eric" on <code>$P0</code> and stores it in <code>$P2</code>.</p> |
1255 | | --- |
1256 | | > This example creates a C<String> object in C<$P0> and an C<Integer> object with |
1257 | | > the value 1 in C<$P1>. C<setprop> sets a property named "eric" on the object in |
1258 | | > C<$P0> and gives the property the value of C<$P1>. C<getprop> retrieves the |
1259 | | > value of the property "eric" on C<$P0> and stores it in C<$P2>. |
1260 | | 962c1067,1068 |
1261 | | < <p>Parrot stores PMC properties in an associative array where the name of the property is the key.</p> |
1262 | | --- |
1263 | | > Parrot stores PMC properties in an associative array where the name of the |
1264 | | > property is the key. |
1265 | | 964,966c1070 |
1266 | | < <p><code>delprop</code><!-- |
1267 | | < INDEX: delprop opcode |
1268 | | < --> deletes a property from a PMC.</p> |
1269 | | --- |
1270 | | > C<delprop>X<delprop opcode> deletes a property from a PMC. |
1271 | | 969,971c1073,1074 |
1272 | | < <p>You can fetch a complete hash of all properties on a PMC with <code>prophash</code><!-- |
1273 | | < INDEX: prophash opcode |
1274 | | < -->:</p> |
1275 | | --- |
1276 | | > You can fetch a complete hash of all properties on a PMC with |
1277 | | > C<prophash>X<prophash opcode>: |
1278 | | 974c1077 |
1279 | | < <p>Fetching the value of a non-existent property returns an <code>Undef</code> PMC.</p> |
1280 | | --- |
1281 | | > Fetching the value of a non-existent property returns an C<Undef> PMC. |
1282 | | 979,991c1082,1104 |
1283 | | < <p><!-- |
1284 | | < INDEX: vtable functions |
1285 | | < --> You may have noticed that a simple operation sometimes has a different effect on different PMCs. Assigning a low-level integer value to a <code>Integer</code> PMC sets its integer value of the PMC, but assigning that same integer to an ordered array sets the size of the array.</p> |
1286 | | < |
1287 | | < <p>Every PMC defines a standard set of low-level operations called vtable functions. When you perform an assignment like:</p> |
1288 | | < |
1289 | | < <pre> $P0 = 5</pre> |
1290 | | < |
1291 | | < <p>... Parrot calls the <code>set_integer_native</code> vtable function on the PMC referred to by register <code>$P0</code>.</p> |
1292 | | < |
1293 | | < <p><!-- |
1294 | | < INDEX: polymorphic substitution |
1295 | | < --> Parrot has a fixed set of vtable functions, so that any PMC can stand in for any other PMC; they're polymorphic.Hence the name "Polymorphic Container". Every PMC defines some behavior for every vtable function. The default behavior is to throw an exception reporting that the PMC doesn't implement that vtable function. The full set of vtable functions for a PMC defines the PMC's basic interface, but PMCs may also define methods to extend their behavior beyond the vtable set.</p> |
1296 | | --- |
1297 | | > X<vtable functions> |
1298 | | > You may have noticed that a simple operation sometimes has a different effect |
1299 | | > on different PMCs. Assigning a low-level integer value to a C<Integer> PMC sets |
1300 | | > its integer value of the PMC, but assigning that same integer to an ordered |
1301 | | > array sets the size of the array. |
| 1147 | > <p>To assign the <i>value</i> of one PMC to another PMC that already exists, use the <code>assign</code><!-- |
| 1148 | > INDEX: assign opcode |
| 1149 | > --> opcode:</p> |
| 1150 | 1027,1032c928 |
| 1151 | < This example creates two C<Integer> PMCs, C<$P1> and C<$P2>, and gives the |
| 1152 | < first one the value 42. It then uses C<assign> to pass the same integer value |
| 1153 | < on to C<$P1>. Though C<$P0> increments, C<$P1> doesn't change. The result for |
| 1154 | < C<assign> must have an existing object of the right type in it, because |
| 1155 | < C<assign> neither creates a new duplicate object (as does C<clone>) or reuses |
| 1156 | < the source object (as does C<=>). |
| 1157 | --- |
| 1158 | > <p>This example creates two <code>Integer</code> PMCs, <code>$P1</code> and <code>$P2</code>, and gives the first one the value 42. It then uses <code>assign</code> to pass the same integer value on to <code>$P1</code>. Though <code>$P0</code> increments, <code>$P1</code> doesn't change. The result for <code>assign</code> must have an existing object of the right type in it, because <code>assign</code> neither creates a new duplicate object (as does <code>clone</code>) or reuses the source object (as does <code>=</code>).</p> |
| 1159 | 1037,1038c933,937 |
| 1160 | < X<properties> |
| 1161 | < X<PMCs (Polymorphic Containers); properties> |
| 1162 | --- |
| 1163 | > <p><!-- |
| 1164 | > INDEX: properties |
| 1165 | > --> <!-- |
| 1166 | > INDEX: PMCs (Polymorphic Containers); properties |
| 1167 | > --></p> |
| 1168 | 1040,1041c939 |
| 1169 | < PMCs can have additional values attached to them as "properties" of the |
| 1170 | < PMC. Most properties hold extra metadata about the PMC. |
| 1171 | --- |
| 1172 | > <p>PMCs can have additional values attached to them as "properties" of the PMC. Most properties hold extra metadata about the PMC.</p> |
| 1173 | 1043,1045c941,943 |
| 1174 | < The C<setprop>X<setprop opcode> opcode sets the value of a named property on a |
| 1175 | < PMC. It takes three arguments: the PMC on which to set a property, the name of |
| 1176 | < the property, and a PMC containing the value of the property. |
| 1177 | --- |
| 1178 | > <p>The <code>setprop</code><!-- |
| 1179 | > INDEX: setprop opcode |
| 1180 | > --> opcode sets the value of a named property on a PMC. It takes three arguments: the PMC on which to set a property, the name of the property, and a PMC containing the value of the property.</p> |
| 1181 | 1048,1050c946,948 |
| 1182 | < The C<getprop>X<getprop opcode> opcode returns the value of a property. It |
| 1183 | < takes two arguments: the name of the property and the PMC from which to |
| 1184 | < retrieve the property value. |
| 1185 | --- |
| 1186 | > <p>The <code>getprop</code><!-- |
| 1187 | > INDEX: getprop opcode |
| 1188 | > --> opcode returns the value of a property. It takes two arguments: the name of the property and the PMC from which to retrieve the property value.</p> |
| 1189 | 1053,1056c951 |
| 1190 | < This example creates a C<String> object in C<$P0> and an C<Integer> object with |
| 1191 | < the value 1 in C<$P1>. C<setprop> sets a property named "eric" on the object in |
| 1192 | < C<$P0> and gives the property the value of C<$P1>. C<getprop> retrieves the |
| 1193 | < value of the property "eric" on C<$P0> and stores it in C<$P2>. |
| 1194 | --- |
| 1195 | > <p>This example creates a <code>String</code> object in <code>$P0</code> and an <code>Integer</code> object with the value 1 in <code>$P1</code>. <code>setprop</code> sets a property named "eric" on the object in <code>$P0</code> and gives the property the value of <code>$P1</code>. <code>getprop</code> retrieves the value of the property "eric" on <code>$P0</code> and stores it in <code>$P2</code>.</p> |
| 1196 | 1067,1068c962 |
| 1197 | < Parrot stores PMC properties in an associative array where the name of the |
| 1198 | < property is the key. |
| 1199 | --- |
| 1200 | > <p>Parrot stores PMC properties in an associative array where the name of the property is the key.</p> |
| 1201 | 1070c964,966 |
| 1202 | < C<delprop>X<delprop opcode> deletes a property from a PMC. |
| 1203 | --- |
| 1204 | > <p><code>delprop</code><!-- |
| 1205 | > INDEX: delprop opcode |
| 1206 | > --> deletes a property from a PMC.</p> |
| 1207 | 1073,1074c969,971 |
| 1208 | < You can fetch a complete hash of all properties on a PMC with |
| 1209 | < C<prophash>X<prophash opcode>: |
| 1210 | --- |
| 1211 | > <p>You can fetch a complete hash of all properties on a PMC with <code>prophash</code><!-- |
| 1212 | > INDEX: prophash opcode |
| 1213 | > -->:</p> |
| 1214 | 1077c974 |
| 1215 | < Fetching the value of a non-existent property returns an C<Undef> PMC. |
| 1216 | --- |
| 1217 | > <p>Fetching the value of a non-existent property returns an <code>Undef</code> PMC.</p> |
| 1218 | 1082,1104c979,991 |
| 1219 | < X<vtable functions> |
| 1220 | < You may have noticed that a simple operation sometimes has a different effect |
| 1221 | < on different PMCs. Assigning a low-level integer value to a C<Integer> PMC sets |
| 1222 | < its integer value of the PMC, but assigning that same integer to an ordered |
| 1223 | < array sets the size of the array. |
| 1224 | < |
| 1225 | < Every PMC defines a standard set of low-level operations called vtable |
| 1226 | < functions. When you perform an assignment like: |
| 1227 | < |
| 1228 | < $P0 = 5 |
| 1229 | < |
| 1230 | < |
| 1231 | < ... Parrot calls the C<set_integer_native> vtable function on the PMC referred |
| 1232 | < to by register C<$P0>. |
| 1233 | < |
| 1234 | < X<polymorphic substitution> |
| 1235 | < Parrot has a fixed set of vtable functions, so that any PMC can stand in for |
| 1236 | < any other PMC; they're polymorphic.N<Hence the name "Polymorphic Container".> |
| 1237 | < Every PMC defines some behavior for every vtable function. The default behavior |
| 1238 | < is to throw an exception reporting that the PMC doesn't implement that vtable |
| 1239 | < function. The full set of vtable functions for a PMC defines the PMC's basic |
| 1240 | < interface, but PMCs may also define methods to extend their behavior beyond the |
| 1241 | < vtable set. |
| 1242 | --- |
| 1243 | > <p><!-- |
| 1244 | > INDEX: vtable functions |
| 1245 | > --> You may have noticed that a simple operation sometimes has a different effect on different PMCs. Assigning a low-level integer value to a <code>Integer</code> PMC sets its integer value of the PMC, but assigning that same integer to an ordered array sets the size of the array.</p> |
1362 | | > The name of every variable stored in a particular namespace must be |
1363 | | > unique. You can't have store both an C<Integer> PMC and an array PMC |
1364 | | > both named "bee", stored in the same namespace.N<You may wonder why |
1365 | | > anyone would want to do this. We wonder the same thing, but Perl 5 does |
1366 | | > it all the time. The Perl 6 implementation on Parrot includes type |
1367 | | > sigils in the names of the variables it stores in namespaces so each |
1368 | | > name is unique, e.g. C<$bee>, C<@bee>....> |
1369 | | 1023,1029c1149,1150 |
1370 | | < <p><!-- |
1371 | | < INDEX: hierarchical namespaces |
1372 | | < --> <!-- |
1373 | | < INDEX: namespaces; hierarchy |
1374 | | < --></p> |
1375 | | < |
1376 | | < <p>A single global namespace would be far too limiting for most languages or applications. The risk of accidental collisions -- where two libraries try to use the same name for some variable -- would be quite high for larger code bases. Parrot maintains a collection of namespaces arranged as a tree, with the <code>parrot</code> namespace as the root. Every namespace you declare is a child of the <code>parrot</code> namespace (or a child of a child....).</p> |
1377 | | --- |
1378 | | > X<hierarchical namespaces> |
1379 | | > X<namespaces; hierarchy> |
1380 | | 1031c1152,1162 |
1381 | | < <p>The <code>set_global</code> and <code>get_global</code> opcodes both have alternate forms that take a key name to access a variable in a particular namespace within the tree. This code example stores a variable as <code>bill</code> in the Duck namespace and retrieves it again:</p> |
1382 | | --- |
1383 | | > A single global namespace would be far too limiting for most languages or |
1384 | | > applications. The risk of accidental collisions -- where two libraries try to |
1385 | | > use the same name for some variable -- would be quite high for larger code |
1386 | | > bases. Parrot maintains a collection of namespaces arranged as a tree, with the |
1387 | | > C<parrot> namespace as the root. Every namespace you declare is a child of the |
1388 | | > C<parrot> namespace (or a child of a child....). |
| 1315 | > <p>A single global namespace would be far too limiting for most languages or applications. The risk of accidental collisions -- where two libraries try to use the same name for some variable -- would be quite high for larger code bases. Parrot maintains a collection of namespaces arranged as a tree, with the <code>parrot</code> namespace as the root. Every namespace you declare is a child of the <code>parrot</code> namespace (or a child of a child....).</p> |
| 1316 | 1152,1162c1031 |
| 1317 | < A single global namespace would be far too limiting for most languages or |
| 1318 | < applications. The risk of accidental collisions -- where two libraries try to |
| 1319 | < use the same name for some variable -- would be quite high for larger code |
| 1320 | < bases. Parrot maintains a collection of namespaces arranged as a tree, with the |
| 1321 | < C<parrot> namespace as the root. Every namespace you declare is a child of the |
| 1322 | < C<parrot> namespace (or a child of a child....). |
| 1323 | < |
| 1324 | < The C<set_global> and C<get_global> opcodes both have alternate forms that take |
| 1325 | < a key name to access a variable in a particular namespace within the tree. This |
| 1326 | < code example stores a variable as C<bill> in the Duck namespace and retrieves |
| 1327 | < it again: |
| 1328 | --- |
| 1329 | > <p>The <code>set_global</code> and <code>get_global</code> opcodes both have alternate forms that take a key name to access a variable in a particular namespace within the tree. This code example stores a variable as <code>bill</code> in the Duck namespace and retrieves it again:</p> |
| 1330 | 1166,1168c1035 |
| 1331 | < The key name for the namespace can have multiple levels, which correspond to |
| 1332 | < levels in the namespace hierarchy. This example stores a variable as C<bill> in |
| 1333 | < the Electric namespace under the General namespace in the hierarchy. |
| 1334 | --- |
| 1335 | > <p>The key name for the namespace can have multiple levels, which correspond to levels in the namespace hierarchy. This example stores a variable as <code>bill</code> in the Electric namespace under the General namespace in the hierarchy.</p> |
| 1336 | 1172,1173c1039,1043 |
| 1337 | < X<root namespace> |
| 1338 | < X<namespaces; root> |
| 1339 | --- |
| 1340 | > <p><!-- |
| 1341 | > INDEX: root namespace |
| 1342 | > --> <!-- |
| 1343 | > INDEX: namespaces; root |
| 1344 | > --></p> |
| 1345 | 1175,1181c1045,1047 |
| 1346 | < The C<set_global> and C<get_global> opcode operate on the currently selected |
| 1347 | < namespace. The default top-level namespace is the "root" namespace. The |
| 1348 | < C<.namespace>X<.namespace directive> directive allows you to declare any |
| 1349 | < namespace for subsequent code. If you select the General Electric |
| 1350 | < namespace, then store or retrieve the C<bill> variable without |
| 1351 | < specifying a namespace, you will work with the General Electric bill, |
| 1352 | < not the Duck bill. |
| 1353 | --- |
| 1354 | > <p>The <code>set_global</code> and <code>get_global</code> opcode operate on the currently selected namespace. The default top-level namespace is the "root" namespace. The <code>.namespace</code><!-- |
| 1355 | > INDEX: .namespace directive |
| 1356 | > --> directive allows you to declare any namespace for subsequent code. If you select the General Electric namespace, then store or retrieve the <code>bill</code> variable without specifying a namespace, you will work with the General Electric bill, not the Duck bill.</p> |
| 1357 | 1183c1049 |
| 1358 | < .namespace ["General";"Electric"] |
| 1359 | --- |
| 1360 | > <pre> .namespace ["General";"Electric"] |
| 1361 | 1185,1186c1051,1052 |
| 1362 | < set_global "bill", $P0 |
| 1363 | < $P1 = get_global "bill" |
| 1364 | --- |
| 1365 | > set_global "bill", $P0 |
| 1366 | > $P1 = get_global "bill"</pre> |
| 1367 | 1187a1054 |
| 1368 | > <p>Passing an empty key to the <code>.namespace</code> directive resets the selected namespace to the root namespace. The brackets are required even when the key is empty.</p> |
| 1369 | 1189,1191c1056 |
| 1370 | < Passing an empty key to the C<.namespace> directive resets the selected |
| 1371 | < namespace to the root namespace. The brackets are required even when the |
| 1372 | < key is empty. |
| 1373 | --- |
| 1374 | > <pre> .namespace [ ]</pre> |
| 1375 | 1193,1202c1058,1062 |
| 1376 | < .namespace [ ] |
| 1377 | < |
| 1378 | < |
| 1379 | < When you need to be absolutely sure you're working with the root namespace |
| 1380 | < regardless of what namespace is currently active, use the |
| 1381 | < C<set_root_global>X<set_root_global opcode> and |
| 1382 | < C<get_root_global>X<get_root_global opcode> opcodes instead of |
| 1383 | < C<set_global> and C<get_global>. This example sets and retrieves the |
| 1384 | < variable C<bill> in the Dollar namespace, which is directly under the |
| 1385 | < root namespace: |
| 1386 | --- |
| 1387 | > <p>When you need to be absolutely sure you're working with the root namespace regardless of what namespace is currently active, use the <code>set_root_global</code><!-- |
| 1388 | > INDEX: set_root_global opcode |
| 1389 | > --> and <code>get_root_global</code><!-- |
| 1390 | > INDEX: get_root_global opcode |
| 1391 | > --> opcodes instead of <code>set_global</code> and <code>get_global</code>. This example sets and retrieves the variable <code>bill</code> in the Dollar namespace, which is directly under the root namespace:</p> |
| 1392 | 1206,1222c1066,1080 |
| 1393 | < X<HLL namespaces> |
| 1394 | < X<namespaces; hll> |
| 1395 | < To prevent further collisions, each high-level language running on |
| 1396 | < Parrot operates within its own virtual namespace root. The default |
| 1397 | < virtual root is C<parrot>, and the C<.HLL>X<.HLL directive> directive |
| 1398 | < (for I<H>igh-I<L>evel I<L>anguage) selects an alternate virtual root for |
| 1399 | < a particular high-level language: |
| 1400 | < |
| 1401 | < .HLL 'ruby' |
| 1402 | < |
| 1403 | < |
| 1404 | < The C<set_hll_global>X<set_hll_global opcode> and |
| 1405 | < C<get_hll_global>X<get_hll_global opcode> opcodes are like |
| 1406 | < C<set_root_global> and C<get_root_global>, except they always operate on |
| 1407 | < the virtual root for the currently selected HLL. This example stores and |
| 1408 | < retrieves a C<bill> variable in the Euro namespace, under the Dutch HLL |
| 1409 | < namespace root: |
| 1410 | --- |
| 1411 | > <p><!-- |
| 1412 | > INDEX: HLL namespaces |
| 1413 | > --> <!-- |
| 1414 | > INDEX: namespaces; hll |
| 1415 | > --> To prevent further collisions, each high-level language running on Parrot operates within its own virtual namespace root. The default virtual root is <code>parrot</code>, and the <code>.HLL</code><!-- |
| 1416 | > INDEX: .HLL directive |
| 1417 | > --> directive (for <i>H</i>igh-<i>L</i>evel <i>L</i>anguage) selects an alternate virtual root for a particular high-level language:</p> |
1448 | | > |
1449 | | > When you need to be absolutely sure you're working with the root namespace |
1450 | | > regardless of what namespace is currently active, use the |
1451 | | > C<set_root_global>X<set_root_global opcode> and |
1452 | | > C<get_root_global>X<get_root_global opcode> opcodes instead of |
1453 | | > C<set_global> and C<get_global>. This example sets and retrieves the |
1454 | | > variable C<bill> in the Dollar namespace, which is directly under the |
1455 | | > root namespace: |
1456 | | 1066,1080c1206,1222 |
1457 | | < <p><!-- |
1458 | | < INDEX: HLL namespaces |
1459 | | < --> <!-- |
1460 | | < INDEX: namespaces; hll |
1461 | | < --> To prevent further collisions, each high-level language running on Parrot operates within its own virtual namespace root. The default virtual root is <code>parrot</code>, and the <code>.HLL</code><!-- |
1462 | | < INDEX: .HLL directive |
1463 | | < --> directive (for <i>H</i>igh-<i>L</i>evel <i>L</i>anguage) selects an alternate virtual root for a particular high-level language:</p> |
1464 | | < |
1465 | | < <pre> .HLL 'ruby'</pre> |
1466 | | < |
1467 | | < <p>The <code>set_hll_global</code><!-- |
1468 | | < INDEX: set_hll_global opcode |
1469 | | < --> and <code>get_hll_global</code><!-- |
1470 | | < INDEX: get_hll_global opcode |
1471 | | < --> opcodes are like <code>set_root_global</code> and <code>get_root_global</code>, except they always operate on the virtual root for the currently selected HLL. This example stores and retrieves a <code>bill</code> variable in the Euro namespace, under the Dutch HLL namespace root:</p> |
1472 | | --- |
1473 | | > X<HLL namespaces> |
1474 | | > X<namespaces; hll> |
1475 | | > To prevent further collisions, each high-level language running on |
1476 | | > Parrot operates within its own virtual namespace root. The default |
1477 | | > virtual root is C<parrot>, and the C<.HLL>X<.HLL directive> directive |
1478 | | > (for I<H>igh-I<L>evel I<L>anguage) selects an alternate virtual root for |
1479 | | > a particular high-level language: |
1480 | | > |
1481 | | > .HLL 'ruby' |
1482 | | > |
1483 | | > |
1484 | | > The C<set_hll_global>X<set_hll_global opcode> and |
1485 | | > C<get_hll_global>X<get_hll_global opcode> opcodes are like |
1486 | | > C<set_root_global> and C<get_root_global>, except they always operate on |
1487 | | > the virtual root for the currently selected HLL. This example stores and |
1488 | | > retrieves a C<bill> variable in the Euro namespace, under the Dutch HLL |
1489 | | > namespace root: |
1490 | | 1082c1224 |
1491 | | < <pre> .HLL 'Dutch' |
1492 | | --- |
1493 | | > .HLL 'Dutch' |
1494 | | 1084,1085c1226,1228 |
1495 | | < set_hll_global ["Euro"], "bill", $P0 |
1496 | | < $P1 = get_hll_global ["Euro"], "bill"</pre> |
1497 | | --- |
1498 | | > set_hll_global ["Euro"], "bill", $P0 |
1499 | | > $P1 = get_hll_global ["Euro"], "bill" |
1500 | | > |
1501 | | 1090,1094c1233,1238 |
1502 | | < <p><!-- |
1503 | | < INDEX: NameSpace PMC |
1504 | | < --> Namespaces are just PMCs. They implement the standard vtable functions and a few extra methods. The <code>get_namespace</code><!-- |
1505 | | < INDEX: get_namespace opcode |
1506 | | < --> opcode retrieves the currently selected namespace as a PMC object:</p> |
1507 | | --- |
1508 | | > X<NameSpace PMC> |
1509 | | > Namespaces are just PMCs. They implement the standard vtable functions |
1510 | | > and a few extra methods. The C<get_namespace>X<get_namespace opcode> |
1511 | | > opcode retrieves the currently selected namespace as a PMC object: |
1512 | | > |
1513 | | > $P0 = get_namespace |
1514 | | 1096d1239 |
1515 | | < <pre> $P0 = get_namespace</pre> |
1516 | | 1098,1102c1241,1244 |
1517 | | < <p>The <code>get_root_namespace</code><!-- |
1518 | | < INDEX: get_root_namespace opcode |
1519 | | < --> opcode retrieves the namespace object for the root namespace. The <code>get_hll_namespace</code><!-- |
1520 | | < INDEX: get_hll_namespace opcode |
1521 | | < --> opcode retrieves the virtual root for the currently selected HLL.</p> |
1522 | | --- |
1523 | | > The C<get_root_namespace>X<get_root_namespace opcode> opcode retrieves |
1524 | | > the namespace object for the root namespace. The |
1525 | | > C<get_hll_namespace>X<get_hll_namespace opcode> opcode retrieves the |
1526 | | > virtual root for the currently selected HLL. |
1527 | | 1104,1105c1246,1247 |
1528 | | < <pre> $P0 = get_root_namespace |
1529 | | < $P0 = get_hll_namespace</pre> |
1530 | | --- |
1531 | | > $P0 = get_root_namespace |
1532 | | > $P0 = get_hll_namespace |
1533 | | 1107d1248 |
1534 | | < <p>Each of these three opcodes can take a key argument to retrieve a namespace under the currenly selected namespace, root namespace, or HLL root namespace:</p> |
1535 | | 1109,1111c1250,1251 |
1536 | | < <pre> $P0 = get_namespace ["Duck"] |
1537 | | < $P0 = get_root_namespace ["General";"Electric"] |
1538 | | < $P0 = get_hll_namespace ["Euro"]</pre> |
1539 | | --- |
1540 | | > Each of these three opcodes can take a key argument to retrieve a namespace |
1541 | | > under the currenly selected namespace, root namespace, or HLL root namespace: |
1542 | | 1113c1253,1255 |
1543 | | < <p>Once you have a namespace object you can use it to retrieve variables from the namespace instead of using a keyed lookup. This example first looks up the Euro namespace in the currently selected HLL, then retrieves the <code>bill</code> variable from that namespace:</p> |
1544 | | --- |
1545 | | > $P0 = get_namespace ["Duck"] |
1546 | | > $P0 = get_root_namespace ["General";"Electric"] |
1547 | | > $P0 = get_hll_namespace ["Euro"] |
1548 | | 1115,1116d1256 |
1549 | | < <pre> $P0 = get_hll_namespace ["Euro"] |
1550 | | < $P1 = get_global $P0, "bill"</pre> |
1551 | | 1118,1120c1258,1261 |
1552 | | < <p>Namespaces also provide a set of methods to provide more complex behavior than the standard vtable functions allow. The <code>get_name</code><!-- |
1553 | | < INDEX: get_name method |
1554 | | < --> method returns the name of the namespace as a <code>ResizableStringArray</code>:</p> |
1555 | | --- |
1556 | | > Once you have a namespace object you can use it to retrieve variables from the |
1557 | | > namespace instead of using a keyed lookup. This example first looks up the Euro |
1558 | | > namespace in the currently selected HLL, then retrieves the C<bill> variable |
1559 | | > from that namespace: |
1560 | | 1122c1263,1264 |
1561 | | < <pre> $P3 = $P0.'get_name'()</pre> |
1562 | | --- |
1563 | | > $P0 = get_hll_namespace ["Euro"] |
1564 | | > $P1 = get_global $P0, "bill" |
1565 | | 1124,1126d1265 |
1566 | | < <p>The <code>get_parent</code><!-- |
1567 | | < INDEX: get_parent method |
1568 | | < --> method retrieves a namespace object for the parent namespace that contains this one:</p> |
1569 | | 1128c1267,1270 |
1570 | | < <pre> $P5 = $P0.'get_parent'()</pre> |
1571 | | --- |
1572 | | > Namespaces also provide a set of methods to provide more complex |
1573 | | > behavior than the standard vtable functions allow. The |
1574 | | > C<get_name>X<get_name method> method returns the name of the namespace |
1575 | | > as a C<ResizableStringArray>: |
1576 | | 1130,1132c1272 |
1577 | | < <p>The <code>get_class</code><!-- |
1578 | | < INDEX: get_class method |
1579 | | < --> method retrieves any Class PMC associated with the namespace:</p> |
1580 | | --- |
1581 | | > $P3 = $P0.'get_name'() |
1582 | | 1134d1273 |
1583 | | < <pre> $P6 = $P0.'get_class'()</pre> |
1584 | | 1136,1140c1275,1276 |
1585 | | < <p>The <code>add_var</code><!-- |
1586 | | < INDEX: add_var method |
1587 | | < --> and <code>find_var</code><!-- |
1588 | | < INDEX: find_var method |
1589 | | < --> methods store and retrieve variables in a namespace in a language-neutral way:</p> |
1590 | | --- |
1591 | | > The C<get_parent>X<get_parent method> method retrieves a namespace |
1592 | | > object for the parent namespace that contains this one: |
1593 | | 1142,1143c1278 |
1594 | | < <pre> $P0.'add_var'("bee", $P3) |
1595 | | < $P1 = $P0.'find_var'("bee")</pre> |
1596 | | --- |
1597 | | > $P5 = $P0.'get_parent'() |
1598 | | 1145,1147d1279 |
1599 | | < <p>The <code>find_namespace</code><!-- |
1600 | | < INDEX: find_namespace method |
1601 | | < --> method looks up a namespace, just like the <code>get_namespace</code> opcode:</p> |
1602 | | 1149c1281,1282 |
1603 | | < <pre> $P1 = $P0.'find_namespace'("Duck")</pre> |
1604 | | --- |
1605 | | > The C<get_class>X<get_class method> method retrieves any Class PMC |
1606 | | > associated with the namespace: |
1607 | | 1151,1153c1284 |
1608 | | < <p>The <code>add_namespace</code><!-- |
1609 | | < INDEX: add_namespace method |
1610 | | < --> method adds a new namespace as a child of the namespace object:</p> |
1611 | | --- |
1612 | | > $P6 = $P0.'get_class'() |
1613 | | 1155d1285 |
1614 | | < <pre> $P0.'add_namespace'($P1)</pre> |
1615 | | 1157,1159c1287,1312 |
1616 | | < <p>The <code>make_namespace</code><!-- |
1617 | | < INDEX: make_namespace method |
1618 | | < --> method looks up a namespace as a child of the namespace object and returns it. If the requested namespace doesn't exist, <code>make_namespace</code> creates a new one and adds it under that name:</p> |
1619 | | --- |
1620 | | > The C<add_var>X<add_var method> and C<find_var>X<find_var method> |
1621 | | > methods store and retrieve variables in a namespace in a |
1622 | | > language-neutral way: |
1623 | | > |
1624 | | > $P0.'add_var'("bee", $P3) |
1625 | | > $P1 = $P0.'find_var'("bee") |
1626 | | > |
1627 | | > |
1628 | | > The C<find_namespace>X<find_namespace method> method looks up a |
1629 | | > namespace, just like the C<get_namespace> opcode: |
1630 | | > |
1631 | | > $P1 = $P0.'find_namespace'("Duck") |
1632 | | > |
1633 | | > |
1634 | | > The C<add_namespace>X<add_namespace method> method adds a new namespace |
1635 | | > as a child of the namespace object: |
1636 | | > |
1637 | | > $P0.'add_namespace'($P1) |
1638 | | > |
1639 | | > |
1640 | | > The C<make_namespace>X<make_namespace method> method looks up a |
1641 | | > namespace as a child of the namespace object and returns it. If the |
1642 | | > requested namespace doesn't exist, C<make_namespace> creates a new one |
1643 | | > and adds it under that name: |
1644 | | > |
1645 | | > $P1 = $P0.'make_namespace'("Duck") |
1646 | | 1161d1313 |
1647 | | < <pre> $P1 = $P0.'make_namespace'("Duck")</pre> |
1648 | | 1166,1168c1318,1322 |
1649 | | < <p><!-- |
1650 | | < INDEX: aliasing |
1651 | | < --> Just like regular assignment, the various operations to store a variable in a namespace only store a pointer to the PMC. If you modify the local PMC after storing in a namespace, those changes will also appear in the stored global. To store a true copy of the PMC, <code>clone</code> it before you store it.</p> |
1652 | | --- |
1653 | | > X<aliasing> |
1654 | | > Just like regular assignment, the various operations to store a variable in a |
1655 | | > namespace only store a pointer to the PMC. If you modify the local PMC after |
1656 | | > storing in a namespace, those changes will also appear in the stored global. To |
1657 | | > store a true copy of the PMC, C<clone> it before you store it. |
1658 | | 1170c1324,1325 |
1659 | | < <p>Leaving the global variable as an alias for a local variable has its advantages. If you retrieve a stored global into a register and modify it:</p> |
1660 | | --- |
1661 | | > Leaving the global variable as an alias for a local variable has its advantages. |
1662 | | > If you retrieve a stored global into a register and modify it: |
1663 | | 1174c1329,1346 |
1664 | | < <p>... you modify the value of the stored global, so you don't need to call <code>set_global</code> again.</p> |
1665 | | --- |
1666 | | > ... you modify the value of the stored global, so you don't need to call |
1667 | | > C<set_global> again. |
1668 | | > |
1669 | | > <h1><a name="POD_ERRORS" |
1670 | | > >POD ERRORS</a></h1> |
1671 | | > |
1672 | | > <p>Hey! |
1673 | | > <b>The above document had some coding errors, |
1674 | | > which are explained below:</b></p> |
1675 | | > |
1676 | | > <dl> |
1677 | | > <dt><a name="Around_line_123:" |
1678 | | > >Around line 123:</a></dt> |
1679 | | > Deleting unknown formatting code G<> |
1680 | | > <dt><a name="Around_line_185:" |
1681 | | > >Around line 185:</a></dt> |
1682 | | > =end PIR_FRAGMENT_INVALID[ doesn't match =begin PIR_FRAGMENT_INVALID. |
1683 | | > (Stack: =begin PIR_FRAGMENT_INVALID)</dl> |
1684 | | 1178c1350 |
1685 | | < Copyright © 2002-2009, Parrot Foundation. |
1686 | | --- |
1687 | | > Copyright © 2002-2010, Parrot Foundation. |
1688 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch05_control_structures.pod.html parrot/docs/html/docs/book/pir/ch05_control_structures.pod.html |
1689 | | 5c5 |
1690 | | < <title>Parrot - Control Structures</title> |
1691 | | --- |
1692 | | > <title>Parrot - Untitled</title> |
1693 | | 7c7 |
1694 | | < href="../../../../resources/parrot.css" |
1695 | | --- |
1696 | | > href="/parrot.css" |
1697 | | 17c17 |
1698 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
1699 | | --- |
1700 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
1701 | | 23c23 |
1702 | | < <a href="../../../../html/index.html">Home</a> » Control Structures |
1703 | | --- |
1704 | | > Untitled |
1705 | | 298a299,308 |
1706 | | > |
1707 | | > <h1><a name="POD_ERRORS" |
1708 | | > >POD ERRORS</a></h1> |
1709 | | > |
1710 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
1711 | | > |
1712 | | > <dl> |
1713 | | > <dt><a name="Around_line_5:" |
1714 | | > >Around line 5:</a></dt> |
1715 | | > Deleting unknown formatting code N<></dl> |
1716 | | 302c312 |
1717 | | < Copyright © 2002-2009, Parrot Foundation. |
1718 | | --- |
1719 | | > Copyright © 2002-2010, Parrot Foundation. |
1720 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch06_subroutines.pod.html parrot/docs/html/docs/book/pir/ch06_subroutines.pod.html |
1721 | | 5c5 |
1722 | | < <title>Parrot - Subroutines</title> |
1723 | | --- |
1724 | | > <title>Parrot - Untitled</title> |
1725 | | 7c7 |
1726 | | < href="../../../../resources/parrot.css" |
1727 | | --- |
1728 | | > href="/parrot.css" |
1729 | | 17c17 |
1730 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
1731 | | --- |
1732 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
1733 | | 23c23 |
1734 | | < <a href="../../../../html/index.html">Home</a> » Subroutines |
1735 | | --- |
1736 | | > Untitled |
| 1421 | > <p>The <code>set_hll_global</code><!-- |
| 1422 | > INDEX: set_hll_global opcode |
| 1423 | > --> and <code>get_hll_global</code><!-- |
| 1424 | > INDEX: get_hll_global opcode |
| 1425 | > --> opcodes are like <code>set_root_global</code> and <code>get_root_global</code>, except they always operate on the virtual root for the currently selected HLL. This example stores and retrieves a <code>bill</code> variable in the Euro namespace, under the Dutch HLL namespace root:</p> |
| 1426 | 1224c1082 |
| 1427 | < .HLL 'Dutch' |
| 1428 | --- |
| 1429 | > <pre> .HLL 'Dutch' |
| 1430 | 1226,1228c1084,1085 |
| 1431 | < set_hll_global ["Euro"], "bill", $P0 |
| 1432 | < $P1 = get_hll_global ["Euro"], "bill" |
| 1433 | < |
| 1434 | --- |
| 1435 | > set_hll_global ["Euro"], "bill", $P0 |
| 1436 | > $P1 = get_hll_global ["Euro"], "bill"</pre> |
| 1437 | 1233,1265c1090,1094 |
| 1438 | < X<NameSpace PMC> |
| 1439 | < Namespaces are just PMCs. They implement the standard vtable functions |
| 1440 | < and a few extra methods. The C<get_namespace>X<get_namespace opcode> |
| 1441 | < opcode retrieves the currently selected namespace as a PMC object: |
| 1442 | < |
| 1443 | < $P0 = get_namespace |
| 1444 | < |
| 1445 | < |
| 1446 | < The C<get_root_namespace>X<get_root_namespace opcode> opcode retrieves |
| 1447 | < the namespace object for the root namespace. The |
| 1448 | < C<get_hll_namespace>X<get_hll_namespace opcode> opcode retrieves the |
| 1449 | < virtual root for the currently selected HLL. |
| 1450 | < |
| 1451 | < $P0 = get_root_namespace |
| 1452 | < $P0 = get_hll_namespace |
| 1453 | < |
| 1454 | < |
| 1455 | < Each of these three opcodes can take a key argument to retrieve a namespace |
| 1456 | < under the currenly selected namespace, root namespace, or HLL root namespace: |
| 1457 | < |
| 1458 | < $P0 = get_namespace ["Duck"] |
| 1459 | < $P0 = get_root_namespace ["General";"Electric"] |
| 1460 | < $P0 = get_hll_namespace ["Euro"] |
| 1461 | < |
| 1462 | < |
| 1463 | < Once you have a namespace object you can use it to retrieve variables from the |
| 1464 | < namespace instead of using a keyed lookup. This example first looks up the Euro |
| 1465 | < namespace in the currently selected HLL, then retrieves the C<bill> variable |
| 1466 | < from that namespace: |
| 1467 | < |
| 1468 | < $P0 = get_hll_namespace ["Euro"] |
| 1469 | < $P1 = get_global $P0, "bill" |
| 1470 | < |
| 1471 | --- |
| 1472 | > <p><!-- |
| 1473 | > INDEX: NameSpace PMC |
| 1474 | > --> Namespaces are just PMCs. They implement the standard vtable functions and a few extra methods. The <code>get_namespace</code><!-- |
| 1475 | > INDEX: get_namespace opcode |
| 1476 | > --> opcode retrieves the currently selected namespace as a PMC object:</p> |
| 1477 | 1267,1270c1096 |
| 1478 | < Namespaces also provide a set of methods to provide more complex |
| 1479 | < behavior than the standard vtable functions allow. The |
| 1480 | < C<get_name>X<get_name method> method returns the name of the namespace |
| 1481 | < as a C<ResizableStringArray>: |
| 1482 | --- |
| 1483 | > <pre> $P0 = get_namespace</pre> |
| 1484 | 1272c1098,1102 |
| 1485 | < $P3 = $P0.'get_name'() |
| 1486 | --- |
| 1487 | > <p>The <code>get_root_namespace</code><!-- |
| 1488 | > INDEX: get_root_namespace opcode |
| 1489 | > --> opcode retrieves the namespace object for the root namespace. The <code>get_hll_namespace</code><!-- |
| 1490 | > INDEX: get_hll_namespace opcode |
| 1491 | > --> opcode retrieves the virtual root for the currently selected HLL.</p> |
| 1492 | 1273a1104,1105 |
| 1493 | > <pre> $P0 = get_root_namespace |
| 1494 | > $P0 = get_hll_namespace</pre> |
| 1495 | 1275,1276c1107 |
| 1496 | < The C<get_parent>X<get_parent method> method retrieves a namespace |
| 1497 | < object for the parent namespace that contains this one: |
| 1498 | --- |
| 1499 | > <p>Each of these three opcodes can take a key argument to retrieve a namespace under the currenly selected namespace, root namespace, or HLL root namespace:</p> |
| 1500 | 1278c1109,1111 |
| 1501 | < $P5 = $P0.'get_parent'() |
| 1502 | --- |
| 1503 | > <pre> $P0 = get_namespace ["Duck"] |
| 1504 | > $P0 = get_root_namespace ["General";"Electric"] |
| 1505 | > $P0 = get_hll_namespace ["Euro"]</pre> |
| 1506 | 1279a1113 |
| 1507 | > <p>Once you have a namespace object you can use it to retrieve variables from the namespace instead of using a keyed lookup. This example first looks up the Euro namespace in the currently selected HLL, then retrieves the <code>bill</code> variable from that namespace:</p> |
| 1508 | 1281,1282c1115,1116 |
| 1509 | < The C<get_class>X<get_class method> method retrieves any Class PMC |
| 1510 | < associated with the namespace: |
| 1511 | --- |
| 1512 | > <pre> $P0 = get_hll_namespace ["Euro"] |
| 1513 | > $P1 = get_global $P0, "bill"</pre> |
| 1514 | 1284c1118,1120 |
| 1515 | < $P6 = $P0.'get_class'() |
| 1516 | --- |
| 1517 | > <p>Namespaces also provide a set of methods to provide more complex behavior than the standard vtable functions allow. The <code>get_name</code><!-- |
| 1518 | > INDEX: get_name method |
| 1519 | > --> method returns the name of the namespace as a <code>ResizableStringArray</code>:</p> |
| 1520 | 1285a1122 |
| 1521 | > <pre> $P3 = $P0.'get_name'()</pre> |
| 1522 | 1287,1289c1124,1126 |
| 1523 | < The C<add_var>X<add_var method> and C<find_var>X<find_var method> |
| 1524 | < methods store and retrieve variables in a namespace in a |
| 1525 | < language-neutral way: |
| 1526 | --- |
| 1527 | > <p>The <code>get_parent</code><!-- |
| 1528 | > INDEX: get_parent method |
| 1529 | > --> method retrieves a namespace object for the parent namespace that contains this one:</p> |
| 1530 | 1291,1292c1128 |
| 1531 | < $P0.'add_var'("bee", $P3) |
| 1532 | < $P1 = $P0.'find_var'("bee") |
| 1533 | --- |
| 1534 | > <pre> $P5 = $P0.'get_parent'()</pre> |
| 1535 | 1293a1130,1132 |
| 1536 | > <p>The <code>get_class</code><!-- |
| 1537 | > INDEX: get_class method |
| 1538 | > --> method retrieves any Class PMC associated with the namespace:</p> |
| 1539 | 1295,1296c1134 |
| 1540 | < The C<find_namespace>X<find_namespace method> method looks up a |
| 1541 | < namespace, just like the C<get_namespace> opcode: |
| 1542 | --- |
| 1543 | > <pre> $P6 = $P0.'get_class'()</pre> |
| 1544 | 1298c1136,1140 |
| 1545 | < $P1 = $P0.'find_namespace'("Duck") |
| 1546 | --- |
| 1547 | > <p>The <code>add_var</code><!-- |
| 1548 | > INDEX: add_var method |
| 1549 | > --> and <code>find_var</code><!-- |
| 1550 | > INDEX: find_var method |
| 1551 | > --> methods store and retrieve variables in a namespace in a language-neutral way:</p> |
| 1552 | 1299a1142,1143 |
| 1553 | > <pre> $P0.'add_var'("bee", $P3) |
| 1554 | > $P1 = $P0.'find_var'("bee")</pre> |
| 1555 | 1301,1302c1145,1147 |
| 1556 | < The C<add_namespace>X<add_namespace method> method adds a new namespace |
| 1557 | < as a child of the namespace object: |
| 1558 | --- |
| 1559 | > <p>The <code>find_namespace</code><!-- |
| 1560 | > INDEX: find_namespace method |
| 1561 | > --> method looks up a namespace, just like the <code>get_namespace</code> opcode:</p> |
| 1562 | 1304c1149 |
| 1563 | < $P0.'add_namespace'($P1) |
| 1564 | --- |
| 1565 | > <pre> $P1 = $P0.'find_namespace'("Duck")</pre> |
| 1566 | 1305a1151,1153 |
| 1567 | > <p>The <code>add_namespace</code><!-- |
| 1568 | > INDEX: add_namespace method |
| 1569 | > --> method adds a new namespace as a child of the namespace object:</p> |
| 1570 | 1307,1310c1155 |
| 1571 | < The C<make_namespace>X<make_namespace method> method looks up a |
| 1572 | < namespace as a child of the namespace object and returns it. If the |
| 1573 | < requested namespace doesn't exist, C<make_namespace> creates a new one |
| 1574 | < and adds it under that name: |
| 1575 | --- |
| 1576 | > <pre> $P0.'add_namespace'($P1)</pre> |
| 1577 | 1312c1157,1159 |
| 1578 | < $P1 = $P0.'make_namespace'("Duck") |
| 1579 | --- |
| 1580 | > <p>The <code>make_namespace</code><!-- |
| 1581 | > INDEX: make_namespace method |
| 1582 | > --> method looks up a namespace as a child of the namespace object and returns it. If the requested namespace doesn't exist, <code>make_namespace</code> creates a new one and adds it under that name:</p> |
| 1583 | 1313a1161 |
| 1584 | > <pre> $P1 = $P0.'make_namespace'("Duck")</pre> |
| 1585 | 1318,1322c1166,1168 |
| 1586 | < X<aliasing> |
| 1587 | < Just like regular assignment, the various operations to store a variable in a |
| 1588 | < namespace only store a pointer to the PMC. If you modify the local PMC after |
| 1589 | < storing in a namespace, those changes will also appear in the stored global. To |
| 1590 | < store a true copy of the PMC, C<clone> it before you store it. |
| 1591 | --- |
| 1592 | > <p><!-- |
| 1593 | > INDEX: aliasing |
| 1594 | > --> Just like regular assignment, the various operations to store a variable in a namespace only store a pointer to the PMC. If you modify the local PMC after storing in a namespace, those changes will also appear in the stored global. To store a true copy of the PMC, <code>clone</code> it before you store it.</p> |
| 1595 | 1324,1325c1170 |
| 1596 | < Leaving the global variable as an alias for a local variable has its advantages. |
| 1597 | < If you retrieve a stored global into a register and modify it: |
| 1598 | --- |
| 1599 | > <p>Leaving the global variable as an alias for a local variable has its advantages. If you retrieve a stored global into a register and modify it:</p> |
| 1600 | 1329,1346c1174 |
| 1601 | < ... you modify the value of the stored global, so you don't need to call |
| 1602 | < C<set_global> again. |
| 1603 | < |
| 1604 | < <h1><a name="POD_ERRORS" |
| 1605 | < >POD ERRORS</a></h1> |
| 1606 | < |
| 1607 | < <p>Hey! |
| 1608 | < <b>The above document had some coding errors, |
| 1609 | < which are explained below:</b></p> |
| 1610 | < |
| 1611 | < <dl> |
| 1612 | < <dt><a name="Around_line_123:" |
| 1613 | < >Around line 123:</a></dt> |
| 1614 | < Deleting unknown formatting code G<> |
| 1615 | < <dt><a name="Around_line_185:" |
| 1616 | < >Around line 185:</a></dt> |
| 1617 | < =end PIR_FRAGMENT_INVALID[ doesn't match =begin PIR_FRAGMENT_INVALID. |
| 1618 | < (Stack: =begin PIR_FRAGMENT_INVALID)</dl> |
| 1619 | --- |
| 1620 | > <p>... you modify the value of the stored global, so you don't need to call <code>set_global</code> again.</p> |
| 1621 | 1350c1178 |
| 1622 | < Copyright © 2002-2010, Parrot Foundation. |
| 1623 | --- |
| 1624 | > Copyright © 2002-2009, Parrot Foundation. |
| 1625 | diff -r parrot/docs/html/docs/book/pir/ch05_control_structures.pod.html parrot-trunk/docs/html/docs/book/pir/ch05_control_structures.pod.html |
| 1626 | 5c5 |
| 1627 | < <title>Parrot - Untitled</title> |
| 1628 | --- |
| 1629 | > <title>Parrot - Control Structures</title> |
| 1630 | 23c23 |
| 1631 | < Untitled |
| 1632 | --- |
| 1633 | > <a href="../../../../html/index.html">Home</a> » Control Structures |
| 1634 | 299,308d298 |
| 1635 | < |
| 1636 | < <h1><a name="POD_ERRORS" |
| 1637 | < >POD ERRORS</a></h1> |
| 1638 | < |
| 1639 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 1640 | < |
| 1641 | < <dl> |
| 1642 | < <dt><a name="Around_line_5:" |
| 1643 | < >Around line 5:</a></dt> |
| 1644 | < Deleting unknown formatting code N<></dl> |
| 1645 | 312c302 |
| 1646 | < Copyright © 2002-2010, Parrot Foundation. |
| 1647 | --- |
| 1648 | > Copyright © 2002-2009, Parrot Foundation. |
| 1649 | diff -r parrot/docs/html/docs/book/pir/ch06_subroutines.pod.html parrot-trunk/docs/html/docs/book/pir/ch06_subroutines.pod.html |
| 1650 | 5c5 |
| 1651 | < <title>Parrot - Untitled</title> |
| 1652 | --- |
| 1653 | > <title>Parrot - Subroutines</title> |
| 1654 | 23c23 |
| 1655 | < Untitled |
| 1656 | --- |
| 1657 | > <a href="../../../../html/index.html">Home</a> » Subroutines |
1738 | | < --> Native Call Interface (NCI) is a special version of the Parrot calling conventions for calling functions in shared C libraries with a known signature. This is a simplified version of the first test in <em><a href="../../../t/pmc/nci.t.html">t/pmc/nci.t</a></em>:</p> |
1739 | | --- |
1740 | | > --> Native Call Interface (NCI) is a special version of the Parrot calling conventions for calling functions in shared C libraries with a known signature. This is a simplified version of the first test in <em>t/pmc/nci.t</em>:</p> |
1741 | | 785a786,807 |
1742 | | > |
1743 | | > <h1><a name="POD_ERRORS" |
1744 | | > >POD ERRORS</a></h1> |
1745 | | > |
1746 | | > <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
1747 | | > |
1748 | | > <dl> |
1749 | | > <dt><a name="Around_line_39:" |
1750 | | > >Around line 39:</a></dt> |
1751 | | > Deleting unknown formatting code N<> |
1752 | | > <dt><a name="Around_line_393:" |
1753 | | > >Around line 393:</a></dt> |
1754 | | > Deleting unknown formatting code N<> |
1755 | | > <dt><a name="Around_line_615:" |
1756 | | > >Around line 615:</a></dt> |
1757 | | > Deleting unknown formatting code N<> |
1758 | | > <dt><a name="Around_line_625:" |
1759 | | > >Around line 625:</a></dt> |
1760 | | > Deleting unknown formatting code N<> |
1761 | | > <dt><a name="Around_line_1083:" |
1762 | | > >Around line 1083:</a></dt> |
1763 | | > Deleting unknown formatting code N<></dl> |
1764 | | 789c811 |
1765 | | < Copyright © 2002-2009, Parrot Foundation. |
1766 | | --- |
1767 | | > Copyright © 2002-2010, Parrot Foundation. |
1768 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch07_objects.pod.html parrot/docs/html/docs/book/pir/ch07_objects.pod.html |
1769 | | 5c5 |
1770 | | < <title>Parrot - Classes and Objects</title> |
1771 | | --- |
1772 | | > <title>Parrot - Untitled</title> |
1773 | | 7c7 |
1774 | | < href="../../../../resources/parrot.css" |
1775 | | --- |
1776 | | > href="/parrot.css" |
1777 | | 17c17 |
1778 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
1779 | | --- |
1780 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
1781 | | 23c23 |
1782 | | < <a href="../../../../html/index.html">Home</a> » Classes and Objects |
1783 | | --- |
1784 | | > Untitled |
1785 | | 337a338,349 |
1786 | | > |
1787 | | > <h1><a name="POD_ERRORS" |
1788 | | > >POD ERRORS</a></h1> |
1789 | | > |
1790 | | > <p>Hey! |
1791 | | > <b>The above document had some coding errors, |
1792 | | > which are explained below:</b></p> |
1793 | | > |
1794 | | > <dl> |
1795 | | > <dt><a name="Around_line_64:" |
1796 | | > >Around line 64:</a></dt> |
1797 | | > Deleting unknown formatting code N<></dl> |
1798 | | 341c353 |
1799 | | < Copyright © 2002-2009, Parrot Foundation. |
1800 | | --- |
1801 | | > Copyright © 2002-2010, Parrot Foundation. |
1802 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch08_io.pod.html parrot/docs/html/docs/book/pir/ch08_io.pod.html |
1803 | | 5c5 |
1804 | | < <title>Parrot - I/O</title> |
1805 | | --- |
1806 | | > <title>Parrot - Untitled</title> |
1807 | | 7c7 |
1808 | | < href="../../../../resources/parrot.css" |
1809 | | --- |
1810 | | > href="/parrot.css" |
1811 | | 17c17 |
1812 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
1813 | | --- |
1814 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
1815 | | 23c23 |
1816 | | < <a href="../../../../html/index.html">Home</a> » I/O |
1817 | | --- |
1818 | | > Untitled |
1819 | | 365c365,380 |
1820 | | < </pre> </div> <!-- "mainbody" --> |
1821 | | --- |
1822 | | > </pre> |
1823 | | > <h1><a name="POD_ERRORS" |
1824 | | > >POD ERRORS</a></h1> |
1825 | | > |
1826 | | > <p>Hey! |
1827 | | > <b>The above document had some coding errors, |
1828 | | > which are explained below:</b></p> |
1829 | | > |
1830 | | > <dl> |
1831 | | > <dt><a name="Around_line_25:" |
1832 | | > >Around line 25:</a></dt> |
1833 | | > Deleting unknown formatting code N<> |
1834 | | > <dt><a name="Around_line_46:" |
1835 | | > >Around line 46:</a></dt> |
1836 | | > Deleting unknown formatting code N<></dl> |
1837 | | > </div> <!-- "mainbody" --> |
1838 | | 368c383 |
1839 | | < Copyright © 2002-2009, Parrot Foundation. |
1840 | | --- |
1841 | | > Copyright © 2002-2010, Parrot Foundation. |
1842 | | diff -r parrot-trunk/docs/html/docs/book/pir/ch09_exceptions.pod.html parrot/docs/html/docs/book/pir/ch09_exceptions.pod.html |
1843 | | 5c5 |
1844 | | < <title>Parrot - Exceptions</title> |
1845 | | --- |
1846 | | > <title>Parrot - Untitled</title> |
1847 | | 7c7 |
1848 | | < href="../../../../resources/parrot.css" |
1849 | | --- |
1850 | | > href="/parrot.css" |
1851 | | 17c17 |
1852 | | < <img border=0 src="../../../../resources/parrot_logo.png" id="logo" alt="parrot"> |
1853 | | --- |
1854 | | > <img border=0 src="/parrot_logo.png" id="logo" alt="parrot"> |
1855 | | 23c23 |
1856 | | < <a href="../../../../html/index.html">Home</a> » Exceptions |
1857 | | --- |
1858 | | > Untitled |
| 1659 | < --> Native Call Interface (NCI) is a special version of the Parrot calling conventions for calling functions in shared C libraries with a known signature. This is a simplified version of the first test in <em>t/pmc/nci.t</em>:</p> |
| 1660 | --- |
| 1661 | > --> Native Call Interface (NCI) is a special version of the Parrot calling conventions for calling functions in shared C libraries with a known signature. This is a simplified version of the first test in <em><a href="../../../t/pmc/nci.t.html">t/pmc/nci.t</a></em>:</p> |
| 1662 | 786,807d785 |
| 1663 | < |
| 1664 | < <h1><a name="POD_ERRORS" |
| 1665 | < >POD ERRORS</a></h1> |
| 1666 | < |
| 1667 | < <p>Hey! <b>The above document had some coding errors, which are explained below:</b></p> |
| 1668 | < |
| 1669 | < <dl> |
| 1670 | < <dt><a name="Around_line_39:" |
| 1671 | < >Around line 39:</a></dt> |
| 1672 | < Deleting unknown formatting code N<> |
| 1673 | < <dt><a name="Around_line_393:" |
| 1674 | < >Around line 393:</a></dt> |
| 1675 | < Deleting unknown formatting code N<> |
| 1676 | < <dt><a name="Around_line_615:" |
| 1677 | < >Around line 615:</a></dt> |
| 1678 | < Deleting unknown formatting code N<> |
| 1679 | < <dt><a name="Around_line_625:" |
| 1680 | < >Around line 625:</a></dt> |
| 1681 | < Deleting unknown formatting code N<> |
| 1682 | < <dt><a name="Around_line_1083:" |
| 1683 | < >Around line 1083:</a></dt> |
| 1684 | < Deleting unknown formatting code N<></dl> |
| 1685 | 811c789 |
| 1686 | < Copyright © 2002-2010, Parrot Foundation. |
| 1687 | --- |
| 1688 | > Copyright © 2002-2009, Parrot Foundation. |
| 1689 | diff -r parrot/docs/html/docs/book/pir/ch07_objects.pod.html parrot-trunk/docs/html/docs/book/pir/ch07_objects.pod.html |
| 1690 | 5c5 |
| 1691 | < <title>Parrot - Untitled</title> |
| 1692 | --- |
| 1693 | > <title>Parrot - Classes and Objects</title> |
| 1694 | 23c23 |
| 1695 | < Untitled |
| 1696 | --- |
| 1697 | > <a href="../../../../html/index.html">Home</a> » Classes and Objects |
| 1698 | 338,349d337 |
| 1699 | < |
| 1700 | < <h1><a name="POD_ERRORS" |
| 1701 | < >POD ERRORS</a></h1> |
| 1702 | < |
| 1703 | < <p>Hey! |
| 1704 | < <b>The above document had some coding errors, |
| 1705 | < which are explained below:</b></p> |
| 1706 | < |
| 1707 | < <dl> |
| 1708 | < <dt><a name="Around_line_64:" |
| 1709 | < >Around line 64:</a></dt> |
| 1710 | < Deleting unknown formatting code N<></dl> |
| 1711 | 353c341 |
| 1712 | < Copyright © 2002-2010, Parrot Foundation. |
| 1713 | --- |
| 1714 | > Copyright © 2002-2009, Parrot Foundation. |
| 1715 | diff -r parrot/docs/html/docs/book/pir/ch08_io.pod.html parrot-trunk/docs/html/docs/book/pir/ch08_io.pod.html |
| 1716 | 5c5 |
| 1717 | < <title>Parrot - Untitled</title> |
| 1718 | --- |
| 1719 | > <title>Parrot - I/O</title> |
| 1720 | 23c23 |
| 1721 | < Untitled |
| 1722 | --- |
| 1723 | > <a href="../../../../html/index.html">Home</a> » I/O |
| 1724 | 365,380c365 |
| 1725 | < </pre> |
| 1726 | < <h1><a name="POD_ERRORS" |
| 1727 | < >POD ERRORS</a></h1> |
| 1728 | < |
| 1729 | < <p>Hey! |
| 1730 | < <b>The above document had some coding errors, |
| 1731 | < which are explained below:</b></p> |
| 1732 | < |
| 1733 | < <dl> |
| 1734 | < <dt><a name="Around_line_25:" |
| 1735 | < >Around line 25:</a></dt> |
| 1736 | < Deleting unknown formatting code N<> |
| 1737 | < <dt><a name="Around_line_46:" |
| 1738 | < >Around line 46:</a></dt> |
| 1739 | < Deleting unknown formatting code N<></dl> |
| 1740 | < </div> <!-- "mainbody" --> |
| 1741 | --- |
| 1742 | > </pre> </div> <!-- "mainbody" --> |
| 1743 | 383c368 |
| 1744 | < Copyright © 2002-2010, Parrot Foundation. |
| 1745 | --- |
| 1746 | > Copyright © 2002-2009, Parrot Foundation. |
| 1747 | diff -r parrot/docs/html/docs/book/pir/ch09_exceptions.pod.html parrot-trunk/docs/html/docs/book/pir/ch09_exceptions.pod.html |
| 1748 | 5c5 |
| 1749 | < <title>Parrot - Untitled</title> |
| 1750 | --- |
| 1751 | > <title>Parrot - Exceptions</title> |
| 1752 | 23c23 |
| 1753 | < Untitled |
| 1754 | --- |
| 1755 | > <a href="../../../../html/index.html">Home</a> » Exceptions |