• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sciprint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: sci_sym_solve

int sci_sym_solve(char *fname, unsigned long fname_len){
	
	int status=0; 
  
	//check whether we have no input and one output argument or not
	CheckInputArgument(pvApiCtx, 0, 0) ;//no input argument
	CheckOutputArgument(pvApiCtx, 1, 1) ;//one output argument

	// Check environment
	if(global_sym_env==NULL)
		sciprint("Error: Symphony environment is not initialized.\n");
	else {// There is an environment opened
		double time_limit = -1.0;
		status = sym_get_dbl_param(global_sym_env,"time_limit",&time_limit);

		if (status == FUNCTION_TERMINATED_NORMALLY) {
			if ( time_limit < 0.0 )
				sciprint("\nNote: There is no limit on time.\n");
			else sciprint("\nNote: Time limit has been set to %lf.\n",time_limit);
			status=process_ret_val(sym_solve(global_sym_env));// Call function	
			}
		else {
			sciprint("\nUnable to read time limit.\n");
			status = 1; //Error state
			}
		}
	// Return result to scilab
	return returnDoubleToScilab(status);
	}
开发者ID:Gurupradeep,项目名称:Compiler-Project,代码行数:29,代码来源:sci_sym_solve.cpp


示例2: printError

int printError(SciErr* _psciErr, int _iLastMsg)
{
    if (_psciErr->iErr == 0)
    {
        return 0;
    }

    SciStoreError(_psciErr->iErr);

    if (getPromptMode() != PROMPTMODE_SILENT && getSilentError() == VERBOSE_ERROR)
    {
        if (_iLastMsg)
        {
            sciprint(_("API Error:\n"));
            sciprint(_("\tin %s\n"), _psciErr->pstMsg[0]);
        }
        else
        {
            sciprint(_("API Error:\n"));

            for (int i = _psciErr->iMsgCount - 1; i >= 0; i--)
            {
                sciprint(_("\tin %s\n"), _psciErr->pstMsg[i]);
            }
        }
    }

    sciErrClean(_psciErr);
    return 0;
}
开发者ID:scitao,项目名称:scilab,代码行数:30,代码来源:api_error.cpp


示例3: C2F

/*--------------------------------------------------------------------------*/
void C2F(mget) (int *fd, double *res, int *n, char *type, int *ierr)
{
    int nc, swap2;
    FILE *fa;

    nc = (int)strlen(type);
    *ierr = 0;
    if (nc == 0)
    {
        sciprint(_("%s: Wrong size for input argument #%d: Non-empty string expected.\n"), "mput", 4, type);
        *ierr = 2;
        return;
    }
    fa = GetFileOpenedInScilab(*fd);
    if (fa)
    {
        swap2 = GetSwapStatus(*fd);
        mget2(fa, swap2, res, *n, type, ierr);
        if (*ierr > 0)
        {
            sciprint(_("%s: Wrong value for input argument #%d: Format not recognized.\n"), "mget", 4);
        }
    }
    else
    {
        sciprint(_("%s: No input file associated to logical unit %d.\n"), "mget", *fd);
        *ierr = 3;
    }
}
开发者ID:quanpan302,项目名称:scilab,代码行数:30,代码来源:mget.c


示例4: printError

