@@ -52,7 +52,32 @@ opcodes will eventually be removed from NQP. Internal opcodes are typically
52
52
used at compile time to replace opcodes that take a variable number of
53
53
arguments.
54
54
55
- # Arithmetic Opcodes
55
+ The opcodes are grouped into the following categories:
56
+
57
+ * [ Arithmetic Opcodes] ( #arithmetic )
58
+ * [ Numeric Opcodes] ( #numeric )
59
+ * [ Trigonometric Opcodes] ( #trig )
60
+ * [ Relational / Logic Opcodes] ( #logic )
61
+ * [ Array Opcodes] ( #array )
62
+ * [ Hash Opcodes] ( #hash )
63
+ * [ String Opcodes] ( #string )
64
+ * [ Unicode Property Opcodes] ( #unicode )
65
+ * [ Conditional Opcodes] ( #conditional )
66
+ * [ Loop/Control Opcodes] ( #control )
67
+ * [ Exceptional Opcodes] ( #exceptions )
68
+ * [ Input/Output Opcodes] ( #io )
69
+ * [ External command Opcodes] ( #extern )
70
+ * [ File / Directory / Network Opcodes] ( #filedirnet )
71
+ * [ Type/Conversion Opcodes] ( #type )
72
+ * [ OO/SixModel Opcodes] ( #sixmodel )
73
+ * [ Bit Opcodes] ( #bit )
74
+ * [ Context Introspection Opcodes] ( #context )
75
+ * [ Variable Opcodes] ( #variable )
76
+ * [ Miscellaneous Opcodes] ( #misc )
77
+ * [ Native Call / Interoperability Opcodes] ( #nativecall )
78
+ * [ Asynchronous operations] ( #async )
79
+
80
+ # <a id =" arithmetic " ></a > Arithmetic Opcodes
56
81
57
82
## abs
58
83
* ` abs_i(int $i) `
@@ -127,7 +152,7 @@ Return the negative of a number.
127
152
Subtract $r from $l, returning the result.
128
153
` _I ` variant returns an object of the given type.
129
154
130
- # Numeric Opcodes
155
+ # < a id = " numeric " ></ a > Numeric Opcodes
131
156
132
157
## base
133
158
* ` base_I(Int $i, int $radix) `
@@ -199,7 +224,7 @@ given number.
199
224
## sqrt
200
225
* ` sqrt_n(num $l, num $r) `
201
226
202
- # Trigonometric Opcodes
227
+ # < a id = " trig " ></ a > Trigonometric Opcodes
203
228
204
229
Each opcode corresponds directly to the trigonometric function of the same
205
230
name. ` h ` indicates a hyperbolic variant.
@@ -243,7 +268,7 @@ name. `h` indicates a hyperbolic variant.
243
268
## tanh
244
269
* ` tanh_n(num $n) `
245
270
246
- # Relational / Logic Opcodes
271
+ # < a id = " logic " ></ a > Relational / Logic Opcodes
247
272
248
273
## cmp
249
274
* ` cmp_i(int $l, int $r) `
@@ -313,7 +338,7 @@ Return non-zero if the two parameters are not equal.
313
338
314
339
Return 1 if ` $val ` is 0, 0 otherwise.
315
340
316
- # Array opcodes
341
+ # < a id = " array " ></ a > Array opcodes
317
342
318
343
## atpos
319
344
* ` atpos(@arr, int $i) `
@@ -424,7 +449,7 @@ while $iter {
424
449
425
450
You can also use ` nqp::iterator() ` to iterate over a hash's key-value pairs.
426
451
427
- # Hash opcodes
452
+ # < a id = " hash " ></ a > Hash opcodes
428
453
429
454
## atkey
430
455
* ` atkey(%hash, String $key) `
@@ -471,7 +496,7 @@ for %hash {
471
496
472
497
Returns the value associated with the given key-value pair.
473
498
474
- # String Opcodes
499
+ # < a id = " string " ></ a > String Opcodes
475
500
476
501
## chars
477
502
* ` chars(str $str) `
@@ -733,7 +758,7 @@ my class MyHandler {
733
758
}
734
759
```
735
760
736
- # Unicode Property Opcodes
761
+ # < a id = " unicode " ></ a > Unicode Property Opcodes
737
762
738
763
## getuniname
739
764
* ` getuniname(int $codepoint) `
@@ -777,7 +802,7 @@ Looks up a codepoint property and return 1 if it matches the pval, 0 otherwise.
777
802
The propcode and pvalcode may be looked up with the opcodes above. (Note that
778
803
you can use the property value name (e.g. Nd) for both lookups.)
779
804
780
- # Conditional Opcodes
805
+ # < a id = " conditional " ></ a > Conditional Opcodes
781
806
782
807
## if
783
808
* ` if(Block $condition, Block $then) `
@@ -793,7 +818,7 @@ If not, and an `$else` block is present, run that instead.
793
818
If the ` $condition ` evaluates to 0, run the ` $then ` block.
794
819
If not, and an ` $else ` block is present, run that instead.
795
820
796
- # Loop/Control Opcodes
821
+ # < a id = " control " ></ a > Loop/Control Opcodes
797
822
798
823
## for
799
824
* ` for(Iterable $iter, Block $body) `
@@ -855,7 +880,7 @@ Not callable directly from NQP, but used in languages via QAST to perform loop
855
880
control. The specific kind of loop control desired is specified via the
856
881
` :name ` atttribute; either ` next ` , ` last ` , or ` redo ` .
857
882
858
- # Exceptional Opcodes
883
+ # < a id = " exceptions " ></ a > Exceptional Opcodes
859
884
860
885
## backtrace
861
886
* ` backtrace(Exception $ex) `
@@ -928,7 +953,7 @@ Sets the exception payload.
928
953
929
954
Throw the exception.
930
955
931
- # Input/Output Opcodes
956
+ # < a id = " io " ></ a > Input/Output Opcodes
932
957
933
958
## closefh
934
959
* ` closefh(Handle $fh) `
@@ -1043,7 +1068,7 @@ Return current access position for an open handle.
1043
1068
1044
1069
Output the given object to the filehandle.
1045
1070
1046
- # External command Opcodes
1071
+ # < a id = " extern " ></ a > External command Opcodes
1047
1072
1048
1073
## shell
1049
1074
* ` shell(str $cmd, str $path, %env) `
@@ -1071,7 +1096,7 @@ processing of args is done. The first value of `@args` is the command
1071
1096
executed, further values are passed as arguments. Blocks until command is
1072
1097
complete.
1073
1098
1074
- # File / Directory / Network Opcodes
1099
+ # < a id = " filedirnet " ></ a > File / Directory / Network Opcodes
1075
1100
1076
1101
## chdir
1077
1102
* ` chdir(str $path) `
@@ -1259,7 +1284,7 @@ Create a symbolic link from `$after` to `$before`
1259
1284
Delete the given file $path. Returns 0 on success, -2 if the file
1260
1285
didn't exist. May throw an exception.
1261
1286
1262
- # Type/Conversion Opcodes
1287
+ # < a id = " type " ></ a > Type/Conversion Opcodes
1263
1288
1264
1289
## bool
1265
1290
* ` bool_I(Int $val) `
@@ -1442,7 +1467,7 @@ Convert Big Integer value to a native number.
1442
1467
Given a Perl 6 object, return a native with the same value,
1443
1468
of the type indicated by the opcode suffix.
1444
1469
1445
- # OO/SixModel Opcodes
1470
+ # < a id = " sixmodel " ></ a > OO/SixModel Opcodes
1446
1471
1447
1472
## bindattr
1448
1473
* ` bindattr(Mu $obj, Mu:T $type, str $attributename, Mu $new_value) `
@@ -1579,7 +1604,7 @@ NQP equivalent for Perl 6's `$obj.WHAT`.
1579
1604
1580
1605
Return a unique ID for this ` $obj ` .
1581
1606
1582
- # Bit Opcodes
1607
+ # < a id = " bit " ></ a > Bit Opcodes
1583
1608
1584
1609
## bitand
1585
1610
* ` bitand_i(int $l, int $r) `
@@ -1626,7 +1651,7 @@ Signed right shift of `$bits` by `$count`.
1626
1651
XOR the bits in ` $l ` and ` $r ` .
1627
1652
` _I ` variant returns an object of the given type.
1628
1653
1629
- # Context Introspection Opcodes
1654
+ # < a id = " context " ></ a > Context Introspection Opcodes
1630
1655
1631
1656
## ctx
1632
1657
* ` ctx() `
@@ -1729,15 +1754,15 @@ Looks up the contextual with the specified name in the caller chain, starting at
1729
1754
1730
1755
Looks up the lexical with the specified name, starting at the given $context. It checks all outer frames of the caller chain.
1731
1756
1732
- # Variable opcodes
1757
+ # < a id = " variable " ></ a > Variable opcodes
1733
1758
1734
1759
## bind
1735
1760
* ` bind(Mu $variable, Mu $value) `
1736
1761
1737
1762
Binds ` $value ` to the ` $variable ` . Dies if ` $variable ` isn't actually a
1738
1763
variable. Same as the ` := ` operator in NQP.
1739
1764
1740
- # Miscellaneous Opcodes
1765
+ # < a id = " misc " ></ a > Miscellaneous Opcodes
1741
1766
1742
1767
## const
1743
1768
* ` const() `
@@ -1857,14 +1882,14 @@ Creates a lexical closure from the block's outer scope.
1857
1882
Return the time in seconds since January 1, 1970 UTC. ` _i ` variant returns
1858
1883
an integral number of seconds, ` _n ` returns a fractional amount.
1859
1884
1860
- # Native Call / Interoperability Opcodes
1885
+ # < a id = " nativecall " ></ a > Native Call / Interoperability Opcodes
1861
1886
1862
1887
## x_posixerrno
1863
1888
* ` x_posixerrno() `
1864
1889
1865
1890
Returns an int that corresponds to the value of POSIX's errno.
1866
1891
1867
- # Asynchronous operations
1892
+ # < a id = " async " ></ a > Asynchronous operations
1868
1893
1869
1894
The various asynchronous operations, such as timers and asynchronous I/O, take
1870
1895
a concurrent queue to push a work item into at an appropriate time. This may
0 commit comments