From e5186dace2ce5c13c2a178b67507a3f917f4ed25 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 4 May 2017 20:40:55 -0700 Subject: ffi: new bstr type. The bstr type is like str, but doesn't perform UTF-8 conversion. The C data is assumed to be null terminated byte strings representing code points U+0000 through U+00FF. * ffi.c (bstr_s, bstr_d_s): New symbol variables. (ffi_bstr_put, ffi_bstr_get, ffi_bstr_d_get): New static functions. (ffi_init_types): Register bstr and bstr-d types. (ffi_init): Initialize bstr_s and bstr_d_s. * ffi.h (bstr_s, bstr_d_s): Declared. * lib.c (chk_strdup_8bit, string_8bit): New function. * lib.h (chk_strdup_8bit, string_8bit): Declared. --- lib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib.h') diff --git a/lib.h b/lib.h index 5c74abf5..4875ef2a 100644 --- a/lib.h +++ b/lib.h @@ -605,6 +605,7 @@ mem_t *chk_manage_vec(mem_t *old, size_t oldfilled, size_t newfilled, wchar_t *chk_wmalloc(size_t nwchar); wchar_t *chk_strdup(const wchar_t *str); char *chk_strdup_utf8(const char *str); +unsigned char *chk_strdup_8bit(const wchar_t *str); mem_t *chk_copy_obj(mem_t *orig, size_t size); val cons(val car, val cdr); val make_lazy_cons(val func); @@ -724,6 +725,7 @@ val maskv(struct args *bits); val string_own(wchar_t *str); val string(const wchar_t *str); val string_utf8(const char *str); +val string_8bit(const unsigned char *str); val mkstring(val len, val ch); val mkustring(val len); /* must initialize immediately with init_str! */ val init_str(val str, const wchar_t *); -- cgit v1.2.3