int printError(SciErr* _psciErr, int _iLastMsg)
{
	int iMode = getExecMode();

	if(_psciErr->iErr == 0)
	{
		return 0;
	}

	SciStoreError(_psciErr->iErr);

	if(iMode == SILENT_EXEC_MODE)
	{
		return 0;
	}

	if(_iLastMsg)
	{
		sciprint(_("API Error:\n"));
		sciprint(_("\tin %s\n"), _psciErr->pstMsg[0]);
	}
	else
	{
		sciprint(_("API Error:\n"));

		//		for(int i = 0 ;  i < _psciErr->iMsgCount ;i++)
		for(int i = _psciErr->iMsgCount - 1 ;  i >= 0 ; i--)
		{
//			if(i == 0)
			sciprint(_("\tin %s\n"), _psciErr->pstMsg[i]);
		}
	}
	return 0;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:34,代码来源:api_error.cpp


示例5: C2F

/*--------------------------------------------------------------------------*/
void C2F(mtell) (int *fd, double *offset, int *err)
{     
	FILE *fa= GetFileOpenedInScilab(*fd);
	if ( fa == (FILE *) 0 ) 
	{
		char *filename = GetFileNameOpenedInScilab(*fd);
		if (filename)
		{
			sciprint(_("%s: Error while opening, reading or writing '%s'.\n"),"mtell",filename);
		}
		else
		{
			sciprint(_("%s: Error while opening, reading or writing.\n"),"mtell");
		}
		
		*err=1;
		return;
	}
	*err = 0;
	#ifdef _MSC_VER
		#if _WIN64 
			*offset = (double) _ftelli64(fa) ;
		#else
			*offset = (double) ftell(fa) ;
		#endif
	#else
	*offset = (double) ftell(fa) ;
	#endif
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:30,代码来源:mtell.c


示例6: C2F

/*--------------------------------------------------------------------------*/
void C2F(mput) (int *fd, double *res, int *n, char *type, int *ierr)
{
    *ierr = 0;
    if (strlen(type) == 0)
    {
        if (getWarningMode())
        {
            sciprint(_("%s: Wrong size for input argument #%d ('%s'): Non-empty string expected.\n"), "mput", 4, type);
        }
        *ierr = 2;
        return;
    }

    types::File *pFile = FileManager::getFile(*fd);
    if (pFile && pFile->getFiledesc())
    {
        mput2(pFile->getFiledesc(), pFile->getFileSwap(), res, *n, type, ierr);
        if (*ierr > 0)
        {
            if (getWarningMode())
            {
                sciprint(_("%s: Wrong value for input argument #%d ('%s'): Format not recognized.\n"), "mput", 4, type);
            }
        }
    }
    else
    {
        if (getWarningMode())
        {
            sciprint(_("%s: No input file associated to logical unit %d.\n"), "mput", *fd);
        }
        *ierr = 3;
    }
}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:35,代码来源:mput.cpp


示例7: sci_sym_getObjSense

int sci_sym_getObjSense(char *fname){
	
	//error management variable
	SciErr sciErr;
	int iRet;
	
	//data declarations
	int objSense;
	
	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		return 1;
	}
	
	//code to check arguments and get them
	CheckInputArgument(pvApiCtx,0,0) ;
	CheckOutputArgument(pvApiCtx,1,1) ;
	
	//code to give output
	iRet=sym_get_obj_sense(global_sym_env,&objSense);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has a problem been loaded?\n");
		return 1;
	}
	if(objSense==1)
		sciprint("Symphony has been set to minimize the objective.\n");
	else
		sciprint("Symphony has been set to maximize the objective.\n");

	if(returnDoubleToScilab(objSense))
		return 1;
	
	return 0;
}
开发者ID:akshaymiterani,项目名称:symphony,代码行数:35,代码来源:sci_sym_getobjsense.cpp


示例8: 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


示例9: sci_sym_open

/* Function that initializes the symphony environment
 * Returns 1 on success , 0 on failure
 */
int sci_sym_open(char *fname, unsigned long fname_len){

	// Error management variable
	SciErr sciErr;
	double status=0;
	
	//check whether we have no input and one output argument or not
	CheckInputArgument(pvApiCtx, 0, 0) ;//no input argument
	CheckOutputArgument(pvApiCtx, 1, 1) ;//one output argument

	//check environment
	if(global_sym_env!=NULL){
		sciprint("Warning: Symphony environment is already initialized.\n");
	}else{
		global_sym_env = sym_open_environment();//open an environment
		if (!global_sym_env)
			sciprint("Error: Unable to create symphony environment.\n");
		else{
			status=1;
			//sciprint("Symphony environment is created successfully. Please run 'sym_close()' to close.\n");
			//create useful variables for user
			createNamedScalarDouble(pvApiCtx,"sym_minimize",1);
			createNamedScalarDouble(pvApiCtx,"sym_maximize",-1);
		}
	}

	/*write satus of function (success-1 or failure-0) as output argument to scilab*/
	if(returnDoubleToScilab(status))
		return 1;
	
	return 0;
}
开发者ID:Gurupradeep,项目名称:Compiler-Project,代码行数:35,代码来源:sci_sym_openclose.cpp


示例10: read_sparse

int read_sparse(char *fname, unsigned long fname_len)
{
    SciErr sciErr;
    int i, j, k;
    int* piAddr			= NULL;
    int iRows			= 0;
    int iCols			= 0;
    int iNbItem			= 0;
    int* piNbItemRow	= NULL;
    int* piColPos		= NULL;
    double* pdblReal	= NULL;
    double* pdblImg		= NULL;

    CheckInputArgument(pvApiCtx, 1, 1);

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

    if (isVarComplex(pvApiCtx, piAddr))
    {
        sciErr = getComplexSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal, &pdblImg);
    }
    else
    {
        sciErr = getSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, &iNbItem, &piNbItemRow, &piColPos, &pdblReal);
    }

    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    sciprint("Sparse %d item(s)\n", iNbItem);
    k = 0;

    for (i = 0 ; i < iRows ; i++)
    {
        for (j = 0 ; j < piNbItemRow[i] ; j++)
        {
            sciprint("(%d,%d) = %f", i + 1, piColPos[k], pdblReal[k]);
            if (isVarComplex(pvApiCtx, piAddr))
            {
                sciprint(" %+fi", pdblImg[k]);
            }

            sciprint("\n");
            k++;
        }
    }

    //assign allocated variables to Lhs position
    AssignOutputVariable(pvApiCtx, 1) = 0;
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:59,代码来源:sparse_reading_api.c


