X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=utils.lisp;h=d2a5dd80a2331f6e25b6ab4d17f73349864674f4;hb=cc146d0b1c7d6d7a050713754f1ea9a8d71a46b5;hp=6b9e17eb63a11c8cad4469fd6e020658b3e57f5c;hpb=cc0d0f58d7261d12a8d6a89153f58ea693618e79;p=umlisp.git diff --git a/utils.lisp b/utils.lisp index 6b9e17e..d2a5dd8 100644 --- a/utils.lisp +++ b/utils.lisp @@ -4,10 +4,10 @@ ;;;; ;;;; Name: utils.lisp ;;;; Purpose: Low-level utility functions for UMLisp -;;;; Programmer: Kevin M. Rosenberg +;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: utils.lisp,v 1.3 2003/05/02 21:49:19 kevin Exp $ +;;;; $Id: utils.lisp,v 1.4 2003/05/06 02:14:59 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. @@ -16,8 +16,11 @@ ;;;; as governed by the terms of the GNU General Public License. ;;;; ************************************************************************* -(in-package :umlisp) -(declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))) +(in-package #:umlisp) + +(eval-when (:compile-toplevel) + (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) @@ -81,18 +84,14 @@ (defconstant +cuisui-scale+ 10000000) (defun make-cuisui (cui sui) - (declare (fixnum cui sui)) - (the integer (+ (* +cuisui-scale+ cui) sui))) + (+ (* +cuisui-scale+ cui) sui)) (defun make-cuilui (cui lui) - (declare (fixnum cui lui)) - (the integer (+ (* +cuisui-scale+ cui) lui))) + (+ (* +cuisui-scale+ cui) lui)) (defun decompose-cuisui (cuisui) - (declare (integer cuisui)) - (let* ((cui (the fixnum (truncate (/ cuisui +cuisui-scale+)))) - (sui (the fixnum (- cuisui (* cui +cuisui-scale+))))) - (values cui sui))) + "Returns the CUI and SUI of a cuisui number" + (floor cuisui cuisui +cuisui-scale+)) ;;; Lookup functions for uterms,ustr in ucons @@ -103,11 +102,7 @@ (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)) + (dolist (uterm (s#term ucon)) + (dolist (ustr (s#str uterm)) + (when (string-equal sui (sui ustr)) + (return-from find-ustr-in-ucon ustr)))))