r4742: *** empty log message ***
[umlisp.git] / utils.lisp
index c25cf1dfb955f48fda76a85ae1b3f360ea01c77d..6b9e17eb63a11c8cad4469fd6e020658b3e57f5c 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: utils.lisp,v 1.2 2002/10/09 23:03:41 kevin Exp $
+;;;; $Id: utils.lisp,v 1.3 2003/05/02 21:49:19 kevin Exp $
 ;;;;
 ;;;; This file, part of UMLisp, is
 ;;;;    Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
   (let* ((cui (the fixnum (truncate (/ cuisui +cuisui-scale+))))
        (sui (the fixnum (- cuisui (* cui +cuisui-scale+)))))
     (values cui sui)))
+
+;;; Lookup functions for uterms,ustr in ucons
+
+(defun find-uterm-in-ucon (ucon lui)
+  (find lui (s#term ucon) :key #'lui :test 'equal))
+
+(defun find-ustr-in-uterm (uterm sui)
+  (find sui (s#str uterm) :key #'sui :test 'equal))
+
+(defun find-ustr-in-ucon (ucon sui)
+  (let ((found-ustr nil))
+    (dolist (uterm (s#term ucon))
+      (unless found-ustr
+       (dolist (ustr (s#str uterm))
+         (unless found-ustr
+           (when (string-equal sui (sui ustr))
+             (setq found-ustr ustr))))))
+    found-ustr))