X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fmcl%2Ffunctions.cl;fp=src%2Fmcl%2Ffunctions.cl;h=0000000000000000000000000000000000000000;hb=e59d8c7edc1d6b3d3e1f8351c8d9a58bff19030a;hp=7712caad0c78a20eeb4db274eb90df98d5062a17;hpb=93d37518cbd27aa8b7f313bb89b9523d5a40ec88;p=uffi.git diff --git a/src/mcl/functions.cl b/src/mcl/functions.cl deleted file mode 100644 index 7712caa..0000000 --- a/src/mcl/functions.cl +++ /dev/null @@ -1,70 +0,0 @@ -;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: UFFI -*- -;;;; ************************************************************************* -;;;; FILE IDENTIFICATION -;;;; -;;;; Name: function.cl -;;;; Purpose: UFFI source to C function defintions -;;;; Programmers: Kevin M. Rosenberg and John DeSoi -;;;; Date Started: Feb 2002 -;;;; -;;;; $Id: functions.cl,v 1.5 2002/08/23 15:28:11 kevin Exp $ -;;;; -;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg -;;;; and John DeSoi -;;;; -;;;; UFFI users are granted the rights to distribute and use this software -;;;; as governed by the terms of the Lisp Lesser GNU Public License -;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. -;;;; ************************************************************************* - -(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) -(in-package :uffi) - -(defun process-function-args (args) - (if (null args) - #+lispworks nil - #+allegro '(:void) - #+cmu nil - #+mcl nil - (let (processed) - (dolist (arg args) - (push (process-one-function-arg arg) processed)) - (nreverse processed)))) - -(defun process-one-function-arg (arg) - (let ((name (car arg)) - (type (convert-from-uffi-type (cadr arg) :routine))) - (if (and (listp type) (listp (car type))) - (append (list name) type) - (list name type)) - )) - -(defun allegro-convert-return-type (type) - (if (and (listp type) (not (listp (car type)))) - (list type) - type)) - -;; name is either a string representing foreign name, or a list -;; of foreign-name as a string and lisp name as a symbol - - -(defmacro def-function (names args &key module returning) - (declare (ignore module)) - - (let* ((result-type (convert-from-uffi-type returning :return)) - (function-args (process-function-args args)) - (foreign-name (if (atom names) names (car names))) - (lisp-name (if (atom names) (make-lisp-name names) (cadr names)))) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (ccl:define-entry-point (,lisp-name ,foreign-name) - ,function-args - ,result-type)))) - - -(defun make-lisp-name (name) - (let ((converted (substitute #\- #\_ name))) - (intern - #+case-sensitive converted - #-case-sensitive (string-upcase converted)))) - -