当前位置: 首页>>代码示例>>C++>>正文


C++ LhsVar函数代码示例

本文整理汇总了C++中LhsVar函数的典型用法代码示例。如果您正苦于以下问题:C++ LhsVar函数的具体用法?C++ LhsVar怎么用?C++ LhsVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LhsVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckInputArgument

int ScilabGateway::exists(char * fname, const int envId, void * pvApiCtx)
{
    SciErr err;
    int * addr = 0;
    int * id = 0;
    int row = 0;
    int col = 0;
    bool exists = false;

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

    ScilabAbstractEnvironment & env = ScilabEnvironments::getEnvironment(envId);
    ScilabGatewayOptions & options = env.getGatewayOptions();
    OptionsHelper::setCopyOccured(false);
    ScilabObjects::initialization(env, pvApiCtx);
    options.setIsNew(false);

    err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
    if (err.iErr)
    {
        throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Invalid variable: cannot retrieve the data"));
    }

    if (!ScilabObjects::isExternalObjOrClass(addr, pvApiCtx))
    {
        throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Wrong type for input argument #%d: An External Object expected."), 1);
        return 0;
    }

    err = getMatrixOfInteger32InList(pvApiCtx, addr, EXTERNAL_OBJ_ID_POSITION, &row, &col, &id);
    if (err.iErr)
    {
        throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Invalid variable: cannot retrieve the data"));
    }

    try
    {
        exists = env.isvalidobject(*id);
    }
    catch (std::exception & e)
    {
        throw;
    }

    createScalarBoolean(pvApiCtx, 1, exists ? 1 : 0);

    LhsVar(1) = 1;
    PutLhsVar();

    return 0;
}
开发者ID:LenRemmerswaal,项目名称:scilab,代码行数:52,代码来源:exists.cpp

示例2: setStacksizeMax

