comparison src/print.c @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents 576fb035e263
children 183866b06e0b
comparison
equal deleted inserted replaced
445:34f3776fcf0e 446:1ccc32a20af4
933 buf [(buf [0] == '-' ? 1 : 0)] = '0'; 933 buf [(buf [0] == '-' ? 1 : 0)] = '0';
934 } 934 }
935 } 935 }
936 #endif /* LISP_FLOAT_TYPE */ 936 #endif /* LISP_FLOAT_TYPE */
937 937
938 /* Print NUMBER to BUFFER. This is equivalent to sprintf(buffer, 938 /* Print NUMBER to BUFFER.
939 "%ld", number), only much faster. 939 This is equivalent to sprintf (buffer, "%ld", number), only much faster.
940 940
941 BUFFER should accept 24 bytes. This should suffice for the longest 941 BUFFER should accept 24 bytes. This should suffice for the longest
942 numbers on 64-bit machines, including the `-' sign and the trailing 942 numbers on 64-bit machines, including the `-' sign and the trailing
943 \0. */ 943 '\0'. Returns a pointer to the trailing '\0'. */
944 void 944 char *
945 long_to_string (char *buffer, long number) 945 long_to_string (char *buffer, long number)
946 { 946 {
947 #if (SIZEOF_LONG != 4) && (SIZEOF_LONG != 8) 947 #if (SIZEOF_LONG != 4) && (SIZEOF_LONG != 8)
948 /* Huh? */ 948 /* Huh? */
949 sprintf (buffer, "%ld", number); 949 sprintf (buffer, "%ld", number);
950 return buffer + strlen (buffer);
950 #else /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */ 951 #else /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
951 char *p = buffer; 952 char *p = buffer;
952 int force = 0; 953 int force = 0;
953 954
954 if (number < 0) 955 if (number < 0)
982 FROB (100); 983 FROB (100);
983 FROB (10); 984 FROB (10);
984 #undef FROB 985 #undef FROB
985 *p++ = number + '0'; 986 *p++ = number + '0';
986 *p = '\0'; 987 *p = '\0';
988 return p;
987 #endif /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */ 989 #endif /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
988 } 990 }
989 991
990 static void 992 static void
991 print_vector_internal (const char *start, const char *end, 993 print_vector_internal (const char *start, const char *end,
1418 if (CONSP (tem)) 1420 if (CONSP (tem))
1419 { 1421 {
1420 write_char_internal ("#", printcharfun); 1422 write_char_internal ("#", printcharfun);
1421 print_internal (XCDR (tem), printcharfun, escapeflag); 1423 print_internal (XCDR (tem), printcharfun, escapeflag);
1422 write_char_internal ("#", printcharfun); 1424 write_char_internal ("#", printcharfun);
1425 UNGCPRO;
1423 return; 1426 return;
1424 } 1427 }
1425 else 1428 else
1426 { 1429 {
1427 if (CONSP (Vprint_gensym_alist)) 1430 if (CONSP (Vprint_gensym_alist))