Mercurial > hg > xemacs-beta
annotate lib-src/make-dump-id.c @ 4995:8431b52e43b1
Move the various map* functions to C; add #'map-into.
src/ChangeLog addition:
2010-01-31 Aidan Kehoe <kehoea@parhasard.net>
Move #'mapcar*, #'mapcan, #'mapc, #'map, #'mapl, #'mapcon to C;
extend #'mapvector, #'mapconcat, #'mapcar to support more
SEQUENCES; have them all error with circular lists.
* fns.c (Fsubseq): Call CHECK_SEQUENCE here; Flength can return
from the debugger if it errors with a non-sequence, leading to a
crash in Fsubseq if sequence really is *not* a sequence.
(mapcarX): Rename mapcar1 to mapcarX; rework it comprehensively to
take an optional lisp output argument, and a varying number of
sequences.
Special-case a single list argument, as we used to, saving its
elements in the stack space for the results before calling
FUNCTION, so FUNCTION can corrupt the list all it
wants. dead_wrong_type_argument() in the other cases if we
encounter a non-cons where we expected a cons.
(Fmapconcat):
Accept further SEQUENCES after separator here. Special-case
the idiom (mapconcat 'identity SEQUENCE), don't even funcall.
(FmapcarX): Rename this from Fmapcar. Accept optional SEQUENCES.
(Fmapvector): Accept optional SEQUENCES.
(Fmapcan, Fmapc, Fmap): Move these here from cl-extra.el.
(Fmap_into): New function, as specified by Common Lisp.
(maplist): New function, the guts of the implementation of
Fmaplist and Fmapl.
(Fmaplist, Fmapl, Fmapcon): Move these from cl-extra.el.
(syms_of_fns):
Add a few needed symbols here, for the type tests
used by #'map. Add the new subrs, with aliases for #'mapc-internal
and #'mapcar.
* general-slots.h: Declare Qcoerce here, now it's used in both
indent.c and fns.c
* indent.c (syms_of_indent): Qcoerce is gone from here.
* lisp.h: Add ARRAYP(), SEQUENCEP(), and the corresponding CHECK_*
macros. Declare Fbit_vector, Fstring, FmapcarX, now other files
need to use them.
* data.c (Farrayp, Fsequencep): Use ARRAYP and SEQUENCEP, just
added to lisp.h
* buffer.c (Fbuffer_list): Now Fmapcar has been renamed FmapcarX
and takes MANY arguments, update this function to reflect that.
lisp/ChangeLog addition:
2010-01-31 Aidan Kehoe <kehoea@parhasard.net>
* cl.el (mapcar*): Delete; this is now in fns.c.
Use #'mapc, not #'mapc-internal in a couple of places.
* cl-macs.el (mapc, mapcar*, map): Delete these compiler macros
now the corresponding functions are in fns.c; there's no run-time
advantage to the macros.
* cl-extra.el (coerce): Extend the possible conversions here a
little; it's not remotely comprehensive yet, though it does allow
running slightly more Common Lisp code than previously.
(cl-mapcar-many): Delete.
(map, maplist, mapc, mapl, mapcan, mapcon): Move these to fns.c.
* bytecomp.el (byte-compile-maybe-mapc):
Use #'mapc itself, not #'mapc-internal, now the former is in C.
(mapcar*): Use #'byte-compile-maybe-mapc as this function's
byte-compile method, now a #'mapc that can take more than one
sequence is in C.
* obsolete.el (cl-mapc): Move this compatibility alias to this file.
* update-elc.el (do-autoload-commands): Use #'mapc, not
#'mapc-internal here.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 31 Jan 2010 18:29:48 +0000 |
parents | ecf1ebac70d8 |
children | 308d34e9f07d |
rev | line source |
---|---|
442 | 1 /* Generate a unique dump-id for use with the portable dumper. |
2 Copyright (C) 2000 Olivier Galibert, Martin Buchholz | |
3 | |
4 This file is part of XEmacs. | |
5 | |
6 XEmacs is free software; you can redistribute it and/or modify it | |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 2, or (at your option) any | |
9 later version. | |
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 | |
17 along with XEmacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
20 | |
21 #include <config.h> | |
22 #include <stdio.h> | |
23 #include <stdlib.h> | |
24 #include "../src/systime.h" | |
25 | |
26 #ifdef WIN32_NATIVE | |
27 #include <sys/timeb.h> | |
28 | |
29 /* Emulate gettimeofday (Ulrich Leodolter, 1/11/95). */ | |
30 void | |
31 gettimeofday (struct timeval *tv, struct timezone *tz) | |
32 { | |
33 struct _timeb tb; | |
34 _ftime (&tb); | |
35 | |
36 tv->tv_sec = tb.time; | |
37 tv->tv_usec = tb.millitm * 1000L; | |
38 if (tz) | |
39 { | |
40 tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */ | |
41 tz->tz_dsttime = tb.dstflag; /* type of dst correction */ | |
42 } | |
43 } | |
44 #endif | |
45 | |
46 /* Generates an (extremely) pseudo random number for the dump-id */ | |
47 static unsigned int | |
48 generate_dump_id (void) | |
49 { | |
50 EMACS_TIME thyme; | |
51 EMACS_GET_TIME (thyme); | |
52 | |
53 return (unsigned int) (EMACS_SECS (thyme) ^ EMACS_USECS (thyme)); | |
54 } | |
55 | |
56 int | |
2367 | 57 main (int argc, char **argv) |
442 | 58 { |
59 FILE *f; | |
60 | |
61 if ((f = fopen ("dump-id.c", "w")) == NULL) | |
62 { | |
63 perror ("open dump-id.c"); | |
64 return EXIT_FAILURE; | |
65 } | |
66 | |
1688 | 67 /* dump_id is declared as extern "C" in dumper.h */ |
68 fputs ("extern\n", f); | |
69 fputs ("#ifdef __cplusplus\n", f); | |
70 fputs ("\"C\"\n", f); | |
71 fputs ("#endif\n", f); | |
72 fputs ("unsigned int dump_id;\n", f); | |
460 | 73 fprintf (f, "unsigned int dump_id = %uU;\n", generate_dump_id ()); |
442 | 74 |
75 if ((fclose (f)) != 0) | |
76 { | |
77 perror ("close dump-id.c"); | |
78 return EXIT_FAILURE; | |
79 } | |
80 | |
81 return EXIT_SUCCESS; | |
82 } |