/*--------------------------------------------------------------------------*/
static int setStacksizeMax(char *fname)
{
    /* we backup previous size */
    unsigned long backupSize = getCurrentStacksize();

    /* Bug 5495 on Windows 2000 -- WONT FIX GetLargestFreeMemoryRegion */
    /* it works on XP, Vista, S7ven */
    /* GetLargestFreeMemoryRegion() returns a superior size to real value */
    unsigned long maxmemfree = (GetLargestFreeMemoryRegion()) / sizeof(double);

    /* We have already max */
    if (maxmemfree <= backupSize)
    {
        LhsVar(1) = 0;
        C2F(putlhsvar) ();
        return 0;
    }

    /* we do a stacksize('min') */
    if (setStacksizeMin(fname) == 0)
    {
        unsigned long memmaxavailablebyscilab = get_max_memory_for_scilab_stack();
        unsigned long newMemSizeMax = maxmemfree;
        int errCode;

        if (memmaxavailablebyscilab < newMemSizeMax)
        {
            newMemSizeMax = memmaxavailablebyscilab;
        }

        if (newMemSizeMax < MIN_STACKSIZE)
        {
            newMemSizeMax = MIN_STACKSIZE;
        }

        errCode = setStacksize(newMemSizeMax);
        if (errCode != 0)
        {
            setStacksize(backupSize);
            Scierror(10001, _("%s: Cannot allocate memory.\n%s\n"), fname, getStackCreationErrorMessage(errCode));
        }
        return 0;
    }
    else
    {
        /* stacksize('min') fails */
        /* restore previous size */
        setStacksize(backupSize);
        Scierror(10001, _("%s: Cannot allocate memory.\n"), fname);
    }
    return 0;
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:53,代码来源:sci_stacksize.c

示例3: sci_stacksizeMin

/*--------------------------------------------------------------------------*/
static int sci_stacksizeMin(char *fname)
{
    if (setStacksizeMin(fname) == 0)
    {
        LhsVar(1) = 0;
        PutLhsVar();
    }
    else
    {
        Scierror(10001, _("%s: Cannot allocate memory.\n"), fname);
    }
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:14,代码来源:sci_stacksize.c

示例4: C2F

/*--------------------------------------------------------------------------*/
int C2F(sci_banner)(char *fname,unsigned long fname_len)
{
	Rhs=Max(Rhs,0);
	CheckRhs(0,0) ;
	CheckLhs(0,1) ;

	banner();

	LhsVar(1) = 0;
	PutLhsVar();	

	return 0;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:14,代码来源:sci_banner.c

示例5: C2F

/*--------------------------------------------------------------------------*/
int C2F(sci_what)(char *fname, unsigned long fname_len)
{
    int sizecommandwords = 0;
    char **commandwords = getcommandkeywords(&sizecommandwords);

    Rhs = Max(0, Rhs);
    CheckRhs(0, 0);
    CheckLhs(1, 2);

    CreateLocalFunctionsTab();
    qsort( LocalFunctionsTab , SizeLocalFunctionsTab ,  sizeof (char *)  , cmpfunctionnames);

    if (Lhs == 1)
    {
        DispInternalFunctions();
        DispCommands();
        LhsVar(1) = 0;
    }
    else /* Lhs == 2 */
    {
        int ncol = 1;
        int nrowFunctions = SizeLocalFunctionsTab;
        int nrowCommands = sizecommandwords;

        CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &nrowFunctions, &ncol, LocalFunctionsTab);
        LhsVar(1) = Rhs + 1;

        CreateVarFromPtr(Rhs + 2, MATRIX_OF_STRING_DATATYPE, &nrowCommands, &ncol, commandwords);
        LhsVar(2) = Rhs + 2;

        freeArrayOfString(LocalFunctionsTab, nrowFunctions);
        freeArrayOfString(commandwords, nrowCommands);

    }

    PutLhsVar();
    return 0;
}
开发者ID:quanpan302,项目名称:scilab,代码行数:39,代码来源:sci_what.c

示例6: sci_oemtochar

/*--------------------------------------------------------------------------*/
int sci_oemtochar(char *fname, unsigned long l)
{
    int l1 = 0, n1 = 0, m1 = 0;
    char *Output = NULL;

    if (getWarningMode())
    {
        sciprint(_("%s: Feature %s is obsolete.\n"), _("Warning"), fname);
        sciprint(_("%s: This feature will be permanently removed in Scilab %s\n\n"), _("Warning"), "5.4.1");
    }

    CheckRhs(1, 1);
    CheckLhs(0, 1);

    if (GetType(1) == sci_strings)
    {
        char *OEMstring = NULL;

        GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1);
        OEMstring = cstk(l1);

        Output = (char*)MALLOC((strlen(OEMstring) + 1) * sizeof(char));
        if (getScilabMode() == SCILAB_STD)
        {
            OemToChar(OEMstring, Output);
        }
        else
        {
            wsprintf(Output, "%s", OEMstring);
        }
    }
    else
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
        return 0;
    }

    n1 = 1;
    m1 = (int)strlen(Output);
    CreateVarFromPtr(Rhs + 1, STRING_DATATYPE, &m1, &n1, &Output);
    if (Output)
    {
        FREE(Output);
        Output = NULL;
    }

    LhsVar(1) = Rhs + 1;
    PutLhsVar();
    return 0;
}
开发者ID:LenRemmerswaal,项目名称:scilab,代码行数:51,代码来源:sci_oemtochar.c

示例7: LhsVar

int ScilabGateway::remove(char * fname, const int envId, void * pvApiCtx)
{
    SciErr err;
    int * addr = 0;

    ScilabAbstractEnvironment & env = ScilabEnvironments::getEnvironment(envId);
    ScilabGatewayOptions & options = env.getGatewayOptions();
    OptionsHelper::setCopyOccured(false);
    ScilabObjects::initialization(env, pvApiCtx);
    options.setIsNew(false);

    if (Rhs == 0)
    {
        env.garbagecollect();

        LhsVar(1) = 0;
        PutLhsVar();

        return 0;
    }

    for (int i = 1; i <= Rhs; i++)
    {
        err = getVarAddressFromPosition(pvApiCtx, i, &addr);
        if (err.iErr)
        {
            throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Invalid variable: cannot retrieve the data"));
        }

        ScilabObjects::removeVar(addr, pvApiCtx);
    }

    LhsVar(1) = 0;
    PutLhsVar();

    return 0;
}
开发者ID:LenRemmerswaal,项目名称:scilab,代码行数:37,代码来源:remove.cpp

