1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2010-2011 - DIGITEO - Allan CORNET 4 * 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises 6 * 7 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * This file was originally licensed under the terms of the CeCILL v2.1, 10 * and continues to be available under such terms. 11 * For more information, see the COPYING file which you should have received 12 * along with this program. 13 * 14 * This code is also published under the GPL v3 license. 15 * 16 */ 17 #ifndef __STRINGTODOUBLE_H__ 18 #define __STRINGTODOUBLE_H__ 19 20 #include "dynlib_string.h" 21 #include "BOOL.h" 22 #include <wchar.h> 23 24 #define NanString "Nan" 25 #define NanStringW L"Nan" 26 #define InfString "Inf" 27 #define InfStringW L"Inf" 28 #define NegInfString "-Inf" 29 #define NegInfStringW L"-Inf" 30 #define PosInfString "+Inf" 31 #define PosInfStringW L"+Inf" 32 #define NegNanString "-Nan" /* no sense but used by some users */ 33 #define NegNanStringW L"-Nan" /* no sense but used by some users */ 34 #define PosNanString "+Nan" /* no sense but used by some users */ 35 #define PosNanStringW L"+Nan" /* no sense but used by some users */ 36 #define ScilabNanString "%nan" 37 #define ScilabNanStringW L"%nan" 38 #define ScilabInfString "%inf" 39 #define ScilabInfStringW L"%inf" 40 #define ScilabNegInfString "-%inf" 41 #define ScilabNegInfStringW L"-%inf" 42 #define ScilabPosInfString "+%inf" 43 #define ScilabPosInfStringW L"+%inf" 44 #define ScilabNegNanString "-%nan" /* no sense but used by some users */ 45 #define ScilabNegNanStringW L"-%nan" /* no sense but used by some users */ 46 #define ScilabPosNanString "+%nan" /* no sense but used by some users */ 47 #define ScilabPosNanStringW L"+%nan" /* no sense but used by some users */ 48 #define ScilabPiString "%pi" 49 #define ScilabPiStringW L"%pi" 50 #define ScilabNegPiString "-%pi" 51 #define ScilabNegPiStringW L"-%pi" 52 #define ScilabPosPiString "+%pi" 53 #define ScilabPosPiStringW L"+%pi" 54 #define ScilabEString "%e" 55 #define ScilabEStringW L"%e" 56 #define ScilabPosEString "+%e" 57 #define ScilabPosEStringW L"+%e" 58 #define ScilabNegEString "-%e" 59 #define ScilabNegEStringW L"-%e" 60 #define ScilabEpsString "%eps" 61 #define ScilabEpsStringW L"%eps" 62 #define ScilabPosEpsString "+%eps" 63 #define ScilabPosEpsStringW L"+%eps" 64 #define ScilabNegEpsString "-%eps" 65 #define ScilabNegEpsStringW L"-%eps" 66 67 #ifdef __cplusplus 68 extern "C" { 69 #endif 70 71 typedef enum 72 { 73 STRINGTODOUBLE_NO_ERROR = 0, 74 STRINGTODOUBLE_MEMORY_ALLOCATION = 1, 75 STRINGTODOUBLE_NOT_A_NUMBER = 2, 76 STRINGTODOUBLE_ERROR = 3 77 } 78 stringToDoubleError; 79 80 /** 81 * @TODO add comment 82 * 83 * @param pSTR 84 * @param bConvertByNAN 85 * @param ierr 86 * @return <ReturnValue> 87 */ 88 STRING_IMPEXP double stringToDouble(const char *pSTR, BOOL bConvertByNAN, stringToDoubleError *ierr); 89 STRING_IMPEXP double stringToDoubleW(const wchar_t* pSTR, BOOL bConvertByNAN, stringToDoubleError* ierr); 90 STRING_IMPEXP double stringToDoubleWInPlace(wchar_t* pSTR, BOOL bConvertByNAN, stringToDoubleError* ierr); 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 97 #endif /* __STRINGTODOUBLE_H__ */ 98 // ============================================================================= 99