| 1 |
/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- */ |
| 2 |
/* vim: set filetype=c tabstop=2 shiftwidth=2 expandtab: */ |
| 3 |
|
| 4 |
/* |
| 5 |
* plusp.d - implementation of CL:PLUSP |
| 6 |
* |
| 7 |
* Copyright (c) 1984 Taiichi Yuasa and Masami Hagiya |
| 8 |
* Copyright (c) 1990 Giuseppe Attardi |
| 9 |
* Copyright (c) 2001 Juan Jose Garcia Ripoll |
| 10 |
* |
| 11 |
* See file 'LICENSE' for the copyright details. |
| 12 |
* |
| 13 |
*/ |
| 14 |
|
| 15 |
|
| 16 |
#include <ecl/ecl.h> |
| 17 |
#include <ecl/impl/math_dispatch.h> |
| 18 |
|
| 19 |
cl_object |
| 20 |
cl_plusp(cl_object x) |
| 21 |
{ /* INV: ecl_plusp() checks type */ |
| 22 |
@(return (ecl_plusp(x) ? ECL_T : ECL_NIL)); |
| 23 |
} |
| 24 |
|
| 25 |
static int |
| 26 |
ecl_plusp_fixnum(cl_object x) |
| 27 |
{ |
| 28 |
return ecl_fixnum_plusp(x); |
| 29 |
} |
| 30 |
|
| 31 |
static int |
| 32 |
ecl_plusp_big(cl_object x) |
| 33 |
{ |
| 34 |
return _ecl_big_sign(x) > 0; |
| 35 |
} |
| 36 |
|
| 37 |
static int |
| 38 |
ecl_plusp_ratio(cl_object x) |
| 39 |
{ |
| 40 |
return ecl_plusp(x->ratio.num); |
| 41 |
} |
| 42 |
|
| 43 |
static int |
| 44 |
ecl_plusp_single_float(cl_object x) |
| 45 |
{ |
| 46 |
return ecl_single_float(x) > 0; |
| 47 |
} |
| 48 |
|
| 49 |
static int |
| 50 |
ecl_plusp_double_float(cl_object x) |
| 51 |
{ |
| 52 |
return ecl_double_float(x) > 0; |
| 53 |
} |
| 54 |
|
| 55 |
static int ecl_plusp_long_float(cl_object x) |
| 56 |
{ |
| 57 |
return ecl_long_float(x) > 0; |
| 58 |
} |
| 59 |
|
| 60 |
MATH_DEF_DISPATCH1_BOOL(plusp, @[plusp], @[real], |
| 61 |
ecl_plusp_fixnum, ecl_plusp_big, ecl_plusp_ratio, |
| 62 |
ecl_plusp_single_float, ecl_plusp_double_float, |
| 63 |
ecl_plusp_long_float, |
| 64 |
pluspfailed, |
| 65 |
pluspfailed, pluspfailed, pluspfailed) |