From 54232a922f4441e2fe1f84df6a2c6aa67ba5d107 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 30 May 2006 15:50:27 +0000 Subject: 2006-05-30 Martin Hunt * string.stp (text_str): New. (text_strn): New. --- tapset/ChangeLog | 5 +++++ tapset/string.stp | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tapset/ChangeLog b/tapset/ChangeLog index fb25fd77..3b376b0d 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,8 @@ +2006-05-30 Martin Hunt + + * string.stp (text_str): New. + (text_strn): New. + 2006-05-26 Martin Hunt * errno.stp: Add octal option for returnstr. diff --git a/tapset/string.stp b/tapset/string.stp index 19b8f81f..a4cff3e4 100644 --- a/tapset/string.stp +++ b/tapset/string.stp @@ -45,4 +45,23 @@ function isinstr:long(s1:string,s2:string) %{ /* pure */ else THIS->__retvalue = 0; %} + +/* + * text_str() + * + * Takes a string, and any ASCII characters that are not printable are + * replaced by the corresponding escape sequence in the returned + * string. + */ +function text_str:string(input:string) +%{ /* pure */ + _stp_text_str(THIS->__retvalue, THIS->input, 0, 0); +%} + +function text_strn:string(input:string, len:long, quoted:long) +%{ /* pure */ + _stp_text_str(THIS->__retvalue, THIS->input, THIS->len, THIS->quoted); +%} + + /** @} */ -- cgit