Artifact 6b73feb372a335edf323ee75182c84efdff4e686:


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 20 42 72 75 6e 6f 20  1995-1999 Bruno 
0020: 48 61 69 62 6c 65 2c 20 3c 62 72 75 6e 6f 40 63  Haible, <bruno@c
0030: 6c 69 73 70 2e 6f 72 67 3e 0a 20 2a 0a 20 2a 20  lisp.org>. *. * 
0040: 54 68 69 73 20 69 73 20 66 72 65 65 20 73 6f 66  This is free sof
0050: 74 77 61 72 65 20 64 69 73 74 72 69 62 75 74 65  tware distribute
0060: 64 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20  d under the GNU 
0070: 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c  General Public L
0080: 69 63 65 6e 63 65 0a 20 2a 20 64 65 73 63 72 69  icence. * descri
0090: 62 65 64 20 69 6e 20 74 68 65 20 66 69 6c 65 20  bed in the file 
00a0: 43 4f 50 59 49 4e 47 2e 20 43 6f 6e 74 61 63 74  COPYING. Contact
00b0: 20 74 68 65 20 61 75 74 68 6f 72 20 69 66 20 79   the author if y
00c0: 6f 75 20 64 6f 6e 27 74 20 68 61 76 65 20 74 68  ou don't have th
00d0: 69 73 0a 20 2a 20 6f 72 20 63 61 6e 27 74 20 6c  is. * or can't l
00e0: 69 76 65 20 77 69 74 68 20 69 74 2e 20 54 68 65  ive with it. The
00f0: 72 65 20 69 73 20 41 42 53 4f 4c 55 54 45 4c 59  re is ABSOLUTELY
0100: 20 4e 4f 20 57 41 52 52 41 4e 54 59 2c 20 65 78   NO WARRANTY, ex
0110: 70 6c 69 63 69 74 20 6f 72 20 69 6d 70 6c 69 65  plicit or implie
0120: 64 2c 0a 20 2a 20 6f 6e 20 74 68 69 73 20 73 6f  d,. * on this so
0130: 66 74 77 61 72 65 2e 0a 20 2a 2f 0a 0a 23 69 6e  ftware.. */..#in
0140: 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 0a  clude <stdio.h>.
0150: 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62  #include <stdlib
0160: 2e 68 3e 0a 0a 23 69 6e 63 6c 75 64 65 20 22 76  .h>..#include "v
0170: 61 63 61 6c 6c 5f 72 2e 68 22 0a 23 69 6e 63 6c  acall_r.h".#incl
0180: 75 64 65 20 22 63 6f 6e 66 69 67 2e 68 22 0a 0a  ude "config.h"..
0190: 2f 2a 20 52 6f 6f 6d 20 66 6f 72 20 72 65 74 75  /* Room for retu
01a0: 72 6e 69 6e 67 20 73 74 72 75 63 74 73 20 61 63  rning structs ac
01b0: 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 70  cording to the p
01c0: 63 63 20 6e 6f 6e 2d 72 65 65 6e 74 72 61 6e 74  cc non-reentrant
01d0: 20 73 74 72 75 63 74 20 72 65 74 75 72 6e 20 63   struct return c
01e0: 6f 6e 76 65 6e 74 69 6f 6e 2e 20 2a 2f 0a 5f 5f  onvention. */.__
01f0: 76 61 5f 73 74 72 75 63 74 5f 62 75 66 66 65 72  va_struct_buffer
0200: 5f 74 20 5f 5f 76 61 5f 73 74 72 75 63 74 5f 62  _t __va_struct_b
0210: 75 66 66 65 72 3b 0a 0a 69 6e 74 20 2f 2a 20 6e  uffer;..int /* n
0220: 6f 20 72 65 74 75 72 6e 20 74 79 70 65 2c 20 73  o return type, s
0230: 69 6e 63 65 20 74 68 69 73 20 6e 65 76 65 72 20  ince this never 
0240: 72 65 74 75 72 6e 73 20 2a 2f 0a 23 69 66 20 64  returns */.#if d
0250: 65 66 69 6e 65 64 28 5f 5f 53 54 44 43 5f 5f 29  efined(__STDC__)
0260: 20 7c 7c 20 64 65 66 69 6e 65 64 28 5f 5f 47 4e   || defined(__GN
0270: 55 43 5f 5f 29 20 7c 7c 20 64 65 66 69 6e 65 64  UC__) || defined
0280: 28 5f 5f 63 70 6c 75 73 70 6c 75 73 29 0a 5f 5f  (__cplusplus).__
0290: 76 61 5f 65 72 72 6f 72 31 20 28 65 6e 75 6d 20  va_error1 (enum 
02a0: 5f 5f 56 41 74 79 70 65 20 73 74 61 72 74 5f 74  __VAtype start_t
02b0: 79 70 65 2c 20 65 6e 75 6d 20 5f 5f 56 41 74 79  ype, enum __VAty
02c0: 70 65 20 72 65 74 75 72 6e 5f 74 79 70 65 29 0a  pe return_type).
02d0: 23 65 6c 73 65 0a 5f 5f 76 61 5f 65 72 72 6f 72  #else.__va_error
02e0: 31 20 28 73 74 61 72 74 5f 74 79 70 65 2c 20 72  1 (start_type, r
02f0: 65 74 75 72 6e 5f 74 79 70 65 29 0a 20 20 65 6e  eturn_type).  en
0300: 75 6d 20 5f 5f 56 41 74 79 70 65 20 73 74 61 72  um __VAtype star
0310: 74 5f 74 79 70 65 3b 0a 20 20 65 6e 75 6d 20 5f  t_type;.  enum _
0320: 5f 56 41 74 79 70 65 20 72 65 74 75 72 6e 5f 74  _VAtype return_t
0330: 79 70 65 3b 0a 23 65 6e 64 69 66 0a 7b 0a 20 20  ype;.#endif.{.  
0340: 2f 2a 20 49 66 20 79 6f 75 20 73 65 65 20 74 68  /* If you see th
0350: 69 73 2c 20 66 69 78 20 79 6f 75 72 20 63 6f 64  is, fix your cod
0360: 65 2e 20 2a 2f 0a 20 20 66 70 72 69 6e 74 66 20  e. */.  fprintf 
0370: 28 73 74 64 65 72 72 2c 20 22 76 61 63 61 6c 6c  (stderr, "vacall
0380: 3a 20 76 61 5f 73 74 61 72 74 20 74 79 70 65 20  : va_start type 
0390: 25 64 20 61 6e 64 20 76 61 5f 72 65 74 75 72 6e  %d and va_return
03a0: 20 74 79 70 65 20 25 64 20 64 69 73 61 67 72 65   type %d disagre
03b0: 65 2e 5c 6e 22 2c 0a 20 20 20 20 20 20 20 20 20  e.\n",.         
03c0: 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 29 73            (int)s
03d0: 74 61 72 74 5f 74 79 70 65 2c 20 28 69 6e 74 29  tart_type, (int)
03e0: 72 65 74 75 72 6e 5f 74 79 70 65 29 3b 0a 20 20  return_type);.  
03f0: 61 62 6f 72 74 28 29 3b 0a 23 69 66 20 64 65 66  abort();.#if def
0400: 69 6e 65 64 28 5f 5f 63 70 6c 75 73 70 6c 75 73  ined(__cplusplus
0410: 29 0a 20 20 72 65 74 75 72 6e 20 30 3b 0a 23 65  ).  return 0;.#e
0420: 6e 64 69 66 0a 7d 0a 0a 69 6e 74 20 2f 2a 20 6e  ndif.}..int /* n
0430: 6f 20 72 65 74 75 72 6e 20 74 79 70 65 2c 20 73  o return type, s
0440: 69 6e 63 65 20 74 68 69 73 20 6e 65 76 65 72 20  ince this never 
0450: 72 65 74 75 72 6e 73 20 2a 2f 0a 23 69 66 20 64  returns */.#if d
0460: 65 66 69 6e 65 64 28 5f 5f 53 54 44 43 5f 5f 29  efined(__STDC__)
0470: 20 7c 7c 20 64 65 66 69 6e 65 64 28 5f 5f 47 4e   || defined(__GN
0480: 55 43 5f 5f 29 20 7c 7c 20 64 65 66 69 6e 65 64  UC__) || defined
0490: 28 5f 5f 63 70 6c 75 73 70 6c 75 73 29 0a 5f 5f  (__cplusplus).__
04a0: 76 61 5f 65 72 72 6f 72 32 20 28 75 6e 73 69 67  va_error2 (unsig
04b0: 6e 65 64 20 69 6e 74 20 73 69 7a 65 29 0a 23 65  ned int size).#e
04c0: 6c 73 65 0a 5f 5f 76 61 5f 65 72 72 6f 72 32 20  lse.__va_error2 
04d0: 28 73 69 7a 65 29 0a 20 20 75 6e 73 69 67 6e 65  (size).  unsigne
04e0: 64 20 69 6e 74 20 73 69 7a 65 3b 0a 23 65 6e 64  d int size;.#end
04f0: 69 66 0a 7b 0a 20 20 2f 2a 20 49 66 20 79 6f 75  if.{.  /* If you
0500: 20 73 65 65 20 74 68 69 73 2c 20 69 6e 63 72 65   see this, incre
0510: 61 73 65 20 5f 5f 56 41 5f 41 4c 49 53 54 5f 57  ase __VA_ALIST_W
0520: 4f 52 44 53 3a 20 2a 2f 0a 20 20 66 70 72 69 6e  ORDS: */.  fprin
0530: 74 66 20 28 73 74 64 65 72 72 2c 20 22 76 61 63  tf (stderr, "vac
0540: 61 6c 6c 3a 20 73 74 72 75 63 74 20 6f 66 20 73  all: struct of s
0550: 69 7a 65 20 25 75 20 74 6f 6f 20 6c 61 72 67 65  ize %u too large
0560: 20 66 6f 72 20 70 63 63 20 73 74 72 75 63 74 20   for pcc struct 
0570: 72 65 74 75 72 6e 2e 5c 6e 22 2c 0a 20 20 20 20  return.\n",.    
0580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73                 s
0590: 69 7a 65 29 3b 0a 20 20 61 62 6f 72 74 28 29 3b  ize);.  abort();
05a0: 0a 23 69 66 20 64 65 66 69 6e 65 64 28 5f 5f 63  .#if defined(__c
05b0: 70 6c 75 73 70 6c 75 73 29 0a 20 20 72 65 74 75  plusplus).  retu
05c0: 72 6e 20 30 3b 0a 23 65 6e 64 69 66 0a 7d 0a     rn 0;.#endif.}.