@@ -18,6 +18,7 @@ Opcode variants may contain a type suffix, which usually indicates:
18
18
* ` _i ` argument is native int
19
19
* ` _n ` argument is native float
20
20
* ` _s ` argument is native string
21
+ * ` _b ` argument is code blocks
21
22
* ` _I ` argument is Big Integer
22
23
23
24
They may also have a numeric suffix, which typically indicates the number
@@ -36,6 +37,7 @@ correspond directly to NQP types.
36
37
* Handle - an I/O Handle object
37
38
* @ - this sigil indicates an array parameter
38
39
* % - this sigil indicates a hash parameter
40
+ * ... - indicates variable args are accepted
39
41
40
42
# Arithmetic Opcodes
41
43
@@ -165,9 +167,12 @@ Return the value of $base raised to $exponent;
165
167
and of type ` $type_bigint ` for positive exponents.
166
168
167
169
## rand
170
+ * ` rand_n(num $n) `
168
171
* ` rand_I(Int $i, Type $type) `
169
172
170
- Returns a psuedo-random bigint up to the value of ` $i ` , of the given type.
173
+ Returns a psuedo-random bigint up to the value of the
174
+ given number.
175
+ ` _I ` variant returns an object of the given type.
171
176
172
177
## sqrt
173
178
* ` sqrt_n(num $l, num $r) `
@@ -298,6 +303,17 @@ Bind $v to @arr at position $i and return $v.
298
303
Joins the separate strings of ` @arr ` into a single string with
299
304
fields separated by the value of EXPR, and returns that new string.
300
305
306
+ ## list
307
+ * ` list(...) `
308
+ * ` list_i(...) `
309
+ * ` list_n(...) `
310
+ * ` list_s(...) `
311
+ * ` list_b(...) `
312
+
313
+ Create a list of the given parameters. If no arguments are passed,
314
+ an empty list is created. If a typed variant is used, the parameters
315
+ are coerced to the appropriate type.
316
+
301
317
## push
302
318
* ` push(@arr, Any $v) `
303
319
* ` push_i(Array int @arr, int $v) `
@@ -392,7 +408,8 @@ reverse order.
392
408
Return lowercase copy of string.
393
409
394
410
## radix
395
- * ` radix_I(int $radix, String $str, int $pos, int $flags) `
411
+ * ` radix(int $radix, String $str, int $pos, int $flags) `
412
+ * ` radix_I(int $radix, String $str, int $pos, int $flags, Type $type) `
396
413
397
414
Convert string $str into a number starting at offset $pos and using radix $radix.
398
415
The result of the conversion returns an array with
@@ -449,6 +466,7 @@ Return an array of strings, describing the backtrace of the given exception.
449
466
450
467
##die
451
468
* ` die(str $message) `
469
+ * ` die_s(str $message) `
452
470
453
471
Create and throw an exception using the given message.
454
472
@@ -602,14 +620,36 @@ Return current access position for an open handle.
602
620
603
621
Output the given object to the filehandle.
604
622
605
- # File / Network Opcodes
623
+ # File / Directory / Network Opcodes
624
+
625
+ ##chdir
626
+ * ` chdir(str $path) `
627
+
628
+ Change the working directory to the given path.
629
+
630
+ ##chmod
631
+ * ` chmod(str $path, int $mode) `
632
+
633
+ Change the permissions of ` $path ` to the posix style permissions of ` $mode ` .
634
+ Returns 0 on success, throws an exception on failure.
635
+
636
+ ##cwd
637
+ * ` cwd() `
638
+
639
+ Return a string containing the current working directory.
606
640
607
641
##fileexecutable
608
642
* ` fileexecutable(str $str) `
609
643
610
644
If the specified filename refers to an executable file, returns 1.
611
645
If not, returns 0. If an error occurs, return -1.
612
646
647
+ ##fileislink
648
+ * ` fileislink(str $str) `
649
+
650
+ If the specified filename refers to a symbolic link, returns 1.
651
+ If not, returns 0. If an error occurs, return -1.
652
+
613
653
##filereadable
614
654
* ` filereadable(str $str) `
615
655
@@ -622,14 +662,42 @@ If not, returns 0. If an error occurs, return -1.
622
662
If the specified filename refers to a writable file, returns 1.
623
663
If not, returns 0. If an error occurs, return -1.
624
664
625
- ##isfilelink
626
- * ` isfilelink(str $str) `
665
+ ##link
666
+ * ` link(str $before, str $after) `
667
+
668
+ Create a link from ` $after ` to ` $before `
669
+
670
+ ##mkdir
671
+ * ` mkdir(str $name, int $mode) `
672
+
673
+ Create a directory of the given name. Use posix-style mode
674
+ on non-windows platforms. Returns 0, or throws an exception.
675
+
676
+ ##rmdir
677
+ * ` rmdir(str $path) `
678
+
679
+ Delete the given directory $path. Returns 0 on success, -2 if the
680
+ directory didn't exist. May throw an exception.
627
681
628
- If the specified filename refers to a symbolic link, returns 1.
629
- If not, returns 0. If an error occurs, return -1.
682
+
683
+ ##symlink
684
+ * ` symlink(str $before, str $after) `
685
+
686
+ Create a symbolic link from ` $after ` to ` $before `
687
+
688
+ ##unlink
689
+ * ` unlink(str $path) `
690
+
691
+ Delete the given file $path. Returns 0 on success, -2 if the file
692
+ didn't exist. May throw an exception.
630
693
631
694
# Type/Conversion Opcodes
632
695
696
+ ##bool
697
+ * ` bool_I(Int $val) `
698
+
699
+ Returns 0 if ` $val ` is 0, otherwise 1.
700
+
633
701
##box
634
702
* ` box_i(int $val, Type $type) `
635
703
* ` box_n(num $val, Type $type) `
0 commit comments