1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: UFFI Example file to atoi/atof/atol
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Mar 2002
10 ;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg
12 ;;;; *************************************************************************
14 (in-package #:uffi-tests)
16 (uffi:def-function ("atoi" c-atoi)
20 (uffi:def-function ("atol" c-atol)
24 (uffi:def-function ("atof" c-atof)
29 "Returns a int from a string."
30 (uffi:with-cstring (str-cstring str)
31 (c-atoi str-cstring)))
34 "Returns a double float from a string."
35 (uffi:with-cstring (str-cstring str)
36 (c-atof str-cstring)))
38 (deftest :atoi.1 (atoi "123") 123)
39 (deftest :atoi.2 (atoi "") 0)
40 (deftest :atof.3 (atof "2.23") 2.23d0)