示例8: sci_xinit

/*--------------------------------------------------------------------------*/
int sci_xinit(char * fname, void *pvApiCtx)
{
    SciErr err;
    int * addr = 0;
    char * path = 0;
    char * realPath = 0;

    CheckInputArgument(pvApiCtx, 1, 1);

    err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
    if (err.iErr)
    {
        printError(&err, 0);
        Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
        return 0;
    }

    if (!isStringType(pvApiCtx, addr) || !checkVarDimension(pvApiCtx, addr, 1, 1))
    {
        Scierror(999, gettext("%s: Wrong type for input argument #%d: string expected.\n"), fname, 1);
        return 0;
    }

    if (getAllocatedSingleString(pvApiCtx, addr, &path) != 0)
    {
        Scierror(999, _("%s: No more memory.\n"), fname);
        return 0;
    }

    realPath = expandPathVariable(path);

    if (realPath)
    {
        org_scilab_modules_graphic_export::Driver::setPath(getScilabJavaVM(), realPath);
        FREE(realPath);
    }
    else
    {
        Scierror(999, _("%s: Invalid path: %s.\n"), fname, path);
        return 0;
    }

    freeAllocatedSingleString(path);

    LhsVar(1) = 0;
    PutLhsVar();

    return 0;
}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:50,代码来源:sci_xinit.cpp

示例9: sci_mtell

/*--------------------------------------------------------------------------*/
int sci_mtell(char *fname, unsigned long fname_len)
{
    int m1 = 0, n1 = 0, l1 = 0;
    int one = 1;
    int l2 = 0, err = 0;
    int fd = ALL_FILES_DESCRIPTOR;

    Nbvars = 0;
    CheckRhs(0, 1);
    CheckLhs(1, 1);

    /*  checking variable file */
    if ( Rhs >= 1)
    {
        if (GetType(1) == sci_matrix)
        {
            GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
            if (m1*n1 == 1)
            {
                fd = *istk(l1);
            }
            else
            {
                Scierror(999, _("%s: Wrong size for input argument #%d: An integer expected.\n"), fname, 1);
                return 0;
            }
        }
        else
        {
            Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname, 1);
            return 0;
        }
    }

    CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l2);

    C2F(mtell)(&fd, stk(l2), &err);

    if (err >  0)
    {
        SciError(10000);
        return 0;
    }

    LhsVar(1) = Rhs + 1;
    PutLhsVar();

    return 0;
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:50,代码来源:sci_mtell.c

示例10: C2F

/*--------------------------------------------------------------------------*/
int C2F(sci_getlanguagealias)(char *fname, unsigned long fname_len)
{
    static int l1, n1, m1;
    char *Output = NULL;

    CheckRhs(0, 0);
    CheckLhs(0, 1);

    Output = getlanguagealias();

    if (Output)
    {
        n1 = 1;
        CreateVarFromPtr( Rhs + 1, STRING_DATATYPE, (m1 = (int)strlen(Output), &m1), &n1, &Output);
        LhsVar(1) = Rhs + 1;
        PutLhsVar();;
        if (Output)
        {
            FREE(Output);
            Output = NULL;
        }
    }
    else
    {
        m1 = 0;
        n1 = 0;
        l1 = 0;
        CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE,  &m1, &n1, &l1);
        LhsVar(1) = Rhs + 1;
        PutLhsVar();;
        return 0;
    }


    return 0;
}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:37,代码来源:sci_getlanguagealias.c

示例11: sci_view

