| 1 |
/* { dg-skip-if "too many arguments in function call" { bpf-*-* } } */ |
| 2 |
|
| 3 |
typedef __SIZE_TYPE__ size_t; |
| 4 |
typedef unsigned char Bufbyte; |
| 5 |
typedef int Bytecount; |
| 6 |
typedef int Charcount; |
| 7 |
typedef struct lstream Lstream; |
| 8 |
typedef int Lisp_Object; |
| 9 |
extern Lisp_Object Qnil; |
| 10 |
extern inline int |
| 11 |
TRUE_LIST_P (Lisp_Object object) |
| 12 |
{ |
| 13 |
return (( object ) == ( Qnil )) ; |
| 14 |
} |
| 15 |
struct Lisp_String |
| 16 |
{ |
| 17 |
Bytecount _size; |
| 18 |
Bufbyte *_data; |
| 19 |
}; |
| 20 |
typedef enum lstream_buffering |
| 21 |
{ |
| 22 |
LSTREAM_LINE_BUFFERED, |
| 23 |
} Lstream_buffering; |
| 24 |
struct lstream |
| 25 |
{ |
| 26 |
Lstream_buffering buffering; |
| 27 |
unsigned char *out_buffer; |
| 28 |
size_t out_buffer_size; |
| 29 |
size_t out_buffer_ind; |
| 30 |
size_t byte_count; |
| 31 |
long flags; |
| 32 |
char data[1]; |
| 33 |
}; |
| 34 |
typedef struct printf_spec printf_spec; |
| 35 |
struct printf_spec |
| 36 |
{ |
| 37 |
}; |
| 38 |
typedef union printf_arg printf_arg; |
| 39 |
union printf_arg |
| 40 |
{ |
| 41 |
}; |
| 42 |
typedef struct |
| 43 |
{ |
| 44 |
int cur; |
| 45 |
} printf_spec_dynarr; |
| 46 |
typedef struct |
| 47 |
{ |
| 48 |
} printf_arg_dynarr; |
| 49 |
extern void Lstream_fputc (struct lstream *, int); |
| 50 |
extern void Lstream_write (struct lstream *, const Bufbyte *, Bytecount); |
| 51 |
extern void Lstream_flush_out (struct lstream *); |
| 52 |
extern printf_spec_dynarr *parse_doprnt_spec (Bufbyte *, Bytecount); |
| 53 |
static void |
| 54 |
doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len, |
| 55 |
Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag) |
| 56 |
{ |
| 57 |
Charcount cclen; |
| 58 |
Bufbyte pad; |
| 59 |
Lstream *lstr = (( struct lstream *) ((void *)(((( stream ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) ; |
| 60 |
cclen = ( len ) ; |
| 61 |
if (zero_flag) |
| 62 |
pad = '0'; |
| 63 |
pad = ' '; |
| 64 |
#if 0 |
| 65 |
if (minlen > cclen && !minus_flag) |
| 66 |
#endif |
| 67 |
{ |
| 68 |
int to_add = minlen - cclen; |
| 69 |
while (to_add > 0) |
| 70 |
{ |
| 71 |
(( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; |
| 72 |
to_add--; |
| 73 |
} |
| 74 |
} |
| 75 |
if (maxlen >= 0) |
| 76 |
len = ( ((( maxlen ) <= ( cclen )) ? ( maxlen ) : ( cclen )) ) ; |
| 77 |
Lstream_write (lstr, string, len); |
| 78 |
if (minlen > cclen && minus_flag) |
| 79 |
{ |
| 80 |
int to_add = minlen - cclen; |
| 81 |
while (to_add > 0) |
| 82 |
{ |
| 83 |
(( lstr )->out_buffer_ind >= ( lstr )->out_buffer_size ? Lstream_fputc ( lstr , pad ) : (( lstr )->out_buffer[( lstr )->out_buffer_ind++] = (unsigned char) ( pad ), ( lstr )->byte_count++, ( lstr )->buffering == LSTREAM_LINE_BUFFERED && ( lstr )->out_buffer[( lstr )->out_buffer_ind - 1] == '\n' ? Lstream_flush_out ( lstr ) : 0)) ; |
| 84 |
to_add--; |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
static Bytecount |
| 89 |
emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc, |
| 90 |
Lisp_Object format_reloc, Bytecount format_length, |
| 91 |
int nargs, |
| 92 |
const Lisp_Object *largs) |
| 93 |
{ |
| 94 |
int i; |
| 95 |
printf_spec_dynarr *specs = 0; |
| 96 |
format_nonreloc = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_data + 0) ; |
| 97 |
format_length = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_size) ; |
| 98 |
specs = parse_doprnt_spec (format_nonreloc, format_length); |
| 99 |
for (i = 0; i < (( specs )->cur) ; i++) |
| 100 |
{ |
| 101 |
char ch; |
| 102 |
doprnt_1 (stream, (Bufbyte *) &ch, 1, 0, -1, 0, 0); |
| 103 |
} |
| 104 |
} |