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

C++ CheckOutputArgument函数代码示例

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

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



在下文中一共展示了CheckOutputArgument函数的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: ScilabAbstractEnvironmentException

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

    if (Rhs == 0)
    {
        throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Wrong number of arguments : more than 1 argument expected"));
    }

    CheckOutputArgument(pvApiCtx, Rhs, Rhs);

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

    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"));
        }

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

        }

        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"));
        }

        if (!ScilabObjects::unwrap(*id, Rhs + i, envId, pvApiCtx))
        {
            try
            {
                ScilabObjects::createEnvironmentObjectAtPos(EXTERNAL_OBJECT, Rhs + i, *id, envId, pvApiCtx);
            }
            catch (ScilabAbstractEnvironmentException & /*e*/)
            {
            }
        }

        LhsVar(i) = Rhs + i;

        env.removeobject(*id);
    }

    PutLhsVar();

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


示例3: sci_mpi_comm_rank

/**
 * This function returns the rank of a process within the specified communicator.
 */
int sci_mpi_comm_rank(char *fname, void* pvApiCtx)
{
    int comm_rank = -1;

    CheckInputArgument(pvApiCtx, 0, 1); // Check the parameters of the function ... Here 0 or 1
    CheckOutputArgument(pvApiCtx, 1, 1); // The output of the function (1 parameter)

    // return the communicator from optional argument "comm"
    // if no optional "comm" is given, return MPI_COMM_WORLD
    MPI_Comm comm = getOptionalComm(pvApiCtx);
    if (comm == NULL)
    {
        Scierror(999, _("%s: Wrong type for input argument #%s: An MPI communicator expected.\n"), fname, "comm");
        return 0;
    }

    if (comm != MPI_COMM_NULL)
    {
        MPI_Comm_rank(comm, &comm_rank);
    }

    if (createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (double)comm_rank))
    {
        Scierror(999, _("%s: Unable to create variable.\n"), fname);
        return 0;
    }

    AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
    ReturnArguments(pvApiCtx);
    return 0;
}
开发者ID:ScilabOrg,项目名称:scilab,代码行数:34,代码来源:sci_mpi_comm_rank.c


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


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


示例6: sci_empty_test

    /**
    * The gateway function for soap_servers()
    * @param[in] fname the name of the file for the error messages
    * @return 0 if successful, a negative value otherwise
    */
    int sci_empty_test(char *fname)
    {
        SciErr sciErr;

        // allocate memory for values
        double dOut = 0;
        char *cOut = "zero";

        // this function does not take input arguments
        CheckInputArgument(pvApiCtx, 0, 0);

        // the number of output arguments must be 2
        CheckOutputArgument(pvApiCtx, 2, 2);

        // create results on stack
        sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 0, 0, &dOut);
        if (sciErr.iErr)
        {
            printError(&sciErr, 0);
            return 0;
        }

        sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 0, 0, &cOut);

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

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

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


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


示例8: sci_dlgamma

/*--------------------------------------------------------------------------*/
int sci_dlgamma(char *fname, unsigned long fname_len)
{
    SciErr sciErr;
    double* lX   = NULL;
    int* piAddrX = NULL;

    int iType1 = 0;
    int MX = 0, NX = 0, i = 0;

    nbInputArgument(pvApiCtx) = Max(0, nbInputArgument(pvApiCtx));

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

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

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

    if ((iType1 == sci_list) || (iType1 == sci_tlist) || (iType1 == sci_mlist))
    {
        OverLoad(1);
        return 0;
    }

    if (isVarComplex(pvApiCtx, piAddrX))
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), fname, 1);
        return 1;
    }

    sciErr = getMatrixOfDouble(pvApiCtx, piAddrX, &MX, &NX, &lX);
    if (sciErr.iErr)
    {
        Scierror(999, _("%s: Wrong type for argument %d: A matrix expected.\n"), fname, 1);
    }

    for (i = 0; i < MX * NX; i++)
    {
        lX[i] = C2F(psi)(lX + i);
    }

    AssignOutputVariable(pvApiCtx, 1) = 1;
    returnArguments(pvApiCtx);
    return 0;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:58,代码来源:sci_dlgamma.c