int sci_view(char *fname) 
{
  static int l1, m1, n1, l2, m2, n2, m3, n3, l3;
  static int minlhs=1, maxlhs=3, minrhs=3, maxrhs=3;

  /* Check number of inputs (rhs=3) and outputs (lhs=3) */
  CheckRhs(minrhs,maxrhs) ;
  CheckLhs(minlhs,maxlhs) ;

  /* Get X (1 ,double), Y (2, int) and  C (3, string) */
  GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
  GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE, &m2, &n2, &l2);
  GetRhsVar(3,STRING_DATATYPE, &m3, &n3, &l3);

  /* Call display function
     stk(l1)->X (double), istk(l2)->Y (int), cstk(l3)->Z  (char)    */
  displ(stk(l1), m1, n1, istk(l2), m2, n2, cstk(l3), m3, n3);

  /*  Return variables  */
  LhsVar(1) = 1;
  LhsVar(2) = 2;
  LhsVar(3) = 3;
  return 0;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:24,代码来源:sci_view.c

示例12: sci_xpause

/*--------------------------------------------------------------------------*/
int sci_xpause(char *fname, unsigned long fname_len)
{
    int m1 = 0, n1 = 0, l1 = 0, sec = 0;

    CheckLhs(0, 1);
    CheckRhs(1, 1);
    if (Rhs == 1)
    {
        GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l1);
        CheckScalar(1, m1, n1);
        sec = (int)  * stk(l1);
        if (sec <= 0)
        {
            Scierror(999, _("%s: Wrong values for input argument #%d: Non-negative integers expected.\n"), fname, 1);
            return 0;
        }

#ifdef _MSC_VER
        {
            int ms = (sec) / 1000; /** time is specified in milliseconds in scilab**/
            if (ms > 0)
            {
                Sleep(ms);    /* Number of milliseconds to sleep. */
            }
        }
#else
        {
            unsigned useconds;
            useconds = (unsigned) sec;
            if (useconds != 0)
#ifdef HAVE_USLEEP
            {
                usleep(useconds);
            }
#else
#ifdef HAVE_SLEEP
            {
                sleep(useconds);
            }
#endif
#endif
        }
#endif
    }
    LhsVar(1) = 0;
    PutLhsVar();
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:49,代码来源:sci_xpause.c

示例13: sci_tohome

/*--------------------------------------------------------------------------*/
int sci_tohome(char *fname, void* pvApiCtx)
{

    CheckRhs(0, 0);
    CheckLhs(0, 1);

    if (!tohome())
    {
        sciprint(_("%s: This feature has not been implemented in this mode.\n"), fname);
    }

    LhsVar(1) = 0;
    PutLhsVar();

    return 0 ;
}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:17,代码来源:sci_tohome.c

示例14: sci_bug_9708

int sci_bug_9708(char *fname)
{
  SciErr sciErr;
  const char varname[] = "iputhereavariabletoolongforscilabandthereisnoerror";
  
  sciErr = createNamedMatrixOfString(pvApiCtx, varname, 1, 1, &varname);
  if(sciErr.iErr)
  {
    printError(&sciErr, 0);
    Scierror(999, _("%s: Invalid variable name.\n"), fname);
    return 0;
  }

  LhsVar(1) = 1;
  return 0;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:16,代码来源:bug_9708.c

示例15: sci_getfilepartlevel

/*--------------------------------------------------------------------------*/
int sci_getfilepartlevel(char *fname, unsigned long fname_len)
{
    CheckRhs(1, 1);
    CheckLhs(1, 1);

    if (GetType(1) == sci_strings)
    {
        int m = 0, n = 0;
        char **InputString = NULL;

        GetRhsVar(1, MATRIX_OF_STRING_DATATYPE, &m, &n, &InputString);
        if ( (m == 1) && (n == 1) )
        {
            char *result = NULL;
            result = getFilePartLevel(InputString[0]);
            if (result == NULL)
            {
                int l = 0;
                m = 0, n = 0;
                CreateVar(Rhs + 1, STRING_DATATYPE,  &m, &n, &l);
            }
            else
            {
                n = 1;
                CreateVarFromPtr(Rhs + 1, STRING_DATATYPE, (m = (int)strlen(result), &m), &n, &result);
                if (result)
                {
                    FREE(result);
                    result = NULL;
                }
            }

            LhsVar(1) = Rhs + 1;
        }
        else
        {
            freeArrayOfString(InputString, m * n);
            Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 1);
        }
    }
    else
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 1);
    }

    return 0;
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:48,代码来源:sci_getfilepartlevel.c


注:本文中的LhsVar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。