r5080: *** empty log message ***
[umlisp.git] / class-support.lisp
index 4b88f846d2bc8b2820f0edd47646d619ea2778e6..413f31470b94724bfaea8e4173356e49b4084416 100644 (file)
@@ -2,15 +2,15 @@
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
-;;;; Name:          classes-support.lisp
-;;;; Purpose:       Class defintions for UMLisp
-;;;; Programmer:    Kevin M. Rosenberg
-;;;; Date Started:  Apr 2000
+;;;; Name:         classes-support.lisp
+;;;; Purpose:      Support for UMLisp classes
+;;;; Author:       Kevin M. Rosenberg
+;;;; Date Started: Apr 2000
 ;;;;
-;;;; $Id: class-support.lisp,v 1.3 2003/05/06 02:15:41 kevin Exp $
+;;;; $Id: class-support.lisp,v 1.11 2003/06/10 22:30:16 kevin Exp $
 ;;;;
 ;;;; This file, part of UMLisp, is
-;;;;    Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
+;;;;    Copyright (c) 2000-2003 by Kevin M. Rosenberg, M.D.
 ;;;;
 ;;;; UMLisp users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the GNU General Public License.
 
 (defgeneric fmt-cui (c))
 (defmethod fmt-cui ((c ucon))
-  (format nil "C~7,'0d" (cui c)))
+  (fmt-cui (cui c)))
 
 (defmethod fmt-cui ((c fixnum))
-  (format nil "C~7,'0d" c))
+  (prefixed-fixnum-string c #\C 7))
 
 (defmethod fmt-cui ((c string))
   (if (eql (aref c 0) #\C)
       c
-    (format nil "C~7,'0d" (parse-integer c))))
+      (fmt-cui (parse-integer c))))
 
 (defmethod fmt-cui ((c null))
   (format nil "nil"))
 
 (defgeneric fmt-lui (c))
 (defmethod fmt-lui ((l uterm))
-  (format nil "L~7,'0d" (lui l)))
+  (fmt-lui (lui l)))
 
 (defmethod fmt-lui ((l fixnum))
-  (format nil "L~7,'0d" l))
+  (prefixed-fixnum-string l #\L 7))
 
 (defmethod fmt-lui ((l string))
   (if (eql (aref l 0) #\L)
       l
-  (format nil "L~7,'0d" (parse-integer l))))
+      (fmt-lui (parse-integer l))))
 
 (defgeneric fmt-sui (s))
 (defmethod fmt-sui ((s ustr))
-  (format nil "S~7,'0d" (sui s)))
+  (fmt-sui (sui s)))
 
 (defmethod fmt-sui ((s fixnum))
-  (format nil "S~7,'0d" s))
+  (prefixed-fixnum-string s #\S 7))
 
 (defmethod fmt-sui ((s string))
   (if (eql (aref s 0) #\S)
       s
-  (format nil "S~7,'0d" (parse-integer s))))
+      (fmt-sui (parse-integer s))))
 
-(defgeneric fmt-tui (t))
-(defmethod fmt-tui ((s fixnum))
-  (format nil "T~3,'0d" s))
+(defgeneric fmt-tui (tui))
+(defmethod fmt-tui ((tui fixnum))
+  (prefixed-fixnum-string tui #\T 3))
 
-(defmethod fmt-tui ((s string))
-  (if (eql (aref s 0) #\T)
-      s
-  (format nil "T~3,'0d" (parse-integer s))))
+(defmethod fmt-tui ((tui string))
+  (if (eql (aref tui 0) #\T)
+      tui
+      (fmt-tui (parse-integer tui))))
 
 (defgeneric fmt-eui (e))
 (defmethod fmt-eui ((e fixnum))
-  (format nil "E~7,'0d" e))
+  (prefixed-fixnum-string e #\E 7))
 
 (defmethod fmt-eui ((e string))
   (if (eql (aref e 0) #\E)
       e
-    (format nil "E~7,'0d" (parse-integer e))))
+      (fmt-eui (parse-integer e))))
 
 (defmethod fmt-eui ((e null))
   (format nil "nil"))
   "Returns T if UCON has a semantic type of TUI."
   (some #'(lambda (usty) (= tui (tui usty))) (s#sty ucon)))
 
+(defgeneric suistr (lo))
+(defmethod suistr ((lo ulo))
+  "Return the string for a ulo object"
+  (find-string-sui (sui lo)))
+
+(defun uterm-pfstr (uterm)
+  "Return the preferred string for a uterm"
+  (dolist (ustr (s#str uterm))
+    (when (string= "PF" (stt ustr))
+      (return-from uterm-pfstr (str ustr)))))
+
+(defun remove-non-english-terms (uterms)
+  (remove-if-not #'english-term-p uterms))
+
+
 #+(or scl cmu)
 (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))
     #+cmu