示例11: sci_sym_set_str_param

int sci_sym_set_str_param(char *fname, unsigned long fname_len){
	
	// Error management variable
	SciErr sciErr1,sciErr2;
	double status=1.0;//assume error status
	double num;//to store the value of the double parameter to be set
	int output;//output return value of the setting of symphony string parameter function
	int *piAddressVarOne = NULL;//pointer used to access first argument of the function
	int *piAddressVarTwo=NULL;//pointer used to access second argument of the function
	char variable_name[100],value[100];//string to hold the name of variable's value to be set and the value to be set is stored in 'value' string
	char *ptr=variable_name,*valptr=value;//pointer-'ptr' to point to address of the variable name and 'valptr' points to the address of the value to be set to the string parameter
	CheckInputArgument(pvApiCtx, 2, 2);//Check we have exactly two argument as input or not
	CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly no argument on output side or not

	//load address of 1st argument into piAddressVarOne
	sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
	sciErr2 = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
	//check whether there is an error or not.
	if (sciErr1.iErr){
        printError(&sciErr1, 0);
        return 0;
	}
	if (sciErr2.iErr){
        printError(&sciErr2, 0);
        return 0;
	}
	
	
	//read the value in that pointer pointing to variable name
	int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
	//read the value of the string variable to be set
	int err2=getAllocatedSingleString(pvApiCtx, piAddressVarTwo, &valptr);

	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		}
	else {
		output=sym_set_str_param(global_sym_env,ptr,valptr);//symphony function to set the variable name pointed by the ptr pointer to the double value stored in 'value' variable.
		if(output==FUNCTION_TERMINATED_NORMALLY){
			sciprint("setting of string parameter function executed successfully\n");
			status=0.0;
		}
		else
			sciprint("Setting of the string parameter was unsuccessfull...check the input values!!\n");
		
		}
	
	int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
	if (e){
		AssignOutputVariable(pvApiCtx, 1) = 0;
		return 1;
		}

	AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
	ReturnArguments(pvApiCtx);

	return 0;
	}
开发者ID:KPJoshi,项目名称:SymphonyToolboxForScilab,代码行数:59,代码来源:sci_sym_set_variables.cpp


示例12: sci_sym_get_dbl_param

int sci_sym_get_dbl_param(char *fname, unsigned long fname_len){
	
	// Error management variable
	SciErr sciErr1;
	double status=1.0;//assume error status
	int *piAddressVarOne = NULL;//pointer used to access first argument of the function
	char variable_name[100];//string to hold the name of variable's value to be retrieved
	char *ptr=variable_name;//pointer to point to address of the variable name
	int output;//output parameter for the symphony get_dbl_param function
	CheckInputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument as input or not
	CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not

	//load address of 1st argument into piAddressVarOne
	sciErr1 = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);

	
	//check whether there is an error or not.
	if (sciErr1.iErr){
        printError(&sciErr1, 0);
        return 0;
	}
		
	
	//read the variable name in that pointer pointing to variable name
	int err1=getAllocatedSingleString(pvApiCtx, piAddressVarOne, &ptr);
	

	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		}
	else {
		double a;//local variable to store the value of variable name we want to retrieve
		output=sym_get_dbl_param(global_sym_env,ptr,&a);//symphony function to get the value of double parameter pointed by ptr pointer and store it in 'a' variable
		if(output==FUNCTION_TERMINATED_NORMALLY){
			sciprint("value of double parameter %s is :: %lf\n",ptr,a);
			status=1.0;
		}
		else{
			sciprint("Unable to get the value of the parameter...check the input values!!\n");
			status=1.0;
		} 


		}
	
	int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
	if (e){
		AssignOutputVariable(pvApiCtx, 1) = 0;
		return 1;
		}

	AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
	ReturnArguments(pvApiCtx);

	return 0;
	}
开发者ID:KPJoshi,项目名称:SymphonyToolboxForScilab,代码行数:57,代码来源:sci_sym_set_variables.cpp


示例13: DeleteDirectory

