Ejemplo n.º 1
0
/*--------------------------------------------------------------------------*/
types::Function::ReturnValue sci_xget(types::typed_list &in, int _iRetCount, types::typed_list &out)
{
    double dValue = 0;
    wchar_t* pwcsWhat = NULL;
    void* pvApiCtx = NULL;

    if (in.size() == 0)
    {
        return Overload::call(L"%_xget", in, _iRetCount, out);
    }

    if (in.size() > 2)
    {
        Scierror(77, _("%s: Wrong number of input argument(s): %d to %d expected.\n"), "xget", 1, 2);
        return types::Function::Error;
    }

    if (_iRetCount > 1)
    {
        Scierror(78, _("%s: Wrong number of output argument(s): %d expected.\n"), "xget", 1);
        return types::Function::Error;
    }

    if (in[0]->isString() == false)
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: A single string expected.\n"), "xget", 1);
        return types::Function::Error;
    }

    types::String* pStr = in[0]->getAs<types::String>();

    if (pStr->isScalar() == false)
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: A single string expected.\n"), "xget", 1);
        return types::Function::Error;
    }

    pwcsWhat = pStr->get(0);

    if (ConfigGraphicVariable::bPropertyFound(pwcsWhat) == false)
    {
        char* pstWhat = wide_string_to_UTF8(pwcsWhat);
        Scierror(999, _("%s: Unrecognized input argument: '%s'.\n"), "xget", pstWhat);
        FREE(pstWhat);
        return types::Function::Error;
    }

    if (in.size() == 2)
    {
        if (in[1]->isDouble() == false)
        {
            Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), "xget", 2);
            return types::Function::Error;
        }

        types::Double* pDbl = in[1]->getAs<types::Double>();

        //CheckScalar
        if (pDbl->isScalar())
        {
            Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar expected.\n"), "xget", 2);
            return types::Function::Error;
        }

        dValue = pDbl->get(0);
    }

    switch (ConfigGraphicVariable::getPropertyValue(pwcsWhat))
    {
        case 15 : // fpf
        {
            out.push_back(new types::String(ConfigGraphicVariable::getFPF().c_str()));
        }
        break;
        case 2 : // auto clear
        {
            int iAutoClear = 0;
            int* piAutoClear = &iAutoClear;
            getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_AUTO_CLEAR__, jni_bool, (void **)&piAutoClear);
            if (iAutoClear == 1)
            {
                out.push_back(new types::String(L"on"));
            }
            else
            {
                out.push_back(new types::String(L"off"));
            }
        }
        break;
        case 8 : // colormap
        {
            int iObjUID = 0;
            // Force figure creation if none exists.
            getOrCreateDefaultSubwin();
            iObjUID = getCurrentFigure();

            out.push_back((types::InternalType*)get_color_map_property(pvApiCtx, iObjUID));
        }
        break;
        case 20 : // mark
        {
            int iObjUID = getOrCreateDefaultSubwin();
            int iMarkStyle = 0;
            int* piMarkStyle = &iMarkStyle;
            int iMarkSize = 0;
            int* piMarkSize = &iMarkSize;
            types::Double* pDbl = new types::Double(1, 2);

            getGraphicObjectProperty(iObjUID, __GO_MARK_STYLE__, jni_int, (void**)&piMarkStyle);
            getGraphicObjectProperty(iObjUID, __GO_MARK_SIZE__, jni_int, (void**)&piMarkSize);

            pDbl->set(0, (double)iMarkStyle);
            pDbl->set(1, (double)iMarkSize);
            out.push_back(pDbl);
        }
        break;
        case 21 : // mark size
        {
            int iObjUID = getOrCreateDefaultSubwin();
            out.push_back((types::InternalType*)get_mark_size_property(pvApiCtx, iObjUID));
        }
        break;
        case 19 : // line style
        {
            out.push_back((types::InternalType*)get_line_style_property(pvApiCtx, getOrCreateDefaultSubwin()));
        }
        break;
        case 5 : // clipping
        {
            types::Double* pDblClipBox = new types::Double(1, 4);
            double *clipBox = NULL;
            int iObjUID = getOrCreateDefaultSubwin();
            getGraphicObjectProperty(iObjUID, __GO_CLIP_BOX__, jni_double_vector, (void **)&clipBox);
            memcpy(pDblClipBox->get(), clipBox, 4 * sizeof(double));
            out.push_back(pDblClipBox);
        }
        break;
        case 12 : // font
        {
            int iObjUID = getOrCreateDefaultSubwin();
            double dblFontSize = 0;
            double* pdblFontSize = &dblFontSize;
            int iFontStyle = 0;
            int* piFontStyle = &iFontStyle;
            types::Double* pDbl = new types::Double(1, 2);

            getGraphicObjectProperty(iObjUID, __GO_FONT_SIZE__, jni_double, (void **)&pdblFontSize);
            getGraphicObjectProperty(iObjUID, __GO_FONT_STYLE__, jni_int, (void**)&piFontStyle);

            pDbl->set(0, (double)iFontStyle);
            pDbl->set(1, dblFontSize);
            out.push_back(pDbl);
        }
        break;
        case 13 : // font size
        {
            double dblFontSize = 0;
            double* pdblFontSize = &dblFontSize;
            getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_FONT_SIZE__, jni_double, (void **)&pdblFontSize);

            out.push_back(new types::Double(dblFontSize));
        }
        break;
        case 9 : // dashes
        {
            int iLineStyle = 0;
            int* piLineStyle = &iLineStyle;

            getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_LINE_STYLE__, jni_int, (void**)&piLineStyle);

            out.push_back(new types::Double((double)iLineStyle));
        }
        break;
        case 16 : // hidden3d
        {
            out.push_back((types::InternalType*)get_hidden_color_property(pvApiCtx, getOrCreateDefaultSubwin()));
        }
        break;
        case 30 : // window
        case 11 : // figure
        {
            int iFigureId = 0;
            int* piFigureId = &iFigureId;

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_ID__, jni_int, (void**)&piFigureId);

            out.push_back(new types::Double((double)iFigureId));
        }
        break;
        case 25 : // thickness
        {
            out.push_back((types::InternalType*)get_thickness_property(pvApiCtx, getOrCreateDefaultSubwin()));
        }
        break;
        case 28 : // wdim
        case 31 : // wpdim
        {
            int *piFigureSize = NULL;
            types::Double* pDblFigureSize = new types::Double(1, 2);

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_SIZE__, jni_int_vector, (void **) &piFigureSize);

            pDblFigureSize->set(0, (double) piFigureSize[0]);
            pDblFigureSize->set(1, (double) piFigureSize[1]);
            out.push_back(pDblFigureSize);
        }
        break;
        case 32 : // wpos
        {
            int *piFigurePosition = NULL;
            types::Double* pDblFigurePos = new types::Double(1, 2);

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_POSITION__, jni_int_vector, (void **) &piFigurePosition);

            pDblFigurePos->set(0, (double) piFigurePosition[0]);
            pDblFigurePos->set(1, (double) piFigurePosition[1]);
            out.push_back(pDblFigurePos);
        }
        break;
        case 27 : // viewport
        {
            int *piViewport = NULL;
            types::Double* pDblViewport = new types::Double(1, 2);

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_VIEWPORT__, jni_int_vector, (void **)&piViewport);

            pDblViewport->set(0, (double) piViewport[0]);
            pDblViewport->set(1, (double) piViewport[1]);
            out.push_back(pDblViewport);
        }
        break;
        case 3 : // background
        {
            out.push_back((types::InternalType*)get_background_property(pvApiCtx, getOrCreateDefaultSubwin()));
        }
        break;
        case 7 : // color
        case 14 : // foreground
        case 23 : // pattern
        {
            out.push_back((types::InternalType*)get_foreground_property(pvApiCtx, getOrCreateDefaultSubwin()));
        }
        break;
        case 17 : // lastpattern
        {
            int iNumColors = 0;
            int* piNumColors = &iNumColors;

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_COLORMAP_SIZE__, jni_int, (void**)&piNumColors);

            out.push_back(new types::Double((double)iNumColors));
        }
        break;
        case 18 : // line mode
        {
            int iLineMode = 0;
            int* lineMode = &iLineMode;

            getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_LINE_MODE__, jni_bool, (void **)&lineMode);

            out.push_back(new types::Double((double)iLineMode));
        }
        break;
        case 29 : // white
        {
            int iNumColors = 0;
            int* piNumColors = &iNumColors;

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_COLORMAP_SIZE__, jni_int, (void**)&piNumColors);

            /* White is lqst colormap index + 2 */
            out.push_back(new types::Double((double)(iNumColors + 2)));
        }
        break;
        case 33 : // wresize
        {
            // autoresize property
            int iAutoResize = 0;
            int* piAutoResize =  &iAutoResize;

            getOrCreateDefaultSubwin();
            getGraphicObjectProperty(getCurrentFigure(), __GO_AUTORESIZE__, jni_bool, (void **)&piAutoResize);

            out.push_back(new types::Double((double)iAutoResize));
        }
        break;
        case 6 : // clipgrf
        {
            /* clip_state : 0 = off, 1 = on */
            int iClipState = 0;
            int* piClipState = &iClipState;

            getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_CLIP_STATE__, jni_int, (void**)&piClipState);

            out.push_back(new types::Double((double)iClipState));
        }
        break;
        case 4 : // clipoff
        {
            int iClipState = 0;
            int* piClipState = &iClipState;

            getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_CLIP_STATE__, jni_int, (void**)&piClipState);

            /* clip_state : 0 = off, 1 = on */
            if (iClipState == 0)
            {
                out.push_back(new types::Double(1));
            }
            else
            {
                out.push_back(new types::Double(0));
            }
        }
        break;
        default :
        {
            char* pstWhat = wide_string_to_UTF8(pwcsWhat);
            Scierror(999, _("%s: Unrecognized input argument: '%s'.\n"), "xget", pstWhat);
            FREE(pstWhat);
            return types::Function::Error;
        }
    }

    return types::Function::OK;
}
Ejemplo n.º 2
0
/*--------------------------------------------------------------------------*/
int sci_xget(char *fname, unsigned long fname_len)
{
    SciErr sciErr;

    int* piAddrl1 = NULL;
    char* l1 = NULL;
    int* piAddrl2 = NULL;
    double* l2 = NULL;
    char* l3 = NULL;

    int m1 = 0, m2 = 0, n2 = 0, i = 0;
    int one = 1;

    BOOL keyFound = FALSE;

    if (nbInputArgument(pvApiCtx) <= 0)
    {
        sci_demo(fname, fname_len);
        return 0;
    }

    CheckInputArgument(pvApiCtx, 1, 2);
    CheckOutputArgument(pvApiCtx, 0, 1);

    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrl1);
    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 1;
    }

    // Retrieve a matrix of double at position 1.
    if (getAllocatedSingleString(pvApiCtx, piAddrl1, &l1))
    {
        Scierror(202, _("%s: Wrong type for argument #%d: A string expected.\n"), fname, 1);
        return 1;
    }

    /* check if key is valid */
    for (i = 0; i < NUMSETFONC ; i++)
    {
        if (strcmp((l1), KeyTab_[i]) == 0)
        {
            keyFound = TRUE;
            break;
        }
    }

    if (!keyFound)
    {
        Scierror(999, _("%s: Unrecognized input argument: '%s'.\n"), fname, (l1));
        freeAllocatedSingleString(l1);
        return -1;
    }

    if (nbInputArgument(pvApiCtx) == 2)
    {
        sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrl2);
        if (sciErr.iErr)
        {
            printError(&sciErr, 0);
            freeAllocatedSingleString(l1);
            return 1;
        }

        // Retrieve a matrix of double at position 2.
        sciErr = getMatrixOfDouble(pvApiCtx, piAddrl2, &m2, &n2, &l2);
        if (sciErr.iErr)
        {
            printError(&sciErr, 0);
            Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 2);
            freeAllocatedSingleString(l1);
            return 1;
        }

        //CheckScalar
        if (m2 != 1 || n2 != 1)
        {
            Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar expected.\n"), fname, 2);
            freeAllocatedSingleString(l1);
            return 1;
        }

    }

    if (strcmp(l1, "fpf") == 0 || strcmp(l1, "auto clear") == 0)
    {
        int bufl;
        char buf[4096];
        /*     special case for global variables set */
        xgetg((l1), buf, &bufl, m1, bsiz);
        if (allocSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, bufl * one, (const char **)&l3))
        {
            Scierror(999, _("%s: Memory allocation error.\n"), fname);
            freeAllocatedSingleString(l1);
            return 1;
        }

        strncpy((l3), buf, bufl);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "colormap") == 0)
    {
        int iObjUID = 0;
        // Force figure creation if none exists.
        getOrCreateDefaultSubwin();
        iObjUID = getCurrentFigure();

        get_color_map_property(pvApiCtx, iObjUID);

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "mark") == 0)
    {
        int iObjUID = getOrCreateDefaultSubwin();
        int iMarkStyle = 0;
        int* piMarkStyle = &iMarkStyle;
        int iMarkSize = 0;
        int* piMarkSize = &iMarkSize;
        double pdblResult[2];

        getGraphicObjectProperty(iObjUID, __GO_MARK_STYLE__, jni_int, (void**)&piMarkStyle);
        getGraphicObjectProperty(iObjUID, __GO_MARK_SIZE__, jni_int, (void**)&piMarkSize);
        pdblResult[0] = iMarkStyle;
        pdblResult[1] = iMarkSize;

        createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 2, pdblResult);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "mark size") == 0)
    {
        int iObjUID = getOrCreateDefaultSubwin();
        get_mark_size_property(pvApiCtx, iObjUID);

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "line style") == 0)
    {
        get_line_style_property(pvApiCtx, getOrCreateDefaultSubwin());

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "clipping") == 0)
    {
        double *clipBox = NULL;
        int iObjUID = getOrCreateDefaultSubwin();

        getGraphicObjectProperty(iObjUID, __GO_CLIP_BOX__, jni_double_vector, (void **)&clipBox);

        createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 4, clipBox);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "font") == 0)
    {
        int iObjUID = getOrCreateDefaultSubwin();
        double dblFontSize = 0;
        double* pdblFontSize = &dblFontSize;
        int iFontStyle = 0;
        int* piFontStyle = &iFontStyle;
        double pdblResult[2];

        getGraphicObjectProperty(iObjUID, __GO_FONT_SIZE__, jni_double, (void **)&pdblFontSize);
        getGraphicObjectProperty(iObjUID, __GO_FONT_STYLE__, jni_int, (void**)&piFontStyle);

        pdblResult[0] = iFontStyle;
        pdblResult[1] = dblFontSize;


        createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 2, pdblResult);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "font size") == 0)
    {
        double dblFontSize = 0;
        double* pdblFontSize = &dblFontSize;
        getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_FONT_SIZE__, jni_double, (void **)&pdblFontSize);

        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblFontSize);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "dashes") == 0)
    {
        int iLineStyle = 0;
        int* piLineStyle = &iLineStyle;

        getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_LINE_STYLE__, jni_int, (void**)&piLineStyle);

        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iLineStyle);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "hidden3d") == 0)
    {
        get_hidden_color_property(pvApiCtx, getOrCreateDefaultSubwin());

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "window") == 0 || strcmp(l1, "figure") == 0)
    {
        int iFigureId = 0;
        int* piFigureId = &iFigureId;

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_ID__, jni_int, (void**)&piFigureId);
        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iFigureId);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "thickness") == 0)
    {
        get_thickness_property(pvApiCtx, getOrCreateDefaultSubwin());

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "wdim") == 0 || strcmp(l1, "wpdim") == 0)
    {
        int *piFigureSize = NULL;
        double pdblFigureSize[2];

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_SIZE__, jni_int_vector, (void **) &piFigureSize);
        pdblFigureSize[0] = (double) piFigureSize[0];
        pdblFigureSize[1] = (double) piFigureSize[1];

        createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 2, pdblFigureSize);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "wpos") == 0)
    {
        int *piFigurePosition = NULL;
        double pdblFigurePosition[2];

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_POSITION__, jni_int_vector, (void **) &piFigurePosition);
        pdblFigurePosition[0] = piFigurePosition[0];
        pdblFigurePosition[1] = piFigurePosition[1];

        createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 2, pdblFigurePosition);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "viewport") == 0)
    {
        int* viewport = NULL;
        double pdblViewport[2];

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_VIEWPORT__, jni_int_vector, (void **)&viewport);
        pdblViewport[0] = viewport[0];
        pdblViewport[1] = viewport[1];

        createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 2, pdblViewport);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "background") == 0)
    {
        get_background_property(pvApiCtx, getOrCreateDefaultSubwin());

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (  strcmp(l1, "color") == 0
               || strcmp(l1, "foreground") == 0
               || strcmp(l1, "pattern") == 0)
    {
        get_foreground_property(pvApiCtx, getOrCreateDefaultSubwin());

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "lastpattern") == 0)
    {
        int iNumColors = 0;
        int* piNumColors = &iNumColors;

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_COLORMAP_SIZE__, jni_int, (void**)&piNumColors);

        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iNumColors);

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "line mode") == 0)
    {
        int iLineMode = 0;
        int* lineMode = &iLineMode;

        getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_LINE_MODE__, jni_bool, (void **)&lineMode);

        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iLineMode);

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "white") == 0)
    {
        int iNumColors = 0;
        int* piNumColors = &iNumColors;

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_COLORMAP_SIZE__, jni_int, (void**)&piNumColors);

        /* White is lqst colormap index + 2 */
        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iNumColors + 2);

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "wresize") == 0)
    {
        // autoresize property
        int iAutoResize = 0;
        int* piAutoResize =  &iAutoResize;

        getOrCreateDefaultSubwin();
        getGraphicObjectProperty(getCurrentFigure(), __GO_AUTORESIZE__, jni_bool, (void **)&piAutoResize);

        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iAutoResize);

        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "clipgrf") == 0)
    {
        /* clip_state : 0 = off, 1 = on */
        int iClipState = 0;
        int* piClipState = &iClipState;

        getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_CLIP_STATE__, jni_int, (void**)&piClipState);

        createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iClipState);
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else if (strcmp(l1, "clipoff") == 0)
    {
        int iClipState = 0;
        int* piClipState = &iClipState;

        getGraphicObjectProperty(getOrCreateDefaultSubwin(), __GO_CLIP_STATE__, jni_int, (void**)&piClipState);

        /* clip_state : 0 = off, 1 = on */
        if (iClipState == 0)
        {
            createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1);
        }
        else
        {
            createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 0);
        }
        AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
        ReturnArguments(pvApiCtx);
    }
    else
    {
        Scierror(999, _("%s: Unrecognized input argument: '%s'.\n"), fname, (l1));
        freeAllocatedSingleString(l1);
        return -1;
    }

    freeAllocatedSingleString(l1);
    return 0;
}