home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / emacs-19.16 / lisp / ring.elc < prev    next >
Emacs Compiled Lisp  |  1993-07-05  |  2.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text


This file was processed as: Emacs Compiled Lisp (other/emacsCompiledLisp).
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert Emacs Compiled Lisp (other/emacsCompiledLisp) magic Unsupported
1% dexvert Combustion 2 Particle Library (other/combustion2ParticleLibrary) ext Unsupported
100% file Emacs/XEmacs v19 byte-compiled Lisp data default
99% file data default
100% TrID Emacs/XEmacs byte-compiled Lisp (generic) default
100% xdgMime text/x-emacs-lisp default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3b 45 4c 43 13 00 00 00 | 0a 3b 3b 3b 20 63 6f 6d |;ELC....|.;;; com|
|00000010| 70 69 6c 65 64 20 62 79 | 20 6a 69 6d 62 40 67 65 |piled by| jimb@ge|
|00000020| 65 63 68 2e 67 6e 75 2e | 61 69 2e 6d 69 74 2e 65 |ech.gnu.|ai.mit.e|
|00000030| 64 75 20 6f 6e 20 4d 6f | 6e 20 4a 75 6c 20 20 35 |du on Mo|n Jul 5|
|00000040| 20 32 33 3a 34 39 3a 30 | 39 20 31 39 39 33 0a 3b | 23:49:0|9 1993.;|
|00000050| 3b 3b 20 66 72 6f 6d 20 | 66 69 6c 65 20 2f 67 64 |;; from |file /gd|
|00000060| 2f 67 6e 75 2f 65 6d 61 | 63 73 2f 31 39 2e 30 2f |/gnu/ema|cs/19.0/|
|00000070| 6c 69 73 70 2f 72 69 6e | 67 2e 65 6c 0a 3b 3b 3b |lisp/rin|g.el.;;;|
|00000080| 20 65 6d 61 63 73 20 76 | 65 72 73 69 6f 6e 20 31 | emacs v|ersion 1|
|00000090| 39 2e 31 35 2e 31 36 2e | 0a 3b 3b 3b 20 62 79 74 |9.15.16.|.;;; byt|
|000000a0| 65 63 6f 6d 70 20 76 65 | 72 73 69 6f 6e 20 46 53 |ecomp ve|rsion FS|
|000000b0| 46 20 32 2e 31 30 0a 3b | 3b 3b 20 6f 70 74 69 6d |F 2.10.;|;; optim|
|000000c0| 69 7a 61 74 69 6f 6e 20 | 69 73 20 6f 6e 2e 0a 3b |ization |is on..;|
|000000d0| 3b 3b 20 74 68 69 73 20 | 66 69 6c 65 20 75 73 65 |;; this |file use|
|000000e0| 73 20 6f 70 63 6f 64 65 | 73 20 77 68 69 63 68 20 |s opcode|s which |
|000000f0| 64 6f 20 6e 6f 74 20 65 | 78 69 73 74 20 69 6e 20 |do not e|xist in |
|00000100| 45 6d 61 63 73 20 31 38 | 2e 0a 0a 28 69 66 20 28 |Emacs 18|...(if (|
|00000110| 61 6e 64 20 28 62 6f 75 | 6e 64 70 20 27 65 6d 61 |and (bou|ndp 'ema|
|00000120| 63 73 2d 76 65 72 73 69 | 6f 6e 29 0a 09 20 28 6f |cs-versi|on).. (o|
|00000130| 72 20 28 61 6e 64 20 28 | 62 6f 75 6e 64 70 20 27 |r (and (|boundp '|
|00000140| 65 70 6f 63 68 3a 3a 76 | 65 72 73 69 6f 6e 29 20 |epoch::v|ersion) |
|00000150| 65 70 6f 63 68 3a 3a 76 | 65 72 73 69 6f 6e 29 0a |epoch::v|ersion).|
|00000160| 09 20 20 20 20 20 28 73 | 74 72 69 6e 67 2d 6c 65 |. (s|tring-le|
|00000170| 73 73 70 20 65 6d 61 63 | 73 2d 76 65 72 73 69 6f |ssp emac|s-versio|
|00000180| 6e 20 22 31 39 22 29 29 | 29 0a 20 20 20 20 28 65 |n "19"))|). (e|
|00000190| 72 72 6f 72 20 22 54 68 | 69 73 20 66 69 6c 65 20 |rror "Th|is file |
|000001a0| 77 61 73 20 63 6f 6d 70 | 69 6c 65 64 20 66 6f 72 |was comp|iled for|
|000001b0| 20 45 6d 61 63 73 20 31 | 39 22 29 29 0a 0a 28 64 | Emacs 1|9"))..(d|
|000001c0| 65 66 61 6c 69 61 73 20 | 27 72 69 6e 67 2d 70 20 |efalias |'ring-p |
|000001d0| 23 5b 28 78 29 20 22 08 | 3a 85 1d 00 08 40 a8 85 |#[(x) ".|:....@..|
|000001e0| 1d 00 08 41 3a 85 1d 00 | 08 41 40 a8 85 1d 00 c1 |...A:...|.A@.....|
|000001f0| 08 41 41 21 87 22 20 5b | 78 20 76 65 63 74 6f 72 |.AA!." [|x vector|
|00000200| 70 5d 20 32 20 22 5c 0a | 52 65 74 75 72 6e 73 20 |p] 2 "\.|Returns |
|00000210| 74 20 69 66 20 58 20 69 | 73 20 61 20 72 69 6e 67 |t if X i|s a ring|
|00000220| 3b 20 6e 69 6c 20 6f 74 | 68 65 72 77 69 73 65 2e |; nil ot|herwise.|
|00000230| 22 5d 29 0a 28 64 65 66 | 61 6c 69 61 73 20 27 6d |"]).(def|alias 'm|
|00000240| 61 6b 65 2d 72 69 6e 67 | 20 23 5b 28 73 69 7a 65 |ake-ring| #[(size|
|00000250| 29 20 22 c0 89 c1 5c 6e | c3 5c 22 42 42 87 22 20 |) "...\n|.\"BB." |
|00000260| 5b 30 20 6d 61 6b 65 2d | 76 65 63 74 6f 72 20 73 |[0 make-|vector s|
|00000270| 69 7a 65 20 6e 69 6c 5d | 20 35 20 22 5c 0a 4d 61 |ize nil]| 5 "\.Ma|
|00000280| 6b 65 20 61 20 72 69 6e | 67 20 74 68 61 74 20 63 |ke a rin|g that c|
|00000290| 61 6e 20 63 6f 6e 74 61 | 69 6e 20 53 49 5a 45 20 |an conta|in SIZE |
|000002a0| 65 6c 65 6d 65 6e 74 73 | 2e 22 5d 29 0a 28 64 65 |elements|."]).(de|
|000002b0| 66 61 6c 69 61 73 20 27 | 72 69 6e 67 2d 70 6c 75 |falias '|ring-plu|
|000002c0| 73 31 20 23 5b 28 69 6e | 64 65 78 20 76 65 63 6c |s1 #[(in|dex vecl|
|000002d0| 65 6e 29 20 22 08 c1 5c | 5c 89 1a 0b 55 83 0e 00 |en) "..\|\...U...|
|000002e0| c4 82 0f 00 5c 6e 29 87 | 22 20 5b 69 6e 64 65 78 |....\n).|" [index|
|000002f0| 20 31 20 6e 65 77 2d 69 | 6e 64 65 78 20 76 65 63 | 1 new-i|ndex vec|
|00000300| 6c 65 6e 20 30 5d 20 33 | 20 22 5c 0a 49 4e 44 45 |len 0] 3| "\.INDE|
|00000310| 58 2b 31 2c 20 77 69 74 | 68 20 77 72 61 70 61 72 |X+1, wit|h wrapar|
|00000320| 6f 75 6e 64 22 5d 29 0a | 28 64 65 66 61 6c 69 61 |ound"]).|(defalia|
|00000330| 73 20 27 72 69 6e 67 2d | 6d 69 6e 75 73 31 20 23 |s 'ring-|minus1 #|
|00000340| 5b 28 69 6e 64 65 78 20 | 76 65 63 6c 65 6e 29 20 |[(index |veclen) |
|00000350| 22 08 c1 55 83 5c 6e 00 | 5c 6e 82 0b 00 08 c3 5a |"..U.\n.|\n.....Z|
|00000360| 87 22 20 5b 69 6e 64 65 | 78 20 30 20 76 65 63 6c |." [inde|x 0 vecl|
|00000370| 65 6e 20 31 5d 20 32 20 | 22 5c 0a 49 4e 44 45 58 |en 1] 2 |"\.INDEX|
|00000380| 2d 31 2c 20 77 69 74 68 | 20 77 72 61 70 61 72 6f |-1, with| wraparo|
|00000390| 75 6e 64 22 5d 29 0a 28 | 64 65 66 61 6c 69 61 73 |und"]).(|defalias|
|000003a0| 20 27 72 69 6e 67 2d 6c | 65 6e 67 74 68 20 23 5b | 'ring-l|ength #[|
|000003b0| 28 72 69 6e 67 29 20 22 | 08 41 40 87 22 20 5b 72 |(ring) "|.A@." [r|
|000003c0| 69 6e 67 5d 20 31 20 22 | 5c 0a 4e 75 6d 62 65 72 |ing] 1 "|\.Number|
|000003d0| 20 6f 66 20 65 6c 65 6d | 65 6e 74 73 20 69 6e 20 | of elem|ents in |
|000003e0| 74 68 65 20 72 69 6e 67 | 2e 22 5d 29 0a 28 62 79 |the ring|."]).(by|
|000003f0| 74 65 2d 63 6f 64 65 20 | 22 c0 c1 c2 5c 22 88 c0 |te-code |"...\"..|
|00000400| c3 c4 5c 22 87 22 20 5b | 64 65 66 61 6c 69 61 73 |..\"." [|defalias|
|00000410| 20 72 69 6e 67 2d 65 6d | 70 74 79 2d 70 20 23 5b | ring-em|pty-p #[|
|00000420| 28 72 69 6e 67 29 20 22 | 08 41 40 c1 55 87 22 20 |(ring) "|.A@.U." |
|00000430| 5b 72 69 6e 67 20 30 5d | 20 32 5d 20 72 69 6e 67 |[ring 0]| 2] ring|
|00000440| 2d 69 6e 64 65 78 20 23 | 5b 28 69 6e 64 65 78 20 |-index #|[(index |
|00000450| 68 65 61 64 20 72 69 6e | 67 6c 65 6e 20 76 65 63 |head rin|glen vec|
|00000460| 6c 65 6e 29 20 22 c0 09 | 5c 6e 5c 22 11 c0 0b 5c |len) "..|\n\"...\|
|00000470| 6e 09 5a 5c 5c 53 0c 5c | 22 87 22 20 5b 72 69 6e |n.Z\\S.\|"." [rin|
|00000480| 67 2d 6d 6f 64 20 69 6e | 64 65 78 20 72 69 6e 67 |g-mod in|dex ring|
|00000490| 6c 65 6e 20 68 65 61 64 | 20 76 65 63 6c 65 6e 5d |len head| veclen]|
|000004a0| 20 34 5d 5d 20 33 29 0a | 28 64 65 66 61 6c 69 61 | 4]] 3).|(defalia|
|000004b0| 73 20 27 72 69 6e 67 2d | 69 6e 73 65 72 74 20 23 |s 'ring-|insert #|
|000004c0| 5b 28 72 69 6e 67 20 69 | 74 65 6d 29 20 22 08 41 |[(ring i|tem) ".A|
|000004d0| 41 89 19 47 1a 08 40 1b | 08 41 40 1c 09 c5 0b 0c |A..G..@.|.A@.....|
|000004e0| 5c 5c 5c 6e 5c 22 0e 06 | 49 0c 5c 6e 55 83 28 00 |\\\n\"..|I.\nU.(.|
|000004f0| 08 c7 0b 5c 6e 5c 22 a0 | 88 82 2e 00 08 41 0c 54 |...\n\".|.....A.T|
|00000500| a0 88 2c 87 22 20 5b 72 | 69 6e 67 20 76 65 63 20 |..,." [r|ing vec |
|00000510| 76 65 63 6c 65 6e 20 68 | 64 20 6c 6e 20 72 69 6e |veclen h|d ln rin|
|00000520| 67 2d 6d 6f 64 20 69 74 | 65 6d 20 72 69 6e 67 2d |g-mod it|em ring-|
|00000530| 70 6c 75 73 31 5d 20 36 | 20 22 5c 0a 49 6e 73 65 |plus1] 6| "\.Inse|
|00000540| 72 74 20 61 20 6e 65 77 | 20 69 74 65 6d 20 6f 6e |rt a new| item on|
|00000550| 74 6f 20 74 68 65 20 72 | 69 6e 67 2e 20 49 66 20 |to the r|ing. If |
|00000560| 74 68 65 20 72 69 6e 67 | 20 69 73 20 66 75 6c 6c |the ring| is full|
|00000570| 2c 20 64 75 6d 70 20 74 | 68 65 20 6f 6c 64 65 73 |, dump t|he oldes|
|00000580| 74 0a 69 74 65 6d 20 74 | 6f 20 6d 61 6b 65 20 72 |t.item t|o make r|
|00000590| 6f 6f 6d 2e 22 5d 29 0a | 28 64 65 66 61 6c 69 61 |oom."]).|(defalia|
|000005a0| 73 20 27 72 69 6e 67 2d | 72 65 6d 6f 76 65 20 23 |s 'ring-|remove #|
|000005b0| 5b 28 72 69 6e 67 20 26 | 6f 70 74 69 6f 6e 61 6c |[(ring &|optional|
|000005c0| 20 69 6e 64 65 78 29 20 | 22 c0 09 21 83 5c 6e 00 | index) |"..!.\n.|
|000005d0| c2 c3 21 87 09 40 1c 09 | 41 40 1d 09 41 41 89 1e |..!..@..|A@..AA..|
|000005e0| 06 47 1e 07 c8 0c 0d 5c | 5c 53 0e 07 5c 22 1e 09 |.G.....\|\S..\"..|
|000005f0| ca 1e 0b 0e 0c 84 30 00 | 0d 53 16 0c cd 0e 0c 0c |......0.|.S......|
|00000600| 0d 0e 07 24 16 0c 0e 06 | 0e 0c 48 16 0b 0e 0c 0e |...$....|..H.....|
|00000610| 09 55 84 64 00 0e 06 0e | 0c 0e 06 ce 0e 0c 0e 07 |.U.d....|........|
|00000620| 5c 22 48 49 88 ce 0e 0c | 0e 07 5c 22 89 16 0c 82 |\"HI....|..\"....|
|00000630| 43 00 0e 06 0e 09 ca 49 | 88 09 41 0d 53 a0 88 0e |C......I|..A.S...|
|00000640| 0b 2e 06 87 22 20 5b 72 | 69 6e 67 2d 65 6d 70 74 |...." [r|ing-empt|
|00000650| 79 2d 70 20 72 69 6e 67 | 20 65 72 72 6f 72 20 22 |y-p ring| error "|
|00000660| 52 69 6e 67 20 65 6d 70 | 74 79 22 20 68 64 20 6c |Ring emp|ty" hd l|
|00000670| 6e 20 76 65 63 20 76 65 | 63 6c 65 6e 20 72 69 6e |n vec ve|clen rin|
|00000680| 67 2d 6d 6f 64 20 74 6c | 20 6e 69 6c 20 6f 6c 64 |g-mod tl| nil old|
|00000690| 65 6c 74 20 69 6e 64 65 | 78 20 72 69 6e 67 2d 69 |elt inde|x ring-i|
|000006a0| 6e 64 65 78 20 72 69 6e | 67 2d 70 6c 75 73 31 5d |ndex rin|g-plus1]|
|000006b0| 20 37 20 22 5c 0a 52 65 | 6d 6f 76 65 20 61 6e 20 | 7 "\.Re|move an |
|000006c0| 69 74 65 6d 20 66 72 6f | 6d 20 74 68 65 20 52 49 |item fro|m the RI|
|000006d0| 4e 47 2e 20 20 52 65 74 | 75 72 6e 20 74 68 65 20 |NG. Ret|urn the |
|000006e0| 72 65 6d 6f 76 65 64 20 | 69 74 65 6d 2e 0a 49 66 |removed |item..If|
|000006f0| 20 6f 70 74 69 6f 6e 61 | 6c 20 49 4e 44 45 58 20 | optiona|l INDEX |
|00000700| 69 73 20 6e 69 6c 2c 20 | 72 65 6d 6f 76 65 20 74 |is nil, |remove t|
|00000710| 68 65 20 6f 6c 64 65 73 | 74 20 69 74 65 6d 2e 20 |he oldes|t item. |
|00000720| 20 49 66 20 69 74 27 73 | 0a 6e 75 6d 65 72 69 63 | If it's|.numeric|
|00000730| 2c 20 72 65 6d 6f 76 65 | 20 74 68 65 20 65 6c 65 |, remove| the ele|
|00000740| 6d 65 6e 74 20 69 6e 64 | 65 78 65 64 2e 22 5d 29 |ment ind|exed."])|
|00000750| 0a 28 64 65 66 61 6c 69 | 61 73 20 27 72 69 6e 67 |.(defali|as 'ring|
|00000760| 2d 6d 6f 64 20 23 5b 28 | 6e 20 6d 29 20 22 08 09 |-mod #[(|n m) "..|
|00000770| a6 89 18 c2 59 83 0e 00 | 08 82 1c 00 08 09 c2 59 |....Y...|.......Y|
|00000780| 83 19 00 09 82 1b 00 09 | 5b 5c 5c 29 87 22 20 5b |........|[\\)." [|
|00000790| 6e 20 6d 20 30 5d 20 34 | 20 22 5c 0a 52 65 74 75 |n m 0] 4| "\.Retu|
|000007a0| 72 6e 73 20 4e 20 6d 6f | 64 20 4d 2e 20 20 4d 20 |rns N mo|d M. M |
|000007b0| 69 73 20 70 6f 73 69 74 | 69 76 65 2e 0a 41 6e 73 |is posit|ive..Ans|
|000007c0| 77 65 72 20 69 73 20 67 | 75 61 72 61 6e 74 65 65 |wer is g|uarantee|
|000007d0| 64 20 74 6f 20 62 65 20 | 6e 6f 6e 2d 6e 65 67 61 |d to be |non-nega|
|000007e0| 74 69 76 65 2c 20 61 6e | 64 20 6c 65 73 73 20 74 |tive, an|d less t|
|000007f0| 68 61 6e 20 6d 2e 22 5d | 29 0a 28 64 65 66 61 6c |han m."]|).(defal|
|00000800| 69 61 73 20 27 72 69 6e | 67 2d 72 65 66 20 23 5b |ias 'rin|g-ref #[|
|00000810| 28 72 69 6e 67 20 69 6e | 64 65 78 29 20 22 c0 09 |(ring in|dex) "..|
|00000820| 21 83 5c 6e 00 c2 c3 21 | 87 09 40 1c 09 41 40 1d |!.\n...!|..@..A@.|
|00000830| 09 41 41 89 1e 06 c7 0e | 08 0c 0d 0e 06 47 24 48 |.AA.....|.....G$H|
|00000840| 2b 87 22 20 5b 72 69 6e | 67 2d 65 6d 70 74 79 2d |+." [rin|g-empty-|
|00000850| 70 20 72 69 6e 67 20 65 | 72 72 6f 72 20 22 69 6e |p ring e|rror "in|
|00000860| 64 65 78 65 64 20 65 6d | 70 74 79 20 72 69 6e 67 |dexed em|pty ring|
|00000870| 22 20 68 64 20 6c 6e 20 | 76 65 63 20 72 69 6e 67 |" hd ln |vec ring|
|00000880| 2d 69 6e 64 65 78 20 69 | 6e 64 65 78 5d 20 37 20 |-index i|ndex] 7 |
|00000890| 22 5c 0a 52 65 74 75 72 | 6e 73 20 52 49 4e 47 27 |"\.Retur|ns RING'|
|000008a0| 73 20 49 4e 44 45 58 20 | 65 6c 65 6d 65 6e 74 2e |s INDEX |element.|
|000008b0| 0a 49 4e 44 45 58 20 6e | 65 65 64 20 6e 6f 74 20 |.INDEX n|eed not |
|000008c0| 62 65 20 3c 3d 20 74 68 | 65 20 72 69 6e 67 20 6c |be <= th|e ring l|
|000008d0| 65 6e 67 74 68 2c 20 74 | 68 65 20 61 70 70 72 6f |ength, t|he appro|
|000008e0| 70 72 69 61 74 65 20 6d | 6f 64 75 6c 6f 20 6f 70 |priate m|odulo op|
|000008f0| 65 72 61 74 69 6f 6e 0a | 77 69 6c 6c 20 62 65 20 |eration.|will be |
|00000900| 70 65 72 66 6f 72 6d 65 | 64 2e 20 20 45 6c 65 6d |performe|d. Elem|
|00000910| 65 6e 74 20 30 20 69 73 | 20 74 68 65 20 6d 6f 73 |ent 0 is| the mos|
|00000920| 74 20 72 65 63 65 6e 74 | 6c 79 20 69 6e 73 65 72 |t recent|ly inser|
|00000930| 74 65 64 3b 20 68 69 67 | 68 65 72 20 69 6e 64 69 |ted; hig|her indi|
|00000940| 63 65 73 0a 63 6f 72 72 | 65 73 70 6f 6e 64 20 74 |ces.corr|espond t|
|00000950| 6f 20 6f 6c 64 65 72 20 | 65 6c 65 6d 65 6e 74 73 |o older |elements|
|00000960| 20 75 6e 74 69 6c 20 74 | 68 65 79 20 77 72 61 70 | until t|hey wrap|
|00000970| 2e 22 5d 29 0a 28 70 72 | 6f 76 69 64 65 20 28 71 |."]).(pr|ovide (q|
|00000980| 75 6f 74 65 20 72 69 6e | 67 29 29 0a |uote rin|g)). |
+--------+-------------------------+-------------------------+--------+--------+