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


C++ PutLhsVar函数代码示例

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


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

示例1: 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:rossdrummond,项目名称:scilab,代码行数:33,代码来源:sci_getlanguagealias.c

示例2: sci_emptystr_one_rhs

/*--------------------------------------------------------------------------*/
static int sci_emptystr_one_rhs(char *fname)
{
    int m1 = 0, n1 = 0; /* m1 is the number of row ; n1 is the number of col*/

    /*With a matrix for input argument returns a zero length character strings matrix of the same size */
    int Type = VarType(1);

    if (Type == sci_matrix)
    {
        char **Input_StringMatrix_One = NULL;

        GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &Input_StringMatrix_One);
        if ((m1 == 0) && (n1 == 0)) /* emptystr([]) */
        {
            int l = 0;
            CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &m1, &n1, &l);
            LhsVar(1) = Rhs + 1 ;
            PutLhsVar();
            return 0;
        }
    }
    else
    {
        if ((Type == sci_mlist) || (Type == sci_tlist))
        {
            /* compatibility with 4.1.2 */
            int lw = 1 + Top - Rhs;
            C2F(overload)(&lw, fname, (int)strlen(fname));
            return 0;
        }
        else
        {
            int RHSPOS = 1;
            int l1 = 0;
            int il = 0;
            int lw = RHSPOS + Top - Rhs;
            l1 = *Lstk(lw);
            il = iadr(l1);

            if (*istk(il ) < 0)
            {
                il = iadr(*istk(il + 1));
            }

            /* get dimensions */
            m1 = getNumberOfLines(il); /* row */
            n1 = getNumberOfColumns(il); /* col */
        }
    }

    /* m1 is the number of row ; n1 is the number of col*/
    CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &m1, &n1, NULL);
    LhsVar(1) = Rhs + 1;
    PutLhsVar();

    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:58,代码来源:sci_emptystr.c

示例3: sci_fromjava

/*--------------------------------------------------------------------------*/
int sci_fromjava(char *fname, unsigned long fname_len)
{
    static int n1;
    int *paramoutINT = (int*)MALLOC(sizeof(int) + 1);

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

    if ( IsFromJava() )
    {
        *paramoutINT = (int)(TRUE);
    }
    else
    {
        *paramoutINT = (int)(FALSE);
    }

    n1 = 1;
    CreateVarFromPtr(Rhs + 1, MATRIX_OF_BOOLEAN_DATATYPE, &n1, &n1, &paramoutINT);
    if (paramoutINT)
    {
        FREE(paramoutINT);
        paramoutINT = NULL;
    }
    LhsVar(1) = Rhs + 1;
    PutLhsVar();

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

示例4: sci_gpuDeviceMemInfo

/* ========================================================================== */
int sci_gpuDeviceMemInfo(char *fname)
{
    #ifdef WITH_CUDA
    if(isGpuInit())
    {
        if (useCuda())
        {
            size_t free = 0, total = 0;
            cuMemGetInfo(&free,&total);
            double freeMem = (double)free;

            createScalarDouble(pvApiCtx, Rhs + 1, freeMem);
        }
        else
        {
            double zero = 0.;
            createScalarDouble(pvApiCtx, Rhs + 1, zero);
            sciprint("not implemented with OpenCL.\n");
        }

        LhsVar(1) = Rhs + 1;
        PutLhsVar();
    }
    else
    {
        Scierror(999,"%s","gpu is not initialised. Please launch gpuInit() before use this function.\n");
    }

    #else
        sciprint("not implemented with OpenCL.\n");
    #endif
    return 0;
}
开发者ID:dawuweijun,项目名称:scigpgpu,代码行数:34,代码来源:sci_gpuDeviceMemInfo.cpp

示例5: sci_type

/*--------------------------------------------------------------------------*/
int sci_type(char *fname, void* pvApiCtx)
{
    SciErr sciErr;
    int* piAddr	= NULL;
    int iType		= 0;
    int iRet = 0;

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

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

    sciErr = getVarType(pvApiCtx, piAddr, &iType);
    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    iRet = createMatrixOfDoubleFromInteger(pvApiCtx, Rhs + 1, 1, 1, &iType);
    if (iRet)
    {
        return 0;
    }

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

示例6: sci_gpuLoadDynLib

/* ========================================================================== */
int sci_gpuLoadDynLib(char* fname)
{
    int row         = 0;
    int col         = 0;
    int* piLen      = NULL;
    char** pstData  = NULL;
    int* pstrA      = NULL;
    int inputType_A = 0;
    int  i          = 0;

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

    // get lib
    getVarAddressFromPosition(pvApiCtx,1,&pstrA);
    getVarType(pvApiCtx, pstrA, &inputType_A);
    getMatrixOfString(pvApiCtx, pstrA, &row, &col, NULL, NULL);
    piLen = (int*)malloc(sizeof(int) * row * col);
    getMatrixOfString(pvApiCtx, pstrA, &row, &col, piLen, NULL);
    pstData = (char**)malloc(sizeof(char*) * row * col);
    for(i = 0 ; i < row * col ; i++)
    {
        pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));
    }
    getMatrixOfString(pvApiCtx, pstrA, &row, &col, piLen, pstData);

    // open lib
    printf("%s\n", *pstData);
    Sci_dlopen(*pstData);

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

    return 0;
}
开发者ID:dawuweijun,项目名称:scigpgpu,代码行数:36,代码来源:sci_gpuLoadDynLib.c

