Skip to content

Commit 8398cee

Browse files
committed
Add links to opcode categories
This makes navigation within the docs easier.
1 parent 5a13871 commit 8398cee

File tree

1 file changed

+47
-22
lines changed

1 file changed

+47
-22
lines changed

docs/ops.markdown

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,32 @@ opcodes will eventually be removed from NQP. Internal opcodes are typically
5252
used at compile time to replace opcodes that take a variable number of
5353
arguments.
5454

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
5681

5782
## abs
5883
* `abs_i(int $i)`
@@ -127,7 +152,7 @@ Return the negative of a number.
127152
Subtract $r from $l, returning the result.
128153
`_I` variant returns an object of the given type.
129154

130-
# Numeric Opcodes
155+
# <a id="numeric"></a> Numeric Opcodes
131156

132157
## base
133158
* `base_I(Int $i, int $radix)`
@@ -199,7 +224,7 @@ given number.
199224
## sqrt
200225
* `sqrt_n(num $l, num $r)`
201226

202-
# Trigonometric Opcodes
227+
# <a id="trig"></a> Trigonometric Opcodes
203228

204229
Each opcode corresponds directly to the trigonometric function of the same
205230
name. `h` indicates a hyperbolic variant.
@@ -243,7 +268,7 @@ name. `h` indicates a hyperbolic variant.
243268
## tanh
244269
* `tanh_n(num $n)`
245270

246-
# Relational / Logic Opcodes
271+
# <a id="logic"></a> Relational / Logic Opcodes
247272

248273
## cmp
249274
* `cmp_i(int $l, int $r)`
@@ -313,7 +338,7 @@ Return non-zero if the two parameters are not equal.
313338

314339
Return 1 if `$val` is 0, 0 otherwise.
315340

316-
# Array opcodes
341+
# <a id="array"></a> Array opcodes
317342

