projects
/
chise
/
xemacs-chise.git.1
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
This commit was generated by cvs2svn to compensate for changes in r4946,
[chise/xemacs-chise.git.1]
/
src
/
doprnt.c
diff --git
a/src/doprnt.c
b/src/doprnt.c
index
b224d50
..
5dac446
100644
(file)
--- a/
src/doprnt.c
+++ b/
src/doprnt.c
@@
-31,13
+31,13
@@
Boston, MA 02111-1307, USA. */
#include "buffer.h"
#include "lstream.h"
#include "buffer.h"
#include "lstream.h"
-static const char *valid_flags = "-+ #0";
+static CONST char *valid_flags = "-+ #0";
-static const char *valid_converters = "diouxXfeEgGcsS";
-static const char *int_converters = "dic";
-static const char *unsigned_int_converters = "ouxX";
-static const char *double_converters = "feEgG";
-static const char *string_converters = "sS";
+static CONST char *valid_converters = "diouxXfeEgGcsS";
+static CONST char *int_converters = "dic";
+static CONST char *unsigned_int_converters = "ouxX";
+static CONST char *double_converters = "feEgG";
+static CONST char *string_converters = "sS";
typedef struct printf_spec printf_spec;
struct printf_spec
typedef struct printf_spec printf_spec;
struct printf_spec
@@
-99,7
+99,7
@@
typedef struct
Note that MINLEN and MAXLEN are Charcounts but LEN is a Bytecount. */
static void
Note that MINLEN and MAXLEN are Charcounts but LEN is a Bytecount. */
static void
-doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len,
+doprnt_1 (Lisp_Object stream, CONST Bufbyte *string, Bytecount len,
Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag)
{
Charcount cclen;
Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag)
{
Charcount cclen;
@@
-140,8
+140,8
@@
doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len,
}
}
}
}
-static const Bufbyte *
-parse_off_posnum (const Bufbyte *start, const Bufbyte *end, int *returned_num)
+static CONST Bufbyte *
+parse_off_posnum (CONST Bufbyte *start, CONST Bufbyte *end, int *returned_num)
{
Bufbyte arg_convert[100];
REGISTER Bufbyte *arg_ptr = arg_convert;
{
Bufbyte arg_convert[100];
REGISTER Bufbyte *arg_ptr = arg_convert;
@@
-178,17
+178,17
@@
parse_off_posnum (const Bufbyte *start, const Bufbyte *end, int *returned_num)
} while (0)
static printf_spec_dynarr *
} while (0)
static printf_spec_dynarr *
-parse_doprnt_spec (const Bufbyte *format, Bytecount format_length)
+parse_doprnt_spec (CONST Bufbyte *format, Bytecount format_length)
{
{
- const Bufbyte *fmt = format;
- const Bufbyte *fmt_end = format + format_length;
+ CONST Bufbyte *fmt = format;
+ CONST Bufbyte *fmt_end = format + format_length;
printf_spec_dynarr *specs = Dynarr_new (printf_spec);
int prev_argnum = 0;
while (1)
{
struct printf_spec spec;
printf_spec_dynarr *specs = Dynarr_new (printf_spec);
int prev_argnum = 0;
while (1)
{
struct printf_spec spec;
- const Bufbyte *text_end;
+ CONST Bufbyte *text_end;
Bufbyte ch;
xzero (spec);
Bufbyte ch;
xzero (spec);
@@
-216,7
+216,7
@@
parse_doprnt_spec (const Bufbyte *format, Bytecount format_length)
/* Is there a field number specifier? */
{
/* Is there a field number specifier? */
{
- const Bufbyte *ptr;
+ CONST Bufbyte *ptr;
int fieldspec;
ptr = parse_off_posnum (fmt, fmt_end, &fieldspec);
int fieldspec;
ptr = parse_off_posnum (fmt, fmt_end, &fieldspec);
@@
-386,7
+386,7
@@
get_doprnt_args (printf_spec_dynarr *specs, va_list vargs)
if (strchr (int_converters, ch))
{
if (spec->h_flag)
if (strchr (int_converters, ch))
{
if (spec->h_flag)
- arg.i = va_arg (vargs, int /* short */);
+ arg.i = va_arg (vargs, short);
else if (spec->l_flag)
arg.l = va_arg (vargs, long);
else
else if (spec->l_flag)
arg.l = va_arg (vargs, long);
else
@@
-395,7
+395,7
@@
get_doprnt_args (printf_spec_dynarr *specs, va_list vargs)
else if (strchr (unsigned_int_converters, ch))
{
if (spec->h_flag)
else if (strchr (unsigned_int_converters, ch))
{
if (spec->h_flag)
- arg.ui = va_arg (vargs, unsigned int /* unsigned short */);
+ arg.ui = va_arg (vargs, unsigned short);
else if (spec->l_flag)
arg.ul = va_arg (vargs, unsigned long);
else
else if (spec->l_flag)
arg.ul = va_arg (vargs, unsigned long);
else
@@
-423,11
+423,11
@@
get_doprnt_args (printf_spec_dynarr *specs, va_list vargs)
to the arguments. */
static Bytecount
to the arguments. */
static Bytecount
-emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_1 (Lisp_Object stream, CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
int nargs,
/* #### Gag me, gag me, gag me */
Lisp_Object format_reloc, Bytecount format_length,
int nargs,
/* #### Gag me, gag me, gag me */
- const Lisp_Object *largs, va_list vargs)
+ CONST Lisp_Object *largs, va_list vargs)
{
printf_spec_dynarr *specs = 0;
printf_arg_dynarr *args = 0;
{
printf_spec_dynarr *specs = 0;
printf_arg_dynarr *args = 0;
@@
-440,7
+440,7
@@
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
format_length = XSTRING_LENGTH (format_reloc);
}
if (format_length < 0)
format_length = XSTRING_LENGTH (format_reloc);
}
if (format_length < 0)
- format_length = (Bytecount) strlen ((const char *) format_nonreloc);
+ format_length = (Bytecount) strlen ((CONST char *) format_nonreloc);
specs = parse_doprnt_spec (format_nonreloc, format_length);
if (largs)
specs = parse_doprnt_spec (format_nonreloc, format_length);
if (largs)
@@
-538,7
+538,7
@@
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
else
{
Lisp_Object obj = largs[spec->argnum - 1];
else
{
Lisp_Object obj = largs[spec->argnum - 1];
- Lisp_String *ls;
+ struct Lisp_String *ls;
if (ch == 'S')
{
if (ch == 'S')
{
@@
-576,7
+576,7
@@
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
{
Lisp_Object obj = largs[spec->argnum - 1];
if (CHARP (obj))
{
Lisp_Object obj = largs[spec->argnum - 1];
if (CHARP (obj))
- obj = make_int (XCHAR (obj));
+ CHECK_INT_COERCE_CHAR (obj);
if (!INT_OR_FLOATP (obj))
{
error ("format specifier %%%c doesn't match argument type",
if (!INT_OR_FLOATP (obj))
{
error ("format specifier %%%c doesn't match argument type",
@@
-657,21
+657,16
@@
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
long_to_string (constructed_spec + strlen (constructed_spec),
spec->precision);
}
long_to_string (constructed_spec + strlen (constructed_spec),
spec->precision);
}
+ sprintf (constructed_spec + strlen (constructed_spec), "%c", ch);
/* sprintf the mofo */
/* we have to use separate calls to sprintf(), rather than
a single big conditional, because of the different types
of the arguments */
if (strchr (double_converters, ch))
/* sprintf the mofo */
/* we have to use separate calls to sprintf(), rather than
a single big conditional, because of the different types
of the arguments */
if (strchr (double_converters, ch))
- {
- sprintf (constructed_spec + strlen (constructed_spec),
- "%c", ch);
- sprintf (text_to_print, constructed_spec, arg.d);
- }
+ sprintf (text_to_print, constructed_spec, arg.d);
else if (strchr (unsigned_int_converters, ch))
{
else if (strchr (unsigned_int_converters, ch))
{
- sprintf (constructed_spec + strlen (constructed_spec),
- "%c", ch);
if (spec->l_flag)
sprintf (text_to_print, constructed_spec, arg.ul);
else
if (spec->l_flag)
sprintf (text_to_print, constructed_spec, arg.ul);
else
@@
-679,12
+674,6
@@
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
}
else
{
}
else
{
- if (spec->zero_flag && spec->minwidth)
- sprintf (constructed_spec + strlen (constructed_spec),
- "0%d%c", spec->minwidth, ch);
- else
- sprintf (constructed_spec + strlen (constructed_spec),
- "%c", ch);
if (spec->l_flag)
sprintf (text_to_print, constructed_spec, arg.l);
else
if (spec->l_flag)
sprintf (text_to_print, constructed_spec, arg.l);
else
@@
-708,9
+697,9
@@
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
/* You really don't want to know why this is necessary... */
static Bytecount
/* You really don't want to know why this is necessary... */
static Bytecount
-emacs_doprnt_2 (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_2 (Lisp_Object stream, CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length, int nargs,
Lisp_Object format_reloc, Bytecount format_length, int nargs,
- const Lisp_Object *largs, ...)
+ CONST Lisp_Object *largs, ...)
{
va_list vargs;
Bytecount val;
{
va_list vargs;
Bytecount val;
@@
-743,7
+732,7
@@
emacs_doprnt_2 (Lisp_Object stream, const Bufbyte *format_nonreloc,
parameter, because this function can cause GC. */
Bytecount
parameter, because this function can cause GC. */
Bytecount
-emacs_doprnt_c (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_c (Lisp_Object stream, CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
...)
{
Lisp_Object format_reloc, Bytecount format_length,
...)
{
@@
-760,7
+749,7
@@
emacs_doprnt_c (Lisp_Object stream, const Bufbyte *format_nonreloc,
/* Like emacs_doprnt_c but the args come in va_list format. */
Bytecount
/* Like emacs_doprnt_c but the args come in va_list format. */
Bytecount
-emacs_doprnt_va (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_va (Lisp_Object stream, CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
va_list vargs)
{
Lisp_Object format_reloc, Bytecount format_length,
va_list vargs)
{
@@
-774,9
+763,9
@@
emacs_doprnt_va (Lisp_Object stream, const Bufbyte *format_nonreloc,
See `format' for a description of this behavior. */
Bytecount
See `format' for a description of this behavior. */
Bytecount
-emacs_doprnt_lisp (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_lisp (Lisp_Object stream, CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
Lisp_Object format_reloc, Bytecount format_length,
- int nargs, const Lisp_Object *largs)
+ int nargs, CONST Lisp_Object *largs)
{
return emacs_doprnt_2 (stream, format_nonreloc, format_reloc,
format_length, nargs, largs);
{
return emacs_doprnt_2 (stream, format_nonreloc, format_reloc,
format_length, nargs, largs);
@@
-785,7
+774,7
@@
emacs_doprnt_lisp (Lisp_Object stream, const Bufbyte *format_nonreloc,
/* Like the previous function but takes a variable number of arguments. */
Bytecount
/* Like the previous function but takes a variable number of arguments. */
Bytecount
-emacs_doprnt_lisp_2 (Lisp_Object stream, const Bufbyte *format_nonreloc,
+emacs_doprnt_lisp_2 (Lisp_Object stream, CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
int nargs, ...)
{
Lisp_Object format_reloc, Bytecount format_length,
int nargs, ...)
{
@@
-807,7
+796,7
@@
emacs_doprnt_lisp_2 (Lisp_Object stream, const Bufbyte *format_nonreloc,
to a stream. */
Lisp_Object
to a stream. */
Lisp_Object
-emacs_doprnt_string_c (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_c (CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
...)
{
Lisp_Object format_reloc, Bytecount format_length,
...)
{
@@
-830,7
+819,7
@@
emacs_doprnt_string_c (const Bufbyte *format_nonreloc,
}
Lisp_Object
}
Lisp_Object
-emacs_doprnt_string_va (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_va (CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
va_list vargs)
{
Lisp_Object format_reloc, Bytecount format_length,
va_list vargs)
{
@@
-853,9
+842,9
@@
emacs_doprnt_string_va (const Bufbyte *format_nonreloc,
}
Lisp_Object
}
Lisp_Object
-emacs_doprnt_string_lisp (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_lisp (CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
Lisp_Object format_reloc, Bytecount format_length,
- int nargs, const Lisp_Object *largs)
+ int nargs, CONST Lisp_Object *largs)
{
Lisp_Object obj;
Lisp_Object stream = make_resizing_buffer_output_stream ();
{
Lisp_Object obj;
Lisp_Object stream = make_resizing_buffer_output_stream ();
@@
-873,7
+862,7
@@
emacs_doprnt_string_lisp (const Bufbyte *format_nonreloc,
}
Lisp_Object
}
Lisp_Object
-emacs_doprnt_string_lisp_2 (const Bufbyte *format_nonreloc,
+emacs_doprnt_string_lisp_2 (CONST Bufbyte *format_nonreloc,
Lisp_Object format_reloc, Bytecount format_length,
int nargs, ...)
{
Lisp_Object format_reloc, Bytecount format_length,
int nargs, ...)
{