Artifact
6b30ab394a1b785725bb02b3b0dfea3da4b3c67b:
0000: 2f 2a 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 /*. * Copyright
0010: 31 39 39 35 2d 31 39 39 39 2c 20 32 30 30 33 2c 1995-1999, 2003,
0020: 20 32 30 30 35 20 42 72 75 6e 6f 20 48 61 69 62 2005 Bruno Haib
0030: 6c 65 2c 20 3c 62 72 75 6e 6f 40 63 6c 69 73 70 le, <bruno@clisp
0040: 2e 6f 72 67 3e 0a 20 2a 0a 20 2a 20 54 68 69 73 .org>. *. * This
0050: 20 69 73 20 66 72 65 65 20 73 6f 66 74 77 61 72 is free softwar
0060: 65 20 64 69 73 74 72 69 62 75 74 65 64 20 75 6e e distributed un
0070: 64 65 72 20 74 68 65 20 47 4e 55 20 47 65 6e 65 der the GNU Gene
0080: 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e ral Public Licen
0090: 63 65 0a 20 2a 20 64 65 73 63 72 69 62 65 64 20 ce. * described
00a0: 69 6e 20 74 68 65 20 66 69 6c 65 20 43 4f 50 59 in the file COPY
00b0: 49 4e 47 2e 20 43 6f 6e 74 61 63 74 20 74 68 65 ING. Contact the
00c0: 20 61 75 74 68 6f 72 20 69 66 20 79 6f 75 20 64 author if you d
00d0: 6f 6e 27 74 20 68 61 76 65 20 74 68 69 73 0a 20 on't have this.
00e0: 2a 20 6f 72 20 63 61 6e 27 74 20 6c 69 76 65 20 * or can't live
00f0: 77 69 74 68 20 69 74 2e 20 54 68 65 72 65 20 69 with it. There i
0100: 73 20 41 42 53 4f 4c 55 54 45 4c 59 20 4e 4f 20 s ABSOLUTELY NO
0110: 57 41 52 52 41 4e 54 59 2c 20 65 78 70 6c 69 63 WARRANTY, explic
0120: 69 74 20 6f 72 20 69 6d 70 6c 69 65 64 2c 0a 20 it or implied,.
0130: 2a 20 6f 6e 20 74 68 69 73 20 73 6f 66 74 77 61 * on this softwa
0140: 72 65 2e 0a 20 2a 2f 0a 0a 23 69 6e 63 6c 75 64 re.. */..#includ
0150: 65 20 3c 73 74 64 69 6f 2e 68 3e 0a 23 69 6e 63 e <stdio.h>.#inc
0160: 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e 68 3e 0a lude <stdlib.h>.
0170: 0a 23 69 6e 63 6c 75 64 65 20 22 76 61 63 61 6c .#include "vacal
0180: 6c 5f 72 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 l_r.h".#include
0190: 22 63 6f 6e 66 69 67 2e 68 22 0a 0a 2f 2a 20 52 "config.h"../* R
01a0: 6f 6f 6d 20 66 6f 72 20 72 65 74 75 72 6e 69 6e oom for returnin
01b0: 67 20 73 74 72 75 63 74 73 20 61 63 63 6f 72 64 g structs accord
01c0: 69 6e 67 20 74 6f 20 74 68 65 20 70 63 63 20 6e ing to the pcc n
01d0: 6f 6e 2d 72 65 65 6e 74 72 61 6e 74 20 73 74 72 on-reentrant str
01e0: 75 63 74 20 72 65 74 75 72 6e 20 63 6f 6e 76 65 uct return conve
01f0: 6e 74 69 6f 6e 2e 20 2a 2f 0a 5f 5f 76 61 5f 73 ntion. */.__va_s
0200: 74 72 75 63 74 5f 62 75 66 66 65 72 5f 74 20 5f truct_buffer_t _
0210: 5f 76 61 5f 73 74 72 75 63 74 5f 62 75 66 66 65 _va_struct_buffe
0220: 72 3b 0a 0a 69 6e 74 20 2f 2a 20 6e 6f 20 72 65 r;..int /* no re
0230: 74 75 72 6e 20 74 79 70 65 2c 20 73 69 6e 63 65 turn type, since
0240: 20 74 68 69 73 20 6e 65 76 65 72 20 72 65 74 75 this never retu
0250: 72 6e 73 20 2a 2f 0a 5f 5f 76 61 5f 65 72 72 6f rns */.__va_erro
0260: 72 31 20 28 65 6e 75 6d 20 5f 5f 56 41 74 79 70 r1 (enum __VAtyp
0270: 65 20 73 74 61 72 74 5f 74 79 70 65 2c 20 65 6e e start_type, en
0280: 75 6d 20 5f 5f 56 41 74 79 70 65 20 72 65 74 75 um __VAtype retu
0290: 72 6e 5f 74 79 70 65 29 0a 7b 0a 20 20 2f 2a 20 rn_type).{. /*
02a0: 49 66 20 79 6f 75 20 73 65 65 20 74 68 69 73 2c If you see this,
02b0: 20 66 69 78 20 79 6f 75 72 20 63 6f 64 65 2e 20 fix your code.
02c0: 2a 2f 0a 20 20 66 70 72 69 6e 74 66 20 28 73 74 */. fprintf (st
02d0: 64 65 72 72 2c 20 22 76 61 63 61 6c 6c 3a 20 76 derr, "vacall: v
02e0: 61 5f 73 74 61 72 74 20 74 79 70 65 20 25 64 20 a_start type %d
02f0: 61 6e 64 20 76 61 5f 72 65 74 75 72 6e 20 74 79 and va_return ty
0300: 70 65 20 25 64 20 64 69 73 61 67 72 65 65 2e 5c pe %d disagree.\
0310: 6e 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 n",.
0320: 20 20 20 20 20 20 20 28 69 6e 74 29 73 74 61 72 (int)star
0330: 74 5f 74 79 70 65 2c 20 28 69 6e 74 29 72 65 74 t_type, (int)ret
0340: 75 72 6e 5f 74 79 70 65 29 3b 0a 20 20 61 62 6f urn_type);. abo
0350: 72 74 28 29 3b 0a 23 69 66 20 64 65 66 69 6e 65 rt();.#if define
0360: 64 28 5f 5f 63 70 6c 75 73 70 6c 75 73 29 0a 20 d(__cplusplus).
0370: 20 72 65 74 75 72 6e 20 30 3b 0a 23 65 6e 64 69 return 0;.#endi
0380: 66 0a 7d 0a 0a 69 6e 74 20 2f 2a 20 6e 6f 20 72 f.}..int /* no r
0390: 65 74 75 72 6e 20 74 79 70 65 2c 20 73 69 6e 63 eturn type, sinc
03a0: 65 20 74 68 69 73 20 6e 65 76 65 72 20 72 65 74 e this never ret
03b0: 75 72 6e 73 20 2a 2f 0a 5f 5f 76 61 5f 65 72 72 urns */.__va_err
03c0: 6f 72 32 20 28 75 6e 73 69 67 6e 65 64 20 69 6e or2 (unsigned in
03d0: 74 20 73 69 7a 65 29 0a 7b 0a 20 20 2f 2a 20 49 t size).{. /* I
03e0: 66 20 79 6f 75 20 73 65 65 20 74 68 69 73 2c 20 f you see this,
03f0: 69 6e 63 72 65 61 73 65 20 5f 5f 56 41 5f 41 4c increase __VA_AL
0400: 49 53 54 5f 57 4f 52 44 53 3a 20 2a 2f 0a 20 20 IST_WORDS: */.
0410: 66 70 72 69 6e 74 66 20 28 73 74 64 65 72 72 2c fprintf (stderr,
0420: 20 22 76 61 63 61 6c 6c 3a 20 73 74 72 75 63 74 "vacall: struct
0430: 20 6f 66 20 73 69 7a 65 20 25 75 20 74 6f 6f 20 of size %u too
0440: 6c 61 72 67 65 20 66 6f 72 20 70 63 63 20 73 74 large for pcc st
0450: 72 75 63 74 20 72 65 74 75 72 6e 2e 5c 6e 22 2c ruct return.\n",
0460: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
0470: 20 20 20 20 73 69 7a 65 29 3b 0a 20 20 61 62 6f size);. abo
0480: 72 74 28 29 3b 0a 23 69 66 20 64 65 66 69 6e 65 rt();.#if define
0490: 64 28 5f 5f 63 70 6c 75 73 70 6c 75 73 29 0a 20 d(__cplusplus).
04a0: 20 72 65 74 75 72 6e 20 30 3b 0a 23 65 6e 64 69 return 0;.#endi
04b0: 66 0a 7d 0a f.}.