示例7: CheckInputArgument

int ScilabGateway::getRepresentation(char * fname, const int envId, void * pvApiCtx)
{
    SciErr err;
    int * addr = 0;
    int tmpvar[2] = {0, 0};
    int idObj = 0;

    CheckInputArgument(pvApiCtx, 1, 1);

    ScilabAbstractEnvironment & env = ScilabEnvironments::getEnvironment(envId);
    ScilabGatewayOptions & options = env.getGatewayOptions();
    OptionsHelper::setCopyOccurred(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);
    }

    idObj = ScilabObjects::getArgumentId(addr, tmpvar, false, false, envId, pvApiCtx);

    env.getrepresentation(idObj, ScilabStringStackAllocator(pvApiCtx, Rhs + 1));

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

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

示例8: sci_stacksizeNoRhs

/*--------------------------------------------------------------------------*/
static int sci_stacksizeNoRhs(char *fname)
{
    int n1 = 0, m1 = 0;
    int *paramoutINT = NULL;
    int total = 0;
    int used = 0;

    paramoutINT = (int *)MALLOC(sizeof(int) * 2);

    C2F(getstackinfo) (&total, &used);
    paramoutINT[0] = total;
    paramoutINT[1] = used;

    n1 = 1;
    m1 = 2;
    CreateVarFromPtr(Rhs + 1, MATRIX_OF_INTEGER_DATATYPE, &n1, &m1, (int *)&paramoutINT);

    LhsVar(1) = Rhs + 1;

    if (paramoutINT)
    {
        FREE(paramoutINT);
        paramoutINT = NULL;
    }

    PutLhsVar();
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:29,代码来源:sci_stacksize.c

示例9: C2F

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

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

    Status = (int*)MALLOC(sizeof(int));
    *Status = (int) ( getScilabMode() == SCILAB_STD );

    m1 = 1;
    n1 = 1;
    CreateVarFromPtr(Rhs + 1, MATRIX_OF_BOOLEAN_DATATYPE, &n1, &n1, &Status);
    LhsVar(1) = Rhs + 1;

    if (Status)
    {
        FREE(Status);
        Status = NULL;
    }

    PutLhsVar();

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

示例10: sci_xname

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

    char *pstCurrentFigure = NULL;

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

    GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1);

    pstCurrentFigure = getCurrentFigure();

    if (pstCurrentFigure == NULL)
    {
        pstCurrentFigure = createNewFigureWithAxes();
    }

    setGraphicObjectProperty(pstCurrentFigure, __GO_NAME__, cstk(l1), jni_string, 1);

    LhsVar(1) = 0;
    PutLhsVar();

    return 0;
}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:26,代码来源:sci_xname.c

示例11: sci_ctree2

/*--------------------------------------------------------------------------*/
int sci_ctree2(char *fname, unsigned long fname_len)
{
    int one = 1, ipvec = 0, nvec = 0, mvec = 0, noin = 0, moin = 0, ipoin = 0, noinr = 0, moinr = 0, ipoinr = 0;
    int ndep = 0, mdep = 0, ipdep = 0, ndepuptr = 0, mdepuptr = 0, ipdepuptr = 0, ipord = 0, ipok = 0, n = 0, nord = 0;

    CheckRhs(5, 5);
    CheckLhs(2, 2);

    GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &nvec, &mvec, &ipvec);
    GetRhsVar(2, MATRIX_OF_INTEGER_DATATYPE, &noin, &moin, &ipoin);
    GetRhsVar(3, MATRIX_OF_INTEGER_DATATYPE, &noinr, &moinr, &ipoinr);
    GetRhsVar(4, MATRIX_OF_INTEGER_DATATYPE, &ndep, &mdep, &ipdep);
    GetRhsVar(5, MATRIX_OF_INTEGER_DATATYPE, &ndepuptr, &mdepuptr, &ipdepuptr);
    n = nvec * mvec;
    CreateVar(6, MATRIX_OF_INTEGER_DATATYPE, &n, &one, &ipord);
    CreateVar(7, MATRIX_OF_INTEGER_DATATYPE, &one, &one, &ipok);

    ctree2(istk(ipvec), n, istk(ipdep), istk(ipdepuptr), istk(ipoin), istk(ipoinr), istk(ipord), &nord, istk(ipok));

    *istk(iadr(C2F(intersci).iwhere[5]) + 1) = nord;

    LhsVar(1) = 6;
    LhsVar(2) = 7;

    PutLhsVar();

    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:29,代码来源:sci_ctree2.c

