summaryrefslogtreecommitdiff
path: root/gcc/melt
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-03 14:07:18 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-03 14:07:18 +0000
commit038a9a3c781109e53bf0cc7e02523a3b840d86d9 (patch)
tree338aeed135dfffd69ea637f2ae805a1335ee640e /gcc/melt
parentfae930676bdd14bacab30c5e8edcda2cac36cedc (diff)
downloadgcc-038a9a3c781109e53bf0cc7e02523a3b840d86d9.tar.gz
2012-09-03 Basile Starynkevitch <basile@starynkevitch.net>
* melt/warmelt-base (string_nth): New primitive. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@190893 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/melt')
-rw-r--r--gcc/melt/warmelt-base.melt7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/melt/warmelt-base.melt b/gcc/melt/warmelt-base.melt
index e03a18f9113..a592bba9783 100644
--- a/gcc/melt/warmelt-base.melt
+++ b/gcc/melt/warmelt-base.melt
@@ -742,6 +742,12 @@ an integer $I if $I is lower than $N.}#
:doc #{Give the length of string value $STR.}#
#{melt_string_length((melt_ptr_t)($str))}#)
+(defprimitive string_nth (str :long rk) :long
+ :doc #{Give the bytecode in string $STR of byte at rank $RK or else
+ 0. If $RK is negative, consider it as an offset from the end, so -1
+ is the last byte.}#
+ #{melt_string_nth((melt_ptr_t)($STR),(int)$RK)}#)
+
(defprimitive string_suffixed (sv :cstring cs) :long
:doc #{Test that the string value $SV ends with the suffix $CS.}#
#{/*string_suffixed:*/(melt_string_is_ending ((melt_ptr_t)$SV, $CS))}#)
@@ -3951,6 +3957,7 @@ which signals are not handled. It could be dynamically nested.}#
string_hex_md5sum_path_sequence
string_hex_md5sum_pathstrv
string_length
+ string_nth
string_prefixed
string_starts
string_suffixed