Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlnlffi-lib / zstring.sig
CommitLineData
7f918cf1
CE
1(* zstring.sig
2 * 2005 Matthew Fluet (mfluet@acm.org)
3 * Adapted for MLton.
4 *)
5
6(*
7 * Functions for translating between 0-terminated C strings and native
8 * ML strings.
9 *
10 * (C) 2001, Lucent Technologies, Bell Laboratories
11 *
12 * author: Matthias Blume (blume@research.bell-labs.com)
13 *)
14signature ZSTRING = sig
15
16 type 'c zstring = (C.uchar, 'c) C.obj C.ptr
17 type 'c zstring' = (C.uchar, 'c) C.obj C.ptr'
18
19 (* the C strlen function *)
20 val length : 'c zstring -> int
21 val length' : 'c zstring' -> int
22
23 (* make ML string from 0-terminated C string *)
24 val toML : 'c zstring -> string
25 val toML' : 'c zstring' -> string
26
27 (* Copy contents of ML string into C string and add terminating 0. *)
28 val cpML : { from: string, to: C.rw zstring } -> unit
29 val cpML' : { from: string, to: C.rw zstring' } -> unit
30
31 (* Make C-duplicate of ML string (allocate memory and then copy). *)
32 val dupML : string -> 'c zstring
33 val dupML' : string -> 'c zstring'
34end