Commit in freeldr/freeldr on MAIN
include/rtl.h+11.7 -> 1.8
rtl/print.c+37-31.5 -> 1.6
   /stdlib.c+401.4 -> 1.5
debug.c+20-21.20 -> 1.21
+98-5
4 modified files
- Implemented the printing of 64 bit numbers.

freeldr/freeldr/include
rtl.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- rtl.h	25 Apr 2003 09:45:17 -0000	1.7
+++ rtl.h	17 May 2004 20:25:01 -0000	1.8
@@ -70,6 +70,7 @@
 int		isxdigit(int c);
 
 char *	convert_to_ascii(char *buf, int c, ...);
+char *	convert_i64_to_ascii(char *buf, int c, ...);
 
 void	putchar(int ch);		// Implemented in asmcode.S
 int		kbhit(void);			// Implemented in asmcode.S

freeldr/freeldr/rtl
print.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- print.c	19 Jan 2003 01:04:01 -0000	1.5
+++ print.c	17 May 2004 20:25:01 -0000	1.6
@@ -38,6 +38,7 @@
 {
 	int *dataptr = (int *) &format;
 	char c, *ptr, str[16];
+	int ll;
 
 	dataptr++;
 
@@ -49,10 +50,26 @@
 		}
 		else
 		{
+			if (*format == 'I' && *(format+1) == '6' && *(format+2) == '4')
+			{
+				ll = 1;
+				format += 3;
+			}
+			else
+			{
+				ll = 0;
+			}
 			switch (c = *(format++))
 			{
 			case 'd': case 'u': case 'x':
-				*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
+				if (ll)
+				{
+					*convert_i64_to_ascii(str, c, *((unsigned long long *) dataptr++)) = 0;
+				}
+				else
+				{
+					*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
+				}
 
 				ptr = str;
 
@@ -88,6 +105,7 @@
 	int *dataptr = (int *) &format;
 	char c, *ptr, str[16];
 	char *p = buffer;
+	int ll;
 
 	dataptr++;
 
@@ -100,11 +118,27 @@
 		}
 		else
 		{
+			if (*format == 'I' && *(format+1) == '6' && *(format+2) == '4')
+			{
+				ll = 1;
+				format += 3;
+			}
+			else
+			{
+				ll = 0;
+			}
 			switch (c = *(format++))
 			{
 			case 'd': case 'u': case 'x':
-				*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
-
+				if (ll)
+				{
+					*convert_i64_to_ascii(str, c, *((unsigned long long*) dataptr++)) = 0;
+				}
+				else
+				{
+					*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
+				}
+					
 				ptr = str;
 
 				while (*ptr)

freeldr/freeldr/rtl
stdlib.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- stdlib.c	19 Jan 2003 01:04:01 -0000	1.4
+++ stdlib.c	17 May 2004 20:25:01 -0000	1.5
@@ -63,6 +63,46 @@
   return ptr;
 }
 
+char *convert_i64_to_ascii(char *buf, int c, ...)
+{
+  unsigned long long num = *(long long*)((&c) + 1);
+  int mult = 10;
+  char *ptr = buf;
+
+  if (c == 'x')
+    mult = 16;
+
+  if ((num & 0x8000000000000000uLL) && c == 'd')
+    {
+      num = (~num)+1;
+      *(ptr++) = '-';
+      buf++;
+    }
+
+  do
+    {
+      int dig = num % mult;
+      *(ptr++) = ( (dig > 9) ? dig + 'a' - 10 : '0' + dig );
+    }
+  while (num /= mult);
+
+  /* reorder to correct direction!! */
+  {
+    char *ptr1 = ptr-1;
+    char *ptr2 = buf;
+    while (ptr1 > ptr2)
+      {
+	int c = *ptr1;
+	*ptr1 = *ptr2;
+	*ptr2 = c;
+	ptr1--;
+	ptr2++;
+      }
+  }
+
+  return ptr;
+}
+
 char *itoa(int value, char *string, int radix)
 {
 	if(radix == 16)

freeldr/freeldr
debug.c 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- debug.c	5 Jun 2003 20:06:47 -0000	1.20
+++ debug.c	17 May 2004 20:25:01 -0000	1.21
@@ -234,6 +234,7 @@
 {
 	int *dataptr = (int *) &format;
 	char c, *ptr, str[16];
+	int ll;
 	
 	// Mask out unwanted debug messages
 	if (!(Mask & DebugPrintMask))
@@ -249,7 +250,7 @@
 	}
 
 	dataptr++;
-
+	ll = 0;
 	while ((c = *(format++)))
 	{
 		if (c != '%')
@@ -258,11 +259,28 @@
 		}
 		else
 		{
+			if (*format == 'I' && *(format+1) == '6' && *(format+2) == '4')
+			{
+				ll = 1;
+				format += 3;
+			}
+			else
+			{
+				ll = 0;
+			}
 			switch (c = *(format++))
 			{
 			case 'd': case 'u': case 'x':
 				
-				*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
+				if (ll)
+				{
+					*convert_i64_to_ascii(str, c, *((unsigned long long*) dataptr)) = 0;
+					dataptr += 2;
+				}
+				else
+				{
+					*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
+				}
 
 				ptr = str;
 
CVSspam 0.2.8