SCM Repository
[smlnj] Annotation of /sml/releases/release-110.35/src/ml-nlffi-lib/zstring.sig
Annotation of /sml/releases/release-110.35/src/ml-nlffi-lib/zstring.sig
Parent Directory
|
Revision Log
Revision 917 -
(view)
(download)
(as text)
1 : |
blume |
837 |
(*
|
2 : |
|
|
* Functions for translating between 0-terminated C strings and native
|
3 : |
|
|
* ML strings.
|
4 : |
|
|
*
|
5 : |
|
|
* (C) 2001, Lucent Technologies, Bell Laboratories
|
6 : |
|
|
*
|
7 : |
|
|
* author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
|
8 : |
|
|
*)
|
9 : |
|
|
signature ZSTRING = sig
|
10 : |
|
|
|
11 : |
|
|
type 'c zstring = (C.uchar, 'c) C.ptr
|
12 : |
|
|
type 'c zstring' = (C.uchar, 'c) C.ptr'
|
13 : |
|
|
|
14 : |
|
|
(* the C strlen function *)
|
15 : |
|
|
val length : 'c zstring -> int
|
16 : |
|
|
val length' : 'c zstring' -> int
|
17 : |
|
|
|
18 : |
|
|
(* make ML string from 0-terminated C string *)
|
19 : |
|
|
val toML : 'c zstring -> string
|
20 : |
|
|
val toML' : 'c zstring' -> string
|
21 : |
|
|
|
22 : |
|
|
(* Copy contents of ML string into C string and add terminating 0. *)
|
23 : |
|
|
val cpML : { from: string, to: C.rw zstring } -> unit
|
24 : |
|
|
val cpML' : { from: string, to: C.rw zstring' } -> unit
|
25 : |
|
|
|
26 : |
|
|
(* Make C-duplicate of ML string (allocate memory and then copy). *)
|
27 : |
|
|
val dupML : string -> C.rw zstring option
|
28 : |
|
|
val dupML' : string -> C.rw zstring' option
|
29 : |
|
|
end
|