[svn r5] Initial commit. Most things are very rough.

This commit is contained in:
Tomas Lindquist Olsen
2007-09-01 21:43:27 +02:00
parent 1c23dd2cdc
commit 34699bbb07
227 changed files with 84269 additions and 0 deletions

67
lphobos/internal/arrays.d Normal file
View File

@@ -0,0 +1,67 @@
module internal.arrays;
extern(C):
void _d_array_init_i1(bool* a, size_t n, bool v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_i8(ubyte* a, size_t n, ubyte v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_i16(ushort* a, size_t n, ushort v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_i32(uint* a, size_t n, uint v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_i64(ulong* a, size_t n, ulong v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_float(float* a, size_t n, float v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_double(double* a, size_t n, double v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}
void _d_array_init_pointer(void** a, size_t n, void* v)
{
auto p = a;
auto end = a+n;
while (p !is end)
*p++ = v;
}

View File

@@ -0,0 +1,13 @@
module internal.contract;
extern(C):
void exit(int);
void _d_assert(bool cond, uint line, char* msg)
{
if (!cond) {
printf("Aborted(%u): %s\n", line, msg);
exit(1);
}
}

View File

@@ -0,0 +1,24 @@
module internal.moduleinit;
private alias extern(C) void function() fptr_t;
extern(C):
fptr_t* _d_get_module_ctors();
fptr_t* _d_get_module_dtors();
void _d_run_module_ctors()
{
auto p = _d_get_module_ctors();
while(*p) {
(*p++)();
}
}
void _d_run_module_dtors()
{
auto p = _d_get_module_dtors();
while(*p) {
(*p++)();
}
}

View File

@@ -0,0 +1,15 @@
; ModuleID = 'internal.moduleinit_backend'
@_d_module_ctor_array = appending global [1 x void ()*] zeroinitializer
@_d_module_dtor_array = appending global [1 x void ()*] zeroinitializer
define void ()** @_d_get_module_ctors() {
entry:
%tmp = getelementptr [1 x void ()*]* @_d_module_ctor_array, i32 0, i32 0
ret void ()** %tmp
}
define void ()** @_d_get_module_dtors() {
entry:
%tmp = getelementptr [1 x void ()*]* @_d_module_dtor_array, i32 0, i32 0
ret void ()** %tmp
}

File diff suppressed because it is too large Load Diff