318343
## atpos
319344
* `atpos(@arr, int $i)`
@@ -424,7 +449,7 @@ while $iter {
424449

425450
You can also use `nqp::iterator()` to iterate over a hash's key-value pairs.
426451

427-
# Hash opcodes
452+
# <a id="hash"></a> Hash opcodes
428453

429454
## atkey
430455
* `atkey(%hash, String $key)`
@@ -471,7 +496,7 @@ for %hash {
471496

472497
Returns the value associated with the given key-value pair.
473498

474-
# String Opcodes
499+
# <a id="string"></a> String Opcodes
475500

476501
## chars
477502
* `chars(str $str)`
@@ -733,7 +758,7 @@ my class MyHandler {
733758
}
734759
```
735760

736-
# Unicode Property Opcodes
761+
# <a id="unicode"></a> Unicode Property Opcodes
737762

738763
## getuniname
739764
* `getuniname(int $codepoint)`
@@ -777,7 +802,7 @@ Looks up a codepoint property and return 1 if it matches the pval, 0 otherwise.
777802
The propcode and pvalcode may be looked up with the opcodes above. (Note that
778803
you can use the property value name (e.g. Nd) for both lookups.)
779804

780-
# Conditional Opcodes
805+
# <a id="conditional"></a> Conditional Opcodes
781806

782807
## if
783808
* `if(Block $condition, Block $then)`
@@ -793,7 +818,7 @@ If not, and an `$else` block is present, run that instead.
793818
If the `$condition` evaluates to 0, run the `$then` block.
794819
If not, and an `$else` block is present, run that instead.
795820

796-
# Loop/Control Opcodes
821+
# <a id="control"></a> Loop/Control Opcodes
797822

798823
## for
799824
* `for(Iterable $iter, Block $body)`
@@ -855,7 +880,7 @@ Not callable directly from NQP, but used in languages via QAST to perform loop
855880
control. The specific kind of loop control desired is specified via the
856881
`:name` atttribute; either `next`, `last`, or `redo`.
857882

858-
# Exceptional Opcodes
883+
# <a id="exceptions"></a> Exceptional Opcodes
859884

860885
## backtrace
861886
* `backtrace(Exception $ex)`
@@ -928,7 +953,7 @@ Sets the exception payload.
928953

929954
Throw the exception.
930955

931-
# Input/Output Opcodes
956+
# <a id="io"></a> Input/Output Opcodes
932957

933958
## closefh
934959
* `closefh(Handle $fh)`
@@ -1043,7 +1068,7 @@ Return current access position for an open handle.
10431068

10441069
Output the given object to the filehandle.
10451070

1046-
# External command Opcodes
1071+
# <a id="extern"></a> External command Opcodes
10471072

10481073
## shell
10491074
* `shell(str $cmd, str $path, %env)`
@@ -1071,7 +1096,7 @@ processing of args is done. The first value of `@args` is the command
10711096
executed, further values are passed as arguments. Blocks until command is
10721097
complete.
10731098

1074-
# File / Directory / Network Opcodes
1099+
# <a id="filedirnet"></a> File / Directory / Network Opcodes
10751100

10761101
## chdir
10771102
* `chdir(str $path)`
@@ -1259,7 +1284,7 @@ Create a symbolic link from `$after` to `$before`
12591284
Delete the given file $path. Returns 0 on success, -2 if the file
12601285
didn't exist. May throw an exception.
12611286

1262-
# Type/Conversion Opcodes
1287+
# <a id="type"></a> Type/Conversion Opcodes
12631288

12641289
## bool
12651290
* `bool_I(Int $val)`
@@ -1442,7 +1467,7 @@ Convert Big Integer value to a native number.
14421467
Given a Perl 6 object, return a native with the same value,
14431468
of the type indicated by the opcode suffix.
14441469

1445-
# OO/SixModel Opcodes
1470+
# <a id="sixmodel"></a> OO/SixModel Opcodes
14461471

14471472
## bindattr
14481473
* `bindattr(Mu $obj, Mu:T $type, str $attributename, Mu $new_value)`
@@ -1579,7 +1604,7 @@ NQP equivalent for Perl 6's `$obj.WHAT`.
15791604

15801605
Return a unique ID for this `$obj`.
15811606

1582-
# Bit Opcodes
1607+
# <a id="bit"></a> Bit Opcodes
15831608

15841609
## bitand
15851610
* `bitand_i(int $l, int $r)`
@@ -1626,7 +1651,7 @@ Signed right shift of `$bits` by `$count`.
16261651
XOR the bits in `$l` and `$r`.
16271652
`_I` variant returns an object of the given type.
16281653

1629-
# Context Introspection Opcodes
1654+
# <a id="context"></a> Context Introspection Opcodes
16301655

16311656
## ctx
16321657
* `ctx()`
@@ -1729,15 +1754,15 @@ Looks up the contextual with the specified name in the caller chain, starting at
17291754

17301755
Looks up the lexical with the specified name, starting at the given $context. It checks all outer frames of the caller chain.
17311756

1732-
# Variable opcodes
1757+
# <a id="variable"></a> Variable opcodes
17331758

17341759
## bind
17351760
* `bind(Mu $variable, Mu $value)`
17361761

17371762
Binds `$value` to the `$variable`. Dies if `$variable` isn't actually a
17381763
variable. Same as the `:=` operator in NQP.
17391764

1740-
# Miscellaneous Opcodes
1765+
# <a id="misc"></a> Miscellaneous Opcodes
17411766

17421767
## const
17431768
* `const()`
@@ -1857,14 +1882,14 @@ Creates a lexical closure from the block's outer scope.
18571882
Return the time in seconds since January 1, 1970 UTC. `_i` variant returns
18581883
an integral number of seconds, `_n` returns a fractional amount.
18591884

1860-
# Native Call / Interoperability Opcodes
1885+
# <a id="nativecall"></a> Native Call / Interoperability Opcodes
18611886

18621887
## x_posixerrno
18631888
* `x_posixerrno()`
18641889

18651890
Returns an int that corresponds to the value of POSIX's errno.
18661891

1867-
# Asynchronous operations
1892+
# <a id="async"></a> Asynchronous operations
18681893

18691894
The various asynchronous operations, such as timers and asynchronous I/O, take
18701895
a concurrent queue to push a work item into at an appropriate time. This may

0 commit comments

Comments
 (0)