diff lphobos/std/format.d @ 131:5825d48b27d1 trunk

[svn r135] * Merged DMD 1.025 * * Fixed a minor linking order mishap * * Added an command line option -annotate * * Fixed some problems with running optimizations * * Added std.stdio and dependencies to lphobos (still not 100% working, but compiles and links) * * Fixed problems with passing aggregate types to variadic functions * * Added initial code towards full GC support, currently based on malloc and friends, not all the runtime calls the GC yet for memory * * Fixed problems with resolving nested function context pointers for some heavily nested cases * * Redid function argument passing + other minor code cleanups, still lots to do on this end... *
author lindquist
date Fri, 04 Jan 2008 01:38:42 +0100
parents 5ce8ab11e75a
children 88e23f8c2354
line wrap: on
line diff
--- a/lphobos/std/format.d	Fri Dec 28 23:52:40 2007 +0100
+++ b/lphobos/std/format.d	Fri Jan 04 01:38:42 2008 +0100
@@ -170,15 +170,12 @@
       ti = typeid(idouble);break;
     case Mangle.Tireal:
       ti = typeid(ireal);break;
-    /+
-    // No complex in LLVMDC yes
     case Mangle.Tcfloat:
       ti = typeid(cfloat);break;
     case Mangle.Tcdouble:
       ti = typeid(cdouble);break;
     case Mangle.Tcreal:
       ti = typeid(creal);break;
-    +/
     case Mangle.Tchar:
       ti = typeid(char);break;
     case Mangle.Twchar:
@@ -450,7 +447,8 @@
  */
 
 void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, void* argptr)
-{   int j;
+{   //printf("doFormat(...)\n");
+    int j;
     TypeInfo ti;
     Mangle m;
     uint flags;
@@ -503,7 +501,7 @@
 
 	void putstr(char[] s)
 	{
-	    //printf("flags = x%x\n", flags);
+	    //printf("flags = 0x%x\n", flags);
 	    int prepad = 0;
 	    int postpad = 0;
 	    int padding = field_width - (strlen(prefix) + s.length);
@@ -539,7 +537,8 @@
 
 	void putreal(real v)
 	{
-	    //printf("putreal %Lg\n", vreal);
+	    //printf("putreal %Lg\n", vreal); // no 80 bit float
+        //printf("putreal %g\n", vreal);
 
 	    switch (fc)
 	    {
@@ -593,9 +592,11 @@
 		format[i + 0] = '*';
 		format[i + 1] = '.';
 		format[i + 2] = '*';
-		format[i + 3] = 'L';
-		format[i + 4] = fc;
-		format[i + 5] = 0;
+        format[i + 3] = fc;
+        format[i + 4] = 0;
+		//format[i + 3] = 'L'; // no 80 bit yet
+		//format[i + 4] = fc;
+		//format[i + 5] = 0;
 		if (!(flags & FLprecision))
 		    precision = -1;
 		while (1)
@@ -638,7 +639,8 @@
 	  auto tiSave = ti;
 	  auto mSave = m;
 	  ti = valti;
-	  //printf("\n%.*s\n", valti.classinfo.name);
+      auto className = valti.classinfo.name;
+	  printf("\n%.*s\n", className.length, className.ptr);
 	  m = getMan(valti);
 	  while (len--)
 	  {
@@ -831,10 +833,12 @@
 		goto Lcomplex;
 
 	    case Mangle.Tsarray:
+        //printf("static array\n");
 		putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, (cast(TypeInfo_StaticArray)ti).next);
 		return;
 
 	    case Mangle.Tarray:
+        //printf("dynamic array\n");
 		int mi = 10;
 	        if (ti.classinfo.name.length == 14 &&
 		    ti.classinfo.name[9..14] == "Array") 
@@ -863,6 +867,7 @@
 		  return;
 		}
 
+        //printf("primitive type\n");
 		while (1)
 		{
 		    m2 = cast(Mangle)ti.classinfo.name[mi];
@@ -897,6 +902,7 @@
 			    continue;
 
 			default:
+                //printf("primitive type default handling\n");
 			    TypeInfo ti2 = primitiveTypeInfo(m2);
 			    if (!ti2)
 			      goto Lerror;
@@ -1058,9 +1064,10 @@
     }
 
 
+    //printf("arguments length: %u\n", arguments.length);
     for (j = 0; j < arguments.length; )
     {	ti = arguments[j++];
-	//printf("test1: '%.*s' %d\n", ti.classinfo.name, ti.classinfo.name.length);
+	//printf("test1: '%.*s' %d\n", ti.classinfo.name.length, ti.classinfo.name.ptr, ti.classinfo.name.length);
 	//ti.print();
 
 	flags = 0;