X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=utils.lisp;h=6b9e17eb63a11c8cad4469fd6e020658b3e57f5c;hb=6dba4359eae9d2481f82d8c7c109eb5a3bc34c45;hp=9bc35b85051a45d34f4029f8bed12f1ac53a819a;hpb=0ececd07987c48de78c14a60136014a2df7b280b;p=umlisp.git diff --git a/utils.lisp b/utils.lisp index 9bc35b8..6b9e17e 100644 --- a/utils.lisp +++ b/utils.lisp @@ -1,9 +1,24 @@ -;;;; $Id: utils.lisp,v 1.1 2002/10/05 20:17:14 kevin Exp $ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: utils.lisp +;;;; Purpose: Low-level utility functions for UMLisp +;;;; Programmer: Kevin M. Rosenberg +;;;; Date Started: Apr 2000 +;;;; +;;;; $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. +;;;; +;;;; UMLisp users are granted the rights to distribute and use this software +;;;; as governed by the terms of the GNU General Public License. +;;;; ************************************************************************* (in-package :umlisp) - -(declaim (inline xml-cdata make-cuisui make-cuilui parse-ui parse-cui)) -(declaim (optimize (speed 3) (safety 1))) +(declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))) +(declaim (inline make-cuisui make-cuilui parse-ui parse-cui)) (defmacro def-metaclass-reader (field) "Create function for reading slot of metaclass" @@ -63,9 +78,6 @@ (parse-integer eui))) eui)) -(defun xml-cdata (str) - (concatenate 'string "")) - (defconstant +cuisui-scale+ 10000000) (defun make-cuisui (cui sui) @@ -81,3 +93,21 @@ (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))