0000: 0a 0a 0a 41 56 43 41 4c 4c 28 33 29 20 20 20 20 ...AVCALL(3)
0010: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0020: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0030: 20 20 20 20 20 20 20 20 20 20 20 41 56 43 41 4c AVCAL
0040: 4c 28 33 29 0a 0a 0a 4e 08 4e 41 08 41 4d 08 4d L(3)...N.NA.AM.M
0050: 45 08 45 0a 20 20 20 20 20 20 20 61 76 63 61 6c E.E. avcal
0060: 6c 20 20 2d 20 62 75 69 6c 64 20 61 20 43 20 61 l - build a C a
0070: 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 69 6e 63 rgument list inc
0080: 72 65 6d 65 6e 74 61 6c 6c 79 20 61 6e 64 20 63 rementally and c
0090: 61 6c 6c 20 61 0a 20 20 20 20 20 20 20 43 20 66 all a. C f
00a0: 75 6e 63 74 69 6f 6e 20 6f 6e 20 69 74 2e 0a 0a unction on it...
00b0: 53 08 53 59 08 59 4e 08 4e 4f 08 4f 50 08 50 53 S.SY.YN.NO.OP.PS
00c0: 08 53 49 08 49 53 08 53 0a 20 20 20 20 20 20 20 .SI.IS.S.
00d0: 23 08 23 69 08 69 6e 08 6e 63 08 63 6c 08 6c 75 #.#i.in.nc.cl.lu
00e0: 08 75 64 08 64 65 08 65 20 3c 08 3c 61 08 61 76 .ud.de.e <.<a.av
00f0: 08 76 63 08 63 61 08 61 6c 08 6c 6c 08 6c 2e 08 .vc.ca.al.ll.l..
0100: 2e 68 08 68 3e 08 3e 0a 0a 20 20 20 20 20 20 20 .h.h>.>..
0110: 61 08 61 76 08 76 5f 08 5f 61 08 61 6c 08 6c 69 a.av.v_._a.al.li
0120: 08 69 73 08 73 74 08 74 20 5f 08 61 5f 08 6c 5f .is.st.t _.a_.l_
0130: 08 69 5f 08 73 5f 08 74 3b 08 3b 0a 0a 20 20 20 .i_.s_.t;.;..
0140: 20 20 20 20 61 08 61 76 08 76 5f 08 5f 73 08 73 a.av.v_._s.s
0150: 74 08 74 61 08 61 72 08 72 74 08 74 5f 08 5f 5f t.ta.ar.rt.t_.__
0160: 08 74 5f 08 79 5f 08 70 5f 08 65 28 08 28 5f 08 .t_.y_.p_.e(.(_.
0170: 61 5f 08 6c 5f 08 69 5f 08 73 5f 08 74 2c 08 2c a_.l_.i_.s_.t,.,
0180: 20 5f 08 26 5f 08 66 5f 08 75 5f 08 6e 5f 08 63 _.&_.f_.u_.n_.c
0190: 20 5b 5b 2c 08 2c 20 5f 08 72 5f 08 65 5f 08 74 [[,., _.r_.e_.t
01a0: 5f 08 75 5f 08 72 5f 08 6e 5f 08 5f 5f 08 74 5f _.u_.r_.n_.__.t_
01b0: 08 79 5f 08 70 5f 08 65 5d 2c 08 2c 20 5f 08 26 .y_.p_.e],., _.&
01c0: 5f 08 72 5f 08 65 5f 08 74 5f 08 75 5f 08 72 5f _.r_.e_.t_.u_.r_
01d0: 08 6e 5f 08 5f 5f 08 76 5f 08 61 5f 08 6c 5f 08 .n_.__.v_.a_.l_.
01e0: 75 5f 08 65 0a 20 20 20 20 20 20 20 5d 29 08 29 u_.e. ]).)
01f0: 3b 08 3b 0a 0a 20 20 20 20 20 20 20 61 08 61 76 ;.;.. a.av
0200: 08 76 5f 08 5f 5f 08 74 5f 08 79 5f 08 70 5f 08 .v_.__.t_.y_.p_.
0210: 65 28 08 28 5f 08 61 5f 08 6c 5f 08 69 5f 08 73 e(.(_.a_.l_.i_.s
0220: 5f 08 74 2c 08 2c 20 5b 5f 08 61 5f 08 72 5f 08 _.t,., [_.a_.r_.
0230: 67 5f 08 5f 5f 08 74 5f 08 79 5f 08 70 5f 08 65 g_.__.t_.y_.p_.e
0240: 2c 08 2c 5d 20 5f 08 76 5f 08 61 5f 08 6c 5f 08 ,.,] _.v_.a_.l_.
0250: 75 5f 08 65 29 08 29 3b 08 3b 0a 0a 20 20 20 20 u_.e).);.;..
0260: 20 20 20 61 08 61 76 08 76 5f 08 5f 63 08 63 61 a.av.v_._c.ca
0270: 08 61 6c 08 6c 6c 08 6c 28 08 28 5f 08 61 5f 08 .al.ll.l(.(_.a_.
0280: 6c 5f 08 69 5f 08 73 5f 08 74 29 08 29 3b 08 3b l_.i_.s_.t).);.;
0290: 0a 0a 44 08 44 45 08 45 53 08 53 43 08 43 52 08 ..D.DE.ES.SC.CR.
02a0: 52 49 08 49 50 08 50 54 08 54 49 08 49 4f 08 4f RI.IP.PT.TI.IO.O
02b0: 4e 08 4e 0a 20 20 20 20 20 20 20 54 68 69 73 20 N.N. This
02c0: 20 73 65 74 20 20 6f 66 20 6d 61 63 72 6f 73 20 set of macros
02d0: 62 75 69 6c 64 73 20 61 6e 20 61 72 67 75 6d 65 builds an argume
02e0: 6e 74 20 6c 69 73 74 20 66 6f 72 20 61 20 43 20 nt list for a C
02f0: 66 75 6e 63 2d 0a 20 20 20 20 20 20 20 74 69 6f func-. tio
0300: 6e 20 61 6e 64 20 20 63 61 6c 6c 73 20 20 74 68 n and calls th
0310: 65 20 20 66 75 6e 63 74 69 6f 6e 20 20 6f 6e 20 e function on
0320: 20 69 74 2e 20 20 49 74 20 20 73 69 67 6e 69 66 it. It signif
0330: 69 63 61 6e 74 6c 79 0a 20 20 20 20 20 20 20 72 icantly. r
0340: 65 64 75 63 65 73 20 20 74 68 65 20 20 61 6d 6f educes the amo
0350: 75 6e 74 20 20 6f 66 20 60 67 6c 75 65 27 20 63 unt of `glue' c
0360: 6f 64 65 20 72 65 71 75 69 72 65 64 20 66 6f 72 ode required for
0370: 20 70 61 72 73 65 72 73 2c 0a 20 20 20 20 20 20 parsers,.
0380: 20 64 65 62 75 67 67 65 72 73 2c 20 69 6d 62 65 debuggers, imbe
0390: 64 64 65 64 20 69 6e 74 65 72 70 72 65 74 65 72 dded interpreter
03a0: 73 2c 20 43 20 65 78 74 65 6e 73 69 6f 6e 73 20 s, C extensions
03b0: 74 6f 20 61 70 70 6c 69 63 61 2d 0a 20 20 20 20 to applica-.
03c0: 20 20 20 74 69 6f 6e 20 20 70 72 6f 67 72 61 6d tion program
03d0: 73 20 20 61 6e 64 20 20 6f 74 68 65 72 20 73 69 s and other si
03e0: 74 75 61 74 69 6f 6e 73 20 77 68 65 72 65 20 63 tuations where c
03f0: 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 0a 20 20 ollections of.
0400: 20 20 20 20 20 66 75 6e 63 74 69 6f 6e 73 20 6e functions n
0410: 65 65 64 20 74 6f 20 62 65 20 63 61 6c 6c 65 64 eed to be called
0420: 20 6f 6e 20 20 6c 69 73 74 73 20 20 6f 66 20 20 on lists of
0430: 65 78 74 65 72 6e 61 6c 6c 79 2d 73 75 70 2d 0a externally-sup-.
0440: 20 20 20 20 20 20 20 70 6c 69 65 64 20 61 72 67 plied arg
0450: 75 6d 65 6e 74 73 2e 0a 0a 20 20 20 20 20 20 20 uments...
0460: 46 75 6e 63 74 69 6f 6e 20 20 63 61 6c 6c 69 6e Function callin
0470: 67 20 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 20 64 g conventions d
0480: 69 66 66 65 72 20 63 6f 6e 73 69 64 65 72 61 62 iffer considerab
0490: 6c 79 20 6f 6e 20 64 69 66 2d 0a 20 20 20 20 20 ly on dif-.
04a0: 20 20 66 65 72 65 6e 74 20 6d 61 63 68 69 6e 65 ferent machine
04b0: 73 20 61 6e 64 20 5f 08 61 5f 08 76 5f 08 63 5f s and _.a_.v_.c_
04c0: 08 61 5f 08 6c 5f 08 6c 20 61 74 74 65 6d 70 74 .a_.l_.l attempt
04d0: 73 20 74 6f 20 70 72 6f 76 69 64 65 20 73 6f 6d s to provide som
04e0: 65 20 64 65 67 72 65 65 0a 20 20 20 20 20 20 20 e degree.
04f0: 6f 66 20 69 73 6f 6c 61 74 69 6f 6e 20 66 72 6f of isolation fro
0500: 6d 20 73 75 63 68 20 61 72 63 68 69 74 65 63 74 m such architect
0510: 75 72 65 20 64 65 70 65 6e 64 65 6e 63 69 65 73 ure dependencies
0520: 2e 0a 0a 20 20 20 20 20 20 20 54 68 65 20 20 69 ... The i
0530: 6e 74 65 72 66 61 63 65 20 20 69 73 20 20 6c 69 nterface is li
0540: 6b 65 20 20 73 08 73 74 08 74 64 08 64 61 08 61 ke s.st.td.da.a
0550: 72 08 72 67 08 67 28 33 29 20 69 6e 20 72 65 76 r.rg.g(3) in rev
0560: 65 72 73 65 2e 20 41 6c 6c 20 6f 66 20 74 68 65 erse. All of the
0570: 0a 20 20 20 20 20 20 20 6d 61 63 72 6f 73 20 72 . macros r
0580: 65 74 75 72 6e 20 30 20 66 6f 72 20 73 75 63 63 eturn 0 for succ
0590: 65 73 73 2c 20 3c 20 30 20 66 6f 72 20 66 61 69 ess, < 0 for fai
05a0: 6c 75 72 65 20 28 65 2e 67 2e 2c 20 20 61 72 67 lure (e.g., arg
05b0: 75 2d 0a 20 20 20 20 20 20 20 6d 65 6e 74 20 6c u-. ment l
05c0: 69 73 74 20 6f 76 65 72 66 6c 6f 77 20 6f 72 20 ist overflow or
05d0: 74 79 70 65 2d 6e 6f 74 2d 73 75 70 70 6f 72 74 type-not-support
05e0: 65 64 29 2e 0a 0a 20 20 20 20 20 20 20 28 31 29 ed)... (1)
05f0: 20 20 20 20 23 08 23 69 08 69 6e 08 6e 63 08 63 #.#i.in.nc.c
0600: 6c 08 6c 75 08 75 64 08 64 65 08 65 20 3c 08 3c l.lu.ud.de.e <.<
0610: 61 08 61 76 08 76 63 08 63 61 08 61 6c 08 6c 6c a.av.vc.ca.al.ll
0620: 08 6c 2e 08 2e 68 08 68 3e 08 3e 0a 20 20 20 20 .l...h.h>.>.
0630: 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 64 65 and de
0640: 63 6c 61 72 65 20 74 68 65 20 61 72 67 75 6d 65 clare the argume
0650: 6e 74 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 nt list structur
0660: 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e.
0670: 61 08 61 76 08 76 5f 08 5f 61 08 61 6c 08 6c 69 a.av.v_._a.al.li
0680: 08 69 73 08 73 74 08 74 20 5f 08 61 5f 08 6c 5f .is.st.t _.a_.l_
0690: 08 69 5f 08 73 5f 08 74 3b 08 3b 0a 0a 20 20 20 .i_.s_.t;.;..
06a0: 20 20 20 20 28 32 29 20 20 20 20 53 65 74 20 20 (2) Set
06b0: 61 6e 79 20 20 73 70 65 63 69 61 6c 20 20 66 6c any special fl
06c0: 61 67 73 2e 20 20 54 68 69 73 20 69 73 20 61 72 ags. This is ar
06d0: 63 68 69 74 65 63 74 75 72 65 20 61 6e 64 0a 20 chitecture and.
06e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6d com
06f0: 70 69 6c 65 72 20 64 65 70 65 6e 64 65 6e 74 2e piler dependent.
0700: 20 20 43 6f 6d 70 69 6c 65 72 20 6f 70 74 69 6f Compiler optio
0710: 6e 73 20 20 74 68 61 74 20 20 61 66 66 65 63 74 ns that affect
0720: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 . p
0730: 61 73 73 69 6e 67 20 20 63 6f 6e 76 65 6e 74 69 assing conventi
0740: 6f 6e 73 20 20 6d 61 79 20 20 6e 65 65 64 20 20 ons may need
0750: 74 6f 20 20 62 65 20 20 66 6c 61 67 67 65 64 20 to be flagged
0760: 62 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 by.
0770: 20 23 08 23 64 08 64 65 08 65 66 08 66 69 08 69 #.#d.de.ef.fi.i
0780: 6e 08 6e 65 08 65 73 20 62 65 66 6f 72 65 20 74 n.ne.es before t
0790: 68 65 20 23 08 23 69 08 69 6e 08 6e 63 08 63 6c he #.#i.in.nc.cl
07a0: 08 6c 75 08 75 64 08 64 65 08 65 20 3c 08 3c 61 .lu.ud.de.e <.<a
07b0: 08 61 76 08 76 63 08 63 61 08 61 6c 08 6c 6c 08 .av.vc.ca.al.ll.
07c0: 6c 2e 08 2e 68 08 68 3e 08 3e 20 20 73 74 61 74 l...h.h>.> stat
07d0: 65 6d 65 6e 74 2e 0a 20 20 20 20 20 20 20 20 20 ement..
07e0: 20 20 20 20 20 48 6f 77 65 76 65 72 2c 20 20 74 However, t
07f0: 68 65 20 20 5f 08 63 5f 08 6f 5f 08 6e 5f 08 66 he _.c_.o_.n_.f
0800: 5f 08 69 5f 08 67 5f 08 75 5f 08 72 5f 08 65 20 _.i_.g_.u_.r_.e
0810: 20 73 63 72 69 70 74 20 73 68 6f 75 6c 64 20 68 script should h
0820: 61 76 65 20 64 65 74 65 72 2d 0a 20 20 20 20 20 ave deter-.
0830: 20 20 20 20 20 20 20 20 20 6d 69 6e 65 64 20 77 mined w
0840: 68 69 63 68 20 23 08 23 64 08 64 65 08 65 66 08 hich #.#d.de.ef.
0850: 66 69 08 69 6e 08 6e 65 08 65 73 20 61 72 65 20 fi.in.ne.es are
0860: 6e 65 65 64 65 64 20 61 6e 64 20 70 75 74 20 74 needed and put t
0870: 68 65 6d 20 61 74 20 74 68 65 0a 20 20 20 20 20 hem at the.
0880: 20 20 20 20 20 20 20 20 20 74 6f 70 20 6f 66 20 top of
0890: 61 08 61 76 08 76 63 08 63 61 08 61 6c 08 6c 6c a.av.vc.ca.al.ll
08a0: 08 6c 2e 08 2e 68 08 68 2e 0a 0a 20 20 20 20 20 .l...h.h...
08b0: 20 20 28 33 29 20 20 20 20 49 6e 69 74 69 61 6c (3) Initial
08c0: 69 7a 65 20 20 74 68 65 20 61 6c 69 73 74 20 77 ize the alist w
08d0: 69 74 68 20 74 68 65 20 66 75 6e 63 74 69 6f 6e ith the function
08e0: 20 61 64 64 72 65 73 73 20 61 6e 64 0a 20 20 20 address and.
08f0: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
0900: 6e 20 76 61 6c 75 65 20 70 6f 69 6e 74 65 72 20 n value pointer
0910: 28 69 66 20 61 6e 79 29 2e 20 54 68 65 72 65 20 (if any). There
0920: 69 73 20 61 20 20 73 65 70 61 72 61 74 65 0a 20 is a separate.
0930: 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 63 mac
0940: 72 6f 20 20 20 66 6f 72 20 20 20 65 61 63 68 20 ro for each
0950: 20 73 69 6d 70 6c 65 20 20 72 65 74 75 72 6e 20 simple return
0960: 20 74 79 70 65 20 20 28 5b 75 5d 63 68 61 72 2c type ([u]char,
0970: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
0980: 75 5d 73 68 6f 72 74 2c 20 5b 75 5d 69 6e 74 2c u]short, [u]int,
0990: 20 5b 75 5d 6c 6f 6e 67 2c 20 5b 75 5d 6c 6f 6e [u]long, [u]lon
09a0: 67 6c 6f 6e 67 2c 20 66 6c 6f 61 74 2c 20 64 6f glong, float, do
09b0: 75 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 u-.
09c0: 20 62 6c 65 2c 20 20 77 68 65 72 65 20 20 60 75 ble, where `u
09d0: 27 20 20 69 6e 64 69 63 61 74 65 73 20 60 75 6e ' indicates `un
09e0: 73 69 67 6e 65 64 27 29 2e 20 54 68 65 20 6d 61 signed'). The ma
09f0: 63 72 6f 73 0a 20 20 20 20 20 20 20 20 20 20 20 cros.
0a00: 20 20 20 66 6f 72 20 20 66 75 6e 63 74 69 6f 6e for function
0a10: 73 20 20 72 65 74 75 72 6e 69 6e 67 20 20 73 74 s returning st
0a20: 72 75 63 74 75 72 65 73 20 20 6f 72 20 20 70 6f ructures or po
0a30: 69 6e 74 65 72 73 0a 20 20 20 20 20 20 20 20 20 inters.
0a40: 20 20 20 20 20 72 65 71 75 69 72 65 20 61 6e 20 require an
0a50: 65 78 70 6c 69 63 69 74 20 74 79 70 65 20 61 72 explicit type ar
0a60: 67 75 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 20 20 gument...
0a70: 45 2e 67 2e 2c 0a 0a 0a 0a 20 20 20 20 20 20 20 E.g.,....
0a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0a90: 20 20 31 34 20 4a 61 6e 75 61 72 79 20 32 30 30 14 January 200
0aa0: 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 1
0ab0: 20 20 20 20 20 20 20 20 20 31 0a 0a 0a 0a 0a 0a 1......
0ac0: 41 56 43 41 4c 4c 28 33 29 20 20 20 20 20 20 20 AVCALL(3)
0ad0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0ae0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0af0: 20 20 20 20 20 20 20 20 41 56 43 41 4c 4c 28 33 AVCALL(3
0b00: 29 0a 0a 0a 20 20 20 20 20 20 20 61 08 61 76 08 )... a.av.
0b10: 76 5f 08 5f 73 08 73 74 08 74 61 08 61 72 08 72 v_._s.st.ta.ar.r
0b20: 74 08 74 5f 08 5f 69 08 69 6e 08 6e 74 08 74 20 t.t_._i.in.nt.t
0b30: 28 08 28 5f 08 61 5f 08 6c 5f 08 69 5f 08 73 5f (.(_.a_.l_.i_.s_
0b40: 08 74 2c 08 2c 20 5f 08 26 5f 08 66 5f 08 75 5f .t,., _.&_.f_.u_
0b50: 08 6e 5f 08 63 2c 08 2c 20 5f 08 26 5f 08 69 5f .n_.c,., _.&_.i_
0b60: 08 6e 5f 08 74 5f 08 5f 5f 08 72 5f 08 65 5f 08 .n_.t_.__.r_.e_.
0b70: 74 5f 08 75 5f 08 72 5f 08 6e 29 08 29 3b 08 3b t_.u_.r_.n).);.;
0b80: 0a 0a 20 20 20 20 20 20 20 61 08 61 76 08 76 5f .. a.av.v_
0b90: 08 5f 73 08 73 74 08 74 61 08 61 72 08 72 74 08 ._s.st.ta.ar.rt.
0ba0: 74 5f 08 5f 64 08 64 6f 08 6f 75 08 75 62 08 62 t_._d.do.ou.ub.b
0bb0: 6c 08 6c 65 08 65 20 28 08 28 5f 08 61 5f 08 6c l.le.e (.(_.a_.l
0bc0: 5f 08 69 5f 08 73 5f 08 74 2c 08 2c 20 5f 08 26 _.i_.s_.t,., _.&
0bd0: 5f 08 66 5f 08 75 5f 08 6e 5f 08 63 2c 08 2c 20 _.f_.u_.n_.c,.,
0be0: 5f 08 26 5f 08 64 5f 08 6f 5f 08 75 5f 08 62 5f _.&_.d_.o_.u_.b_
0bf0: 08 6c 5f 08 65 5f 08 5f 5f 08 72 5f 08 65 5f 08 .l_.e_.__.r_.e_.
0c00: 74 5f 08 75 5f 08 72 5f 08 6e 29 08 29 3b 08 3b t_.u_.r_.n).);.;
0c10: 0a 0a 20 20 20 20 20 20 20 61 08 61 76 08 76 5f .. a.av.v_
0c20: 08 5f 73 08 73 74 08 74 61 08 61 72 08 72 74 08 ._s.st.ta.ar.rt.
0c30: 74 5f 08 5f 76 08 76 6f 08 6f 69 08 69 64 08 64 t_._v.vo.oi.id.d
0c40: 20 28 08 28 5f 08 61 5f 08 6c 5f 08 69 5f 08 73 (.(_.a_.l_.i_.s
0c50: 5f 08 74 2c 08 2c 20 5f 08 26 5f 08 66 5f 08 75 _.t,., _.&_.f_.u
0c60: 5f 08 6e 5f 08 63 29 08 29 3b 08 3b 0a 0a 20 20 _.n_.c).);.;..
0c70: 20 20 20 20 20 61 08 61 76 08 76 5f 08 5f 73 08 a.av.v_._s.
0c80: 73 74 08 74 61 08 61 72 08 72 74 08 74 5f 08 5f st.ta.ar.rt.t_._
0c90: 73 08 73 74 08 74 72 08 72 75 08 75 63 08 63 74 s.st.tr.ru.uc.ct
0ca0: 08 74 20 28 08 28 5f 08 61 5f 08 6c 5f 08 69 5f .t (.(_.a_.l_.i_
0cb0: 08 73 5f 08 74 2c 08 2c 20 5f 08 26 5f 08 66 5f .s_.t,., _.&_.f_
0cc0: 08 75 5f 08 6e 5f 08 63 2c 08 2c 20 5f 08 73 5f .u_.n_.c,., _.s_
0cd0: 08 74 5f 08 72 5f 08 75 5f 08 63 5f 08 74 5f 08 .t_.r_.u_.c_.t_.
0ce0: 5f 5f 08 74 5f 08 79 5f 08 70 5f 08 65 2c 08 2c __.t_.y_.p_.e,.,
0cf0: 20 5f 08 73 5f 08 70 5f 08 6c 5f 08 69 5f 08 74 _.s_.p_.l_.i_.t
0d00: 5f 08 74 5f 08 61 5f 08 62 5f 08 6c 5f 08 65 2c _.t_.a_.b_.l_.e,
0d10: 08 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 .,.
0d20: 20 20 20 20 20 20 20 20 20 20 20 5f 08 26 5f 08 _.&_.
0d30: 73 5f 08 74 5f 08 72 5f 08 75 5f 08 63 5f 08 74 s_.t_.r_.u_.c_.t
0d40: 5f 08 5f 5f 08 72 5f 08 65 5f 08 74 5f 08 75 5f _.__.r_.e_.t_.u_
0d50: 08 72 5f 08 6e 29 08 29 3b 08 3b 0a 0a 20 20 20 .r_.n).);.;..
0d60: 20 20 20 20 61 08 61 76 08 76 5f 08 5f 73 08 73 a.av.v_._s.s
0d70: 74 08 74 61 08 61 72 08 72 74 08 74 5f 08 5f 70 t.ta.ar.rt.t_._p
0d80: 08 70 74 08 74 72 08 72 20 28 08 28 5f 08 61 5f .pt.tr.r (.(_.a_
0d90: 08 6c 5f 08 69 5f 08 73 5f 08 74 2c 08 2c 20 5f .l_.i_.s_.t,., _
0da0: 08 26 5f 08 66 5f 08 75 5f 08 6e 5f 08 63 2c 08 .&_.f_.u_.n_.c,.
0db0: 2c 20 5f 08 70 5f 08 6f 5f 08 69 5f 08 6e 5f 08 , _.p_.o_.i_.n_.
0dc0: 74 5f 08 65 5f 08 72 5f 08 5f 5f 08 74 5f 08 79 t_.e_.r_.__.t_.y
0dd0: 5f 08 70 5f 08 65 2c 08 2c 0a 20 20 20 20 20 20 _.p_.e,.,.
0de0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f _
0df0: 08 26 5f 08 70 5f 08 6f 5f 08 69 5f 08 6e 5f 08 .&_.p_.o_.i_.n_.
0e00: 74 5f 08 65 5f 08 72 5f 08 5f 5f 08 72 5f 08 65 t_.e_.r_.__.r_.e
0e10: 5f 08 74 5f 08 75 5f 08 72 5f 08 6e 29 08 29 3b _.t_.u_.r_.n).);
0e20: 08 3b 0a 0a 20 20 20 20 20 20 20 54 68 65 20 20 .;.. The
0e30: 5f 08 73 5f 08 70 5f 08 6c 5f 08 69 5f 08 74 5f _.s_.p_.l_.i_.t_
0e40: 08 74 5f 08 61 5f 08 62 5f 08 6c 5f 08 65 20 66 .t_.a_.b_.l_.e f
0e50: 6c 61 67 20 73 70 65 63 69 66 69 65 73 20 77 68 lag specifies wh
0e60: 65 74 68 65 72 20 74 68 65 20 5f 08 73 5f 08 74 ether the _.s_.t
0e70: 5f 08 72 5f 08 75 5f 08 63 5f 08 74 5f 08 5f 5f _.r_.u_.c_.t_.__
0e80: 08 74 5f 08 79 5f 08 70 5f 08 65 20 63 61 6e 0a .t_.y_.p_.e can.
0e90: 20 20 20 20 20 20 20 62 65 20 72 65 74 75 72 6e be return
0ea0: 65 64 20 69 6e 20 72 65 67 69 73 74 65 72 73 20 ed in registers
0eb0: 73 75 63 68 20 74 68 61 74 20 65 76 65 72 79 20 such that every
0ec0: 73 74 72 75 63 74 20 66 69 65 6c 64 20 66 69 74 struct field fit
0ed0: 73 0a 20 20 20 20 20 20 20 65 6e 74 69 72 65 6c s. entirel
0ee0: 79 20 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 72 y in a single r
0ef0: 65 67 69 73 74 65 72 2e 20 54 68 69 73 20 6e 65 egister. This ne
0f00: 65 64 73 20 74 6f 20 62 65 20 73 70 65 63 69 66 eds to be specif
0f10: 69 65 64 0a 20 20 20 20 20 20 20 66 6f 72 20 73 ied. for s
0f20: 74 72 75 63 74 73 20 6f 66 20 73 69 7a 65 20 32 tructs of size 2
0f30: 2a 73 69 7a 65 6f 66 28 6c 6f 6e 67 29 2e 20 46 *sizeof(long). F
0f40: 6f 72 20 73 74 72 75 63 74 73 20 6f 66 20 73 69 or structs of si
0f50: 7a 65 20 3c 3d 0a 20 20 20 20 20 20 20 73 69 7a ze <=. siz
0f60: 65 6f 66 28 6c 6f 6e 67 29 2c 20 20 5f 08 73 5f eof(long), _.s_
0f70: 08 70 5f 08 6c 5f 08 69 5f 08 74 5f 08 74 5f 08 .p_.l_.i_.t_.t_.
0f80: 61 5f 08 62 5f 08 6c 5f 08 65 20 20 69 73 20 69 a_.b_.l_.e is i
0f90: 67 6e 6f 72 65 64 20 61 6e 64 20 61 73 73 75 6d gnored and assum
0fa0: 65 64 20 74 6f 20 62 65 20 31 2e 0a 20 20 20 20 ed to be 1..
0fb0: 20 20 20 46 6f 72 20 20 73 74 72 75 63 74 73 20 For structs
0fc0: 20 6f 66 20 20 73 69 7a 65 20 20 3e 20 20 32 2a of size > 2*
0fd0: 73 69 7a 65 6f 66 28 6c 6f 6e 67 29 2c 20 20 5f sizeof(long), _
0fe0: 08 73 5f 08 70 5f 08 6c 5f 08 69 5f 08 74 5f 08 .s_.p_.l_.i_.t_.
0ff0: 74 5f 08 61 5f 08 62 5f 08 6c 5f 08 65 20 20 69 t_.a_.b_.l_.e i
1000: 73 0a 20 20 20 20 20 20 20 69 67 6e 6f 72 65 64 s. ignored
1010: 20 20 61 6e 64 20 20 61 73 73 75 6d 65 64 20 74 and assumed t
1020: 6f 20 62 65 20 30 2e 20 54 68 65 72 65 20 61 72 o be 0. There ar
1030: 65 20 73 6f 6d 65 20 68 61 6e 64 79 20 6d 61 63 e some handy mac
1040: 72 6f 73 0a 20 20 20 20 20 20 20 66 6f 72 20 74 ros. for t
1050: 68 69 73 3a 0a 20 20 20 20 20 20 20 61 08 61 76 his:. a.av
1060: 08 76 5f 08 5f 77 08 77 6f 08 6f 72 08 72 64 08 .v_._w.wo.or.rd.
1070: 64 5f 08 5f 73 08 73 70 08 70 6c 08 6c 69 08 69 d_._s.sp.pl.li.i
1080: 74 08 74 74 08 74 61 08 61 62 08 62 6c 08 6c 65 t.tt.ta.ab.bl.le
1090: 08 65 5f 08 5f 31 08 31 20 28 08 28 5f 08 74 5f .e_._1.1 (.(_.t_
10a0: 08 79 5f 08 70 5f 08 65 5f 08 31 29 08 29 0a 20 .y_.p_.e_.1).).
10b0: 20 20 20 20 20 20 61 08 61 76 08 76 5f 08 5f 77 a.av.v_._w
10c0: 08 77 6f 08 6f 72 08 72 64 08 64 5f 08 5f 73 08 .wo.or.rd.d_._s.
10d0: 73 70 08 70 6c 08 6c 69 08 69 74 08 74 74 08 74 sp.pl.li.it.tt.t
10e0: 61 08 61 62 08 62 6c 08 6c 65 08 65 5f 08 5f 32 a.ab.bl.le.e_._2
10f0: 08 32 20 28 08 28 5f 08 74 5f 08 79 5f 08 70 5f .2 (.(_.t_.y_.p_
1100: 08 65 5f 08 31 2c 08 2c 20 5f 08 74 5f 08 79 5f .e_.1,., _.t_.y_
1110: 08 70 5f 08 65 5f 08 32 29 08 29 0a 20 20 20 20 .p_.e_.2).).
1120: 20 20 20 61 08 61 76 08 76 5f 08 5f 77 08 77 6f a.av.v_._w.wo
1130: 08 6f 72 08 72 64 08 64 5f 08 5f 73 08 73 70 08 .or.rd.d_._s.sp.
1140: 70 6c 08 6c 69 08 69 74 08 74 74 08 74 61 08 61 pl.li.it.tt.ta.a
1150: 62 08 62 6c 08 6c 65 08 65 5f 08 5f 33 08 33 20 b.bl.le.e_._3.3
1160: 28 08 28 5f 08 74 5f 08 79 5f 08 70 5f 08 65 5f (.(_.t_.y_.p_.e_
1170: 08 31 2c 08 2c 20 5f 08 74 5f 08 79 5f 08 70 5f .1,., _.t_.y_.p_
1180: 08 65 5f 08 32 2c 08 2c 20 5f 08 74 5f 08 79 5f .e_.2,., _.t_.y_
1190: 08 70 5f 08 65 5f 08 33 29 08 29 0a 20 20 20 20 .p_.e_.3).).
11a0: 20 20 20 61 08 61 76 08 76 5f 08 5f 77 08 77 6f a.av.v_._w.wo
11b0: 08 6f 72 08 72 64 08 64 5f 08 5f 73 08 73 70 08 .or.rd.d_._s.sp.
11c0: 70 6c 08 6c 69 08 69 74 08 74 74 08 74 61 08 61 pl.li.it.tt.ta.a
11d0: 62 08 62 6c 08 6c 65 08 65 5f 08 5f 34 08 34 20 b.bl.le.e_._4.4
11e0: 28 08 28 5f 08 74 5f 08 79 5f 08 70 5f 08 65 5f (.(_.t_.y_.p_.e_
11f0: 08 31 2c 08 2c 20 5f 08 74 5f 08 79 5f 08 70 5f .1,., _.t_.y_.p_
1200: 08 65 5f 08 32 2c 08 2c 20 5f 08 74 5f 08 79 5f .e_.2,., _.t_.y_
1210: 08 70 5f 08 65 5f 08 33 2c 08 2c 20 5f 08 74 5f .p_.e_.3,., _.t_
1220: 08 79 5f 08 70 5f 08 65 5f 08 34 29 08 29 0a 20 .y_.p_.e_.4).).
1230: 20 20 20 20 20 20 46 6f 72 20 61 20 73 74 72 75 For a stru
1240: 63 74 20 77 69 74 68 20 74 68 72 65 65 20 73 6c ct with three sl
1250: 6f 74 73 0a 20 20 20 20 20 20 20 73 08 73 74 08 ots. s.st.
1260: 74 72 08 72 75 08 75 63 08 63 74 08 74 20 7b 08 tr.ru.uc.ct.t {.
1270: 7b 20 5f 08 74 5f 08 79 5f 08 70 5f 08 65 5f 08 { _.t_.y_.p_.e_.
1280: 31 20 5f 08 69 5f 08 64 5f 08 31 3b 08 3b 20 5f 1 _.i_.d_.1;.; _
1290: 08 74 5f 08 79 5f 08 70 5f 08 65 5f 08 32 20 5f .t_.y_.p_.e_.2 _
12a0: 08 69 5f 08 64 5f 08 32 3b 08 3b 20 5f 08 74 5f .i_.d_.2;.; _.t_
12b0: 08 79 5f 08 70 5f 08 65 5f 08 33 20 5f 08 69 5f .y_.p_.e_.3 _.i_
12c0: 08 64 5f 08 33 3b 08 3b 20 7d 08 7d 0a 20 20 20 .d_.3;.; }.}.
12d0: 20 20 20 20 79 6f 75 20 63 61 6e 20 73 70 65 63 you can spec
12e0: 69 66 79 20 5f 08 73 5f 08 70 5f 08 6c 5f 08 69 ify _.s_.p_.l_.i
12f0: 5f 08 74 5f 08 74 5f 08 61 5f 08 62 5f 08 6c 5f _.t_.t_.a_.b_.l_
1300: 08 65 20 61 73 20 61 08 61 76 08 76 5f 08 5f 77 .e as a.av.v_._w
1310: 08 77 6f 08 6f 72 08 72 64 08 64 5f 08 5f 73 08 .wo.or.rd.d_._s.
1320: 73 70 08 70 6c 08 6c 69 08 69 74 08 74 74 08 74 sp.pl.li.it.tt.t
1330: 61 08 61 62 08 62 6c 08 6c 65 08 65 5f 08 5f 33 a.ab.bl.le.e_._3
1340: 08 33 20 28 08 28 5f 08 74 5f 08 79 5f 08 70 5f .3 (.(_.t_.y_.p_
1350: 08 65 5f 08 31 2c 08 2c 0a 20 20 20 20 20 20 20 .e_.1,.,.
1360: 5f 08 74 5f 08 79 5f 08 70 5f 08 65 5f 08 32 2c _.t_.y_.p_.e_.2,
1370: 08 2c 20 5f 08 74 5f 08 79 5f 08 70 5f 08 65 5f ., _.t_.y_.p_.e_
1380: 08 33 29 08 29 20 2e 0a 0a 20 20 20 20 20 20 20 .3).) ...
1390: 28 34 29 20 20 20 20 50 75 73 68 20 20 74 68 65 (4) Push the
13a0: 20 20 61 72 67 75 6d 65 6e 74 73 20 6f 6e 20 74 arguments on t
13b0: 6f 20 74 68 65 20 6c 69 73 74 20 69 6e 20 6f 72 o the list in or
13c0: 64 65 72 2e 20 41 67 61 69 6e 0a 20 20 20 20 20 der. Again.
13d0: 20 20 20 20 20 20 20 20 20 74 68 65 72 65 20 69 there i
13e0: 73 20 61 20 6d 61 63 72 6f 20 66 6f 72 20 65 61 s a macro for ea
13f0: 63 68 20 73 69 6d 70 6c 65 20 62 75 69 6c 74 2d ch simple built-
1400: 69 6e 20 74 79 70 65 2c 20 61 6e 64 0a 20 20 20 in type, and.
1410: 20 20 20 20 20 20 20 20 20 20 20 74 68 65 20 20 the
1420: 6d 61 63 72 6f 73 20 20 66 6f 72 20 20 73 74 72 macros for str
1430: 75 63 74 75 72 65 20 20 61 6e 64 20 20 70 6f 69 ucture and poi
1440: 6e 74 65 72 20 61 72 67 75 6d 65 6e 74 73 0a 20 nter arguments.
1450: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 71 req
1460: 75 69 72 65 20 61 6e 20 65 78 74 72 61 20 74 79 uire an extra ty
1470: 70 65 20 61 72 67 75 6d 65 6e 74 3a 0a 0a 20 20 pe argument:..
1480: 20 20 20 20 20 61 08 61 76 08 76 5f 08 5f 69 08 a.av.v_._i.
1490: 69 6e 08 6e 74 08 74 20 28 08 28 5f 08 61 5f 08 in.nt.t (.(_.a_.
14a0: 6c 5f 08 69 5f 08 73 5f 08 74 2c 08 2c 20 5f 08 l_.i_.s_.t,., _.
14b0: 69 5f 08 6e 5f 08 74 5f 08 5f 5f 08 76 5f 08 61 i_.n_.t_.__.v_.a
14c0: 5f 08 6c 5f 08 75 5f 08 65 29 08 29 3b 08 3b 0a _.l_.u_.e).);.;.
14d0: 0a 20 20 20 20 20 20 20 61 08 61 76 08 76 5f 08 . a.av.v_.
14e0: 5f 64 08 64 6f 08 6f 75 08 75 62 08 62 6c 08 6c _d.do.ou.ub.bl.l
14f0: 65 08 65 20 28 08 28 5f 08 61 5f 08 6c 5f 08 69 e.e (.(_.a_.l_.i
1500: 5f 08 73 5f 08 74 2c 08 2c 20 5f 08 64 5f 08 6f _.s_.t,., _.d_.o
1510: 5f 08 75 5f 08 62 5f 08 6c 5f 08 65 5f 08 5f 5f _.u_.b_.l_.e_.__
1520: 08 76 5f 08 61 5f 08 6c 5f 08 75 5f 08 65 29 08 .v_.a_.l_.u_.e).
1530: 29 3b 08 3b 0a 0a 20 20 20 20 20 20 20 61 08 61 );.;.. a.a
1540: 76 08 76 5f 08 5f 73 08 73 74 08 74 72 08 72 75 v.v_._s.st.tr.ru
1550: 08 75 63 08 63 74 08 74 20 28 08 28 5f 08 61 5f .uc.ct.t (.(_.a_
1560: 08 6c 5f 08 69 5f 08 73 5f 08 74 2c 08 2c 20 5f .l_.i_.s_.t,., _
1570: 08 73 5f 08 74 5f 08 72 5f 08 75 5f 08 63 5f 08 .s_.t_.r_.u_.c_.
1580: 74 5f 08 5f 5f 08 6f 5f 08 72 5f 08 5f 5f 08 75 t_.__.o_.r_.__.u
1590: 5f 08 6e 5f 08 69 5f 08 6f 5f 08 6e 5f 08 5f 5f _.n_.i_.o_.n_.__
15a0: 08 74 5f 08 79 5f 08 70 5f 08 65 2c 08 2c 20 5f .t_.y_.p_.e,., _
15b0: 08 73 5f 08 74 5f 08 72 5f 08 75 5f 08 63 5f 08 .s_.t_.r_.u_.c_.
15c0: 74 5f 08 5f 5f 08 76 5f 08 61 5f 08 6c 5f 08 75 t_.__.v_.a_.l_.u
15d0: 5f 08 65 29 08 29 3b 08 3b 0a 0a 20 20 20 20 20 _.e).);.;..
15e0: 20 20 61 08 61 76 08 76 5f 08 5f 70 08 70 74 08 a.av.v_._p.pt.
15f0: 74 72 08 72 20 28 08 28 5f 08 61 5f 08 6c 5f 08 tr.r (.(_.a_.l_.
1600: 69 5f 08 73 5f 08 74 2c 08 2c 20 5f 08 70 5f 08 i_.s_.t,., _.p_.
1610: 6f 5f 08 69 5f 08 6e 5f 08 74 5f 08 65 5f 08 72 o_.i_.n_.t_.e_.r
1620: 5f 08 5f 5f 08 74 5f 08 79 5f 08 70 5f 08 65 2c _.__.t_.y_.p_.e,
1630: 08 2c 20 5f 08 70 5f 08 6f 5f 08 69 5f 08 6e 5f ., _.p_.o_.i_.n_
1640: 08 74 5f 08 65 5f 08 72 5f 08 5f 5f 08 76 5f 08 .t_.e_.r_.__.v_.
1650: 61 5f 08 6c 5f 08 75 5f 08 65 29 08 29 3b 08 3b a_.l_.u_.e).);.;
1660: 0a 0a 20 20 20 20 20 20 20 28 35 29 20 20 20 20 .. (5)
1670: 43 61 6c 6c 20 74 68 65 20 66 75 6e 63 74 69 6f Call the functio
1680: 6e 2c 20 73 65 74 20 74 68 65 20 72 65 74 75 72 n, set the retur
1690: 6e 20 76 61 6c 75 65 2c 20 20 61 6e 64 20 20 74 n value, and t
16a0: 69 64 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 idy.
16b0: 20 20 75 70 3a 0a 0a 20 20 20 20 20 20 20 61 08 up:.. a.
16c0: 61 76 08 76 5f 08 5f 63 08 63 61 08 61 6c 08 6c av.v_._c.ca.al.l
16d0: 6c 08 6c 20 28 08 28 5f 08 61 5f 08 6c 5f 08 69 l.l (.(_.a_.l_.i
16e0: 5f 08 73 5f 08 74 29 08 29 3b 08 3b 0a 0a 0a 4e _.s_.t).);.;...N
16f0: 08 4e 4f 08 4f 54 08 54 45 08 45 53 08 53 0a 20 .NO.OT.TE.ES.S.
1700: 20 20 20 20 20 20 28 31 29 20 20 46 75 6e 63 74 (1) Funct
1710: 69 6f 6e 73 20 20 77 68 6f 73 65 20 20 66 69 72 ions whose fir
1720: 73 74 20 64 65 63 6c 61 72 61 74 69 6f 6e 20 69 st declaration i
1730: 73 20 69 6e 20 4b 65 72 6e 69 67 68 61 6e 20 26 s in Kernighan &
1740: 0a 20 20 20 20 20 20 20 52 69 74 63 68 69 65 20 . Ritchie
1750: 73 74 79 6c 65 20 28 69 2e 65 2e 2c 20 77 69 74 style (i.e., wit
1760: 68 6f 75 74 20 61 20 74 79 70 65 64 20 61 72 67 hout a typed arg
1770: 75 6d 65 6e 74 20 20 6c 69 73 74 29 20 20 4d 55 ument list) MU
1780: 53 54 0a 20 20 20 20 20 20 20 75 73 65 20 64 65 ST. use de
1790: 66 61 75 6c 74 20 4b 26 52 20 43 20 65 78 70 72 fault K&R C expr
17a0: 65 73 73 69 6f 6e 20 70 72 6f 6d 6f 74 69 6f 6e ession promotion
17b0: 73 20 28 63 68 61 72 20 61 6e 64 20 73 68 6f 72 s (char and shor
17c0: 74 20 74 6f 0a 20 20 20 20 20 20 20 69 6e 74 2c t to. int,
17d0: 20 66 6c 6f 61 74 20 74 6f 20 64 6f 75 62 6c 65 float to double
17e0: 29 20 77 68 65 74 68 65 72 20 74 68 65 79 20 61 ) whether they a
17f0: 72 65 20 63 6f 6d 70 69 6c 65 64 20 62 79 20 20 re compiled by
1800: 61 20 20 4b 26 52 0a 20 20 20 20 20 20 20 6f 72 a K&R. or
1810: 20 20 61 6e 20 20 41 4e 53 49 20 63 6f 6d 70 69 an ANSI compi
1820: 6c 65 72 2c 20 62 65 63 61 75 73 65 20 74 68 65 ler, because the
1830: 20 74 72 75 65 20 61 72 67 75 6d 65 6e 74 20 74 true argument t
1840: 79 70 65 73 20 6d 61 79 0a 0a 0a 0a 20 20 20 20 ypes may....
1850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1860: 20 20 20 20 20 31 34 20 4a 61 6e 75 61 72 79 20 14 January
1870: 32 30 30 31 20 20 20 20 20 20 20 20 20 20 20 20 2001
1880: 20 20 20 20 20 20 20 20 20 20 20 20 32 0a 0a 0a 2...
1890: 0a 0a 0a 41 56 43 41 4c 4c 28 33 29 20 20 20 20 ...AVCALL(3)
18a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18c0: 20 20 20 20 20 20 20 20 20 20 20 41 56 43 41 4c AVCAL
18d0: 4c 28 33 29 0a 0a 0a 20 20 20 20 20 20 20 6e 6f L(3)... no
18e0: 74 20 62 65 20 6b 6e 6f 77 6e 20 61 74 20 74 68 t be known at th
18f0: 65 20 63 61 6c 6c 20 70 6f 69 6e 74 2e 20 53 75 e call point. Su
1900: 63 68 20 20 66 75 6e 63 74 69 6f 6e 73 20 20 74 ch functions t
1910: 79 70 69 63 61 6c 6c 79 0a 20 20 20 20 20 20 20 ypically.
1920: 62 61 63 6b 2d 63 6f 6e 76 65 72 74 20 20 74 68 back-convert th
1930: 65 69 72 20 20 61 72 67 75 6d 65 6e 74 73 20 20 eir arguments
1940: 74 6f 20 20 74 68 65 20 20 64 65 63 6c 61 72 65 to the declare
1950: 64 20 74 79 70 65 73 20 6f 6e 0a 20 20 20 20 20 d types on.
1960: 20 20 66 75 6e 63 74 69 6f 6e 20 65 6e 74 72 79 function entry
1970: 2e 20 28 49 6e 20 66 61 63 74 2c 20 74 68 65 20 . (In fact, the
1980: 6f 6e 6c 79 20 20 77 61 79 20 20 74 6f 20 20 70 only way to p
1990: 61 73 73 20 20 61 20 20 74 72 75 65 0a 20 20 20 ass a true.
19a0: 20 20 20 20 63 68 61 72 2c 20 20 73 68 6f 72 74 char, short
19b0: 20 20 6f 72 20 20 66 6c 6f 61 74 20 20 69 6e 20 or float in
19c0: 20 4b 26 52 20 43 20 69 73 20 62 79 20 61 6e 20 K&R C is by an
19d0: 65 78 70 6c 69 63 69 74 20 63 61 73 74 3a 0a 20 explicit cast:.
19e0: 20 20 20 20 20 20 66 08 66 75 08 75 6e 08 6e 63 f.fu.un.nc
19f0: 08 63 28 08 28 28 08 28 63 08 63 68 08 68 61 08 .c(.((.(c.ch.ha.
1a00: 61 72 08 72 29 08 29 63 08 63 2c 08 2c 28 08 28 ar.r).)c.c,.,(.(
1a10: 66 08 66 6c 08 6c 6f 08 6f 61 08 61 74 08 74 29 f.fl.lo.oa.at.t)
1a20: 08 29 66 08 66 29 08 29 20 29 2e 20 20 53 69 6d .)f.f).) ). Sim
1a30: 69 6c 61 72 6c 79 2c 20 73 6f 6d 65 20 20 4b 26 ilarly, some K&
1a40: 52 20 20 63 6f 6d 70 69 6c 65 72 73 0a 20 20 20 R compilers.
1a50: 20 20 20 20 28 73 75 63 68 20 61 73 20 53 75 6e (such as Sun
1a60: 20 63 63 20 6f 6e 20 74 68 65 20 73 70 61 72 63 cc on the sparc
1a70: 29 20 61 63 74 75 61 6c 6c 79 20 72 65 74 75 72 ) actually retur
1a80: 6e 20 61 20 66 6c 6f 61 74 20 61 73 20 61 0a 20 n a float as a.
1a90: 20 20 20 20 20 20 64 6f 75 62 6c 65 2e 0a 0a 20 double...
1aa0: 20 20 20 20 20 20 48 65 6e 63 65 2c 20 66 6f 72 Hence, for
1ab0: 20 61 72 67 75 6d 65 6e 74 73 20 6f 66 20 66 75 arguments of fu
1ac0: 6e 63 74 69 6f 6e 73 20 64 65 63 6c 61 72 65 64 nctions declared
1ad0: 20 20 69 6e 20 20 4b 26 52 20 20 73 74 79 6c 65 in K&R style
1ae0: 0a 20 20 20 20 20 20 20 79 6f 75 20 20 73 68 6f . you sho
1af0: 75 6c 64 20 20 75 73 65 20 20 61 08 61 76 08 76 uld use a.av.v
1b00: 5f 08 5f 69 08 69 6e 08 6e 74 08 74 28 08 28 29 _._i.in.nt.t(.()
1b10: 08 29 20 20 61 6e 64 20 20 61 08 61 76 08 76 5f .) and a.av.v_
1b20: 08 5f 64 08 64 6f 08 6f 75 08 75 62 08 62 6c 08 ._d.do.ou.ub.bl.
1b30: 6c 65 08 65 28 08 28 29 08 29 20 20 72 61 74 68 le.e(.().) rath
1b40: 65 72 20 20 74 68 61 6e 0a 20 20 20 20 20 20 20 er than.
1b50: 61 08 61 76 08 76 5f 08 5f 63 08 63 68 08 68 61 a.av.v_._c.ch.ha
1b60: 08 61 72 08 72 28 08 28 29 08 29 2c 08 2c 20 61 .ar.r(.().),., a
1b70: 08 61 76 08 76 5f 08 5f 73 08 73 68 08 68 6f 08 .av.v_._s.sh.ho.
1b80: 6f 72 08 72 74 08 74 28 08 28 29 08 29 20 6f 72 or.rt.t(.().) or
1b90: 20 61 08 61 76 08 76 5f 08 5f 66 08 66 6c 08 6c a.av.v_._f.fl.l
1ba0: 6f 08 6f 61 08 61 74 08 74 28 08 28 29 08 29 2e o.oa.at.t(.().).
1bb0: 08 2e 20 20 49 66 20 20 79 6f 75 20 20 75 73 65 .. If you use
1bc0: 20 20 61 20 20 4b 26 52 0a 20 20 20 20 20 20 20 a K&R.
1bd0: 63 6f 6d 70 69 6c 65 72 2c 20 20 74 68 65 20 20 compiler, the
1be0: 61 76 63 61 6c 6c 20 20 68 65 61 64 65 72 20 66 avcall header f
1bf0: 69 6c 65 73 20 6d 61 79 20 62 65 20 61 62 6c 65 iles may be able
1c00: 20 74 6f 20 64 65 74 65 63 74 0a 20 20 20 20 20 to detect.
1c10: 20 20 74 68 69 73 20 61 6e 64 20 64 65 66 69 6e this and defin
1c20: 65 20 61 08 61 76 08 76 5f 08 5f 66 08 66 6c 08 e a.av.v_._f.fl.
1c30: 6c 6f 08 6f 61 08 61 74 08 74 28 08 28 29 08 29 lo.oa.at.t(.().)
1c40: 2c 08 2c 20 65 74 63 2c 20 61 70 70 72 6f 70 72 ,., etc, appropr
1c50: 69 61 74 65 6c 79 2c 20 20 62 75 74 20 20 77 69 iately, but wi
1c60: 74 68 0a 20 20 20 20 20 20 20 61 6e 20 20 41 4e th. an AN
1c70: 53 49 20 20 63 6f 6d 70 69 6c 65 72 20 20 74 68 SI compiler th
1c80: 65 72 65 20 20 69 73 20 6e 6f 20 77 61 79 20 5f ere is no way _
1c90: 08 61 5f 08 76 5f 08 63 5f 08 61 5f 08 6c 5f 08 .a_.v_.c_.a_.l_.
1ca0: 6c 20 63 61 6e 20 6b 6e 6f 77 20 68 6f 77 20 61 l can know how a
1cb0: 0a 20 20 20 20 20 20 20 66 75 6e 63 74 69 6f 6e . function
1cc0: 20 77 61 73 20 64 65 63 6c 61 72 65 64 2c 20 73 was declared, s
1cd0: 6f 20 79 6f 75 20 68 61 76 65 20 74 6f 20 63 6f o you have to co
1ce0: 72 72 65 63 74 20 74 68 65 20 61 72 67 75 6d 65 rrect the argume
1cf0: 6e 74 0a 20 20 20 20 20 20 20 74 79 70 65 73 20 nt. types
1d00: 79 6f 75 72 73 65 6c 66 2e 0a 0a 20 20 20 20 20 yourself...
1d10: 20 20 28 32 29 20 20 54 68 65 20 20 65 78 70 6c (2) The expl
1d20: 69 63 69 74 20 20 74 79 70 65 20 20 61 72 67 75 icit type argu
1d30: 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 61 08 61 ments of the a.a
1d40: 76 08 76 5f 08 5f 73 08 73 74 08 74 72 08 72 75 v.v_._s.st.tr.ru
1d50: 08 75 63 08 63 74 08 74 28 08 28 29 08 29 20 61 .uc.ct.t(.().) a
1d60: 6e 64 0a 20 20 20 20 20 20 20 61 08 61 76 08 76 nd. a.av.v
1d70: 5f 08 5f 70 08 70 74 08 74 72 08 72 28 08 28 29 _._p.pt.tr.r(.()
1d80: 08 29 20 6d 61 63 72 6f 73 20 61 72 65 20 20 74 .) macros are t
1d90: 79 70 69 63 61 6c 6c 79 20 20 75 73 65 64 20 20 ypically used
1da0: 74 6f 20 20 63 61 6c 63 75 6c 61 74 65 20 20 73 to calculate s
1db0: 69 7a 65 2c 0a 20 20 20 20 20 20 20 61 6c 69 67 ize,. alig
1dc0: 6e 6d 65 6e 74 2c 20 20 61 6e 64 20 70 61 73 73 nment, and pass
1dd0: 69 6e 67 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 2e ing conventions.
1de0: 20 20 54 68 69 73 20 6d 61 79 20 6e 6f 74 20 62 This may not b
1df0: 65 20 73 75 66 2d 0a 20 20 20 20 20 20 20 66 69 e suf-. fi
1e00: 63 69 65 6e 74 20 66 6f 72 20 20 73 6f 6d 65 20 cient for some
1e10: 20 6d 61 63 68 69 6e 65 73 20 20 77 69 74 68 20 machines with
1e20: 20 75 6e 75 73 75 61 6c 20 20 73 74 72 75 63 74 unusual struct
1e30: 75 72 65 20 20 61 6e 64 0a 20 20 20 20 20 20 20 ure and.
1e40: 70 6f 69 6e 74 65 72 20 20 68 61 6e 64 6c 69 6e pointer handlin
1e50: 67 3a 20 69 6e 20 74 68 69 73 20 63 61 73 65 20 g: in this case
1e60: 61 64 64 69 74 69 6f 6e 61 6c 20 61 08 61 76 08 additional a.av.
1e70: 76 5f 08 5f 73 08 73 74 08 74 61 08 61 72 08 72 v_._s.st.ta.ar.r
1e80: 74 08 74 5f 08 5f 5f 08 74 5f 08 79 5f 08 70 5f t.t_.__.t_.y_.p_
1e90: 08 65 28 08 28 29 08 29 0a 20 20 20 20 20 20 20 .e(.().).
1ea0: 61 6e 64 20 61 08 61 76 08 76 5f 08 5f 5f 08 74 and a.av.v_.__.t
1eb0: 5f 08 79 5f 08 70 5f 08 65 28 08 28 29 08 29 20 _.y_.p_.e(.().)
1ec0: 6d 61 63 72 6f 73 20 6d 61 79 20 62 65 20 64 65 macros may be de
1ed0: 66 69 6e 65 64 2e 0a 0a 20 20 20 20 20 20 20 28 fined... (
1ee0: 33 29 20 54 68 65 20 6d 61 63 72 6f 73 20 61 08 3) The macros a.
1ef0: 61 76 08 76 5f 08 5f 73 08 73 74 08 74 61 08 61 av.v_._s.st.ta.a
1f00: 72 08 72 74 08 74 5f 08 5f 6c 08 6c 6f 08 6f 6e r.rt.t_._l.lo.on
1f10: 08 6e 67 08 67 6c 08 6c 6f 08 6f 6e 08 6e 67 08 .ng.gl.lo.on.ng.
1f20: 67 28 08 28 29 08 29 2c 20 20 61 08 61 76 08 76 g(.().), a.av.v
1f30: 5f 08 5f 73 08 73 74 08 74 61 08 61 72 08 72 74 _._s.st.ta.ar.rt
1f40: 08 74 5f 08 5f 75 08 75 6c 08 6c 6f 08 6f 6e 08 .t_._u.ul.lo.on.
1f50: 6e 67 08 67 6c 08 6c 6f 08 6f 6e 08 6e 67 08 67 ng.gl.lo.on.ng.g
1f60: 28 08 28 29 08 29 2c 0a 20 20 20 20 20 20 20 61 (.().),. a
1f70: 08 61 76 08 76 5f 08 5f 6c 08 6c 6f 08 6f 6e 08 .av.v_._l.lo.on.
1f80: 6e 67 08 67 6c 08 6c 6f 08 6f 6e 08 6e 67 08 67 ng.gl.lo.on.ng.g
1f90: 28 08 28 29 08 29 20 20 61 6e 64 20 20 61 08 61 (.().) and a.a
1fa0: 76 08 76 5f 08 5f 75 08 75 6c 08 6c 6f 08 6f 6e v.v_._u.ul.lo.on
1fb0: 08 6e 67 08 67 6c 08 6c 6f 08 6f 6e 08 6e 67 08 .ng.gl.lo.on.ng.
1fc0: 67 28 08 28 29 08 29 20 77 6f 72 6b 20 6f 6e 6c g(.().) work onl
1fd0: 79 20 69 66 20 74 68 65 20 43 20 63 6f 6d 2d 0a y if the C com-.
1fe0: 20 20 20 20 20 20 20 70 69 6c 65 72 20 68 61 73 piler has
1ff0: 20 61 20 77 6f 72 6b 69 6e 67 20 6c 08 6c 6f 08 a working l.lo.
2000: 6f 6e 08 6e 67 08 67 20 6c 08 6c 6f 08 6f 6e 08 on.ng.g l.lo.on.
2010: 6e 67 08 67 20 36 34 2d 62 69 74 20 69 6e 74 65 ng.g 64-bit inte
2020: 67 65 72 20 74 79 70 65 2e 0a 0a 20 20 20 20 20 ger type...
2030: 20 20 28 34 29 20 20 54 68 65 20 20 73 74 72 75 (4) The stru
2040: 63 74 20 20 74 79 70 65 73 20 20 75 73 65 64 20 ct types used
2050: 20 69 6e 20 20 61 08 61 76 08 76 5f 08 5f 73 08 in a.av.v_._s.
2060: 73 74 08 74 61 08 61 72 08 72 74 08 74 5f 08 5f st.ta.ar.rt.t_._
2070: 73 08 73 74 08 74 72 08 72 75 08 75 63 08 63 74 s.st.tr.ru.uc.ct
2080: 08 74 28 08 28 29 08 29 20 20 20 61 6e 64 0a 20 .t(.().) and.
2090: 20 20 20 20 20 20 61 08 61 76 08 76 5f 08 5f 73 a.av.v_._s
20a0: 08 73 74 08 74 72 08 72 75 08 75 63 08 63 74 08 .st.tr.ru.uc.ct.
20b0: 74 28 08 28 29 08 29 20 20 6d 75 73 74 20 20 6f t(.().) must o
20c0: 6e 6c 79 20 20 63 6f 6e 74 61 69 6e 20 28 73 69 nly contain (si
20d0: 67 6e 65 64 20 6f 72 20 75 6e 73 69 67 6e 65 64 gned or unsigned
20e0: 29 20 69 6e 74 2c 0a 20 20 20 20 20 20 20 6c 6f ) int,. lo
20f0: 6e 67 2c 20 6c 6f 6e 67 20 6c 6f 6e 67 20 6f 72 ng, long long or
2100: 20 70 6f 69 6e 74 65 72 20 66 69 65 6c 64 73 2e pointer fields.
2110: 20 20 53 74 72 75 63 74 20 74 79 70 65 73 20 20 Struct types
2120: 63 6f 6e 74 61 69 6e 2d 0a 20 20 20 20 20 20 20 contain-.
2130: 69 6e 67 20 20 28 73 69 67 6e 65 64 20 20 6f 72 ing (signed or
2140: 20 20 75 6e 73 69 67 6e 65 64 29 20 20 63 68 61 unsigned) cha
2150: 72 2c 20 73 68 6f 72 74 2c 20 66 6c 6f 61 74 2c r, short, float,
2160: 20 64 6f 75 62 6c 65 20 6f 72 0a 20 20 20 20 20 double or.
2170: 20 20 6f 74 68 65 72 20 73 74 72 75 63 74 73 20 other structs
2180: 61 72 65 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 are not supporte
2190: 64 2e 0a 0a 0a 53 08 53 45 08 45 45 08 45 20 41 d....S.SE.EE.E A
21a0: 08 41 4c 08 4c 53 08 53 4f 08 4f 0a 20 20 20 20 .AL.LS.SO.O.
21b0: 20 20 20 73 08 73 74 08 74 64 08 64 61 08 61 72 s.st.td.da.ar
21c0: 08 72 67 08 67 28 33 29 2c 20 76 08 76 61 08 61 .rg.g(3), v.va.a
21d0: 72 08 72 61 08 61 72 08 72 67 08 67 73 08 73 28 r.ra.ar.rg.gs.s(
21e0: 33 29 2e 0a 0a 0a 42 08 42 55 08 55 47 08 47 53 3)....B.BU.UG.GS
21f0: 08 53 0a 20 20 20 20 20 20 20 54 68 65 20 63 75 .S. The cu
2200: 72 72 65 6e 74 20 69 6d 70 6c 65 6d 65 6e 74 61 rrent implementa
2210: 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65 6e 20 tions have been
2220: 74 65 73 74 65 64 20 6f 6e 20 20 61 20 20 73 65 tested on a se
2230: 6c 65 63 2d 0a 20 20 20 20 20 20 20 74 69 6f 6e lec-. tion
2240: 20 20 6f 66 20 20 63 6f 6d 6d 6f 6e 20 20 63 61 of common ca
2250: 73 65 73 20 20 62 75 74 20 74 68 65 72 65 20 61 ses but there a
2260: 72 65 20 70 72 6f 62 61 62 6c 79 20 73 74 69 6c re probably stil
2270: 6c 20 6d 61 6e 79 0a 20 20 20 20 20 20 20 62 75 l many. bu
2280: 67 73 2e 0a 0a 20 20 20 20 20 20 20 54 68 65 72 gs... Ther
2290: 65 20 61 72 65 20 74 79 70 69 63 61 6c 6c 79 20 e are typically
22a0: 62 75 69 6c 74 2d 69 6e 20 6c 69 6d 69 74 73 20 built-in limits
22b0: 6f 6e 20 20 74 68 65 20 20 73 69 7a 65 20 20 6f on the size o
22c0: 66 20 20 74 68 65 0a 20 20 20 20 20 20 20 61 72 f the. ar
22d0: 67 75 6d 65 6e 74 2d 6c 69 73 74 2c 20 20 77 68 gument-list, wh
22e0: 69 63 68 20 20 6d 61 79 20 20 61 6c 73 6f 20 20 ich may also
22f0: 69 6e 63 6c 75 64 65 20 20 74 68 65 20 73 69 7a include the siz
2300: 65 20 6f 66 20 61 6e 79 0a 20 20 20 20 20 20 20 e of any.
2310: 73 74 72 75 63 74 75 72 65 20 61 72 67 75 6d 65 structure argume
2320: 6e 74 73 2e 0a 0a 20 20 20 20 20 20 20 54 68 65 nts... The
2330: 20 64 65 63 69 73 69 6f 6e 20 77 68 65 74 68 65 decision whethe
2340: 72 20 61 20 73 74 72 75 63 74 20 69 73 20 74 6f r a struct is to
2350: 20 62 65 20 72 65 74 75 72 6e 65 64 20 69 6e 20 be returned in
2360: 20 72 65 67 69 73 2d 0a 20 20 20 20 20 20 20 74 regis-. t
2370: 65 72 73 20 20 6f 72 20 20 69 6e 20 20 6d 65 6d ers or in mem
2380: 6f 72 79 20 20 63 6f 6e 73 69 64 65 72 73 20 6f ory considers o
2390: 6e 6c 79 20 74 68 65 20 73 74 72 75 63 74 27 73 nly the struct's
23a0: 20 73 69 7a 65 20 61 6e 64 0a 20 20 20 20 20 20 size and.
23b0: 20 61 6c 69 67 6e 6d 65 6e 74 2e 20 54 68 69 73 alignment. This
23c0: 20 69 73 20 69 6e 61 63 63 75 72 61 74 65 3a 20 is inaccurate:
23d0: 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 67 63 63 for example, gcc
23e0: 20 20 6f 6e 20 20 6d 36 38 6b 2d 0a 20 20 20 20 on m68k-.
23f0: 20 20 20 6e 65 78 74 20 20 72 65 74 75 72 6e 73 next returns
2400: 20 20 73 08 73 74 08 74 72 08 72 75 08 75 63 08 s.st.tr.ru.uc.
2410: 63 74 08 74 20 20 7b 08 7b 20 20 63 08 63 68 08 ct.t {.{ c.ch.
2420: 68 61 08 61 72 08 72 20 20 61 08 61 2c 08 2c 62 ha.ar.r a.a,.,b
2430: 08 62 2c 08 2c 63 08 63 3b 08 3b 20 20 7d 08 7d .b,.,c.c;.; }.}
2440: 20 69 6e 20 72 65 67 69 73 74 65 72 73 20 61 6e in registers an
2450: 64 0a 20 20 20 20 20 20 20 73 08 73 74 08 74 72 d. s.st.tr
2460: 08 72 75 08 75 63 08 63 74 08 74 20 7b 08 7b 20 .ru.uc.ct.t {.{
2470: 63 08 63 68 08 68 61 08 61 72 08 72 20 61 08 61 c.ch.ha.ar.r a.a
2480: 5b 08 5b 33 08 33 5d 08 5d 3b 08 3b 20 7d 08 7d [.[3.3].];.; }.}
2490: 20 69 6e 20 6d 65 6d 6f 72 79 2c 20 61 6c 74 68 in memory, alth
24a0: 6f 75 67 68 20 62 6f 74 68 20 74 79 70 65 73 20 ough both types
24b0: 20 68 61 76 65 0a 20 20 20 20 20 20 20 74 68 65 have. the
24c0: 20 73 61 6d 65 20 73 69 7a 65 20 61 6e 64 20 74 same size and t
24d0: 68 65 20 73 61 6d 65 20 61 6c 69 67 6e 6d 65 6e he same alignmen
24e0: 74 2e 0a 0a 0a 0a 20 20 20 20 20 20 20 20 20 20 t.....
24f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 1
2500: 34 20 4a 61 6e 75 61 72 79 20 32 30 30 31 20 20 4 January 2001
2510: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2520: 20 20 20 20 20 20 33 0a 0a 0a 0a 0a 0a 41 56 43 3......AVC
2530: 41 4c 4c 28 33 29 20 20 20 20 20 20 20 20 20 20 ALL(3)
2540: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2560: 20 20 20 20 20 41 56 43 41 4c 4c 28 33 29 0a 0a AVCALL(3)..
2570: 0a 4e 08 4e 4f 08 4f 4e 08 4e 2d 08 2d 42 08 42 .N.NO.ON.N-.-B.B
2580: 55 08 55 47 08 47 53 08 53 0a 20 20 20 20 20 20 U.UG.GS.S.
2590: 20 41 6c 6c 20 20 69 6e 66 6f 72 6d 61 74 69 6f All informatio
25a0: 6e 20 69 73 20 70 61 73 73 65 64 20 69 6e 20 43 n is passed in C
25b0: 50 55 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 PU registers and
25c0: 20 74 68 65 20 73 74 61 63 6b 2e 0a 20 20 20 20 the stack..
25d0: 20 20 20 54 68 65 20 61 08 61 76 08 76 63 08 63 The a.av.vc.c
25e0: 61 08 61 6c 08 6c 6c 08 6c 20 70 61 63 6b 61 67 a.al.ll.l packag
25f0: 65 20 69 73 20 74 68 65 72 65 66 6f 72 65 20 6d e is therefore m
2600: 75 6c 74 69 74 68 72 65 61 64 2d 73 61 66 65 2e ultithread-safe.
2610: 0a 0a 0a 50 08 50 4f 08 4f 52 08 52 54 08 54 49 ...P.PO.OR.RT.TI
2620: 08 49 4e 08 4e 47 08 47 20 41 08 41 56 08 56 43 .IN.NG.G A.AV.VC
2630: 08 43 41 08 41 4c 08 4c 4c 08 4c 0a 20 20 20 20 .CA.AL.LL.L.
2640: 20 20 20 50 6f 72 74 73 2c 20 62 75 67 2d 66 69 Ports, bug-fi
2650: 78 65 73 2c 20 61 6e 64 20 73 75 67 67 65 73 74 xes, and suggest
2660: 69 6f 6e 73 20 61 72 65 20 20 6d 6f 73 74 20 20 ions are most
2670: 77 65 6c 63 6f 6d 65 2e 20 20 54 68 65 0a 20 20 welcome. The.
2680: 20 20 20 20 20 6d 61 63 72 6f 73 20 20 72 65 71 macros req
2690: 75 69 72 65 64 20 20 66 6f 72 20 20 61 72 67 75 uired for argu
26a0: 6d 65 6e 74 20 70 75 73 68 69 6e 67 20 61 72 65 ment pushing are
26b0: 20 70 72 65 74 74 79 20 67 72 75 6e 67 79 2c 0a pretty grungy,.
26c0: 20 20 20 20 20 20 20 62 75 74 20 69 74 20 64 6f but it do
26d0: 65 73 20 73 65 65 6d 20 74 6f 20 62 65 20 70 6f es seem to be po
26e0: 73 73 69 62 6c 65 20 74 6f 20 70 6f 72 74 20 61 ssible to port a
26f0: 76 63 61 6c 6c 20 74 6f 20 61 20 20 72 61 6e 67 vcall to a rang
2700: 65 0a 20 20 20 20 20 20 20 6f 66 20 20 6d 61 63 e. of mac
2710: 68 69 6e 65 73 2e 20 50 6f 72 74 73 20 74 6f 20 hines. Ports to
2720: 6e 6f 6e 2d 73 74 61 6e 64 61 72 64 20 6f 72 20 non-standard or
2730: 6e 6f 6e 2d 33 32 2d 62 69 74 20 6d 61 63 68 69 non-32-bit machi
2740: 6e 65 73 0a 20 20 20 20 20 20 20 61 72 65 20 65 nes. are e
2750: 73 70 65 63 69 61 6c 6c 79 20 77 65 6c 63 6f 6d specially welcom
2760: 65 20 73 6f 20 77 65 20 63 61 6e 20 73 6f 72 74 e so we can sort
2770: 20 20 74 68 65 20 20 69 6e 74 65 72 66 61 63 65 the interface
2780: 20 20 6f 75 74 0a 20 20 20 20 20 20 20 62 65 66 out. bef
2790: 6f 72 65 20 69 74 27 73 20 74 6f 6f 20 6c 61 74 ore it's too lat
27a0: 65 2e 0a 0a 20 20 20 20 20 20 20 4b 6e 6f 77 6c e... Knowl
27b0: 65 64 67 65 20 20 61 62 6f 75 74 20 61 72 67 75 edge about argu
27c0: 6d 65 6e 74 20 70 61 73 73 69 6e 67 20 63 6f 6e ment passing con
27d0: 76 65 6e 74 69 6f 6e 73 20 63 61 6e 20 62 65 20 ventions can be
27e0: 66 6f 75 6e 64 0a 20 20 20 20 20 20 20 69 6e 20 found. in
27f0: 74 68 65 20 67 63 63 20 73 6f 75 72 63 65 2c 20 the gcc source,
2800: 66 69 6c 65 20 20 67 63 63 2d 32 2e 36 2e 33 2f file gcc-2.6.3/
2810: 63 6f 6e 66 69 67 2f 5f 08 63 5f 08 70 5f 08 75 config/_.c_.p_.u
2820: 2f 5f 08 63 5f 08 70 5f 08 75 2e 68 2c 20 20 73 /_.c_.p_.u.h, s
2830: 65 63 2d 0a 20 20 20 20 20 20 20 74 69 6f 6e 20 ec-. tion
2840: 22 53 74 61 63 6b 20 6c 61 79 6f 75 74 3b 20 66 "Stack layout; f
2850: 75 6e 63 74 69 6f 6e 20 65 6e 74 72 79 2c 20 65 unction entry, e
2860: 78 69 74 20 61 6e 64 20 63 61 6c 6c 69 6e 67 2e xit and calling.
2870: 22 0a 0a 20 20 20 20 20 20 20 53 6f 6d 65 20 20 ".. Some
2880: 6f 66 20 20 74 68 65 20 67 72 75 6e 67 65 20 69 of the grunge i
2890: 73 20 75 73 75 61 6c 6c 79 20 68 61 6e 64 6c 65 s usually handle
28a0: 64 20 62 79 20 61 20 43 20 6f 72 20 61 73 73 65 d by a C or asse
28b0: 6d 62 6c 79 0a 20 20 20 20 20 20 20 6c 65 76 65 mbly. leve
28c0: 6c 20 67 6c 75 65 20 72 6f 75 74 69 6e 65 20 74 l glue routine t
28d0: 68 61 74 20 20 61 63 74 75 61 6c 6c 79 20 20 70 hat actually p
28e0: 75 73 68 65 73 20 20 74 68 65 20 20 61 72 67 75 ushes the argu
28f0: 6d 65 6e 74 73 2c 0a 20 20 20 20 20 20 20 63 61 ments,. ca
2900: 6c 6c 73 20 20 74 68 65 20 66 75 6e 63 74 69 6f lls the functio
2910: 6e 20 61 6e 64 20 75 6e 70 61 63 6b 73 20 61 6e n and unpacks an
2920: 79 20 72 65 74 75 72 6e 20 76 61 6c 75 65 2e 20 y return value.
2930: 20 54 68 69 73 20 69 73 0a 20 20 20 20 20 20 20 This is.
2940: 63 61 6c 6c 65 64 20 5f 5f 62 75 69 6c 74 69 6e called __builtin
2950: 5f 61 76 63 61 6c 6c 28 29 2e 20 41 20 70 72 65 _avcall(). A pre
2960: 63 6f 6d 70 69 6c 65 64 20 61 73 73 65 6d 62 6c compiled assembl
2970: 65 72 20 76 65 72 73 69 6f 6e 0a 20 20 20 20 20 er version.
2980: 20 20 66 6f 72 20 70 65 6f 70 6c 65 20 77 69 74 for people wit
2990: 68 6f 75 74 20 67 63 63 20 69 73 20 61 6c 73 6f hout gcc is also
29a0: 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 2e made available.
29b0: 20 54 68 65 20 72 6f 75 74 69 6e 65 0a 20 20 20 The routine.
29c0: 20 20 20 20 73 68 6f 75 6c 64 20 69 64 65 61 6c should ideal
29d0: 6c 79 20 68 61 76 65 20 66 6c 61 67 73 20 66 6f ly have flags fo
29e0: 72 20 74 68 65 20 70 61 73 73 69 6e 67 20 20 63 r the passing c
29f0: 6f 6e 76 65 6e 74 69 6f 6e 73 20 20 6f 66 0a 20 onventions of.
2a00: 20 20 20 20 20 20 6f 74 68 65 72 20 63 6f 6d 70 other comp
2a10: 69 6c 65 72 73 2e 0a 0a 20 20 20 20 20 20 20 4d ilers... M
2a20: 61 6e 79 20 20 6f 66 20 20 74 68 65 20 20 63 75 any of the cu
2a30: 72 72 65 6e 74 20 72 6f 75 74 69 6e 65 73 20 77 rrent routines w
2a40: 61 73 74 65 20 61 20 6c 6f 74 20 6f 66 20 73 74 aste a lot of st
2a50: 61 63 6b 20 73 70 61 63 65 0a 20 20 20 20 20 20 ack space.
2a60: 20 61 6e 64 20 67 65 6e 65 72 61 6c 6c 79 20 64 and generally d
2a70: 6f 20 68 61 69 72 79 20 74 68 69 6e 67 73 20 74 o hairy things t
2a80: 6f 20 73 74 61 63 6b 20 66 72 61 6d 65 73 20 2d o stack frames -
2a90: 20 61 20 62 69 74 20 6d 6f 72 65 0a 20 20 20 20 a bit more.
2aa0: 20 20 20 61 73 73 65 6d 62 6c 79 20 63 6f 64 65 assembly code
2ab0: 20 77 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 would probably
2ac0: 68 65 6c 70 20 74 68 69 6e 67 73 20 61 6c 6f 6e help things alon
2ad0: 67 20 71 75 69 74 65 20 61 20 62 69 74 0a 20 20 g quite a bit.
2ae0: 20 20 20 20 20 68 65 72 65 2e 0a 0a 0a 41 08 41 here....A.A
2af0: 55 08 55 54 08 54 48 08 48 4f 08 4f 52 08 52 0a U.UT.TH.HO.OR.R.
2b00: 20 20 20 20 20 20 20 42 69 6c 6c 20 54 72 69 67 Bill Trig
2b10: 67 73 20 3c 42 69 6c 6c 2e 54 72 69 67 67 73 40 gs <Bill.Triggs@
2b20: 69 6e 72 69 61 6c 70 65 73 2e 66 72 3e 2e 0a 0a inrialpes.fr>...
2b30: 0a 41 08 41 43 08 43 4b 08 4b 4e 08 4e 4f 08 4f .A.AC.CK.KN.NO.O
2b40: 57 08 57 4c 08 4c 45 08 45 44 08 44 47 08 47 45 W.WL.LE.ED.DG.GE
2b50: 08 45 4d 08 4d 45 08 45 4e 08 4e 54 08 54 53 08 .EM.ME.EN.NT.TS.
2b60: 53 0a 20 20 20 20 20 20 20 53 6f 6d 65 20 69 6e S. Some in
2b70: 69 74 69 61 6c 20 69 64 65 61 73 20 77 65 72 65 itial ideas were
2b80: 20 73 74 6f 6c 65 6e 20 66 72 6f 6d 20 74 68 65 stolen from the
2b90: 20 43 20 69 6e 74 65 72 66 61 63 65 20 74 6f 20 C interface to
2ba0: 74 68 65 0a 20 20 20 20 20 20 20 5a 65 6c 6b 20 the. Zelk
2bb0: 65 78 74 65 6e 73 69 6f 6e 73 20 74 6f 20 4f 6c extensions to Ol
2bc0: 69 76 65 72 20 4c 61 75 6d 61 6e 6e 27 73 20 45 iver Laumann's E
2bd0: 6c 6b 20 73 63 68 65 6d 65 20 69 6e 74 65 72 70 lk scheme interp
2be0: 72 65 74 65 72 0a 20 20 20 20 20 20 20 62 79 20 reter. by
2bf0: 4a 2e 50 2e 4c 65 77 69 73 2c 20 4e 45 43 20 20 J.P.Lewis, NEC
2c00: 43 26 43 20 20 52 65 73 65 61 72 63 68 2c 20 20 C&C Research,
2c10: 3c 7a 69 6c 6c 61 40 63 63 72 6c 2e 6e 6a 2e 6e <zilla@ccrl.nj.n
2c20: 65 63 2e 63 6f 6d 3e 0a 20 20 20 20 20 20 20 28 ec.com>. (
2c30: 66 6f 72 20 20 20 20 53 75 6e 34 20 20 20 20 26 for Sun4 &
2c40: 20 20 20 20 53 47 49 29 2c 20 20 20 20 61 6e 64 SGI), and
2c50: 20 20 20 20 52 6f 79 20 20 20 20 46 65 61 74 68 Roy Feath
2c60: 65 72 73 74 6f 6e 65 27 73 0a 20 20 20 20 20 20 erstone's.
2c70: 20 3c 72 6f 79 40 72 6f 62 6f 74 73 2e 6f 78 66 <roy@robots.oxf
2c80: 6f 72 64 2e 61 63 2e 75 6b 3e 20 70 65 72 73 6f ord.ac.uk> perso
2c90: 6e 61 6c 20 43 20 69 6e 74 65 72 66 61 63 65 20 nal C interface
2ca0: 6c 69 62 72 61 72 79 20 66 6f 72 0a 20 20 20 20 library for.
2cb0: 20 20 20 53 75 6e 5b 33 34 5d 20 20 26 20 20 53 Sun[34] & S
2cc0: 47 49 2e 20 20 20 49 20 20 61 6c 73 6f 20 6c 6f GI. I also lo
2cd0: 6f 6b 65 64 20 61 74 20 74 68 65 20 6d 61 63 68 oked at the mach
2ce0: 69 6e 65 2d 64 65 70 65 6e 64 65 6e 74 0a 20 20 ine-dependent.
2cf0: 20 20 20 20 20 70 61 72 74 73 20 6f 66 20 74 68 parts of th
2d00: 65 20 47 43 43 20 61 6e 64 20 47 44 42 20 64 69 e GCC and GDB di
2d10: 73 74 72 69 62 75 74 69 6f 6e 73 2c 20 61 6e 64 stributions, and
2d20: 20 20 70 75 74 20 20 74 68 65 20 20 67 63 63 0a put the gcc.
2d30: 20 20 20 20 20 20 20 61 73 6d 28 29 20 65 78 74 asm() ext
2d40: 65 6e 73 69 6f 6e 73 20 74 6f 20 67 6f 6f 64 20 ensions to good
2d50: 75 73 65 2e 20 54 68 61 6e 6b 73 20 67 75 79 73 use. Thanks guys
2d60: 21 0a 0a 20 20 20 20 20 20 20 54 68 69 73 20 77 !.. This w
2d70: 6f 72 6b 20 77 61 73 20 70 61 72 74 6c 79 20 73 ork was partly s
2d80: 75 70 70 6f 72 74 65 64 20 62 79 20 45 43 2d 45 upported by EC-E
2d90: 53 50 52 49 54 20 42 61 73 69 63 20 52 65 73 65 SPRIT Basic Rese
2da0: 61 72 63 68 0a 20 20 20 20 20 20 20 41 63 74 69 arch. Acti
2db0: 6f 6e 20 53 45 43 4f 4e 44 2e 0a 0a 0a 0a 0a 0a on SECOND.......
2dc0: 0a 0a 0a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 .....
2dd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 34 14
2de0: 20 4a 61 6e 75 61 72 79 20 32 30 30 31 20 20 20 January 2001
2df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2e00: 20 20 20 20 20 34 0a 0a 0a 4...