@@ -46,6 +46,12 @@ VM-specific opcodes are denoted with a `jvm`, e.g. on the same line
46
46
as the header. No annotation indicates this opcode should be supported on
47
47
all nqp backends.
48
48
49
+ Some individual opcodes may be marked with _ Internal_ or _ Deprecated_ .
50
+ Both of these indicate the opcodes are not intended to be used. Deprecated
51
+ opcodes will eventually be removed from NQP. Internal opcodes are typically
52
+ used at compile time to replace opcodes that take a variable number of
53
+ arguments.
54
+
49
55
# Arithmetic Opcodes
50
56
51
57
## abs
@@ -490,11 +496,9 @@ Return the position in `$haystack` at which `$needle` appears, or -1
490
496
if ` $needle ` does not appear. Begin searching at position ` $pos ` if specified,
491
497
or at 0, otherwise.
492
498
493
- ## indexfrom
494
- * ` indexfrom(str $haystack, str $needle, int $pos) `
499
+ * ` indexfrom(str $haystack, str $needle, int $pos) ` _ Internal_
495
500
496
- Return the position in ` $haystack ` at which ` $needle ` appears, or -1
497
- if ` $needle ` does not appear. Begin searching at position ` $pos ` .
501
+ ` index ` is converted to this internal opcode by the compiler.
498
502
499
503
## iscclass
500
504
* ` iscclass(int $class, str $str, int $i) `
@@ -520,15 +524,10 @@ Return lowercase copy of string.
520
524
Return the unicode codepoint of the first character in ` $str ` , or
521
525
at the ` $i ` th character, if it's specified.
522
526
523
- ## ordat
524
- * ` ordat(str $str, int $i) `
525
-
526
- Return the unicode codepoint of the ` $i ` th character in ` $str `
527
+ * ` ordat(str $str, int $i) ` _ Internal_
528
+ * ` ordfirst(str $str) ` _ Internal_
527
529
528
- ## ordfirst
529
- * ` ordfirst(str $str, int $i) `
530
-
531
- Return the unicode codepoint of the th character in ` $str `
530
+ ` ord ` is converted to these internal opcodes by the compiler.
532
531
533
532
## radix
534
533
* ` radix(int $radix, String $str, int $pos, int $flags) `
@@ -565,17 +564,10 @@ Searching backwards through the `$haystack`, return the position at which
565
564
` $needle ` appears, or -1 if it does not. Begin searching at ` $pos ` if
566
565
specified, otherwise start from the last position.
567
566
568
- ## rindexfrom
569
- * ` rindexfrom(str $haystack, str $needle, int $pos) `
570
-
571
- Searching backwards through the ` $haystack ` , starting at ` $pos ` return the
572
- position at which ` $needle ` appears, or -1 if it does not.
567
+ * ` rindexfrom(str $haystack, str $needle, int $pos) ` _ Internal_
568
+ * ` rindexfromend(str $haystack, str $needle) ` _ Internal_
573
569
574
- ## rindexfromend
575
- * ` rindexfromend(str $haystack, str $needle) `
576
-
577
- Searching backwards through the ` $haystack ` , return the position at which
578
- ` $needle ` appears, or -1 if it does not.
570
+ ` rindex ` is converted to these internal opcodes by the compiler.
579
571
580
572
## uc
581
573
* ` uc(str $str) `
@@ -592,15 +584,19 @@ If the original string begins or ends with the delimiter, the resulting
592
584
array will begin or end with an empty element.
593
585
594
586
## substr
595
- * ` substr(...) `
596
- * ` substr2(str $str, int $position) `
597
- * ` substr3(str $str, int $position, int $length) `
587
+ * ` substr(str $str, int $position) `
588
+ * ` substr(str $str, int $position, int $length) `
598
589
599
590
Return the portion of the string starting at the given position.
600
591
If ` $length ` is specified, only return that many characters. The
601
592
numbered variants required the args specified - the unnumbered
602
593
version may use either signature.
603
594
595
+ * ` substr2(str $str, int $position) ` _ Internal_
596
+ * ` substr3(str $str, int $position, int $length) ` _ Internal_
597
+
598
+ ` substr ` is converted to these internal opcodes by the compiler.
599
+
604
600
## tc
605
601
* ` tc(str $str) `
606
602
@@ -875,12 +871,14 @@ specified environment variables. Returns a POSIX-style return value. Command
875
871
is executed using an OS-appropriate shell (` sh -c ` or ` cmd /c ` ). Blocks
876
872
until command is complete.
877
873
878
- ## shell
879
- * ` shell(str $cmd) `
874
+ * ` shell(str $cmd) ` _ Deprecated: use the three argument version_
880
875
881
876
Same as the three argument version of ` shell ` , using the current directory and an empty environment.
882
877
883
- _ Deprecated: use the three argument version_
878
+ * ` shell1(str $cmd) ` _ Internal, Deprecated_
879
+ * ` shell3(str $cmd, str $path, %env) ` _ Internal_
880
+
881
+ ` shell ` is converted to these internal opcodes by the compiler.
884
882
885
883
## spawn
886
884
* ` spawn(@cmd, str $path, %env) `
0 commit comments