Mercurial > emacs
view lisp/=sc-alist.el @ 20892:18f3cb26243f before-miles-orphaned-changes gcc-2_8_1-980401 gcc-2_8_1-980407 gcc-2_8_1-980412 gcc-2_8_1-980413 gcc-2_8_1-RELEASE gcc_2_8_1-980315 libc-980214 libc-980215 libc-980216 libc-980217 libc-980218 libc-980219 libc-980220 libc-980221 libc-980222 libc-980223 libc-980224 libc-980225 libc-980226 libc-980227 libc-980228 libc-980301 libc-980302 libc-980303 libc-980304 libc-980306 libc-980307 libc-980308 libc-980309 libc-980310 libc-980311 libc-980312 libc-980313 libc-980314 libc-980315 libc-980316 libc-980317 libc-980318 libc-980319 libc-980320 libc-980321 libc-980322 libc-980323 libc-980324 libc-980325 libc-980326 libc-980327 libc-980328 libc-980329 libc-980330 libc-980331 libc-980401 libc-980402 libc-980403 libc-980404 libc-980405 libc-980406 libc-980407 libc-980408 libc-980409 libc-980410 libc-980411 libc-980412 libc-980413 libc-980414 libc-980428 libc-980429 libc-980430 libc-980501 libc-980502 libc-980503 libc-980504 libc-980505 libc-980506 libc-980507 libc-980508 libc-980509 libc-980510 libc-980512 libc-980513 libc-980514 libc-980515 libc-980516 libc-980517 libc-980518 libc-980519 libc-980520 libc-980521 libc-980522 libc-980523 libc-980524 libc-980525 libc-980526 libc-980527 libc-980528 libc-980529 libc-980530 libc-980531 libc-980601 libc-980602 libc-980603 libc-980604 libc-980605 libc-980606 libc-980607 libc-980608 libc-980609 libc-980610 libc-980611 libc-980612 libc-980613
Add PentiumII (i786). Add '7' to all i[3456] entries.
Add AMD and Cyrix names for P5 and P6.
author | Richard Kenner <kenner@gnu.org> |
---|---|
date | Fri, 13 Feb 1998 12:16:46 +0000 |
parents | 5180778aedcb |
children |
line wrap: on
line source
;; -*- Mode: Emacs-Lisp -*- ;; sc-alist.el -- Version 1.0 (used to be baw-alist.el) ;; association list utilities providing insertion, deletion, sorting ;; fetching off key-value pairs in association lists. ;; ========== Disclaimer ========== ;; This software is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor accepts ;; responsibility to anyone for the consequences of using it or for ;; whether it serves any particular purpose or works at all, unless he ;; says so in writing. ;; This software was written as part of the supercite author's ;; official duty as an employee of the United States Government and is ;; thus in the public domain. You are free to use that particular ;; software as you wish, but WITHOUT ANY WARRANTY WHATSOEVER. It ;; would be nice, though if when you use any of this code, you give ;; due credit to the author. ;; ========== Author (unless otherwise stated) ======================== ;; NAME: Barry A. Warsaw USMAIL: Century Computing, Inc. ;; TELE: (301) 593-3330 1014 West Street ;; INET: bwarsaw@cen.com Laurel, Md 20707 ;; UUCP: uunet!cen.com!bwarsaw ;; (provide 'sc-alist) (defun asort (alist-symbol key) "Move a specified key-value pair to the head of an alist. The alist is referenced by ALIST-SYMBOL. Key-value pair to move to head is one matching KEY. Returns the sorted list and doesn't affect the order of any other key-value pair. Side effect sets alist to new sorted list." (set alist-symbol (sort (copy-alist (eval alist-symbol)) (function (lambda (a b) (equal (car a) key)))))) (defun aelement (key value) "Makes a list of a cons cell containing car of KEY and cdr of VALUE. The returned list is suitable as an element of an alist." (list (cons key value))) (defun aheadsym (alist) "Return the key symbol at the head of ALIST." (car (car alist))) (defun anot-head-p (alist key) "Find out if a specified key-value pair is not at the head of an alist. The alist to check is specified by ALIST and the key-value pair is the one matching the supplied KEY. Returns nil if ALIST is nil, or if key-value pair is at the head of the alist. Returns t if key-value pair is not at the head of alist. ALIST is not altered." (not (equal (aheadsym alist) key))) (defun aput (alist-symbol key &optional value) "Inserts a key-value pair into an alist. The alist is referenced by ALIST-SYMBOL. The key-value pair is made from KEY and optionally, VALUE. Returns the altered alist or nil if ALIST is nil. If the key-value pair referenced by KEY can be found in the alist, and VALUE is supplied non-nil, then the value of KEY will be set to VALUE. If VALUE is not supplied, or is nil, the key-value pair will not be modified, but will be moved to the head of the alist. If the key-value pair cannot be found in the alist, it will be inserted into the head of the alist (with value nil if VALUE is nil or not supplied)." (let ((elem (aelement key value)) alist) (asort alist-symbol key) (setq alist (eval alist-symbol)) (cond ((null alist) (set alist-symbol elem)) ((anot-head-p alist key) (set alist-symbol (nconc elem alist))) (value (setcar alist (car elem))) (t alist)))) (defun adelete (alist-symbol key) "Delete a key-value pair from the alist. Alist is referenced by ALIST-SYMBOL and the key-value pair to remove is pair matching KEY. Returns the altered alist." (asort alist-symbol key) (let ((alist (eval alist-symbol))) (cond ((null alist) nil) ((anot-head-p alist key) alist) (t (set alist-symbol (cdr alist)))))) (defun aget (alist key &optional keynil-p) "Returns the value in ALIST that is associated with KEY. Optional KEYNIL-P describes what to do if the value associated with KEY is nil. If KEYNIL-P is not supplied or is nil, and the value is nil, then KEY is returned. If KEYNIL-P is non-nil, then nil would be returned. If no key-value pair matching KEY could be found in ALIST, or ALIST is nil then nil is returned. ALIST is not altered." (let ((copy (copy-alist alist))) (cond ((null alist) nil) ((progn (asort 'copy key) (anot-head-p copy key)) nil) ((cdr (car copy))) (keynil-p nil) ((car (car copy))) (t nil)))) (defun amake (alist-symbol keylist &optional valuelist) "Make an association list. The association list is attached to the alist referenced by ALIST-SYMBOL. Each element in the KEYLIST becomes a key and is associated with the value in VALUELIST with the same index. If VALUELIST is not supplied or is nil, then each key in KEYLIST is associated with nil. KEYLIST and VALUELIST should have the same number of elements, but this isn't enforced. If VALUELIST is smaller than KEYLIST, remaining keys are associated with nil. If VALUELIST is larger than KEYLIST, extra values are ignored. Returns the created alist." (let ((keycar (car keylist)) (keycdr (cdr keylist)) (valcar (car valuelist)) (valcdr (cdr valuelist))) (cond ((null keycdr) (aput alist-symbol keycar valcar)) (t (amake alist-symbol keycdr valcdr) (aput alist-symbol keycar valcar)))) (eval alist-symbol))