projects
/
chise
/
xemacs-chise.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(M-01418): Unify JC3-43DE.
[chise/xemacs-chise.git]
/
src
/
print.c
diff --git
a/src/print.c
b/src/print.c
index
f98c244
..
cdb75af
100644
(file)
--- a/
src/print.c
+++ b/
src/print.c
@@
-52,7
+52,11
@@
Lisp_Object Vstandard_output, Qstandard_output;
/* The subroutine object for external-debugging-output is kept here
for the convenience of the debugger. */
/* The subroutine object for external-debugging-output is kept here
for the convenience of the debugger. */
-Lisp_Object Qexternal_debugging_output;
+Lisp_Object Qexternal_debugging_output, Qalternate_debugging_output;
+
+#ifdef HAVE_MS_WINDOWS
+Lisp_Object Qmswindows_debugging_output;
+#endif
/* Avoid actual stack overflow in print. */
static int print_depth;
/* Avoid actual stack overflow in print. */
static int print_depth;
@@
-105,10
+109,6
@@
FILE *termscript; /* Stdio stream being used for copy of all output. */
int stdout_needs_newline;
int stdout_needs_newline;
-#ifdef WIN32_NATIVE
-static int no_useful_stderr;
-#endif
-
static void
std_handle_out_external (FILE *stream, Lisp_Object lstream,
const Extbyte *extptr, Extcount extlen,
static void
std_handle_out_external (FILE *stream, Lisp_Object lstream,
const Extbyte *extptr, Extcount extlen,
@@
-120,12
+120,14
@@
std_handle_out_external (FILE *stream, Lisp_Object lstream,
if (stream)
{
#ifdef WIN32_NATIVE
if (stream)
{
#ifdef WIN32_NATIVE
- if (!no_useful_stderr)
- no_useful_stderr = GetStdHandle (STD_ERROR_HANDLE) == 0 ? 1 : -1;
+ HANDLE errhand = GetStdHandle (STD_INPUT_HANDLE);
+ int no_useful_stderr = errhand == 0 || errhand == INVALID_HANDLE_VALUE;
+ if (!no_useful_stderr)
+ no_useful_stderr = !PeekNamedPipe (errhand, 0, 0, 0, 0, 0);
/* we typically have no useful stdout/stderr under windows if we're
being invoked graphically. */
/* we typically have no useful stdout/stderr under windows if we're
being invoked graphically. */
- if (!noninteractive || no_useful_stderr > 0)
+ if (no_useful_stderr)
mswindows_output_console_string (extptr, extlen);
else
#endif
mswindows_output_console_string (extptr, extlen);
else
#endif
@@
-189,7
+191,7
@@
std_handle_out_va (FILE *stream, const char *fmt, va_list args)
extptr = (Extbyte *) kludge;
extlen = (Extcount) strlen ((char *) kludge);
}
extptr = (Extbyte *) kludge;
extlen = (Extcount) strlen ((char *) kludge);
}
-
+
std_handle_out_external (stream, Qnil, extptr, extlen, 1, 1);
return retval;
}
std_handle_out_external (stream, Qnil, extptr, extlen, 1, 1);
return retval;
}
@@
-507,19
+509,19
@@
write_c_string (const char *str, Lisp_Object stream)
\f
DEFUN ("write-char", Fwrite_char, 1, 2, 0, /*
\f
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).
*/
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;
{
/* 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);
output_string (canonicalize_printcharfun (stream), str, Qnil, 0, len);
- return ch;
+ return character;
}
void
}
void
@@
-671,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 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))
{
*/
(object, stream))
{
@@
-933,18
+935,19
@@
float_to_string (char *buf, double data)
}
#endif /* LISP_FLOAT_TYPE */
}
#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
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);
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;
#else /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
char *p = buffer;
int force = 0;
@@
-982,6
+985,7
@@
long_to_string (char *buffer, long number)
#undef FROB
*p++ = number + '0';
*p = '\0';
#undef FROB
*p++ = number + '0';
*p = '\0';
+ return p;
#endif /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
}
\f
#endif /* (SIZEOF_LONG == 4) || (SIZEOF_LONG == 8) */
}
\f
@@
-1404,7
+1408,7
@@
print_symbol (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
the flag print-gensym is non-nil, prefix it with #n= to read the
object back with the #n# reader syntax later if needed. */
if (!NILP (Vprint_gensym)
the flag print-gensym is non-nil, prefix it with #n= to read the
object back with the #n# reader syntax later if needed. */
if (!NILP (Vprint_gensym)
- /* #### Test whether this produces a noticable slow-down for
+ /* #### Test whether this produces a noticeable slow-down for
printing when print-gensym is non-nil. */
&& !EQ (obj, oblookup (Vobarray,
string_data (symbol_name (XSYMBOL (obj))),
printing when print-gensym is non-nil. */
&& !EQ (obj, oblookup (Vobarray,
string_data (symbol_name (XSYMBOL (obj))),
@@
-1418,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);
write_char_internal ("#", printcharfun);
print_internal (XCDR (tem), printcharfun, escapeflag);
write_char_internal ("#", printcharfun);
+ UNGCPRO;
return;
}
else
return;
}
else
@@
-1512,13
+1517,9
@@
print_symbol (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
UNGCPRO;
}
\f
UNGCPRO;
}
\f
-/* #ifdef DEBUG_XEMACS */
-/* I don't like seeing `Note: Strange doc (not fboundp) for function
- alternate-debugging-output @ 429542' -slb */
-/* #### Eek! Any clue how to get rid of it? In fact, how about
- getting rid of this function altogether? Does anything actually
- *use* it? --hniksic */
+/* Useful on systems or in places where writing to stdout is unavailable or
+ not working. */
static int alternate_do_pointer;
static char alternate_do_string[5000];
static int alternate_do_pointer;
static char alternate_do_string[5000];
@@
-1546,7
+1547,6
@@
to 0.
alternate_do_string[alternate_do_pointer] = 0;
return character;
}
alternate_do_string[alternate_do_pointer] = 0;
return character;
}
-/* #endif / * DEBUG_XEMACS */
DEFUN ("external-debugging-output", Fexternal_debugging_output, 1, 3, 0, /*
Write CHAR-OR-STRING to stderr or stdout.
DEFUN ("external-debugging-output", Fexternal_debugging_output, 1, 3, 0, /*
Write CHAR-OR-STRING to stderr or stdout.
@@
-1607,22
+1607,24
@@
the output also will be logged to this file.
}
DEFUN ("open-termscript", Fopen_termscript, 1, 1, "FOpen termscript 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)
{
/* 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)
if (termscript == NULL)
- report_file_error ("Opening termscript", list1 (file));
+ report_file_error ("Opening termscript", list1 (filename));
}
return Qnil;
}
}
return Qnil;
}
@@
-1658,6
+1660,12
@@
debug_print_no_newline (Lisp_Object debug_print_obj)
Vprint_level = make_int (debug_print_level);
print_internal (debug_print_obj, Qexternal_debugging_output, 1);
Vprint_level = make_int (debug_print_level);
print_internal (debug_print_obj, Qexternal_debugging_output, 1);
+ alternate_do_pointer = 0;
+ print_internal (debug_print_obj, Qalternate_debugging_output, 1);
+#ifdef WIN32_NATIVE
+ /* Write out to the debugger, as well */
+ print_internal (debug_print_obj, Qmswindows_debugging_output, 1);
+#endif
Vinhibit_quit = save_Vinhibit_quit;
Vprint_level = save_Vprint_level;
Vinhibit_quit = save_Vinhibit_quit;
Vprint_level = save_Vprint_level;
@@
-1783,6
+1791,10
@@
syms_of_print (void)
DEFSUBR (Fexternal_debugging_output);
DEFSUBR (Fopen_termscript);
defsymbol (&Qexternal_debugging_output, "external-debugging-output");
DEFSUBR (Fexternal_debugging_output);
DEFSUBR (Fopen_termscript);
defsymbol (&Qexternal_debugging_output, "external-debugging-output");
+ defsymbol (&Qalternate_debugging_output, "alternate-debugging-output");
+#ifdef HAVE_MS_WINDOWS
+ defsymbol (&Qmswindows_debugging_output, "mswindows-debugging-output");
+#endif
DEFSUBR (Fwith_output_to_temp_buffer);
}
DEFSUBR (Fwith_output_to_temp_buffer);
}