示例9: sci_getlookandfeel

/*--------------------------------------------------------------------------*/
int sci_getlookandfeel(char *fname, void* pvApiCtx)
{
    CheckInputArgument(pvApiCtx, 0, 0);
    CheckOutputArgument(pvApiCtx, 1, 1);

    org_scilab_modules_gui_utils::LookAndFeelManager * lnf = 0;
    try
    {
        lnf = new org_scilab_modules_gui_utils::LookAndFeelManager(getScilabJavaVM());
    }
    catch (const GiwsException::JniException & e)
    {
        Scierror(999, _("%s: A Java exception arisen:\n%s"), fname, e.whatStr().c_str());
        return 1;
    }

    if (lnf)
    {
        static int n1 = 0, m1 = 0;
        char *look = lnf->getCurrentLookAndFeel();

        if (look)
        {
            m1 = (int)strlen(look);
            n1 = 1;

            if (createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, look))
            {
                Scierror(999, _("%s: Memory allocation error.\n"), fname);
                return 1;
            }

            if (look)
            {
                delete[]look;
                look = NULL;
            }
            delete lnf;

            AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
            ReturnArguments(pvApiCtx);
        }
        else
        {
            delete lnf;
            Scierror(999, _("%s: An error occurred: %s.\n"), fname, _("Impossible to get current look and feel"));
            return 1;
        }
    }
    else
    {
        Scierror(999, _("%s: No more memory.\n"), fname);
        return 1;
    }

    return 0;
}
开发者ID:ScilabOrg,项目名称:scilab,代码行数:58,代码来源:sci_getlookandfeel.cpp


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


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


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


示例13: CheckInputArgument

int
int_legdwavf 
#ifdef _SCILAB6_
(char *fname, void* pvApiCtx)
#else
(char *fname)
#endif
{
  static int l1, m1, n1, l2, m2, n2;
  static int minlhs = 1, maxlhs = 1, minrhs = 1, maxrhs = 1;
  swt_wavelet pWaveStruct;
  int errCode, family, member;
  int readFlag;
  char * input_string1 = NULL;
  double *output1;

  CheckInputArgument(pvApiCtx,minrhs, maxrhs);
  CheckOutputArgument(pvApiCtx,minlhs, maxlhs);

  legdwavf_form_validate (pvApiCtx, &errCode);
  if (errCode != SUCCESS)
    {
      validate_print (errCode);
      return 0;
    }

  //GetRhsVar (1, "c", &m1, &n1, &l1);
  readFlag = swt_gwsupport_GetScalarString(pvApiCtx, fname, 1 , &input_string1 );
  m1=1;n1=1;
  if(readFlag==SWT_GWSUPPORT_ERROR)
    {
      return 0;
    }
  legdwavf_content_validate (pvApiCtx, &errCode,input_string1);
  if (errCode != SUCCESS)
    {
      validate_print (errCode);
      return 0;
    }

  wavelet_parser(input_string1,&family,&member);
  legendre_synthesis_initialize (member, &pWaveStruct);
  m2 = 1;
  n2 = pWaveStruct.length;
  //CreateVar (2, "d", &m2, &n2, &l2);
  readFlag = swt_gwsupport_AllocMatrixOfDoubles (pvApiCtx, fname, 1,  m2 , n2 , &output1 );
  if(readFlag==SWT_GWSUPPORT_ERROR)
    {
      return 0;
    }
  verbatim_copy (pWaveStruct.pLowPass, m2*n2, output1, m2*n2);
  filter_clear();
  //LhsVar (1) = 2;
  return 0;
}
开发者ID:Fenlly,项目名称:swt,代码行数:55,代码来源:dwt_int.c


示例14: sci_TCL_DoOneEvent

