这篇教程C++ CheckOutputArgument函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CheckOutputArgument函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckOutputArgument函数的具体用法?C++ CheckOutputArgument怎么用?C++ CheckOutputArgument使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CheckOutputArgument函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: sci_sym_solveint 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,
示例2: ScilabAbstractEnvironmentExceptionint 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,
示例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,
示例4: sci_sym_getObjSenseint 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,
示例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,
示例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,
示例7: sci_sym_set_str_paramint 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,
示例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,
示例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,
示例10: sci_sym_get_dbl_paramint 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,
示例11: sci_sym_setVarBoundint 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,
示例12: sci_sym_setObjSenseint 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,
示例13: CheckInputArgumentintint_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,
示例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,
示例15: CheckInputArgumentint 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,
示例16: sci_sym_setObjCoeffint 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,
示例17: sci_sym_getRowActivityint 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,
示例18: sci_mpi_initint 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,
示例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,
示例20: sci_sym_setColSolnint 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,
示例21: C2F/*--------------------------------------------------------------------------*/int C2F(sci_getscilabmode)(char *fname, unsigned long fname_len){ int n1 = 0, m1 = 0; char *output = NULL ; int iRet = 0; SciErr sciErr; CheckInputArgument(pvApiCtx, 0, 0) ; CheckOutputArgument(pvApiCtx, 1, 1) ; switch (getScilabMode()) { case SCILAB_API: default : output = strdup("API"); break; case SCILAB_STD: output = strdup("STD"); break; case SCILAB_NW: output = strdup("NW"); break; case SCILAB_NWNI: output = strdup("NWNI"); break; } /* Create the string matrix as return of the function */ iRet = createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, output); free(output); // Data have been copied into Scilab memory if (iRet) { freeAllocatedSingleString(output); return 1; } AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; ReturnArguments(pvApiCtx); return 0;}
开发者ID:rushboy52,项目名称:scilab,代码行数:41,
示例22: sci_mpi_finalizeint sci_mpi_finalize(char *fname, void* pvApiCtx){ int iRet = 0; CheckInputArgument(pvApiCtx, 0, 0); CheckOutputArgument(pvApiCtx, 1, 1); mpi_finalize_internal(); iRet = MPI_Finalize(); if (iRet != MPI_SUCCESS) { char error_string[MPI_MAX_ERROR_STRING]; int length_of_error_string; MPI_Error_string(iRet, error_string, &length_of_error_string); Scierror(999, _("%s: Could not finalize the MPI instance: %s/n"), fname, error_string); return 0; } // TODO: catch les erreurs AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:22,
示例23: sci_sym_set_defaults//This function is for loading a mps file to symphonyint sci_sym_set_defaults(char *fname, unsigned long fname_len){ double status=1.0;//assume error status int *piAddressVarOne = NULL;//pointer used to access argument of the function int output=0;//out parameter for the setting of default values function CheckInputArgument(pvApiCtx, 0, 0);//Check we no argument as input or not CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not //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_defaults(global_sym_env);//setting all environment variables and parameters in this symphony environment passed to their default values if(output==FUNCTION_TERMINATED_ABNORMALLY) { status=1.0;//function did not invoke successfully sciprint("Function terminated abnormally,didnot execute"); } else if(output==FUNCTION_TERMINATED_NORMALLY) { status=0.0;//no error in executing the function sciprint("Function executed successfully"); } } 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,代码行数:40,
示例24: sci_drawlater/*--------------------------------------------------------------------------*/int sci_drawlater(char * fname, void* pvApiCtx){ int iFalse = (int)FALSE; int iParentFigureUID = 0; int* piParentFigureUID = &iParentFigureUID; int iSubwinUID = 0; int iCurChildUID = 0; int iType = -1; int *piType = &iType; CheckInputArgument(pvApiCtx, 0, 0); CheckOutputArgument(pvApiCtx, 0, 1); if (nbInputArgument(pvApiCtx) <= 0) { iSubwinUID = getOrCreateDefaultSubwin(); if (iSubwinUID != 0) { // Look for top level figure iCurChildUID = iSubwinUID; do { iParentFigureUID = getParentObject(iCurChildUID); getGraphicObjectProperty(iParentFigureUID, __GO_TYPE__, jni_int, (void **)&piType); iCurChildUID = iParentFigureUID; } while (iParentFigureUID != 0 && iType != __GO_FIGURE__); if (iParentFigureUID != 0) { setGraphicObjectProperty(iParentFigureUID, __GO_IMMEDIATE_DRAWING__, &iFalse, jni_bool, 1); } } } AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:40,
示例25: sci_sym_close/*Function that closes symphony environment * Returns 1 on success , 0 on failure*/int sci_sym_close(char *fname, unsigned long fname_len){ // Error management variable SciErr sciErr; double status=0; int output;//output parameter for closing the environment //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 if (global_sym_env==NULL){//check for environment sciprint("Error: symphony environment is not initialized./n"); }else{ output=sym_close_environment(global_sym_env);//close environment if(output==ERROR__USER){ status=0;//User error detected in user_free_master() function or when function invoked unsuccessfully sciprint("Error in user_free_master()/n"); }else if(output==FUNCTION_TERMINATED_ABNORMALLY){ status=0;//function invoked unsuccessfully sciprint("Symphony environment could not be closed./n"); }else if(output==FUNCTION_TERMINATED_NORMALLY){ status=1;//function invoked successfully and no error global_sym_env=NULL;//important to set to NULL, so that other functions can detect that environment is not open. //sciprint("Symphony environement closed successfully. Please run 'sym_open()' to restart./n"); //delete the sym_ variables deleteNamedVariable(pvApiCtx,"sym_minimize"); deleteNamedVariable(pvApiCtx,"sym_maximize"); } } /*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,代码行数:41,
示例26: CheckInputArgumentint ScilabGateway::getEnvId(char * fname, const int envId, void * pvApiCtx){ SciErr sciErr; CheckInputArgument(pvApiCtx, 0, 0); CheckOutputArgument(pvApiCtx, 1, 1); ScilabAbstractEnvironment & env = ScilabEnvironments::getEnvironment(envId); ScilabGatewayOptions & options = env.getGatewayOptions(); OptionsHelper::setCopyOccurred(false); ScilabObjects::initialization(env, pvApiCtx); options.setIsNew(false); sciErr = createMatrixOfInteger32(pvApiCtx, 1, 1, 1, &envId); if (sciErr.iErr) { throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Cannot create the identifier")); } LhsVar(1) = 1; PutLhsVar(); return 0;}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:24,
示例27: sci_contour2di/*--------------------------------------------------------------------------*/int sci_contour2di(char * fname, void* pvApiCtx){ SciErr sciErr; int flagx = 0, nz = 10; /* default number of level curves : 10 */ int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0, m4 = 0, n4 = 0; double* hl1 = NULL; double* hl2 = NULL; double* znz = NULL; int ix4, i = 0, un = 1; int* piAddr1 = NULL; int* piAddr2 = NULL; int* piAddr3 = NULL; int* piAddr4 = NULL; double* l1 = NULL; double* l2 = NULL; double* l3 = NULL; double* l4 = NULL; int* l5 = NULL; CheckInputArgument(pvApiCtx, 4, 4); CheckOutputArgument(pvApiCtx, 2, 2); //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &m1, &n1, &l1); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 1); printError(&sciErr, 0); return 1; } //CheckVector if (m1 != 1 && n1 != 1) { Scierror(999, _("%s: Wrong size for input argument #%d: Vector expected./n"), fname, 1); return 1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &m2, &n2, &l2); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 2); printError(&sciErr, 0); return 1; } //CheckVector if (m2 != 1 && n2 != 1) { Scierror(999, _("%s: Wrong size for input argument #%d: Vector expected./n"), fname, 2); return 1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 3. sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &m3, &n3, &l3); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 3); printError(&sciErr, 0); return 1; } if (m3 * n3 == 0) { AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; } if (m3 == 1 || n3 == 1) { Scierror(999, _("%s: Wrong type for input argument #%d: Matrix expected./n"), fname, 3); return 1;//.........这里部分代码省略.........
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:101,
示例28: sci_delete/*--------------------------------------------------------------------------*/int sci_delete(char *fname, unsigned long fname_len){ SciErr sciErr; int* piAddrl1 = NULL; long long* l1 = NULL; int* piAddrl2 = NULL; char* l2 = NULL; int m1 = 0, n1 = 0, lw = 0; unsigned long hdl = 0; int nb_handles = 0, i = 0, dont_overload = 0; int iObjUID = 0; int iFigureUID = 0; int* piChildrenUID = NULL; int iChildrenCount = 0; int* childrencount = &iChildrenCount; int iHidden = 0; int *piHidden = &iHidden; int iParentUID = 0; int* piParentUID = &iParentUID; int iParentType = -1; int *piParentType = &iParentType; int iObjType = -1; int *piObjType = &iObjType; CheckInputArgument(pvApiCtx, 0, 1); CheckOutputArgument(pvApiCtx, 0, 1); if (nbInputArgument(pvApiCtx) == 0) /* Delete current object */ { iObjUID = getCurrentObject(); if (iObjUID == 0) { //No current object, we can leave AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; } hdl = (unsigned long)getHandle(iObjUID); dont_overload = 1; nb_handles = 1; } else { sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrl1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } switch (getInputArgumentType(pvApiCtx, 1)) { case sci_matrix: { if (isEmptyMatrix(pvApiCtx, piAddrl1)) { AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 1; } else { Scierror(202, _("%s: Wrong type for input argument #%d: Handle matrix expected./n"), fname, 1); return 1; } break; } case sci_handles: /* delete Entity given by a handle */ // Retrieve a matrix of handle at position 1. sciErr = getMatrixOfHandle(pvApiCtx, piAddrl1, &m1, &n1, &l1); /* Gets the Handle passed as argument */ if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for input argument #%d: Handle matrix expected./n"), fname, 1); return 1; } nb_handles = m1 * n1; if (nbInputArgument(pvApiCtx) == 2) { sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrl2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. if (getAllocatedSingleString(pvApiCtx, piAddrl2, &l2)) /* Gets the command name */ { Scierror(202, _("%s: Wrong type for argument #%d: A string expected./n"), fname, 2); return 1; }//.........这里部分代码省略.........
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:101,
示例29: sci_dnaupd/*--------------------------------------------------------------------------*/int sci_dnaupd(char *fname, void *pvApiCtx){ SciErr sciErr; int* piAddrpIDO = NULL; int* pIDO = NULL; int* piAddrpBMAT = NULL; char* pBMAT = NULL; int* piAddrpN = NULL; int* pN = NULL; int* piAddrpWHICH = NULL; char* pWHICH = NULL; int* piAddrpNEV = NULL; int* pNEV = NULL; int* piAddrpTOL = NULL; double* pTOL = NULL; int* piAddrpRESID = NULL; double* pRESID = NULL; int* piAddrpNCV = NULL; int* pNCV = NULL; int* piAddrpV = NULL; double* pV = NULL; int* piAddrpIPARAM = NULL; int* pIPARAM = NULL; int* piAddrpIPNTR = NULL; int* pIPNTR = NULL; int* piAddrpWORKD = NULL; double* pWORKD = NULL; int* piAddrpWORKL = NULL; double* pWORKL = NULL; int* piAddrpINFO = NULL; int* pINFO = NULL; int IDO, mIDO, nIDO; int mN, nN; int mNEV, nNEV; int mTOL, nTOL; int RESID, mRESID, nRESID; int mNCV, nNCV; int V, mV, nV; int IPARAM, mIPARAM, nIPARAM; int IPNTR, mIPNTR, nIPNTR; int WORKD, mWORKD, nWORKD; int WORKL, mWORKL, nWORKL; int INFO, mINFO, nINFO; int minlhs = 1, minrhs = 14, maxlhs = 8, maxrhs = 14; int LDV, LWORKL; int sizeWORKL = 0; /* [IDO,RESID,V,IPARAM,IPNTR,WORKD,WORKL,INFO]=dnaupd... (ID0,BMAT,N,WHICH,NEV,TOL,RESID,NCV,V,IPARAM,IPNTR,WORKD,WORKL,INFO) */ CheckInputArgument(pvApiCtx, minrhs, maxrhs); CheckOutputArgument(pvApiCtx, minlhs, maxlhs); /* VARIABLE = NUMBER */ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrpIDO); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDoubleAsInteger(pvApiCtx, piAddrpIDO, &mIDO, &nIDO, &pIDO); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 1); return 1; } IDO = 1; sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddrpN); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 3. sciErr = getMatrixOfDoubleAsInteger(pvApiCtx, piAddrpN, &mN, &nN, &pN); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 3); return 1; } sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddrpNEV); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 5.//.........这里部分代码省略.........
开发者ID:lucianofreitas,项目名称:scilab,代码行数:101,
注:本文中的CheckOutputArgument函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CheckPlayersFrostResist函数代码示例 C++ CheckMenuItem函数代码示例 |