2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / 20000211-1.c
blob8d8a4074e0f910e0ef8740441b15a1c02a452162
1 typedef long unsigned int size_t;
2 typedef unsigned char Bufbyte;
3 typedef int Bytecount;
4 typedef int Charcount;
5 typedef struct lstream Lstream;
6 typedef int Lisp_Object;
7 extern Lisp_Object Qnil;
8 extern inline int
9 TRUE_LIST_P (Lisp_Object object)
11 return (( object ) == ( Qnil )) ;
13 struct Lisp_String
15 Bytecount _size;
16 Bufbyte *_data;
18 typedef enum lstream_buffering
20 LSTREAM_LINE_BUFFERED,
21 } Lstream_buffering;
22 struct lstream
24 Lstream_buffering buffering;
25 unsigned char *out_buffer;
26 size_t out_buffer_size;
27 size_t out_buffer_ind;
28 size_t byte_count;
29 long flags;
30 char data[1];
32 typedef struct printf_spec printf_spec;
33 struct printf_spec
36 typedef union printf_arg printf_arg;
37 union printf_arg
40 typedef struct
42 int cur;
43 } printf_spec_dynarr;
44 typedef struct
46 } printf_arg_dynarr;
47 static void
48 doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len,
49 Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag)
51 Charcount cclen;
52 Bufbyte pad;
53 Lstream *lstr = (( struct lstream *) ((void *)(((( stream ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) ;
54 cclen = ( len ) ;
55 if (zero_flag)
56 pad = '0';
57 pad = ' ';
58 #if 0
59 if (minlen > cclen && !minus_flag)
60 #endif
62 int to_add = minlen - cclen;
63 while (to_add > 0)
65 (( 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)) ;
66 to_add--;
69 if (maxlen >= 0)
70 len = ( ((( maxlen ) <= ( cclen )) ? ( maxlen ) : ( cclen )) ) ;
71 Lstream_write (lstr, string, len);
72 if (minlen > cclen && minus_flag)
74 int to_add = minlen - cclen;
75 while (to_add > 0)
77 (( 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)) ;
78 to_add--;
82 static Bytecount
83 emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc,
84 Lisp_Object format_reloc, Bytecount format_length,
85 int nargs,
86 const Lisp_Object *largs)
88 int i;
89 printf_spec_dynarr *specs = 0;
90 format_nonreloc = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_data + 0) ;
91 format_length = (( (( struct Lisp_String *) ((void *)(((( format_reloc ) & ((1UL << ((4 * 8 ) - 4 ) ) - 1UL) ) ) | 0x40000000 )) ) )->_size) ;
92 specs = parse_doprnt_spec (format_nonreloc, format_length);
93 for (i = 0; i < (( specs )->cur) ; i++)
95 char ch;
96 doprnt_1 (stream, (Bufbyte *) &ch, 1, 0, -1, 0, 0);