comparison tools/binding/llvm/util.d @ 1273:1ba61de8796b

Committing LLVM binding for D as it currently exists in the SVN repository.
author Frits van Bommel <fvbommel wxs.nl>
date Mon, 27 Apr 2009 22:33:17 +0200
parents
children
comparison
equal deleted inserted replaced
1272:dd4766851b37 1273:1ba61de8796b
1 // Written in the D programming language by Tomas Lindquist Olsen 2008
2 // Binding of llvm.c.Core values for D.
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 module llvm.util;
8
9 //we need <cstring>
10 version(Tango) {
11 import tango.stdc.string;
12 }
13 else {
14 import std.c.string;
15 }
16
17 ///
18 char[] from_stringz(char* p)
19 {
20 if (p is null)
21 return "";
22 return p[0..strlen(p)];
23 }
24
25 ///
26 char* to_stringz(char[] s)
27 {
28 return (s~\0).ptr;
29 }
30