Mercurial > hg > xemacs-beta
comparison lisp/utils/ring.el @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | 2d532a89d707 |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Maintainer: FSF | 5 ;; Maintainer: FSF |
6 ;; Keywords: extensions | 6 ;; Keywords: extensions |
7 | 7 |
8 ;; This file is part of GNU Emacs. | 8 ;; This file is part of XEmacs. |
9 | 9 |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | 10 ;; XEmacs is free software; you can redistribute it and/or modify it |
11 ;; it under the terms of the GNU General Public License as published by | 11 ;; under the terms of the GNU General Public License as published by |
12 ;; the Free Software Foundation; either version 2, or (at your option) | 12 ;; the Free Software Foundation; either version 2, or (at your option) |
13 ;; any later version. | 13 ;; any later version. |
14 | 14 |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | 15 ;; XEmacs is distributed in the hope that it will be useful, but |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 ;; GNU General Public License for more details. | 18 ;; General Public License for more details. |
19 | 19 |
20 ;; You should have received a copy of the GNU General Public License | 20 ;; You should have received a copy of the GNU General Public License |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | 21 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
23 ;; 02111-1307, USA. | |
23 | 24 |
24 ;;; Synched up with: FSF 19.30. | 25 ;;; Synched up with: FSF 19.34. |
25 | 26 |
26 ;;; Commentary: | 27 ;;; Commentary: |
27 | 28 |
28 ;;; This code defines a ring data structure. A ring is a | 29 ;; This code defines a ring data structure. A ring is a |
29 ;;; (hd-index length . vector) | 30 ;; (hd-index length . vector) |
30 ;;; list. You can insert to, remove from, and rotate a ring. When the ring | 31 ;; list. You can insert to, remove from, and rotate a ring. When the ring |
31 ;;; fills up, insertions cause the oldest elts to be quietly dropped. | 32 ;; fills up, insertions cause the oldest elts to be quietly dropped. |
32 ;;; | 33 ;; |
33 ;;; In ring-ref, 0 is the index of the newest element. Higher indexes | 34 ;; In ring-ref, 0 is the index of the newest element. Higher indexes |
34 ;;; correspond to older elements until they wrap. | 35 ;; correspond to older elements until they wrap. |
35 ;;; | 36 ;; |
36 ;;; hd-index = index of the newest item on the ring. | 37 ;; hd-index = index of the newest item on the ring. |
37 ;;; length = number of ring items. | 38 ;; length = number of ring items. |
38 ;;; | 39 ;; |
39 ;;; These functions are used by the input history mechanism, but they can | 40 ;; These functions are used by the input history mechanism, but they can |
40 ;;; be used for other purposes as well. | 41 ;; be used for other purposes as well. |
41 | 42 |
42 ;;; Code: | 43 ;;; Code: |
43 | 44 |
45 ;; XEmacs change | |
44 ;;;###autoload | 46 ;;;###autoload |
45 (defun ringp (x) | 47 (defun ringp (x) |
46 "Returns t if X is a ring; nil otherwise." | 48 "Returns t if X is a ring; nil otherwise." |
47 (and (consp x) (integerp (car x)) | 49 (and (consp x) (integerp (car x)) |
48 (consp (cdr x)) (integerp (car (cdr x))) | 50 (consp (cdr x)) (integerp (car (cdr x))) |
49 (vectorp (cdr (cdr x))))) | 51 (vectorp (cdr (cdr x))))) |
50 | 52 |
53 ;; XEmacs change | |
51 ;;;###autoload | 54 ;;;###autoload |
52 (define-obsolete-function-alias 'ring-p 'ringp) | 55 (define-obsolete-function-alias 'ring-p 'ringp) |
53 | 56 |
54 ;;;###autoload | 57 ;;;###autoload |
55 (defun make-ring (size) | 58 (defun make-ring (size) |