/*--------------------------------------------------------------------------*/
int sci_TCL_DoOneEvent (char *fname, void* pvApiCtx)
{
    CheckInputArgument(pvApiCtx, 0, 0);
    CheckOutputArgument(pvApiCtx, 1, 1);

    // wait for events and invoke event handlers
    Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT);

    AssignOutputVariable(pvApiCtx, 1) = 0;
    ReturnArguments(pvApiCtx);
    return 0;
}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:13,代码来源:sci_TCL_DoOneEvent.c


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


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


示例17: sci_sym_getRowActivity

int sci_sym_getRowActivity(char *fname){
	
	//error management variable
	SciErr sciErr;
	int iRet;
	
	//data declarations
	int numConstr;
	double *rowAct;
	
	//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 process input
	iRet=sym_get_num_rows(global_sym_env,&numConstr);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
		return 1;
	}
	rowAct=new double[numConstr];
	iRet=sym_get_row_activity(global_sym_env,rowAct);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. Has the problem been solved? Is the problem feasible?\n");
		delete[] rowAct;
		return 1;
	}
	
	//code to give output
	sciErr=createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,numConstr,1,rowAct);
	if (sciErr.iErr)
	{
		printError(&sciErr, 0);
		delete[] rowAct;
		return 1;
	}
	AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1;
	//ReturnArguments(pvApiCtx);
	
	delete[] rowAct;
	
	return 0;
}
开发者ID:akshaymiterani,项目名称:symphony,代码行数:49,代码来源:sci_sym_getrowact.cpp


示例18: sci_mpi_init

int sci_mpi_init(char *fname, void* pvApiCtx)
{
    int flag;

    CheckInputArgument(pvApiCtx, 0, 0);
    CheckOutputArgument(pvApiCtx, 1, 1);
    mpi_init_internal();
    MPI_Initialized(&flag);
    if (!flag)
    {
        /* MPI Not yet initialized */
        MPI_Init(NULL, NULL);
        MPI_Comm_create_errhandler(MPIErrHandler, &errhdl);
    }
    AssignOutputVariable(pvApiCtx, 1) = 0;
    ReturnArguments(pvApiCtx);
    return 0;
}
开发者ID:ScilabOrg,项目名称:scilab,代码行数:18,代码来源:sci_mpi_init.c


示例19: sci_xlfont

/*--------------------------------------------------------------------------*/
int sci_xlfont(char * fname, unsigned long fname_len)
{
    CheckInputArgument(pvApiCtx, 0, 4);
    CheckOutputArgument(pvApiCtx, 0, 1);

    switch (nbInputArgument(pvApiCtx))
    {
        case 0:
            return xlfont_no_rhs(fname);
            break;
        case 1:
            return xlfont_one_rhs(fname);
            break;
        default:
            return xlfont_n_rhs(fname);
            break;
    }
    return 0;
}
开发者ID:quanpan302,项目名称:scilab,代码行数:20,代码来源:sci_xlfont.c


示例20: sci_sym_setColSoln

int sci_sym_setColSoln(char *fname){
	
	//error management variable
	SciErr sciErr;
	int iRet;
	
	//data declarations
	int numVars;
	double *solution;
	
	//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
	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;
	}
	
	if(getFixedSizeDoubleMatrixFromScilab(1,1,numVars,&solution))
		return 1;

	iRet=sym_set_col_solution(global_sym_env,solution);
	if(iRet==FUNCTION_TERMINATED_ABNORMALLY){
		Scierror(999, "An error occured. The given solution may be infeasible\nor worse than the current solution.\n");
		return 1;
	}
	
	//code to give output
	if(return0toScilab())
		return 1;
	
	return 0;
}
开发者ID:akshaymiterani,项目名称:symphony,代码行数:42,代码来源:sci_sym_setcolsoln.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CheckPlayersFrostResist函数代码示例发布时间:2022-05-30
下一篇:
C++ CheckMenuItem函数代码示例发布时间: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