1.1 --- a/templates/native/str.c Thu Feb 02 23:15:24 2017 +0100
1.2 +++ b/templates/native/str.c Thu Feb 02 23:17:08 2017 +0100
1.3 @@ -1,6 +1,6 @@
1.4 /* Native functions for string operations.
1.5
1.6 -Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk>
1.7 +Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.8
1.9 This program is free software; you can redistribute it and/or modify it under
1.10 the terms of the GNU General Public License as published by the Free Software
1.11 @@ -45,6 +45,17 @@
1.12 return __new_str(r, n);
1.13 }
1.14
1.15 +__attr __fn_native_str_str_chr(__attr __args[])
1.16 +{
1.17 + __attr * const _data = &__args[1];
1.18 + /* _data interpreted as int */
1.19 + int n = _data->intvalue;
1.20 + char *s = (char *) __ALLOCATE(2, sizeof(char));
1.21 +
1.22 + s[0] = (char) n;
1.23 + return __new_str(s, 1);
1.24 +}
1.25 +
1.26 __attr __fn_native_str_str_lt(__attr __args[])
1.27 {
1.28 __attr * const _data = &__args[1];