1.0.29.44: Complex float improvements
[sbcl.git] / src / runtime / print.c
index 9b86ef2..6f3b505 100644 (file)
@@ -195,12 +195,15 @@ static boolean continue_p(boolean newline)
             printf("More? [y] ");
             fflush(stdout);
 
-            fgets(buffer, sizeof(buffer), stdin);
-
-            if (buffer[0] == 'n' || buffer[0] == 'N')
-                throw_to_monitor();
-            else
+            if (fgets(buffer, sizeof(buffer), stdin)) {
+                if (buffer[0] == 'n' || buffer[0] == 'N')
+                    throw_to_monitor();
+                else
+                    cur_lines = 0;
+            } else {
+                printf("\nUnable to read response, assuming y.\n");
                 cur_lines = 0;
+            }
         }
     }
 
@@ -237,7 +240,8 @@ static void print_fixnum(lispobj obj)
 
 static void brief_otherimm(lispobj obj)
 {
-    int type, c, idx;
+    int type, c;
+    unsigned int idx;
     char buffer[10];
 
     type = widetag_of(obj);
@@ -288,7 +292,9 @@ static void brief_otherimm(lispobj obj)
 
 static void print_otherimm(lispobj obj)
 {
-    int type, idx;
+    int type;
+
+    unsigned int idx;
 
     type = widetag_of(obj);
     idx = type >> 2;
@@ -335,7 +341,7 @@ static void brief_list(lispobj obj)
                 obj = NIL;
                 break;
             }
-            print_obj(NULL, cons->car);
+            print_obj("", cons->car);
             obj = cons->cdr;
             space = 1;
             if (obj == NIL)
@@ -343,7 +349,7 @@ static void brief_list(lispobj obj)
         }
         if (obj != NIL) {
             printf(" . ");
-            print_obj(NULL, obj);
+            print_obj("", obj);
         }
         putchar(')');
     }
@@ -379,7 +385,7 @@ static void brief_struct(lispobj obj)
 static void print_struct(lispobj obj)
 {
     struct instance *instance = (struct instance *)native_pointer(obj);
-    int i;
+    unsigned int i;
     char buffer[16];
     print_obj("type: ", ((struct instance *)native_pointer(obj))->slots[0]);
     for (i = 1; i < HeaderValue(instance->header); i++) {
@@ -543,9 +549,17 @@ static void print_otherptr(lispobj obj)
 #ifdef COMPLEX_SINGLE_FLOAT_WIDETAG
             case COMPLEX_SINGLE_FLOAT_WIDETAG:
                 NEWLINE_OR_RETURN;
+#ifdef LISP_FEATURE_X86_64
+                printf("%g", ((struct complex_single_float *)native_pointer(obj))->data.data[0]);
+#else
                 printf("%g", ((struct complex_single_float *)native_pointer(obj))->real);
+#endif
                 NEWLINE_OR_RETURN;
+#ifdef LISP_FEATURE_X86_64
+                printf("%g", ((struct complex_single_float *)native_pointer(obj))->data.data[1]);
+#else
                 printf("%g", ((struct complex_single_float *)native_pointer(obj))->imag);
+#endif
                 break;
 #endif
 
@@ -731,8 +745,10 @@ static void print_obj(char *prefix, lispobj obj)
         dont_descend = 1;
 
     if (var == NULL &&
-        /* FIXME: What does this "x & y & z & .." expression mean? */
-        (obj & FUN_POINTER_LOWTAG & LIST_POINTER_LOWTAG & INSTANCE_POINTER_LOWTAG & OTHER_POINTER_LOWTAG) != 0)
+        ((obj & LOWTAG_MASK) == FUN_POINTER_LOWTAG ||
+         (obj & LOWTAG_MASK) == LIST_POINTER_LOWTAG ||
+         (obj & LOWTAG_MASK) == INSTANCE_POINTER_LOWTAG ||
+         (obj & LOWTAG_MASK) == OTHER_POINTER_LOWTAG))
         var = define_var(NULL, obj, 0);
 
     if (var != NULL)