X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fprint.c;h=cdb75af338292099fe928d88f46dbad8b3398ea2;hb=ac155f65fdad732a944b5217c90d8340818e0c0a;hp=afbbf0d5b83476b57eebe3c1f35bb332c551695a;hpb=d8bd7eee3147c839d3c74d1823c139cd54867a75;p=chise%2Fxemacs-chise.git- diff --git a/src/print.c b/src/print.c index afbbf0d..cdb75af 100644 --- a/src/print.c +++ b/src/print.c @@ -509,19 +509,19 @@ write_c_string (const char *str, Lisp_Object stream) DEFUN ("write-char", Fwrite_char, 1, 2, 0, /* -Output character CH to stream STREAM. +Output character CHARACTER to stream STREAM. STREAM defaults to the value of `standard-output' (which see). */ - (ch, stream)) + (character, stream)) { /* This function can GC */ Bufbyte str[MAX_EMCHAR_LEN]; Bytecount len; - CHECK_CHAR_COERCE_INT (ch); - len = set_charptr_emchar (str, XCHAR (ch)); + CHECK_CHAR_COERCE_INT (character); + len = set_charptr_emchar (str, XCHAR (character)); output_string (canonicalize_printcharfun (stream), str, Qnil, 0, len); - return ch; + return character; } void @@ -673,7 +673,7 @@ DEFUN ("princ", Fprinc, 1, 2, 0, /* Output the printed representation of OBJECT, any Lisp object. No quoting characters are used; no delimiters are printed around the contents of strings. -Output stream is STREAM, or value of standard-output (which see). +Output stream is STREAM, or value of `standard-output' (which see). */ (object, stream)) { @@ -935,18 +935,19 @@ float_to_string (char *buf, double data) } #endif /* LISP_FLOAT_TYPE */ -/* Print NUMBER to BUFFER. This is equivalent to sprintf(buffer, - "%ld", number), only much faster. +/* Print NUMBER to BUFFER. + This is equivalent to sprintf (buffer, "%ld", number), only much faster. BUFFER should accept 24 bytes. This should suffice for the longest numbers on 64-bit machines, including the `-' sign and the trailing - \0. */ -void + '\0'. Returns a pointer to the trailing '\0'. */ +char * long_to_string (char *buffer, long number) { #if (SIZEOF_LONG != 4) && (SIZEOF_LONG != 8) /* Huh? */ sprintf (buffer, "%ld", number); + return buffer + strlen (buffer); #else /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */ char *p = buffer; int force = 0; @@ -984,6 +985,7 @@ long_to_string (char *buffer, long number) #undef FROB *p++ = number + '0'; *p = '\0'; + return p; #endif /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */ } @@ -1420,6 +1422,7 @@ print_symbol (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) write_char_internal ("#", printcharfun); print_internal (XCDR (tem), printcharfun, escapeflag); write_char_internal ("#", printcharfun); + UNGCPRO; return; } else @@ -1604,22 +1607,24 @@ the output also will be logged to this file. } DEFUN ("open-termscript", Fopen_termscript, 1, 1, "FOpen termscript file: ", /* -Start writing all terminal output to FILE as well as the terminal. -FILE = nil means just close any termscript file currently open. +Start writing all terminal output to FILENAME as well as the terminal. +FILENAME = nil means just close any termscript file currently open. */ - (file)) + (filename)) { /* This function can GC */ if (termscript != 0) - fclose (termscript); - termscript = 0; + { + fclose (termscript); + termscript = 0; + } - if (! NILP (file)) + if (! NILP (filename)) { - file = Fexpand_file_name (file, Qnil); - termscript = fopen ((char *) XSTRING_DATA (file), "w"); + filename = Fexpand_file_name (filename, Qnil); + termscript = fopen ((char *) XSTRING_DATA (filename), "w"); if (termscript == NULL) - report_file_error ("Opening termscript", list1 (file)); + report_file_error ("Opening termscript", list1 (filename)); } return Qnil; }