static int DeleteDirectory(char *refcstrRootDirectory)
{
    DIR *dir;
    struct dirent *ent;
    dir = opendir(refcstrRootDirectory) ;

    if (dir == NULL)
    {
        sciprint(_("Warning: Error while opening %s: %s\n"), refcstrRootDirectory, strerror(errno));
        return -1;
    }
    while ((ent = readdir(dir)) != NULL)
    {
        char *filename = NULL;
        if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
        {
            continue ;
        }
        filename = MALLOC(sizeof(char) * (strlen(refcstrRootDirectory) + 1 + strlen(ent->d_name) + 1 + 1)) ;
        sprintf(filename, "%s/%s", refcstrRootDirectory, ent->d_name);
        if (isdir(filename))
        {
            /* Delete recursively */
            DeleteDirectory(filename);
            if (filename)
            {
                FREE(filename);
                filename = NULL;
            }
        }
        else
        {
            /* Not a directory... It must be a file (at least, I hope it is a file */
            if (remove(filename) != 0)
            {
                sciprint(_("Warning: Could not remove file %s: %s\n"), filename, strerror(errno));
            }
            if (filename)
            {
                FREE(filename);
                filename = NULL;
            }
        }
    }
    if (rmdir(refcstrRootDirectory) != 0)
    {
        sciprint(_("Warning: Could not remove directory %s: %s\n"), refcstrRootDirectory, strerror(errno));
    }

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

    return 0;
}
开发者ID:quanpan302,项目名称:scilab,代码行数:57,代码来源:removedir.c


示例14: sci_sym_setVarBound

int sci_sym_setVarBound(char *fname){
	
	//error management variable
	SciErr sciErr;
	int iRet;
	
	//data declarations
	int *varAddress,varIndex,numVars;
	double inputDouble,newBound;
	bool isLower;
	
	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		return 1;
	}
	
	//code to check arguments and get them
	CheckInputArgument(pvApiCtx,2,2) ;
	CheckOutputArgument(pvApiCtx,1,1) ;
	
	//get argument 1: index of variable whose bound is to be changed
	if(getUIntFromScilab(1,&varIndex))
		return 1;
	iRet=sym_get_num_cols(global_sym_env,&numVars);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has a problem been loaded?\n");
		return 1;
	}else if(varIndex>=numVars){
		Scierror(999, "An error occured. Variable index must be a number between 0 and %d.\n",numVars-1);
		return 1;
	}
	
	//get argument 2: new bound
	if(getDoubleFromScilab(2,&newBound))
		return 1;
	
	//decide which function to execute
	isLower=(strcmp(fname,"sym_setVarLower")==0);
	if(isLower)
		iRet=sym_set_col_lower(global_sym_env,varIndex,newBound);
	else
		iRet=sym_set_col_upper(global_sym_env,varIndex,newBound);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has a problem been loaded?\n");
		return 1;
	}else{
		sciprint("Bound successfully changed.\n");
	}
	
	//code to give output
	if(return0toScilab())
		return 1;
	
	return 0;
}
开发者ID:akshaymiterani,项目名称:symphony,代码行数:56,代码来源:sci_sym_varbounds.cpp


示例15: Sci_dlsym

