Artifact 79839f93299e97cfe709ae7b1ab3f0e3fdf55640:


0000: 74 72 61 6d 70 6f 6c 69 6e 65 20 2d 20 63 6c 6f  trampoline - clo
0010: 73 75 72 65 73 20 61 73 20 66 69 72 73 74 2d 63  sures as first-c
0020: 6c 61 73 73 20 43 20 66 75 6e 63 74 69 6f 6e 73  lass C functions
0030: 2e 0a 0a 54 68 69 73 20 6c 69 62 72 61 72 79 20  ...This library 
0040: 69 6d 70 6c 65 6d 65 6e 74 73 20 63 6c 6f 73 75  implements closu
0050: 72 65 73 20 61 73 20 66 69 72 73 74 2d 63 6c 61  res as first-cla
0060: 73 73 20 43 20 66 75 6e 63 74 69 6f 6e 73 2e 20  ss C functions. 
0070: 41 20 63 6c 6f 73 75 72 65 0a 63 6f 6e 73 69 73  A closure.consis
0080: 74 73 20 6f 66 20 61 20 72 65 67 75 6c 61 72 20  ts of a regular 
0090: 43 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 61  C function and a
00a0: 20 70 69 65 63 65 20 6f 66 20 64 61 74 61 20 77   piece of data w
00b0: 68 69 63 68 20 67 65 74 73 20 70 61 73 73 65 64  hich gets passed
00c0: 20 74 6f 0a 74 68 65 20 43 20 66 75 6e 63 74 69   to.the C functi
00d0: 6f 6e 20 77 68 65 6e 20 74 68 65 20 63 6c 6f 73  on when the clos
00e0: 75 72 65 20 69 73 20 63 61 6c 6c 65 64 2e 0a 0a  ure is called...
00f0: 54 79 70 69 63 61 6c 20 75 73 65 73 20 6f 66 20  Typical uses of 
0100: 63 6c 6f 73 75 72 65 73 20 61 72 65 20 6e 65 73  closures are nes
0110: 74 65 64 20 66 75 6e 63 74 69 6f 6e 73 20 69 6e  ted functions in
0120: 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e   programming lan
0130: 67 75 61 67 65 73 2c 0a 61 6e 64 20 63 61 6c 6c  guages,.and call
0140: 2d 62 61 63 6b 20 66 75 6e 63 74 69 6f 6e 73 20  -back functions 
0150: 70 61 73 73 65 64 20 74 6f 20 6f 74 68 65 72 20  passed to other 
0160: 6c 69 62 72 61 72 69 65 73 2e 0a 0a 0a 49 6e 73  libraries....Ins
0170: 74 61 6c 6c 61 74 69 6f 6e 20 69 6e 73 74 72 75  tallation instru
0180: 63 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 20 20  ctions:..       
0190: 20 2e 2f 63 6f 6e 66 69 67 75 72 65 0a 20 20 20   ./configure.   
01a0: 20 20 20 20 20 6d 61 6b 65 0a 20 20 20 20 20 20       make.      
01b0: 20 20 6d 61 6b 65 20 63 68 65 63 6b 0a 20 20 20    make check.   
01c0: 20 20 20 20 20 6d 61 6b 65 20 69 6e 73 74 61 6c       make instal
01d0: 6c 0a 0a 0a 46 69 6c 65 73 20 69 6e 20 74 68 69  l...Files in thi
01e0: 73 20 70 61 63 6b 61 67 65 3a 0a 0a 20 20 20 20  s package:..    
01f0: 44 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 3a 0a 0a  Documentation:..
0200: 20 20 20 20 20 20 20 20 52 45 41 44 4d 45 20 20          README  
0210: 20 20 20 20 20 20 20 20 20 74 68 69 73 20 74 65           this te
0220: 78 74 0a 20 20 20 20 20 20 20 20 43 4f 50 59 49  xt.        COPYI
0230: 4e 47 20 20 20 20 20 20 20 20 20 20 66 72 65 65  NG          free
0240: 20 73 6f 66 74 77 61 72 65 20 6c 69 63 65 6e 73   software licens
0250: 65 0a 20 20 20 20 20 20 20 20 50 4c 41 54 46 4f  e.        PLATFO
0260: 52 4d 53 20 20 20 20 20 20 20 20 6c 69 73 74 20  RMS        list 
0270: 6f 66 20 73 75 70 70 6f 72 74 65 64 20 70 6c 61  of supported pla
0280: 74 66 6f 72 6d 73 0a 20 20 20 20 20 20 20 20 74  tforms.        t
0290: 72 61 6d 70 6f 6c 69 6e 65 2e 33 20 20 20 20 20  rampoline.3     
02a0: 6d 61 6e 75 61 6c 20 70 61 67 65 20 69 6e 20 55  manual page in U
02b0: 6e 69 78 20 6d 61 6e 20 66 6f 72 6d 61 74 0a 20  nix man format. 
02c0: 20 20 20 20 20 20 20 74 72 61 6d 70 6f 6c 69 6e         trampolin
02d0: 65 2e 68 74 6d 6c 20 20 6d 61 6e 75 61 6c 20 70  e.html  manual p
02e0: 61 67 65 20 69 6e 20 48 54 4d 4c 20 66 6f 72 6d  age in HTML form
02f0: 61 74 0a 0a 20 20 20 20 53 6f 75 72 63 65 3a 0a  at..    Source:.
0300: 0a 20 20 20 20 20 20 20 20 74 72 61 6d 70 6f 6c  .        trampol
0310: 69 6e 65 2e 68 2e 69 6e 20 20 69 6e 63 6c 75 64  ine.h.in  includ
0320: 65 20 66 69 6c 65 0a 20 20 20 20 20 20 20 20 74  e file.        t
0330: 72 61 6d 70 6f 6c 69 6e 65 2e 63 20 20 20 20 20  rampoline.c     
0340: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f  implementation o
0350: 66 20 74 68 65 20 6c 69 62 72 61 72 79 20 66 75  f the library fu
0360: 6e 63 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 20  nctions.        
0370: 74 72 61 6d 70 2d 68 70 70 61 2e 73 20 20 20 20  tramp-hppa.s    
0380: 20 74 68 65 20 74 72 61 6d 70 6f 6c 69 6e 65 20   the trampoline 
0390: 66 6f 72 20 68 70 70 61 2c 20 69 6e 20 61 73 73  for hppa, in ass
03a0: 65 6d 62 6c 79 20 6c 61 6e 67 75 61 67 65 0a 20  embly language. 
03b0: 20 20 20 20 20 20 20 74 72 61 6d 70 2d 70 6f 77         tramp-pow
03c0: 65 72 70 63 2e 53 20 20 74 68 65 20 74 72 61 6d  erpc.S  the tram
03d0: 70 6f 6c 69 6e 65 20 66 6f 72 20 70 6f 77 65 72  poline for power
03e0: 70 63 2c 20 69 6e 20 61 73 73 65 6d 62 6c 79 20  pc, in assembly 
03f0: 6c 61 6e 67 75 61 67 65 0a 20 20 20 20 20 20 20  language.       
0400: 20 70 72 6f 74 65 78 65 63 2e 63 20 20 20 20 20   protexec.c     
0410: 20 20 68 6f 77 20 74 6f 20 73 65 74 20 6d 65 6d    how to set mem
0420: 6f 72 79 20 70 72 6f 74 65 63 74 69 6f 6e 20 74  ory protection t
0430: 6f 20 65 78 65 63 75 74 61 62 6c 65 2c 20 6e 6f  o executable, no
0440: 77 20 75 6e 75 73 65 64 0a 20 20 20 20 20 20 20  w unused.       
0450: 20 63 61 63 68 65 2e 63 20 20 20 20 20 20 20 20   cache.c        
0460: 20 20 68 6f 77 20 74 6f 20 66 6c 75 73 68 20 74    how to flush t
0470: 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 63  he instruction c
0480: 61 63 68 65 2c 20 6e 6f 77 20 75 6e 75 73 65 64  ache, now unused
0490: 0a 20 20 20 20 20 20 20 20 74 65 73 74 31 2e 63  .        test1.c
04a0: 20 20 20 20 20 20 20 20 20 20 74 65 73 74 20 70            test p
04b0: 72 6f 67 72 61 6d 0a 20 20 20 20 20 20 20 20 74  rogram.        t
04c0: 65 73 74 32 2e 63 20 20 20 20 20 20 20 20 20 20  est2.c          
04d0: 74 65 73 74 20 70 72 6f 67 72 61 6d 0a 0a 20 20  test program..  
04e0: 20 20 49 6e 73 74 61 6c 6c 61 74 69 6f 6e 3a 0a    Installation:.
04f0: 0a 20 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75  .        configu
0500: 72 65 20 20 20 20 20 20 20 20 63 6f 6e 66 69 67  re        config
0510: 75 72 61 74 69 6f 6e 20 73 63 72 69 70 74 0a 20  uration script. 
0520: 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 65         configure
0530: 2e 69 6e 20 20 20 20 20 61 75 74 6f 63 6f 6e 66  .in     autoconf
0540: 2d 32 2e 31 32 20 73 6f 75 72 63 65 20 66 6f 72  -2.12 source for
0550: 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69   the configurati
0560: 6f 6e 20 73 63 72 69 70 74 0a 20 20 20 20 20 20  on script.      
0570: 20 20 2e 2e 2f 62 75 69 6c 64 2d 61 75 78 2f 2a    ../build-aux/*
0580: 20 20 20 61 75 78 69 6c 69 61 72 79 20 62 75 69     auxiliary bui
0590: 6c 64 20 73 63 72 69 70 74 73 0a 20 20 20 20 20  ld scripts.     
05a0: 20 20 20 4d 61 6b 65 66 69 6c 65 2e 69 6e 20 20     Makefile.in  
05b0: 20 20 20 20 4d 61 6b 65 66 69 6c 65 20 6d 61 73      Makefile mas
05c0: 74 65 72 0a 20 20 20 20 20 20 20 20 63 6f 6e 66  ter.        conf
05d0: 69 67 2e 68 2e 69 6e 20 20 20 20 20 20 63 6f 6e  ig.h.in      con
05e0: 66 69 67 2e 68 20 6d 61 73 74 65 72 0a 0a 20 20  fig.h master..  
05f0: 20 20 50 6f 72 74 69 6e 67 3a 0a 0a 20 20 20 20    Porting:..    
0600: 20 20 20 20 50 4f 52 54 49 4e 47 20 20 20 20 20      PORTING     
0610: 20 20 20 20 20 70 6f 72 74 69 6e 67 20 69 6e 73       porting ins
0620: 74 72 75 63 74 69 6f 6e 73 0a 20 20 20 20 20 20  tructions.      
0630: 20 20 4d 61 6b 65 66 69 6c 65 2e 64 65 76 65 6c    Makefile.devel
0640: 20 20 20 64 65 76 65 6c 6f 70 65 72 27 73 20 4d     developer's M
0650: 61 6b 65 66 69 6c 65 0a 20 20 20 20 20 20 20 20  akefile.        
0660: 70 72 6f 74 6f 2e 63 20 20 20 20 20 20 20 20 20  proto.c         
0670: 20 73 61 6d 70 6c 65 20 73 6f 75 72 63 65 20 63   sample source c
0680: 6f 6e 74 61 69 6e 69 6e 67 20 61 73 73 69 67 6e  ontaining assign
0690: 6d 65 6e 74 20 61 6e 64 20 6a 75 6d 70 69 6e 67  ment and jumping
06a0: 0a 20 20 20 20 20 20 20 20 70 72 6f 74 6f 2d 2a  .        proto-*
06b0: 2e 73 20 20 20 20 20 20 20 20 69 74 73 20 74 72  .s        its tr
06c0: 61 6e 73 6c 61 74 69 6f 6e 20 74 6f 20 61 73 73  anslation to ass
06d0: 65 6d 62 6c 79 20 6c 61 6e 67 75 61 67 65 0a 20  embly language. 
06e0: 20 20 20 20 20 20 20 74 72 61 6d 70 2d 2a 2e 73         tramp-*.s
06f0: 20 20 20 20 20 20 20 20 74 68 65 20 74 72 61 6d          the tram
0700: 70 6f 6c 69 6e 65 2c 20 69 6e 20 61 73 73 65 6d  poline, in assem
0710: 62 6c 79 20 6c 61 6e 67 75 61 67 65 0a 20 20 20  bly language.   
0720: 20 20 20 20 20 74 72 61 6d 70 2d 2a 2e 6f 20 20       tramp-*.o  
0730: 20 20 20 20 20 20 74 68 65 20 74 72 61 6d 70 6f        the trampo
0740: 6c 69 6e 65 2c 20 69 6e 20 62 69 6e 61 72 79 20  line, in binary 
0750: 66 6f 72 6d 0a 0a 0a 43 6f 70 79 72 69 67 68 74  form...Copyright
0760: 20 6e 6f 74 69 63 65 3a 0a 0a 43 6f 70 79 72 69   notice:..Copyri
0770: 67 68 74 20 31 39 39 35 20 42 72 75 6e 6f 20 48  ght 1995 Bruno H
0780: 61 69 62 6c 65 2c 20 3c 62 72 75 6e 6f 40 63 6c  aible, <bruno@cl
0790: 69 73 70 2e 6f 72 67 3e 0a 0a 54 68 69 73 20 69  isp.org>..This i
07a0: 73 20 66 72 65 65 20 73 6f 66 74 77 61 72 65 20  s free software 
07b0: 64 69 73 74 72 69 62 75 74 65 64 20 75 6e 64 65  distributed unde
07c0: 72 20 74 68 65 20 47 4e 55 20 47 65 6e 65 72 61  r the GNU Genera
07d0: 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 63 65  l Public Licence
07e0: 0a 64 65 73 63 72 69 62 65 64 20 69 6e 20 74 68  .described in th
07f0: 65 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 2e 20  e file COPYING. 
0800: 43 6f 6e 74 61 63 74 20 74 68 65 20 61 75 74 68  Contact the auth
0810: 6f 72 20 69 66 20 79 6f 75 20 64 6f 6e 27 74 20  or if you don't 
0820: 68 61 76 65 20 74 68 69 73 0a 6f 72 20 63 61 6e  have this.or can
0830: 27 74 20 6c 69 76 65 20 77 69 74 68 20 69 74 2e  't live with it.
0840: 20 54 68 65 72 65 20 69 73 20 41 42 53 4f 4c 55   There is ABSOLU
0850: 54 45 4c 59 20 4e 4f 20 57 41 52 52 41 4e 54 59  TELY NO WARRANTY
0860: 2c 20 65 78 70 6c 69 63 69 74 20 6f 72 20 69 6d  , explicit or im
0870: 70 6c 69 65 64 2c 0a 6f 6e 20 74 68 69 73 20 73  plied,.on this s
0880: 6f 66 74 77 61 72 65 2e 0a 0a 0a 42 72 75 6e 6f  oftware....Bruno
0890: 20 48 61 69 62 6c 65 0a 3c 62 72 75 6e 6f 40 63   Haible.<bruno@c
08a0: 6c 69 73 70 2e 6f 72 67 3e 0a 0a                 lisp.org>..