Mercurial > hg > xemacs-beta
annotate src/ecrt0.c @ 5652:cc6f0266bc36
Avoid #'delq in core Lisp, for the sake of style, a very slightly smaller binary
lisp/ChangeLog addition:
2012-05-01 Aidan Kehoe <kehoea@parhasard.net>
Avoid #'delq in core code, for the sake of style and a (very
slightly) smaller binary.
* behavior.el (disable-behavior):
* behavior.el (compute-behavior-group-children):
* buff-menu.el (buffers-tab-items):
* byte-optimize.el (byte-optimize-delay-constants-math):
* byte-optimize.el (byte-optimize-logmumble):
* byte-optimize.el (byte-decompile-bytecode-1):
* byte-optimize.el (byte-optimize-lapcode):
* bytecomp.el:
* bytecomp.el (byte-compile-arglist-warn):
* bytecomp.el (byte-compile-warn-about-unresolved-functions):
* bytecomp.el (byte-compile-lambda):
* bytecomp.el (byte-compile-out-toplevel):
* bytecomp.el (byte-compile-insert):
* bytecomp.el (byte-compile-defalias-warn):
* cl-macs.el (cl-upcase-arg):
* cl-macs.el (cl-transform-lambda):
* cl-macs.el (cl-do-proclaim):
* cl-macs.el (defstruct):
* cl-macs.el (cl-make-type-test):
* cl-macs.el (define-compiler-macro):
* cl-macs.el (delete-duplicates):
* cus-edit.el (widget-face-value-delete):
* cus-edit.el (face-history):
* easymenu.el (easy-menu-remove):
* files.el (files-fetch-hook-value):
* files.el (file-expand-wildcards):
* font-lock.el (font-lock-update-removed-keyword-alist):
* font-lock.el (font-lock-remove-keywords):
* frame.el (frame-initialize):
* frame.el (frame-notice-user-settings):
* frame.el (set-frame-font):
* frame.el (delete-other-frames):
* frame.el (get-frame-for-buffer-noselect):
* gnuserv.el (gnuserv-kill-buffer-function):
* gnuserv.el (gnuserv-check-device):
* gnuserv.el (gnuserv-kill-client):
* gnuserv.el (gnuserv-buffer-done-1):
* gtk-font-menu.el (gtk-reset-device-font-menus):
* gutter-items.el (buffers-tab-items):
* gutter.el (set-gutter-element-visible-p):
* info.el (Info-find-file-node):
* info.el (Info-history-add):
* info.el (Info-build-annotation-completions):
* info.el (Info-index):
* info.el (Info-reannotate-node):
* itimer.el (delete-itimer):
* itimer.el (start-itimer):
* lib-complete.el (lib-complete:cache-completions):
* loadhist.el (unload-feature):
* menubar-items.el (build-buffers-menu-internal):
* menubar.el (delete-menu-item):
* menubar.el (relabel-menu-item):
* msw-font-menu.el (mswindows-reset-device-font-menus):
* mule/make-coding-system.el (fixed-width-generate-helper):
* next-error.el (next-error-find-buffer):
* obsolete.el:
* obsolete.el (find-non-ascii-charset-string):
* obsolete.el (find-non-ascii-charset-region):
* occur.el (multi-occur-by-filename-regexp):
* occur.el (occur-1):
* packages.el (packages-package-hierarchy-directory-names):
* packages.el (package-get-key-1):
* process.el (setenv):
* simple.el (undo):
* simple.el (handle-pre-motion-command-current-command-is-motion):
* sound.el (load-sound-file):
* wid-edit.el (widget-field-value-delete):
* wid-edit.el (widget-checklist-match-inline):
* wid-edit.el (widget-checklist-match-find):
* wid-edit.el (widget-editable-list-delete-at):
* wid-edit.el (widget-editable-list-entry-create):
* window.el (quit-window):
* x-font-menu.el (x-reset-device-font-menus-core):
1. Replace (delq nil (mapcar ....)) with analogous (mapcan ...)
forms; this is in non-dumped files, it was done previously in
dumped files.
2. Replace (delq FOO (copy-sequence BAR)) with (remove* FOO BAR),
where #'eq and #'eql are equivalent
3. Replace (delq FOO BAR) with (delete* FOO BAR), where FOO is not
a non-fixnum number. Saves a little space in the dumped file
(since the compiler macro adds :test #'eq to the delete* call if
it's not clear that FOO is not a non-fixnum number).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 01 May 2012 16:17:42 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
428 | 1 /* C code startup routine. |
2 Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
428 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
9 option) any later version. |
428 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4759
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 18 |
19 /* Synched up with: FSF 19.30. */ | |
20 | |
21 | |
771 | 22 /* [[The standard Vax 4.2 Unix crt0.c cannot be used for Emacs |
428 | 23 because it makes `environ' an initialized variable. |
24 It is easiest to have a special crt0.c on all machines | |
771 | 25 though I don't know whether other machines actually need it.]] |
26 This is insane! We DO NOT want to be doing this crap. */ | |
428 | 27 |
28 /* On the vax and 68000, in BSD4.2 and USG5.2, | |
29 this is the data format on startup: | |
30 (vax) ap and fp are unpredictable as far as I know; don't use them. | |
31 sp -> word containing argc | |
32 word pointing to first arg string | |
33 [word pointing to next arg string]... 0 or more times | |
34 0 | |
35 Optionally: | |
36 [word pointing to environment variable]... 1 or more times | |
37 ... | |
38 0 | |
39 And always: | |
40 first arg string | |
41 [next arg string]... 0 or more times | |
42 */ | |
43 | |
44 /* On the 16000, at least in the one 4.2 system I know about, | |
45 the initial data format is | |
46 sp -> word containing argc | |
47 word containing argp | |
48 word pointing to first arg string, and so on as above | |
49 */ | |
50 | |
51 #ifdef emacs | |
52 #include <config.h> | |
53 #endif | |
54 | |
55 #ifdef __GNUC__ | |
56 #define asm __asm | |
57 #endif | |
58 | |
59 /* Workaround for Sun cc 3.0, which doesn't handle asm's outside a fn. */ | |
60 #if __SUNPRO_C >= 0x300 | |
61 #define no_toplevel_asm | |
62 #endif | |
63 | |
64 /* ******** WARNING ******** | |
65 Do not insert any data definitions before data_start! | |
66 Since this is the first file linked, the address of the following | |
67 variable should correspond to the start of initialized data space. | |
68 On some systems this is a constant that is independent of the text | |
69 size for shared executables. On others, it is a function of the | |
70 text size. In short, this seems to be the most portable way to | |
71 discover the start of initialized data space dynamically at runtime, | |
72 for either shared or unshared executables, on either swapping or | |
73 virtual systems. It only requires that the linker allocate objects | |
74 in the order encountered, a reasonable model for most Unix systems. | |
75 Similarly, note that the address of _start() should be the start | |
76 of text space. Fred Fish, UniSoft Systems Inc. */ | |
77 | |
78 int data_start = 0; | |
79 | |
80 #ifdef NEED_ERRNO | |
81 int errno; | |
82 #endif | |
83 | |
84 char **environ; | |
85 | |
86 #ifndef static | |
87 /* On systems where the static storage class is usable, this function | |
88 should be declared as static. Otherwise, the static keyword has | |
89 been defined to be something else, and code for those systems must | |
90 take care of this declaration appropriately. */ | |
91 static start1 (); | |
92 #endif | |
93 | |
94 #ifdef CRT0_DUMMIES | |
95 | |
96 /* Define symbol "start": here; some systems want that symbol. */ | |
97 #ifdef DOT_GLOBAL_START | |
98 asm(" .text "); | |
99 asm(" .globl start "); | |
100 asm(" start: "); | |
101 #endif /* DOT_GLOBAL_START */ | |
102 | |
103 #ifdef NODOT_GLOBAL_START | |
104 asm(" text "); | |
105 asm(" global start "); | |
106 asm(" start: "); | |
107 #endif /* NODOT_GLOBAL_START */ | |
108 | |
109 #ifdef m68000 | |
110 | |
111 /* GCC 2.1, when optimization is turned off, seems to want to push a | |
112 word of garbage on the stack, which screws up the CRT0_DUMMIES | |
113 hack. So we hand-code _start in assembly language. */ | |
114 asm(".text "); | |
115 #ifndef sony_news | |
116 asm(" .even "); | |
117 #else /* sony_news (not gas) */ | |
118 + asm(" .align 2 "); | |
119 #endif /* sony_news (not gas) */ | |
120 asm(".globl __start "); | |
121 asm("__start: "); | |
122 asm(" link a6,#0 "); | |
123 asm(" jbsr _start1 "); | |
124 asm(" unlk a6 "); | |
125 asm(" rts "); | |
126 | |
127 #else /* not m68000 */ | |
128 | |
129 int | |
130 _start () | |
131 { | |
132 start1 (); | |
133 } | |
134 | |
135 #endif /* possibly m68000 */ | |
136 | |
137 #ifdef __bsdi__ /* for version number */ | |
138 #include <sys/param.h> | |
139 #endif | |
140 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501) | |
141 char *__progname; | |
142 #endif | |
143 static int | |
144 start1 (CRT0_DUMMIES int argc, char *xargv) | |
145 { | |
146 char **argv = &xargv; | |
147 environ = argv + argc + 1; | |
148 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501) | |
149 __progname = argv[0]; | |
150 #endif | |
151 | |
152 if ((char *)environ == xargv) | |
153 environ--; | |
154 exit (main (argc, argv, environ)); | |
155 | |
156 /* Refer to `start1' so GCC will not think it is never called | |
157 and optimize it out. */ | |
158 (void) &start1; | |
159 } | |
160 #else /* not CRT0_DUMMIES */ | |
161 | |
162 /* "m68k" and "m68000" both stand for m68000 processors, | |
163 but with different program-entry conventions. | |
164 This is a kludge. Now that the CRT0_DUMMIES mechanism above exists, | |
165 most of these machines could use the vax code above | |
166 with some suitable definition of CRT0_DUMMIES. | |
167 Then the symbol m68k could be flushed. | |
168 But I don't want to risk breaking these machines | |
169 in a version 17 patch release, so that change is being put off. */ | |
170 | |
171 #ifdef m68k /* Can't do it all from C */ | |
172 asm (" global _start"); | |
173 asm (" text"); | |
174 asm ("_start:"); | |
175 #ifndef NU | |
176 #ifdef STRIDE | |
177 asm (" comm havefpu%,2"); | |
178 #else /* m68k, not STRIDE */ | |
179 asm (" comm splimit%,4"); | |
180 #endif /* STRIDE */ | |
181 asm (" global exit"); | |
182 asm (" text"); | |
183 #ifdef STRIDE | |
184 asm (" trap &3"); | |
185 asm (" mov.w %d0,havefpu%"); | |
186 #else /* m68k, not STRIDE */ | |
187 asm (" mov.l %d0,splimit%"); | |
188 #endif /* STRIDE */ | |
189 #endif /* not NU */ | |
190 asm (" jsr start1"); | |
191 asm (" mov.l %d0,(%sp)"); | |
192 asm (" jsr exit"); | |
193 asm (" mov.l &1,%d0"); /* d0 = 1 => exit */ | |
194 asm (" trap &0"); | |
195 #else /* m68000, not m68k */ | |
196 | |
197 #ifdef m68000 | |
198 _start () | |
199 { | |
200 #ifdef sun | |
201 finitfp_(); | |
202 #endif | |
203 /* On 68000, _start pushes a6 onto stack */ | |
204 start1 (); | |
205 } | |
206 #endif /* m68000 */ | |
207 #endif /* m68k */ | |
208 | |
209 #if defined(m68k) || defined(m68000) | |
210 /* ignore takes care of skipping the a6 value pushed in start. */ | |
211 static | |
212 #if defined(m68k) | |
213 start1 (argc, xargv) | |
214 #else | |
215 start1 (ignore, argc, xargv) | |
216 #endif | |
217 int argc; | |
218 char *xargv; | |
219 { | |
220 char **argv = &xargv; | |
221 environ = argv + argc + 1; | |
222 | |
223 if ((char *)environ == xargv) | |
224 environ--; | |
225 #ifdef sun_68881 | |
226 asm(" jsr f68881_used"); | |
227 #endif | |
228 #ifdef sun_fpa | |
229 asm(" jsr ffpa_used"); | |
230 #endif | |
231 #ifdef sun_soft | |
232 asm(" jsr start_float"); | |
233 #endif | |
234 exit (main (argc, argv, environ)); | |
235 } | |
236 | |
237 #endif /* m68k or m68000 */ | |
238 | |
239 #endif /* not CRT0_DUMMIES */ | |
240 | |
241 #ifdef sparc | |
242 #ifdef no_toplevel_asm | |
243 static no_toplevel_asm_wrapper() { | |
244 #ifdef USG5_4 | |
245 asm (".pushsection \".text\""); | |
246 #endif /* USG5_4 */ | |
247 #endif /* no_toplevel_asm */ | |
248 #ifdef USG5_4 | |
249 asm (".global _start"); | |
250 asm (".text"); | |
251 asm ("_start:"); | |
252 asm (" mov 0, %fp"); | |
253 asm (" ld [%sp + 64], %o0"); | |
254 asm (" add %sp, 68, %o1"); | |
255 asm (" sll %o0, 2, %o2"); | |
256 asm (" add %o2, 4, %o2"); | |
257 asm (" add %o1, %o2, %o2"); | |
258 asm (" sethi %hi(_environ), %o3"); | |
259 asm (" st %o2, [%o3+%lo(_environ)]"); | |
260 asm (" andn %sp, 7, %sp"); | |
261 asm (" call main"); | |
262 asm (" sub %sp, 24, %sp"); | |
263 asm (" call _exit"); | |
264 asm (" nop"); | |
265 #else | |
266 asm (".global __start"); | |
267 asm (".text"); | |
268 asm ("__start:"); | |
269 asm (" mov 0, %fp"); | |
270 asm (" ld [%sp + 64], %o0"); | |
271 asm (" add %sp, 68, %o1"); | |
272 asm (" sll %o0, 2, %o2"); | |
273 asm (" add %o2, 4, %o2"); | |
274 asm (" add %o1, %o2, %o2"); | |
275 asm (" sethi %hi(_environ), %o3"); | |
276 asm (" st %o2, [%o3+%lo(_environ)]"); | |
277 asm (" andn %sp, 7, %sp"); | |
278 asm (" call _main"); | |
279 asm (" sub %sp, 24, %sp"); | |
280 asm (" call __exit"); | |
281 asm (" nop"); | |
282 #endif /* USG5_4 */ | |
283 #ifdef no_toplevel_asm | |
284 #ifdef USG5_4 | |
285 asm (".popsection"); | |
286 #endif /* USG5_4 */ | |
287 } /* no_toplevel_asm_wrapper() */ | |
288 #endif /* no_toplevel_asm */ | |
289 #endif /* sparc */ | |
290 | |
291 #if __FreeBSD__ == 2 | |
292 char *__progname; | |
293 #endif | |
294 #ifdef __bsdi__ | |
295 #include <sys/param.h> /* for version number */ | |
296 #if defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199501) | |
297 char *__progname; | |
298 #endif | |
299 #endif /* __bsdi__ */ |