Mercurial > hg > xemacs-beta
annotate lisp/cl-compat.el @ 5494:861f2601a38b
Sync s/ files with GNU 23.1.92, delete obsolete stuff, simplify other stuff
--- ChangeLog
2010-02-20 Ben Wing <ben@xemacs.org>
* configure:
* configure.ac (XE_EXPAND_VARIABLE):
* configure.ac (TAB):
irix6-0.h renamed to irix6-5.h; sco7.h deleted.
bsd4-3.h renamed to bsd-common.h.
Simplify setting machine= for intel386, mips.
Put back linux.h.
Incorporate some stuff about debug/optimization flags in irix6-5.h
into configure.ac.
Add a comment about LCC stuff with optimization flags that should be
fixed up.
--- src/ChangeLog
2010-02-20 Ben Wing <ben@xemacs.org>
* sysdep.c:
* sysdep.c (qxe_reliable_signal):
* sysdep.c (retry_open_1):
* sysdep.c (retry_close):
* sysdep.c (retry_read_1):
* sysdep.c (retry_write_1):
* sysdep.c (retry_fopen):
* sysdep.c (retry_fclose):
* sysdep.c (retry_fread):
* sysdep.c (retry_fwrite):
Remove conditionalization on INTERRUPTIBLE_IO, INTERRUPTIBLE_OPEN,
INTERRUPTIBLE_CLOSE -- always check for EINTR as there's no harm
in it.
Remove old #if 0'ed out SA_RESTART code.
Use manifest constant IRIX6_5 instead of IRIX.
* Makefile.in.in:
* dired.c:
* dired.c (Ffile_attributes):
Use manifest constant IRIX6_5 instead of IRIX.
Eliminate constant BSD4_2, use BSD4_3 instead.
* getloadavg.c:
* getloadavg.c (getloadavg):
* getloadavg.c (LDAV_PRIVILEGED):
* getloadavg.c (LDAV_DONE):
Sync with GNU 23.1.92.
2010-02-20 Ben Wing <ben@xemacs.org>
* s/README:
* s/aix4-2.h:
* s/aix4-2.h (MAIL_USE_LOCKF):
* s/bsd-common.h:
* s/freebsd.h:
* s/freebsd.h (Carey):
* s/freebsd.h (or):
* s/gnu.h:
* s/gnu.h (DATA_START):
* s/hpux11-shr.h:
* s/hpux11.h:
* s/hpux11.h (random):
* s/irix6-5.h:
* s/linux.h:
* s/mach-bsd4-3.h:
* s/netbsd.h:
* s/netbsd.h (or):
* s/netbsd.h (A_TEXT_OFFSET):
* s/netbsd.h (NO_MATHERR):
* s/openbsd.h:
* s/sol2.h:
* s/usg5-4-2.h:
* s/usg5-4.h:
* s/usg5-4.h (or):
* s/usg5-4.h (ORDINARY_LINK):
Sync with GNU 23.1.92.
Put back linux.h.
Rename: bsd4-3.h -> bsd-common.h; irix6-0.h -> irix6-5.h.
Delete: template.h (useless).
Delete a whole bunch of obsolete stuff in sol2.h, linux.h,
freebsd.h -- assume anything over 10 years old is sufficiently
obsolete to be deleted.
Remove LIBS_DEBUG, C_DEBUG_SWITCH, C_OPTIMIZE_SWITCH, KERNEL_FILE,
LDAV_SYMBOL, most remaining PTY stuff, remaining TERMINFO/TERMCAP
stuff. Update README appropriately.
Remove stuff in hpux11-shr.h duplicated in hpux11.h.
Remove sco7.h, identical with usg5-4-2.h.
Remove unused POSIX flag, BROKEN_TIOC*, NO_SIOCTL_H.
2010-02-20 Ben Wing <ben@xemacs.org>
* m/arm.h:
* m/hp800.h:
* m/intel386.h:
* m/mips.h:
* m/powerpc.h:
* m/sparc.h:
* m/template.h:
Temporarily ifdef out all defines involving load-average stuff --
using define ENABLE_SM_FILE_DECLS_OF_LOADAVG_STUFF, which is not
defined.
I'm pretty sure getloadavg.c will take care of defining stuff
properly on all systems without the need to duplicate the info
in m/*. --ben
Delete LIBS_TERMCAP; configure auto-handles this.
Delete extra stuff in hp800.h.
Delete C_DEBUG_SWITCH, C_OPTIMIZE_SWITCH, LDAV_SYMBOL; incorporate
some stuff into configure.ac.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 20 Feb 2010 06:03:00 -0600 |
parents | 8b50bee3c88c |
children | 2a54dfbe434f 308d34e9f07d |
rev | line source |
---|---|
613 | 1 ;;; cl-compat.el --- Common Lisp extensions for XEmacs Lisp (compatibility) |
209 | 2 |
3 ;; Copyright (C) 1993 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Dave Gillespie <daveg@synaptics.com> | |
6 ;; Version: 2.02 | |
7 ;; Keywords: extensions | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
11 ;; XEmacs is free software; you can redistribute it and/or modify it | |
12 ;; under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; XEmacs is distributed in the hope that it will be useful, but | |
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 ;; General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
24 ;; 02111-1307, USA. | |
25 | |
2153 | 26 ;;; Synched up with: FSF 21.3. |
209 | 27 |
28 ;;; Commentary: | |
29 | |
30 ;; These are extensions to Emacs Lisp that provide a degree of | |
31 ;; Common Lisp compatibility, beyond what is already built-in | |
32 ;; in Emacs Lisp. | |
33 ;; | |
34 ;; This package was written by Dave Gillespie; it is a complete | |
35 ;; rewrite of Cesar Quiroz's original cl.el package of December 1986. | |
36 ;; | |
37 ;; This package works with Emacs 18, Emacs 19, and XEmacs/Lucid Emacs 19. | |
38 ;; | |
39 ;; Bug reports, comments, and suggestions are welcome! | |
40 | |
41 ;; This file contains emulations of internal routines of the older | |
42 ;; CL package which users may have called directly from their code. | |
43 ;; Use (require 'cl-compat) to get these routines. | |
44 | |
45 ;; See cl.el for Change Log. | |
46 | |
47 | |
48 ;;; Code: | |
49 | |
50 ;; Require at load-time, but not when compiling cl-compat. | |
51 (or (featurep 'cl) (require 'cl)) | |
52 | |
53 | |
54 ;;; Keyword routines not supported by new package. | |
55 | |
56 (defmacro defkeyword (x &optional doc) | |
57 (list* 'defconst x (list 'quote x) (and doc (list doc)))) | |
58 | |
59 (defun keyword-of (sym) | |
4793
8b50bee3c88c
Remove attempted support for 1996-era emacs without self-quoting keywords.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4678
diff
changeset
|
60 (or (keywordp sym) (keywordp (read (format ":%s" sym))))) |
209 | 61 |
62 ;;; Routines for parsing keyword arguments. | |
63 | |
64 (defun build-klist (arglist keys &optional allow-others) | |
4677
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2153
diff
changeset
|
65 (let ((res (multiple-value-call 'mapcar* 'cons (unzip-lists arglist)))) |
209 | 66 (or allow-others |
67 (let ((bad (set-difference (mapcar 'car res) keys))) | |
68 (if bad (error "Bad keywords: %s not in %s" bad keys)))) | |
69 res)) | |
70 | |
71 (defun extract-from-klist (klist key &optional def) | |
72 (let ((res (assq key klist))) (if res (cdr res) def))) | |
73 | |
74 (defun keyword-argument-supplied-p (klist key) | |
75 (assq key klist)) | |
76 | |
77 (defun elt-satisfies-test-p (item elt klist) | |
78 (let ((test-not (cdr (assq ':test-not klist))) | |
79 (test (cdr (assq ':test klist))) | |
80 (key (cdr (assq ':key klist)))) | |
81 (if key (setq elt (funcall key elt))) | |
82 (if test-not (not (funcall test-not item elt)) | |
83 (funcall (or test 'eql) item elt)))) | |
84 | |
4678
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4677
diff
changeset
|
85 ;; The rounding functions in C now have all the functionality this package |
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4677
diff
changeset
|
86 ;; used to: |
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4677
diff
changeset
|
87 (loop |
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4677
diff
changeset
|
88 for symbol in '(floor ceiling round truncate) |
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4677
diff
changeset
|
89 do (defalias (intern (format "cl-%s" symbol)) symbol)) |
209 | 90 |
91 (defun safe-idiv (a b) | |
92 (let* ((q (/ (abs a) (abs b))) | |
93 (s (* (signum a) (signum b)))) | |
4677
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2153
diff
changeset
|
94 (values q (- a (* s q b)) s))) |
209 | 95 |
96 ;; Internal routines. | |
97 | |
98 (defun pair-with-newsyms (oldforms) | |
99 (let ((newsyms (mapcar (function (lambda (x) (gensym))) oldforms))) | |
4677
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2153
diff
changeset
|
100 (values (mapcar* 'list newsyms oldforms) newsyms))) |
209 | 101 |
102 (defun zip-lists (evens odds) | |
103 (mapcan 'list evens odds)) | |
104 | |
105 (defun unzip-lists (list) | |
106 (let ((e nil) (o nil)) | |
107 (while list | |
108 (setq e (cons (car list) e) o (cons (cadr list) o) list (cddr list))) | |
4677
8f1ee2d15784
Support full Common Lisp multiple values in C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2153
diff
changeset
|
109 (values (nreverse e) (nreverse o)))) |
209 | 110 |
111 (defun reassemble-argslists (list) | |
112 (let ((n (apply 'min (mapcar 'length list))) (res nil)) | |
113 (while (>= (setq n (1- n)) 0) | |
114 (setq res (cons (mapcar (function (lambda (x) (elt x n))) list) res))) | |
115 res)) | |
116 | |
117 (defun duplicate-symbols-p (list) | |
118 (let ((res nil)) | |
119 (while list | |
120 (if (memq (car list) (cdr list)) (setq res (cons (car list) res))) | |
121 (setq list (cdr list))) | |
122 res)) | |
123 | |
124 | |
125 ;;; Setf internals. | |
126 | |
127 (defun setnth (n list x) | |
128 (setcar (nthcdr n list) x)) | |
129 | |
130 (defun setnthcdr (n list x) | |
131 (setcdr (nthcdr (1- n) list) x)) | |
132 | |
133 (defun setelt (seq n x) | |
134 (if (consp seq) (setcar (nthcdr n seq) x) (aset seq n x))) | |
135 | |
136 | |
137 ;;; Functions omitted: case-clausify, check-do-stepforms, check-do-endforms, | |
138 ;;; extract-do-inits, extract-do[*]-steps, select-stepping-forms, | |
139 ;;; elt-satisfies-if[-not]-p, with-keyword-args, mv-bind-clausify, | |
140 ;;; all names with embedded `$'. | |
141 | |
142 | |
143 (provide 'cl-compat) | |
144 | |
2153 | 145 ;;; arch-tag: 9996bb4f-aaf5-4592-b436-bf64759a3163 |
209 | 146 ;;; cl-compat.el ends here |