home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__src1 / crt1.c < prev    next >
C/C++ Source or Header  |  1993-07-23  |  6KB  |  151 lines

  1. /* C++ code startup routine.  For GNU C++ on incremental load.
  2.    Copyright (C) 1985, 1986 Free Software Foundation, Inc.
  3.    Hacked by Michael Tiemann (tiemann@mcc.com)
  4.  
  5.                NO WARRANTY
  6.  
  7.   BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  8. NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  9. WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  10. RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
  11. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  12. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  13. FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  14. AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
  15. DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  16. CORRECTION.
  17.  
  18.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
  19. STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
  20. WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
  21. LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
  22. OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  23. USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
  24. DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
  25. A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
  26. PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
  27. DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  28.  
  29.         GENERAL PUBLIC LICENSE TO COPY
  30.  
  31.   1. You may copy and distribute verbatim copies of this source file
  32. as you receive it, in any medium, provided that you conspicuously
  33. and appropriately publish on each copy a valid copyright notice
  34. "Copyright (C) 1986 Richard M. Stallman"; and include following the
  35. copyright notice a verbatim copy of the above disclaimer of warranty
  36. and of this License.
  37.  
  38.   2. You may modify your copy or copies of this source file or
  39. any portion of it, and copy and distribute such modifications under
  40. the terms of Paragraph 1 above, provided that you also do the following:
  41.  
  42.     a) cause the modified files to carry prominent notices stating
  43.     that you changed the files and the date of any change; and
  44.  
  45.     b) cause the whole of any work that you distribute or publish,
  46.     that in whole or in part contains or is a derivative of this
  47.     program or any part thereof, to be freely distributed
  48.     and licensed to all third parties on terms identical to those
  49.     contained in this License Agreement (except that you may choose
  50.     to grant more extensive warranty protection to third parties,
  51.     at your option).
  52.  
  53.   3. You may copy and distribute this program or any portion of it in
  54. compiled, executable or object code form under the terms of Paragraphs
  55. 1 and 2 above provided that you do the following:
  56.  
  57.     a) cause each such copy to be accompanied by the
  58.     corresponding machine-readable source code, which must
  59.     be distributed under the terms of Paragraphs 1 and 2 above; or,
  60.  
  61.     b) cause each such copy to be accompanied by a
  62.     written offer, with no time limit, to give any third party
  63.     free (except for a nominal shipping charge) a machine readable
  64.     copy of the corresponding source code, to be distributed
  65.     under the terms of Paragraphs 1 and 2 above; or,
  66.  
  67.     c) in the case of a recipient of this program in compiled, executable
  68.     or object code form (without the corresponding source code) you
  69.     shall cause copies you distribute to be accompanied by a copy
  70.     of the written offer of source code which you received along
  71.     with the copy you received.
  72.  
  73.   4. You may not copy, sublicense, distribute or transfer this program
  74. except as expressly provided under this License Agreement.  Any attempt
  75. otherwise to copy, sublicense, distribute or transfer this program is void and
  76. your rights to use the program under this License agreement shall be
  77. automatically terminated.  However, parties who have received computer
  78. software programs from you with this License Agreement will not have
  79. their licenses terminated so long as such parties remain in full compliance.
  80.  
  81.   5. If you wish to incorporate parts of this program into other free
  82. programs whose distribution conditions are different, write to the Free
  83. Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
  84. worked out a simple rule that can be stated here, but we will often permit
  85. this.  We will be guided by the two goals of preserving the free status of
  86. all derivatives of our free software and of promoting the sharing and reuse of
  87. software.
  88.  
  89.  
  90. In other words, you are welcome to use, share and improve this program.
  91. You are forbidden to forbid anyone else to use, share and improve
  92. what you give them.   Help stamp out software-hoarding!  */
  93.  
  94.  
  95. /* This file provides the startup routine for files loaded with
  96.    the -A option of GNU ld.  When a program makes a call to the
  97.    initial address of code incrementally loaded, it expects that the
  98.    first function laid out in the object files loaded will
  99.    be the function called.  In GNU C++, we slip crt1.o in front of
  100.    the object files the user specifies, so that we can call any needed
  101.    global constructors, and set up calls for global destructors.
  102.    Control is then passed to the first routine that the user specified.  */
  103.  
  104. #include "config.h"
  105.  
  106. extern void __do_global_init ();
  107.  
  108. /*        ********  WARNING ********
  109.     Note that the address of _incstart() should be the start
  110.     of text space.
  111.  
  112.     Michael Tiemann, Microelectronics and Computer Technology Corporation.  */
  113.  
  114. typedef struct dtor_table_entry
  115. {
  116.   struct dtor_table_entry *next;
  117.   void (*fp)();
  118. } dtor_table_entry;
  119.  
  120. /* The '_' in the front are so GNU ld can find these guys fast.  */
  121. static void (**_xCTOR_LIST__)() = 0;
  122. static struct dtor_table_entry *__xDTOR_LIST__ = 0;
  123. extern dtor_table_entry *__DTOR_LIST__;
  124. static void (*_initfn)() = 0;
  125.  
  126. /* These are patched to pointer the the head and tail of the
  127.    new destructors.  */
  128. static dtor_table_entry *_head = 0, *_tail = 0;
  129.  
  130. static void
  131. _incstart ()
  132. {
  133.   int i;
  134.  
  135.   if (_head)
  136.     {
  137.       _tail->next = __DTOR_LIST__;
  138.       __DTOR_LIST__ = _head;
  139.     }
  140.  
  141.   while (*_xCTOR_LIST__)
  142.     (*_xCTOR_LIST__++)();
  143.  
  144.   (*_initfn)();
  145. }
  146.  
  147. static int
  148. _end_crt1 ()
  149. {
  150. }
  151.