home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / a2.0bemacs-src.lha / Emacs-19.25 / lisp / ring.elc < prev    next >
Emacs Compiled Lisp  |  1993-08-10  |  2.2 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
100% file Emacs/XEmacs v19 byte-compiled Lisp data default
99% file data default
100% TrID Emacs/XEmacs byte-compiled Lisp (generic) default



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 72 6f 6c 61 6e 64 40 |piled by| roland@|
|00000020| 63 68 75 72 63 68 79 2e | 67 6e 75 2e 61 69 2e 6d |churchy.|gnu.ai.m|
|00000030| 69 74 2e 65 64 75 20 6f | 6e 20 54 75 65 20 41 75 |it.edu o|n Tue Au|
|00000040| 67 20 31 30 20 31 33 3a | 33 39 3a 32 34 20 31 39 |g 10 13:|39:24 19|
|00000050| 39 33 0a 3b 3b 3b 20 66 | 72 6f 6d 20 66 69 6c 65 |93.;;; f|rom file|
|00000060| 20 2f 67 64 2f 67 6e 75 | 2f 65 6d 61 63 73 2f 31 | /gd/gnu|/emacs/1|
|00000070| 39 2e 30 2f 6c 69 73 70 | 2f 72 69 6e 67 2e 65 6c |9.0/lisp|/ring.el|
|00000080| 0a 3b 3b 3b 20 65 6d 61 | 63 73 20 76 65 72 73 69 |.;;; ema|cs versi|
|00000090| 6f 6e 20 31 39 2e 31 38 | 2e 30 2e 0a 3b 3b 3b 20 |on 19.18|.0..;;; |
|000000a0| 62 79 74 65 63 6f 6d 70 | 20 76 65 72 73 69 6f 6e |bytecomp| version|
|000000b0| 20 46 53 46 20 32 2e 31 | 30 0a 3b 3b 3b 20 6f 70 | FSF 2.1|0.;;; op|
|000000c0| 74 69 6d 69 7a 61 74 69 | 6f 6e 20 69 73 20 6f 6e |timizati|on is on|
|000000d0| 2e 0a 3b 3b 3b 20 74 68 | 69 73 20 66 69 6c 65 20 |..;;; th|is file |
|000000e0| 75 73 65 73 20 6f 70 63 | 6f 64 65 73 20 77 68 69 |uses opc|odes whi|
|000000f0| 63 68 20 64 6f 20 6e 6f | 74 20 65 78 69 73 74 20 |ch do no|t exist |
|00000100| 69 6e 20 45 6d 61 63 73 | 20 31 38 2e 0a 0a 28 69 |in Emacs| 18...(i|
|00000110| 66 20 28 61 6e 64 20 28 | 62 6f 75 6e 64 70 20 27 |f (and (|boundp '|
|00000120| 65 6d 61 63 73 2d 76 65 | 72 73 69 6f 6e 29 0a 09 |emacs-ve|rsion)..|
|00000130| 20 28 6f 72 20 28 61 6e | 64 20 28 62 6f 75 6e 64 | (or (an|d (bound|
|00000140| 70 20 27 65 70 6f 63 68 | 3a 3a 76 65 72 73 69 6f |p 'epoch|::versio|
|00000150| 6e 29 20 65 70 6f 63 68 | 3a 3a 76 65 72 73 69 6f |n) epoch|::versio|
|00000160| 6e 29 0a 09 20 20 20 20 | 20 28 73 74 72 69 6e 67 |n).. | (string|
|00000170| 2d 6c 65 73 73 70 20 65 | 6d 61 63 73 2d 76 65 72 |-lessp e|macs-ver|
|00000180| 73 69 6f 6e 20 22 31 39 | 22 29 29 29 0a 20 20 20 |sion "19|"))). |
|00000190| 20 28 65 72 72 6f 72 20 | 22 54 68 69 73 20 66 69 | (error |"This fi|
|000001a0| 6c 65 20 77 61 73 20 63 | 6f 6d 70 69 6c 65 64 20 |le was c|ompiled |
|000001b0| 66 6f 72 20 45 6d 61 63 | 73 20 31 39 22 29 29 0a |for Emac|s 19")).|
|000001c0| 0a 28 64 65 66 61 6c 69 | 61 73 20 27 72 69 6e 67 |.(defali|as 'ring|
|000001d0| 2d 70 20 23 5b 28 78 29 | 20 22 08 3a 85 1d 00 08 |-p #[(x)| ".:....|
|000001e0| 40 a8 85 1d 00 08 41 3a | 85 1d 00 08 41 40 a8 85 |@.....A:|....A@..|
|000001f0| 1d 00 c1 08 41 41 21 87 | 22 20 5b 78 20 76 65 63 |....AA!.|" [x vec|
|00000200| 74 6f 72 70 5d 20 32 20 | 22 5c 0a 52 65 74 75 72 |torp] 2 |"\.Retur|
|00000210| 6e 73 20 74 20 69 66 20 | 58 20 69 73 20 61 20 72 |ns t if |X is a r|
|00000220| 69 6e 67 3b 20 6e 69 6c | 20 6f 74 68 65 72 77 69 |ing; nil| otherwi|
|00000230| 73 65 2e 22 5d 29 0a 28 | 64 65 66 61 6c 69 61 73 |se."]).(|defalias|
|00000240| 20 27 6d 61 6b 65 2d 72 | 69 6e 67 20 23 5b 28 73 | 'make-r|ing #[(s|
|00000250| 69 7a 65 29 20 22 c0 89 | c1 5c 6e c3 5c 22 42 42 |ize) "..|.\n.\"BB|
|00000260| 87 22 20 5b 30 20 6d 61 | 6b 65 2d 76 65 63 74 6f |." [0 ma|ke-vecto|
|00000270| 72 20 73 69 7a 65 20 6e | 69 6c 5d 20 35 20 22 5c |r size n|il] 5 "\|
|00000280| 0a 4d 61 6b 65 20 61 20 | 72 69 6e 67 20 74 68 61 |.Make a |ring tha|
|00000290| 74 20 63 61 6e 20 63 6f | 6e 74 61 69 6e 20 53 49 |t can co|ntain SI|
|000002a0| 5a 45 20 65 6c 65 6d 65 | 6e 74 73 2e 22 5d 29 0a |ZE eleme|nts."]).|
|000002b0| 28 64 65 66 61 6c 69 61 | 73 20 27 72 69 6e 67 2d |(defalia|s 'ring-|
|000002c0| 70 6c 75 73 31 20 23 5b | 28 69 6e 64 65 78 20 76 |plus1 #[|(index v|
|000002d0| 65 63 6c 65 6e 29 20 22 | 08 c1 5c 5c 89 1a 0b 55 |eclen) "|..\\...U|
|000002e0| 83 0e 00 c4 82 0f 00 5c | 6e 29 87 22 20 5b 69 6e |.......\|n)." [in|
|000002f0| 64 65 78 20 31 20 6e 65 | 77 2d 69 6e 64 65 78 20 |dex 1 ne|w-index |
|00000300| 76 65 63 6c 65 6e 20 30 | 5d 20 33 20 22 5c 0a 49 |veclen 0|] 3 "\.I|
|00000310| 4e 44 45 58 2b 31 2c 20 | 77 69 74 68 20 77 72 61 |NDEX+1, |with wra|
|00000320| 70 61 72 6f 75 6e 64 22 | 5d 29 0a 28 64 65 66 61 |paround"|]).(defa|
|00000330| 6c 69 61 73 20 27 72 69 | 6e 67 2d 6d 69 6e 75 73 |lias 'ri|ng-minus|
|00000340| 31 20 23 5b 28 69 6e 64 | 65 78 20 76 65 63 6c 65 |1 #[(ind|ex vecle|
|00000350| 6e 29 20 22 08 c1 55 83 | 5c 6e 00 5c 6e 82 0b 00 |n) "..U.|\n.\n...|
|00000360| 08 c3 5a 87 22 20 5b 69 | 6e 64 65 78 20 30 20 76 |..Z." [i|ndex 0 v|
|00000370| 65 63 6c 65 6e 20 31 5d | 20 32 20 22 5c 0a 49 4e |eclen 1]| 2 "\.IN|
|00000380| 44 45 58 2d 31 2c 20 77 | 69 74 68 20 77 72 61 70 |DEX-1, w|ith wrap|
|00000390| 61 72 6f 75 6e 64 22 5d | 29 0a 28 64 65 66 61 6c |around"]|).(defal|
|000003a0| 69 61 73 20 27 72 69 6e | 67 2d 6c 65 6e 67 74 68 |ias 'rin|g-length|
|000003b0| 20 23 5b 28 72 69 6e 67 | 29 20 22 08 41 40 87 22 | #[(ring|) ".A@."|
|000003c0| 20 5b 72 69 6e 67 5d 20 | 31 20 22 5c 0a 4e 75 6d | [ring] |1 "\.Num|
|000003d0| 62 65 72 20 6f 66 20 65 | 6c 65 6d 65 6e 74 73 20 |ber of e|lements |
|000003e0| 69 6e 20 74 68 65 20 72 | 69 6e 67 2e 22 5d 29 0a |in the r|ing."]).|
|000003f0| 28 62 79 74 65 2d 63 6f | 64 65 20 22 c0 c1 c2 5c |(byte-co|de "...\|
|00000400| 22 88 c0 c3 c4 5c 22 87 | 22 20 5b 64 65 66 61 6c |"....\".|" [defal|
|00000410| 69 61 73 20 72 69 6e 67 | 2d 65 6d 70 74 79 2d 70 |ias ring|-empty-p|
|00000420| 20 23 5b 28 72 69 6e 67 | 29 20 22 08 41 40 c1 55 | #[(ring|) ".A@.U|
|00000430| 87 22 20 5b 72 69 6e 67 | 20 30 5d 20 32 5d 20 72 |." [ring| 0] 2] r|
|00000440| 69 6e 67 2d 69 6e 64 65 | 78 20 23 5b 28 69 6e 64 |ing-inde|x #[(ind|
|00000450| 65 78 20 68 65 61 64 20 | 72 69 6e 67 6c 65 6e 20 |ex head |ringlen |
|00000460| 76 65 63 6c 65 6e 29 20 | 22 08 09 a6 10 5c 6e 09 |veclen) |"....\n.|
|00000470| 08 5a 5c 5c 53 0b a6 87 | 22 20 5b 69 6e 64 65 78 |.Z\\S...|" [index|
|00000480| 20 72 69 6e 67 6c 65 6e | 20 68 65 61 64 20 76 65 | ringlen| head ve|
|00000490| 63 6c 65 6e 5d 20 33 5d | 5d 20 33 29 0a 28 64 65 |clen] 3]|] 3).(de|
|000004a0| 66 61 6c 69 61 73 20 27 | 72 69 6e 67 2d 69 6e 73 |falias '|ring-ins|
|000004b0| 65 72 74 20 23 5b 28 72 | 69 6e 67 20 69 74 65 6d |ert #[(r|ing item|
|000004c0| 29 20 22 08 41 41 89 19 | 47 1a 08 40 1b 08 41 40 |) ".AA..|G..@..A@|
|000004d0| 1c 09 0b 0c 5c 5c 5c 6e | a6 0d 49 0c 5c 6e 55 83 |....\\\n|..I.\nU.|
|000004e0| 26 00 08 c6 0b 5c 6e 5c | 22 a0 88 82 2c 00 08 41 |&....\n\|"...,..A|
|000004f0| 0c 54 a0 88 2c 87 22 20 | 5b 72 69 6e 67 20 76 65 |.T..,." |[ring ve|
|00000500| 63 20 76 65 63 6c 65 6e | 20 68 64 20 6c 6e 20 69 |c veclen| hd ln i|
|00000510| 74 65 6d 20 72 69 6e 67 | 2d 70 6c 75 73 31 5d 20 |tem ring|-plus1] |
|00000520| 36 20 22 5c 0a 49 6e 73 | 65 72 74 20 61 20 6e 65 |6 "\.Ins|ert a ne|
|00000530| 77 20 69 74 65 6d 20 6f | 6e 74 6f 20 74 68 65 20 |w item o|nto the |
|00000540| 72 69 6e 67 2e 20 49 66 | 20 74 68 65 20 72 69 6e |ring. If| the rin|
|00000550| 67 20 69 73 20 66 75 6c | 6c 2c 20 64 75 6d 70 20 |g is ful|l, dump |
|00000560| 74 68 65 20 6f 6c 64 65 | 73 74 0a 69 74 65 6d 20 |the olde|st.item |
|00000570| 74 6f 20 6d 61 6b 65 20 | 72 6f 6f 6d 2e 22 5d 29 |to make |room."])|
|00000580| 0a 28 64 65 66 61 6c 69 | 61 73 20 27 72 69 6e 67 |.(defali|as 'ring|
|00000590| 2d 72 65 6d 6f 76 65 20 | 23 5b 28 72 69 6e 67 20 |-remove |#[(ring |
|000005a0| 26 6f 70 74 69 6f 6e 61 | 6c 20 69 6e 64 65 78 29 |&optiona|l index)|
|000005b0| 20 22 c0 09 21 83 5c 6e | 00 c2 c3 21 87 09 40 1c | "..!.\n|...!..@.|
|000005c0| 09 41 40 1d 09 41 41 89 | 1e 06 47 1e 07 0c 0d 5c |.A@..AA.|..G....\|
|000005d0| 5c 53 0e 07 a6 1e 08 c9 | 1e 5c 6e 0e 0b 84 2f 00 |\S......|.\n.../.|
|000005e0| 0d 53 16 0b cc 0e 0b 0c | 0d 0e 07 24 16 0b 0e 06 |.S......|...$....|
|000005f0| 0e 0b 48 16 5c 6e 0e 0b | 0e 08 55 84 63 00 0e 06 |..H.\n..|..U.c...|
|00000600| 0e 0b 0e 06 cd 0e 0b 0e | 07 5c 22 48 49 88 cd 0e |........|.\"HI...|
|00000610| 0b 0e 07 5c 22 89 16 0b | 82 42 00 0e 06 0e 08 c9 |...\"...|.B......|
|00000620| 49 88 09 41 0d 53 a0 88 | 0e 5c 6e 2e 06 87 22 20 |I..A.S..|.\n..." |
|00000630| 5b 72 69 6e 67 2d 65 6d | 70 74 79 2d 70 20 72 69 |[ring-em|pty-p ri|
|00000640| 6e 67 20 65 72 72 6f 72 | 20 22 52 69 6e 67 20 65 |ng error| "Ring e|
|00000650| 6d 70 74 79 22 20 68 64 | 20 6c 6e 20 76 65 63 20 |mpty" hd| ln vec |
|00000660| 76 65 63 6c 65 6e 20 74 | 6c 20 6e 69 6c 20 6f 6c |veclen t|l nil ol|
|00000670| 64 65 6c 74 20 69 6e 64 | 65 78 20 72 69 6e 67 2d |delt ind|ex ring-|
|00000680| 69 6e 64 65 78 20 72 69 | 6e 67 2d 70 6c 75 73 31 |index ri|ng-plus1|
|00000690| 5d 20 37 20 22 5c 0a 52 | 65 6d 6f 76 65 20 61 6e |] 7 "\.R|emove an|
|000006a0| 20 69 74 65 6d 20 66 72 | 6f 6d 20 74 68 65 20 52 | item fr|om the R|
|000006b0| 49 4e 47 2e 20 20 52 65 | 74 75 72 6e 20 74 68 65 |ING. Re|turn the|
|000006c0| 20 72 65 6d 6f 76 65 64 | 20 69 74 65 6d 2e 0a 49 | removed| item..I|
|000006d0| 66 20 6f 70 74 69 6f 6e | 61 6c 20 49 4e 44 45 58 |f option|al INDEX|
|000006e0| 20 69 73 20 6e 69 6c 2c | 20 72 65 6d 6f 76 65 20 | is nil,| remove |
|000006f0| 74 68 65 20 6f 6c 64 65 | 73 74 20 69 74 65 6d 2e |the olde|st item.|
|00000700| 20 20 49 66 20 69 74 27 | 73 0a 6e 75 6d 65 72 69 | If it'|s.numeri|
|00000710| 63 2c 20 72 65 6d 6f 76 | 65 20 74 68 65 20 65 6c |c, remov|e the el|
|00000720| 65 6d 65 6e 74 20 69 6e | 64 65 78 65 64 2e 22 5d |ement in|dexed."]|
|00000730| 29 0a 28 64 65 66 61 6c | 69 61 73 20 27 72 69 6e |).(defal|ias 'rin|
|00000740| 67 2d 72 65 66 20 23 5b | 28 72 69 6e 67 20 69 6e |g-ref #[|(ring in|
|00000750| 64 65 78 29 20 22 c0 09 | 21 83 5c 6e 00 c2 c3 21 |dex) "..|!.\n...!|
|00000760| 87 09 40 1c 09 41 40 1d | 09 41 41 89 1e 06 c7 0e |..@..A@.|.AA.....|
|00000770| 08 0c 0d 0e 06 47 24 48 | 2b 87 22 20 5b 72 69 6e |.....G$H|+." [rin|
|00000780| 67 2d 65 6d 70 74 79 2d | 70 20 72 69 6e 67 20 65 |g-empty-|p ring e|
|00000790| 72 72 6f 72 20 22 69 6e | 64 65 78 65 64 20 65 6d |rror "in|dexed em|
|000007a0| 70 74 79 20 72 69 6e 67 | 22 20 68 64 20 6c 6e 20 |pty ring|" hd ln |
|000007b0| 76 65 63 20 72 69 6e 67 | 2d 69 6e 64 65 78 20 69 |vec ring|-index i|
|000007c0| 6e 64 65 78 5d 20 37 20 | 22 5c 0a 52 65 74 75 72 |ndex] 7 |"\.Retur|
|000007d0| 6e 73 20 52 49 4e 47 27 | 73 20 49 4e 44 45 58 20 |ns RING'|s INDEX |
|000007e0| 65 6c 65 6d 65 6e 74 2e | 0a 49 4e 44 45 58 20 6e |element.|.INDEX n|
|000007f0| 65 65 64 20 6e 6f 74 20 | 62 65 20 3c 3d 20 74 68 |eed not |be <= th|
|00000800| 65 20 72 69 6e 67 20 6c | 65 6e 67 74 68 2c 20 74 |e ring l|ength, t|
|00000810| 68 65 20 61 70 70 72 6f | 70 72 69 61 74 65 20 6d |he appro|priate m|
|00000820| 6f 64 75 6c 6f 20 6f 70 | 65 72 61 74 69 6f 6e 0a |odulo op|eration.|
|00000830| 77 69 6c 6c 20 62 65 20 | 70 65 72 66 6f 72 6d 65 |will be |performe|
|00000840| 64 2e 20 20 45 6c 65 6d | 65 6e 74 20 30 20 69 73 |d. Elem|ent 0 is|
|00000850| 20 74 68 65 20 6d 6f 73 | 74 20 72 65 63 65 6e 74 | the mos|t recent|
|00000860| 6c 79 20 69 6e 73 65 72 | 74 65 64 3b 20 68 69 67 |ly inser|ted; hig|
|00000870| 68 65 72 20 69 6e 64 69 | 63 65 73 0a 63 6f 72 72 |her indi|ces.corr|
|00000880| 65 73 70 6f 6e 64 20 74 | 6f 20 6f 6c 64 65 72 20 |espond t|o older |
|00000890| 65 6c 65 6d 65 6e 74 73 | 20 75 6e 74 69 6c 20 74 |elements| until t|
|000008a0| 68 65 79 20 77 72 61 70 | 2e 22 5d 29 0a 28 70 72 |hey wrap|."]).(pr|
|000008b0| 6f 76 69 64 65 20 28 71 | 75 6f 74 65 20 72 69 6e |ovide (q|uote rin|
|000008c0| 67 29 29 0a | |g)). | |
+--------+-------------------------+-------------------------+--------+--------+