1
;; -*- coding: utf-8; mode: scheme -*-
5
;; Copyright (c) 2006 KOGURO, Naoki (naoki@koguro.net)
7
;; Permission is hereby granted, free of charge, to any person
8
;; obtaining a copy of this software and associated
9
;; documentation files (the "Software"), to deal in the
10
;; Software without restriction, including without limitation
11
;; the rights to use, copy, modify, merge, publish, distribute,
12
;; sublicense, and/or sell copies of the Software, and to
13
;; permit persons to whom the Software is furnished to do so,
14
;; subject to the following conditions:
16
;; The above copyright notice and this permission notice shall
17
;; be included in all copies or substantial portions of the
20
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
21
;; KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
22
;; WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23
;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
24
;; OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25
;; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26
;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
;; $Id: ffilib.stub 310 2006-08-17 15:00:58Z naoki $
32
#include \"c-parser.h\"
37
(define-cproc strtoll (nptr::<const-cstring>)
38
(code "char *endptr = NULL;"
39
"long long v = strtoll(nptr, &endptr, 0);"
40
"if (nptr == endptr) {"
41
" SCM_RETURN(SCM_FALSE);"
43
" SCM_RETURN(Scm_MakeInteger64((ScmInt64) v));"
46
(define-cproc strtod (nptr::<const-cstring>)
47
(code "char *endptr = NULL;"
48
"double v = strtod(nptr, &endptr);"
49
"if (nptr == endptr) {"
50
" SCM_RETURN(SCM_FALSE);"
52
" SCM_RETURN(Scm_MakeFlonum(v));"