Ejemplo n.º 1
0
double BigNumber::Double() const
{
    LispString str;
    ANumber num(*iNumber);
    ANumberToString(str, num, 10);
    std::istringstream is(str.c_str());
    double d;
    is >> d;
    return d;
}
Ejemplo n.º 2
0
LispInt InternalAsciiToInt(const LispString& aString)
{
    const LispChar* ptr = aString.c_str();

    if (!IsNumber(ptr, false))
        throw LispErrInvalidArg();

    return std::stoi(aString);
}
Ejemplo n.º 3
0
void PrintExpression(LispString& aResult,
                     LispPtr& aExpression,
                     LispEnvironment& aEnvironment,
                     std::size_t aMaxChars)
{
    std::ostringstream stream;
    InfixPrinter infixprinter(aEnvironment.PreFix(),
                              aEnvironment.InFix(),
                              aEnvironment.PostFix(),
                              aEnvironment.Bodied());
    infixprinter.Print(aExpression, stream, aEnvironment);
    aResult.assign(stream.str());
    if (aMaxChars > 0 && aResult.size()>aMaxChars)
    {
        aResult.resize(aMaxChars - 3);
        aResult += "...";
    }
}