[svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though

This commit is contained in:
Tomas Lindquist Olsen
2008-01-17 03:15:12 +01:00
parent 4f977e3cec
commit 5652546986
40 changed files with 900 additions and 548 deletions

View File

@@ -27,6 +27,9 @@
extern (C):
debug = PRINTF;
debug(PRINTF) int printf(char*, ...);
/******************************************
* Given a pointer:
* If it is an Object, return that Object.
@@ -54,6 +57,7 @@ Object _d_toObject(void* p)
o = cast(Object)(p - pi.offset);
}
}
debug(PRINTF) printf("toObject = %p\n", o);
return o;
}
@@ -75,6 +79,7 @@ Object _d_interface_cast(void* p, ClassInfo c)
o = cast(Object)(p - pi.offset);
return _d_dynamic_cast(o, c);
}
debug(PRINTF) printf("_d_interface_cast = %p\n", o);
return o;
}
@@ -82,7 +87,7 @@ Object _d_dynamic_cast(Object o, ClassInfo c)
{ ClassInfo oc;
size_t offset = 0;
//printf("_d_dynamic_cast(o = %p, c = '%.*s')\n", o, c.name);
debug(PRINTF) printf("_d_dynamic_cast(o = %p, c = '%.*s')\n", o, c.name.length, c.name.ptr);
if (o)
{
@@ -96,16 +101,20 @@ Object _d_dynamic_cast(Object o, ClassInfo c)
o = null;
}
//printf("\tresult = %p\n", o);
debug(PRINTF) printf("_d_dynamic_cast = %p\n", o);
return o;
}
int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset)
{ int i;
debug(PRINTF) printf("_d_isbaseof2(%.*s, %.*s, %ul)\n", oc.name.length, oc.name.ptr, c.name.length, c.name.ptr, offset);
if (oc is c)
return 1;
do
{
debug(PRINTF) printf("oc.interfaces.length = %ul\n", oc.interfaces.length);
if (oc.base is c)
return 1;
for (i = 0; i < oc.interfaces.length; i++)
@@ -113,6 +122,7 @@ int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset)
ClassInfo ic;
ic = oc.interfaces[i].classinfo;
debug(PRINTF) printf("checking %.*s\n", ic.name.length, ic.name.ptr);
if (ic is c)
{ offset = cast(size_t)oc.interfaces[i].offset;
return 1;

View File

@@ -25,6 +25,7 @@ public import tango.io.model.IBuffer,
extern (C)
{
protected void * memcpy (void *dst, void *src, uint);
private int printf(char*, ...);
}
/*******************************************************************************
@@ -163,10 +164,14 @@ class Buffer : IBuffer
this (IConduit conduit)
{
printf("Buffer.this(%p)\n", conduit);
assert (conduit !is null);
assert (conduit);
this (conduit.bufferSize);
setConduit (conduit);
assert(this !is null);
}
/***********************************************************************
@@ -221,7 +226,8 @@ class Buffer : IBuffer
this (uint capacity = 0)
{
setContent (new ubyte[capacity], 0);
setContent (new ubyte[capacity], 0);
assert(this !is null);
}
/***********************************************************************

View File

@@ -23,6 +23,7 @@ private import tango.io.Buffer,
version (Posix)
private import tango.stdc.posix.unistd; // needed for isatty()
private extern(C) int printf(char*, ...);
/*******************************************************************************
@@ -69,6 +70,8 @@ struct Console
private this (Conduit conduit, bool redirected)
{
printf("Console.Input.this(%p, %d)\n", conduit, redirected);
assert (conduit);
redirect = redirected;
buffer = new Buffer (conduit);
}
@@ -596,6 +599,7 @@ struct Console
private this (Handle handle)
{
printf("Console.Conduit.this(%d)\n", handle);
reopen (handle);
redirected = (isatty(handle) is 0);
}
@@ -621,14 +625,13 @@ static Console.Output Cout, /// the standard output stream
******************************************************************************/
extern(C) int printf(char*, ...);
static this ()
{
printf("STATIC INIT FOR CONSOLE\n");
printf("Cin\n");
printf("Cin conduit\n");
auto conduit = new Console.Conduit (0);
assert(conduit);
printf("Cin input\n");
Cin = new Console.Input (conduit, conduit.redirected);
printf("Cout\n");

View File

@@ -18,6 +18,8 @@ public import tango.io.Conduit;
private import tango.core.Exception;
private extern(C) int printf(char*, ...);
/*******************************************************************************
Implements a means of reading and writing a file device. Conduits