AVL-Tree in Emacs 22/23

[email protected] (Przemysław Wojnowski)
Newsgroups gmane.emacs.jdee.devel
Message-ID <[email protected]>
Hi!
I have created a patch which allows JDE to work in Emacs 22 to work with
avltree from elib and in Emacs 23 with avl-tree contained in Emacs.

For JDE the main difference between avltree from old elib and the new
one is that old avltree returned list structure and the new one returns
vector. I changed this to sequence type to support both versions. Later
it can be changed to use only vector.

Regards,
Przemek

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

_______________________________________________
jdee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jdee-devel
jde-parse.diff (text/x-diff, 1.5 KB)
Index: lisp/jde-parse.el
===================================================================
--- lisp/jde-parse.el	(revision 158)
+++ lisp/jde-parse.el	(working copy)
@@ -25,7 +25,22 @@
 
 (require 'semantic-sb)
 (require 'semantic-ctxt)
-(require 'avltree)
+(if (< emacs-major-version 23)
+    (require 'avltree)
+  (progn
+    (require 'avl-tree)
+    (defalias 'avltree-clear   'avl-tree-clear)
+    (defalias 'avltree-copy    'avl-tree-copy)
+    (defalias 'avltree-create  'avl-tree-create)
+    (defalias 'avltree-delete  'avl-tree-delete)
+    (defalias 'avltree-empty   'avl-tree-empty)
+    (defalias 'avltree-enter   'avl-tree-enter)
+    (defalias 'avltree-first   'avl-tree-first)
+    (defalias 'avltree-flatten 'avl-tree-flatten)
+    (defalias 'avltree-last    'avl-tree-last)
+    (defalias 'avltree-map     'avl-tree-map)
+    (defalias 'avltree-member  'avl-tree-member)
+    (defalias 'avltree-size    'avl-tree-size)))
 (require 'thingatpt)
 (require 'eieio)
 (require 'jde-imenu)                    ; All the imenu stuff is here now!
@@ -907,7 +922,7 @@
 
 (defclass jde-avl-tree ()
   ((tree        :initarg tree
-		:type list
+		:type sequence
 		:documentation
 		"The tree")
    (compare-fcn :initarg compare-fcn
@@ -925,7 +940,7 @@
 
   (assert (typep  (oref this compare-fcn)  'function))
 
-  (oset this  tree (avltree-create (oref this compare-fcn))))
+  (oset this tree (avltree-create (oref this compare-fcn))))
 
 (defmethod jde-avl-tree-add ((this jde-avl-tree) item)
   "Inserts ITEM in this tree."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.