/*---------------------------------------------------------------------------*/
int Sci_dlsym(char *ename, int ishared, char *strf)
{
    DynLibHandle hd1 = NULL;
    int ish = Min(Max(0, ishared), ENTRYMAX - 1);
    char enamebuf[MAXNAME];

    if ( strf[0] == 'f' )
    {
        Underscores(1, ename, enamebuf);
    }
    else
    {
        Underscores(0, ename, enamebuf);
    }

    /* lookup the address of the function to be called */
    if ( NEpoints == ENTRYMAX )
    {
        return -1;
    }
    if ( hd[ish].ok == FALSE )
    {
        return -3;
    }
    /** entry was previously loaded **/
    if ( SearchFandS(ename, ish) >= 0 )
    {
        sciprint(_("Entry name %s.\n"), ename);
        return -4;
    }
    else
    {
        hd1 = (DynLibHandle)hd[ish].shl;
        EP[NEpoints].epoint = (function) GetDynLibFuncPtr (hd1, enamebuf);
        if ( EP[NEpoints].epoint == NULL )
        {
            if (getIlibVerboseLevel() != ILIB_VERBOSE_NO_OUTPUT)
            {
                sciprint(_("%s is not an entry point.\n"), enamebuf);
            }
            return -5;
        }
        else
        {
            /* we don't add the _ in the table */
            if (debug)
            {
                sciprint(_("Linking %s.\n"), ename);
            }
            strncpy(EP[NEpoints].name, ename, MAXNAME);
            EP[NEpoints].Nshared = ish;
            NEpoints++;
        }
    }
    return 0;
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:57,代码来源:dynamic_link.c


示例16: print_type

void print_type(char* _pstType)
{
#ifdef PRINT_DEBUG
    for (int i = 0 ; i < iLevel ; i++)
    {
        sciprint("\t");
    }
    sciprint("%s\n", _pstType);
#endif
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:10,代码来源:sci_export_to_hdf5.cpp


示例17: sci_sym_setObjSense

int sci_sym_setObjSense(char *fname){
	
	//error management variable
	SciErr sciErr;
	int iRet;
	
	//data declarations
	int *varAddress;
	double objSense;
	
	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		return 1;
	}
	
	//code to check arguments and get them
	CheckInputArgument(pvApiCtx,1,1) ;
	CheckOutputArgument(pvApiCtx,1,1) ;
	
	//code to process input
	sciErr = getVarAddressFromPosition(pvApiCtx, 1, &varAddress);
	if (sciErr.iErr)
	{
		printError(&sciErr, 0);
		return 1;
	}
	if ( !isDoubleType(pvApiCtx,varAddress) ||  isVarComplex(pvApiCtx,varAddress) )
	{
		Scierror(999, "Wrong type for input argument #1:\nEither 1 (sym_minimize) or -1 (sym_maximize) is expected.\n");
		return 1;
	}
	iRet = getScalarDouble(pvApiCtx, varAddress, &objSense);
	if(iRet || (objSense!=-1 && objSense!=1))
	{
		Scierror(999, "Wrong type for input argument #1:\nEither 1 (sym_minimize) or -1 (sym_maximize) is expected.\n");
		return 1;
	}
	iRet=sym_set_obj_sense(global_sym_env,objSense);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured.\n");
		return 1;
	}else{
		if(objSense==1)
			sciprint("The solver has been set to minimize the objective.\n");
		else
			sciprint("The solver has been set to maximize the objective.\n");
	}
	
	//code to give output
	if(return0toScilab())
		return 1;
	
	return 0;
}
开发者ID:akshaymiterani,项目名称:symphony,代码行数:55,代码来源:sci_sym_setobj.cpp


示例18: get_info

int get_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
    SciErr sciErr;
    int iRet    = 0;
    int iType   = 0;

    sciErr = getVarType(_pvCtx, _piAddr, &iType);
    switch (iType)
    {
        case sci_matrix :
            iRet = get_double_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_poly :
            iRet = get_poly_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_boolean :
            iRet = get_boolean_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_sparse :
            iRet = get_sparse_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_boolean_sparse :
            iRet = get_bsparse_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_ints :
            iRet = get_integer_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_strings :
            iRet = get_string_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_list :
            insert_indent();
            sciprint("List ");
            iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_tlist :
            insert_indent();
            sciprint("TList ");
            iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_mlist :
            insert_indent();
            sciprint("MList ");
            iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        case sci_pointer :
            iRet = get_pointer_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
            break;
        default :
            insert_indent();
            sciprint("Unknown type\n");
            return 1;
    }
    return iRet;
}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:55,代码来源:common_read_api.c


示例19: sci_sym_setObjCoeff

int sci_sym_setObjCoeff(char *fname){
	
	//error management variable
	SciErr sciErr;
	int iRet;
	
	//data declarations
	int *varAddress,varIndex,numVars;
	double inputDouble,newCoeff;
	
	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		return 1;
	}
	
	//code to check arguments and get them
	CheckInputArgument(pvApiCtx,2,2) ;
	CheckOutputArgument(pvApiCtx,1,1) ;
	
	//get argument 1: index of variable whose coefficient is to be changed
	if(getUIntFromScilab(1,&varIndex))
		return 1;
	iRet=sym_get_num_cols(global_sym_env,&numVars);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has a problem been loaded?\n");
		return 1;
	}else if(varIndex>=numVars){
		Scierror(999, "An error occured. Variable index must be a number between 0 and %d.\n",numVars-1);
		return 1;
	}
	
	//get argument 2: new coefficient
	if(getDoubleFromScilab(2,&newCoeff))
		return 1;
	
	iRet=sym_set_obj_coeff(global_sym_env,varIndex,newCoeff);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has a problem been loaded?\n");
		return 1;
	}else{
		sciprint("Coefficient successfully changed.\n");
	}
	
	//code to give output
	if(return0toScilab())
		return 1;
	
	return 0;
}
开发者ID:akshaymiterani,项目名称:symphony,代码行数:50,代码来源:sci_sym_setobj.cpp


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sclose函数代码示例发布时间:2022-05-30
下一篇:
C++ scintilla_send_message函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap