Esempio n. 1
0
bool ilparser::evalun()
{
    int tp;
    bool notus = true;

    if ( !mContext->cycles->error )
        do
        {
            notus = true;
            if ( contopt = !mContext->stacks->isemptystack( OPTOR ) )
            {
                oldopt = (optorec*)mContext->stacks->stacktop( OPTOR );
                if ( contopt = oldopt->optornr < 0 && oldopt->unaropt )
                {
                    oldn = oldopt->opt;
                    tp = ( (datpnt *)mContext->stacks->stacktop( OPADR ) )->tp;
                    if ( contopt = tp != ULimpf && tp != ULcom )
                    {
                        mContext->stacks->popspnt( OPTOR );
                        pushop.opeval = 0;
                        contopt = notus = callop( 1, &oldn );
                    }
                }
            }
        }
        while ( !mContext->cycles->error && contopt );
    return notus;
}
Esempio n. 2
0
bool ilparser::evalst( bool evass )
{
    bool ass = false;
    bool notus;
    bool def = false;
    bool smp = false;

    if ( mContext->cycles->error )
        return 0;
    pushop.opeval = OPEVALST;
    do
    {
        notus = true;
        if ( contopt = !mContext->stacks->isemptystack( OPTOR ) )
        {
            oldopt = (optorec*)mContext->stacks->stacktop( OPTOR );
            oldn = oldopt->opt;
            if ( contopt = ( unary = ( oldopt->unaropt ) ) ||
                           oldopt->optornr < 0 ||
                           evass && ( ( ass = ( oldopt->optornr == ASGNMNT ||
                                                ( def = oldopt->optornr == DEFNTN ) ) ) ||
                                      oldopt->optornr == ALTERN ||
                                      ( smp = oldopt->optornr == SMPALTERN ) ) )
            {
                mContext->stacks->popspnt( OPTOR );
                if ( unary )
                    contopt = notus = callop( 1, &oldn );
                else if ( oldopt->optornr >= 0 )
                {
                    if ( ass )
                        assign( def );
                    else
                    {
                        mContext->stacks->popspnt( OPTOR );
                        mContext->funcall->callfun( 3, smp ? findsmpcondmap() : findcondmap(), 0 );
                    }
                }
                else
                    contopt = notus = callop( 2, &oldn );
            }
        }
    }
    while ( !mContext->cycles->error && contopt );
    return notus;
}
Esempio n. 3
0
void ilparser::parsoprt( optorec* newoperator )
{
    bool notus = true;
    int neoprio;

    if ( parsval )
        mContext->stacks->pushd( OPTOR, newoperator );
    else
    {
        pushop.opeval = OPEVALNEW;
        pushop.iloperator = *newoperator;
        neoprio = newoperator->opt.priority;
        do
        {
            notus = true;
            if ( contopt = !mContext->stacks->isemptystack( OPTOR ) )
            {
                oldopt = (optorec*)mContext->stacks->stacktop( OPTOR );
                oldn = oldopt->opt;
                if ( contopt =
                            ( unary = oldopt->unaropt ) ||
                            ( oldopt->optornr < 0 &&
                              neoprio <= oldn.priority ) )
                {
                    mContext->stacks->popspnt( OPTOR );
                    contopt = notus = callop( unary ? 1 : 2, &oldn );
                }
            }
        }
        while ( !mContext->cycles->error && contopt );
        if ( notus )
            mContext->stacks->pushd( OPTOR, newoperator );
    }
    if ( notus )
    {
        parsval = true;
        mContext->scanner->scancom();
    }
}
Esempio n. 4
0
int execSharedPtr()
{
#if __cplusplus >= 201103L
    string output;
    gInterpreter->GetInterpreterTypeName("std::__shared_ptr<int>",output,kTRUE);
    if ( output.length() && output != "__shared_ptr<int>" ) {
        Error("GetInterpreterTypeName","Instead of __shared_ptr<int>, we got %s.",output.c_str());
        //return 1;
    }
    TClass *c = TClass::GetClass("std::shared_ptr<int>");
    if (!c) {
        Error("GetClass","Did not find the TClass for std::shared_ptr<int>.");
        return 2;
    }
    TObject *m = c->GetListOfAllPublicMethods()->FindObject("get");
    if (!m) {
        Error("GetListOfAllPublicMethods","Did not find the get method");
        return 3;
    }
    if (0 != strcmp("get",m->GetName())) {
        Error("TMethod","Instead of get the name of the method is %s",m->GetName());
        return 4;
    }
    std::shared_ptr<int> ptr;
    TMethodCall call((TFunction*)m);
    call.Execute();

    c = TClass::GetClass("__shared_ptr<int>");
    if (!c) c = TClass::GetClass("std::shared_ptr<int>");
    if (c) {
        m = c->GetListOfAllPublicMethods()->FindObject("operator=");
        if (!m) {
            Error("GetListOfAllPublicMethods","Did not find the operator= method");
            return 3;
        }
        if (0 != strcmp("operator=",m->GetName())) {
            Error("TMethod","Instead of operator= the name of the method is %s",m->GetName());
            return 4;
        }
        TMethodCall callop((TFunction*)m);
        callop.Execute(&ptr);

        m = c->GetListOfAllPublicMethods()->FindObject("swap");
        if (!m) {
            Error("GetListOfAllPublicMethods","Did not find the swap method");
            return 3;
        }
        if (0 != strcmp("swap",m->GetName())) {
            Error("TMethod","Instead of swap the name of the method is %s",m->GetName());
            return 4;
        }
        TMethodCall callswap((TFunction*)m);
        callswap.Execute(&ptr);
    }
#else
    // Emulated expected errors
    Error("TClingCallFunc::exec","The method get is called without an object.");
    Error("TClingCallFunc::exec","Not enough arguments provided for operator= (0 instead of the minimum 1)");
    Error("TClingCallFunc::exec","Not enough arguments provided for swap (0 instead of the minimum 1)");

#endif
    return 0;
}