示例12: sci_loadfftwlibrary

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

	CheckRhs(1,1);

	if (GetType(1) == sci_strings)
	{
		GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
		FFTWLibname=cstk(l1);
		setfftwlibname(FFTWLibname);

		n1=1;
		if ( LoadFFTWLibrary(FFTWLibname) )
		{
			CreateVar(Rhs+1,MATRIX_OF_BOOLEAN_DATATYPE, &n1,&n1,&l1);
			*istk(l1)=(int)(TRUE);
		}
		else
		{
			CreateVar(Rhs+1,MATRIX_OF_BOOLEAN_DATATYPE, &n1,&n1,&l1);
			*istk(l1)=(int)(FALSE);
		}

		LhsVar(1)=Rhs+1;
		PutLhsVar();
	}
	else
	{
		 Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,1);
	}
	return(0);
}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:35,代码来源:sci_loadfftwlibrary.c

示例13: sci_gethistoryfile

/*--------------------------------------------------------------------------*/
int sci_gethistoryfile(char *fname, unsigned long fname_len)
{
    char *filename = NULL;
    int m1 = 0, n1 = 0;

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

    filename = getFilenameScilabHistory();

    if (filename)
    {
        n1 = 1;
        m1 = (int)strlen(filename);
        CreateVarFromPtr(Rhs + 1, STRING_DATATYPE, &m1, &n1, &filename);
        if (filename)
        {
            FREE(filename);
            filename = NULL;
        }
        LhsVar(1) = Rhs + 1;
        PutLhsVar();
    }
    else
    {
        Scierror(999, _("%s: An error occurred: %s\n"), fname, _("filename not defined."));
    }
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:30,代码来源:sci_gethistoryfile.c

示例14: OneLhs

 /*--------------------------------------------------------------------------*/
 static int OneLhs(struct VariableStruct* Vstruct,int lenStructArray,BOOL Sorted)
 {
	 int i=0;
	 int m=0;
	 int n=0;

	 char **LocalTab = NULL;

	 if (Sorted) SortVarsStructByStrings(Vstruct,lenStructArray);

	 LocalTab=(char **)MALLOC(sizeof(char*)*(lenStructArray));

	 for (i=0;i<lenStructArray;i++)
	 {
		 if (strlen(Vstruct[i].NameVariable)>0)
		 {
			 LocalTab[i] = strdup(Vstruct[i].NameVariable);
		 }
	 }

	 m=lenStructArray;
	 n=1;
	 CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &m, &n,LocalTab);
	 LhsVar(1)=Rhs+1;

	 freeArrayOfString(LocalTab, lenStructArray);
	 PutLhsVar();
	 return 0;
 }
开发者ID:rossdrummond,项目名称:scilab,代码行数:30,代码来源:sci_who.c

示例15: TwoLhs

/*--------------------------------------------------------------------------*/
 static int TwoLhs(struct VariableStruct* Vstruct,int lenStructArray,BOOL Sorted)
 {
	 char **Tab=NULL;
	 int *Size=NULL;
	 int i=0;
	 int m=0;
	 int n=0;

	 if (Sorted) SortVarsStructByStrings(Vstruct,lenStructArray);

	 Tab=(char **)MALLOC(sizeof(char*)*lenStructArray);
	 Size=(int *)MALLOC(sizeof(int)*lenStructArray);

	 for (i=0;i<lenStructArray;i++)
	 {
		 Tab[i] = strdup(Vstruct[i].NameVariable);
		 Size[i]=Vstruct[i].SizeVariable;
	 }

	 m=lenStructArray;
	 n=1;

	 CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &m, &n, Tab);
	 LhsVar(1) = Rhs+1;

	 CreateVarFromPtr(Rhs+2,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &Size);
	 LhsVar(2) = Rhs+2;

	 freeArrayOfString(Tab, lenStructArray);
	 if (Size) {FREE(Size);Size=NULL;}

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


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