r11148: fix limit / filter, improve udoc support
[umlisp.git] / class-support.lisp
index a9fae985c89b54108da0d916d6c52c6c7ea19571..dd969038bc87ee7e65396631be22e207d85c1d2c 100644 (file)
 (defgeneric fmt-aui (aui))
 (when *has-fixnum-class*
   (defmethod fmt-aui ((aui fixnum))
-    (prefixed-fixnum-string aui #\A 7)))
+    (if (>= aui 10000000)
+      (prefixed-fixnum-string aui #\A 8)
+      (prefixed-fixnum-string aui #\A 7))))
 
 (defmethod fmt-aui ((aui integer))
-  (prefixed-integer-string aui #\A 7))
+  (if (>= aui 10000000)
+    (prefixed-integer-string aui #\A 8)
+    (prefixed-integer-string aui #\A 7)))
 
 (defmethod fmt-aui ((aui string))
   (if (eql (aref aui 0) #\A)
     (dolist (term (s#term ucon) (nreverse res))
       (dolist (str (s#str term))
        (push str res)))))
-                    
+
 
 (defmethod pfstr ((uterm uterm))
   "Return the preferred string for a uterm"
         ((char-equal #\O c)
          "Other"))))
 
-           
+
 (defun ucon-parents (con &optional sab)
   (ucon-ancestors con sab t))
 
   (let* ((parent-rels (filter-urels-by-rel (s#rel ucon) "par"))
         (anc nil))
     (when sab
-      (setq parent-rels (delete-if-not 
+      (setq parent-rels (delete-if-not
                         (lambda (rel) (string-equal sab (sab rel)))
                         parent-rels)))
     (dolist (rel parent-rels (nreverse anc))
 (defmethod cxt-ancestors ((con ucon))
   (loop for term in (s#term con)
       append (cxt-ancestors term)))
-                   
+
 
 (defmethod cxt-ancestors ((term uterm))
   (loop for str in (s#str term)
       append (cxt-ancestors str)))
-    
+
 (defmethod cxt-ancestors ((str ustr))
   "Return the ancestory contexts of a ustr"
   (let* ((anc (remove-if-not
         (sort anc-this-cxn (lambda (a b) (< (rank a) (rank b))))
         anc-lists)))))
 
-  
+(defun uso-unique-codes (usos)
+  (let ((sab-codes (make-hash-table :test 'equal)))
+    (dolist (uso usos)
+      (setf (gethash (sab uso) sab-codes) (code uso)))
+    (loop for key being the hash-key in sab-codes
+        collect (list key (gethash key sab-codes)))))
+
+                                          
 #+scl
 (dolist (c '(urank udef usat uso ucxt ustr ulo uterm usty urel ucoc uatx ucon uxw uxnw uxns lexterm labr lagr lcmp lmod lnom lprn lprp lspl ltrm ltyp lwd sdef sstr sstre1 sstre2 usrl))
     (let ((cl (find-class c)))