Mercurial > hg > xemacs-beta
annotate netinstall/find.cc @ 5182:2e528066e2fc
Move #'sort*, #'fill, #'merge to C from cl-seq.el.
lisp/ChangeLog addition:
2010-04-01 Aidan Kehoe <kehoea@parhasard.net>
* cl-seq.el (fill, sort*, merge): Move these functions to fns.c.
(stable-sort): Make this docstring reflect the argument names used
in the #'sort* docstring.
* cl-macs.el (stable-sort): Make #'stable-sort exactly equivalent
to #'sort* in compiled code.
* bytecomp.el (byte-compile-maybe-add-*):
New macro, for functions like #'sort and #'mapcar that, to be
strictly compatible, should only take two args, but in our
implementation can take more, because they're aliases of #'sort*
and #'mapcar*.
(byte-compile-mapcar, byte-compile-sort, byte-compile-fillarray):
Use this new macro.
(map-into): Add a byte-compile method for #'map-into in passing.
* apropos.el (apropos-print): Use #'sort* with a :key argument,
now it's in C.
* compat.el (extent-at): Ditto.
* register.el (list-registers): Ditto.
* package-ui.el (pui-list-packages): Ditto.
* help.el (sorted-key-descriptions): Ditto.
src/ChangeLog addition:
2010-03-31 Aidan Kehoe <kehoea@parhasard.net>
* fns.c (STRING_DATA_TO_OBJECT_ARRAY)
(BIT_VECTOR_TO_OBJECT_ARRAY, c_merge_predicate_key)
(c_merge_predicate_nokey, list_merge, array_merge)
(list_array_merge_into_list, list_list_merge_into_array)
(list_array_merge_into_array, CHECK_KEY_ARGUMENT, Fmerge)
(list_sort, array_sort, FsortX):
Move #'sort*, #'fill, #'merge from cl-seq.el to C, extending the
implementations of Fsort, Ffillarray, and merge() to do so.
* keymap.c (keymap_submaps, map_keymap_sort_predicate)
(describe_map_sort_predicate):
Change the calling semantics of the C sort predicates to return a
non-nil Lisp object if the first argument is less than the second,
rather than C integers.
* fontcolor-msw.c (sort_font_list_function):
* fileio.c (build_annotations):
* dired.c (Fdirectory_files):
* abbrev.c (Finsert_abbrev_table_description):
Call list_sort instead of Fsort, list_merge instead of merge() in
these functions.
man/ChangeLog addition:
2010-04-01 Aidan Kehoe <kehoea@parhasard.net>
* lispref/lists.texi (Rearrangement):
Update the documentation of #'sort here, now that it accepts any
type of sequence and the KEY keyword argument. (Though this is
probably now the wrong place for this function, given that.)
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 01 Apr 2010 20:22:50 +0100 |
parents | 3078fd1074e8 |
children |
rev | line source |
---|---|
448 | 1 /* |
2 * Copyright (c) 2000, Red Hat, Inc. | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * A copy of the GNU General Public License can be found at | |
10 * http://www.gnu.org/ | |
11 * | |
12 * Written by DJ Delorie <dj@cygnus.com> | |
13 * | |
14 */ | |
15 | |
16 /* The purpose of this file is to doa recursive find on a given | |
17 directory, calling a given function for each file found. */ | |
18 | |
19 #include "win32.h" | |
20 #include <stdio.h> | |
21 #include <stdlib.h> | |
22 | |
23 #include "port.h" | |
24 | |
25 static void (*for_each)(char *, unsigned int); | |
26 static char dir[_MAX_PATH], *found_part; | |
27 | |
28 static int | |
29 find_sub () | |
30 { | |
31 WIN32_FIND_DATA wfd; | |
32 HANDLE h; | |
33 char *end = dir + strlen (dir); | |
34 int rv = 0; | |
35 | |
36 *end++ = '/'; | |
37 strcpy (end, "*"); | |
38 | |
39 h = FindFirstFile (dir, &wfd); | |
40 | |
41 if (h == INVALID_HANDLE_VALUE) | |
42 return 0; | |
43 | |
44 do { | |
45 if (strcmp (wfd.cFileName, ".") == 0 | |
46 || strcmp (wfd.cFileName, "..") == 0) | |
47 continue; | |
48 | |
49 strcpy (end, wfd.cFileName); | |
50 | |
51 if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) | |
52 find_sub (); | |
53 else | |
54 { | |
55 for_each (found_part, wfd.nFileSizeLow); | |
56 rv ++; | |
57 } | |
58 | |
59 } while (FindNextFile (h, &wfd)); | |
60 | |
61 FindClose (h); | |
62 return rv; | |
63 } | |
64 | |
65 int | |
66 find (char *starting_dir, void (*_for_each)(char *, unsigned int)) | |
67 { | |
68 strcpy (dir, starting_dir); | |
69 for_each = _for_each; | |
70 found_part = dir + strlen (dir) + 1; | |
71 | |
72 return find_sub (); | |
73 } |