本文整理汇总了C++中ReturnArguments函数的典型用法代码示例。如果您正苦于以下问题:C++ ReturnArguments函数的具体用法?C++ ReturnArguments怎么用?C++ ReturnArguments使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReturnArguments函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: sci_displayhistory
/*--------------------------------------------------------------------------*/
int sci_displayhistory(char *fname, unsigned long fname_len)
{
displayScilabHistory();
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: sci_fftw_forget_wisdom
/*--------------------------------------------------------------------------*/
int sci_fftw_forget_wisdom(char *fname, void* pvApiCtx)
{
CheckInputArgument(pvApiCtx, 0, 0);
FreeFFTWPlan(getSci_Backward_Plan());
FreeFFTWPlan(getSci_Forward_Plan());
call_fftw_forget_wisdom();
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: sci_mpi_finalize
int 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;
}
示例12: sci_sym_set_defaults
//This function is for loading a mps file to symphony
int 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;
}
示例13: 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;
}
示例14: xlfont_no_rhs
/*--------------------------------------------------------------------------*/
static int xlfont_no_rhs(char * fname)
{
SciErr sciErr;
int m1 = 0, n1 = 0;
int nbElements = 0;
char **fontsname = getInstalledFontsName(&nbElements);
m1 = 1;
n1 = nbElements;
sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, m1, n1, (const char * const*)fontsname);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 1;
}
freeArrayOfString(fontsname, nbElements);
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
ReturnArguments(pvApiCtx);
return 0;
}
示例15: sci_fftwlibraryisloaded
/*--------------------------------------------------------------------------*/
int sci_fftwlibraryisloaded(char *fname, void* pvApiCtx)
{
int iErr;
if ( IsLoadedFFTW() )
{
iErr = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1); // true
}
else
{
iErr = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 0); // false
}
if (iErr)
{
Scierror(999, _("%s: Memory allocation error.\n"), fname);
return iErr;
}
AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
ReturnArguments(pvApiCtx);
return 0;
}