这篇教程C++ AssignOutputVariable函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AssignOutputVariable函数的典型用法代码示例。如果您正苦于以下问题:C++ AssignOutputVariable函数的具体用法?C++ AssignOutputVariable怎么用?C++ AssignOutputVariable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AssignOutputVariable函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: 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;}
开发者ID:lucianofreitas,项目名称:scilab,代码行数:15,
示例2: 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,
示例3: returnIntegerMatrixToScilabint returnIntegerMatrixToScilab(int itemPos, int rows, int cols, int *dest){ SciErr sciErr; //same steps as above sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + itemPos, rows, cols, dest); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } AssignOutputVariable(pvApiCtx, itemPos) = nbInputArgument(pvApiCtx)+itemPos; return 0;}
开发者ID:Gurupradeep,项目名称:Compiler-Project,代码行数:15,
示例4: 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,
示例5: write_sparseint write_sparse(char *fname, void* pvApiCtx){ SciErr sciErr; int piNbItemRow[] = {1, 2, 1}; int piColPos[] = {8, 4, 7, 2}; double pdblSReal[] = {1, 2, 3, 4}; double pdblSImg[] = {4, 3, 2, 1}; int iNbItem = 4; sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; return 0;}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:19,
示例6: common_readint common_read(char *fname, void* pvApiCtx){ SciErr sciErr; int iItem = 0; int iRet = 0; int *piAddr = NULL; CheckInputArgument(pvApiCtx, 1, 1); sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } get_info(pvApiCtx, 1, NULL, piAddr, 0); AssignOutputVariable(pvApiCtx, 1) = 0; return 0;}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:20,
示例7: 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,
示例8: 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,
示例9: 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,
示例10: write_polyint write_poly(char *fname, void* pvApiCtx){ SciErr sciErr; //output variable info : polynomial matrix 2 x 4 //[ x + 2 x^2 - 4x + 5 4x^3 - 14x^2 + 18 ; // 2x^3 - 12x^2 + 64 1 8x^5 + 32x^3] int iRows = 2; int iCols = 3; //varname "x" char pstVarName[2] = {"x"}; //coeficient array int piNbCoef[6] = {2, 4, 3, 1, 4, 6}; //data array double *pdblReal[6] = {0}; double pdblPoly0[2] = {2, 1}; double pdblPoly1[4] = {64, 0, -12, 2}; double pdblPoly2[3] = {5, -4, 1}; double pdblPoly3[1] = {1}; double pdblPoly4[4] = {18, 0, -14, 4}; double pdblPoly5[6] = {0, 0, 0, 32, 0, 8}; pdblReal[0] = pdblPoly0; pdblReal[1] = pdblPoly1; pdblReal[2] = pdblPoly2; pdblReal[3] = pdblPoly3; pdblReal[4] = pdblPoly4; pdblReal[5] = pdblPoly5; sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //assign allocated variables to Lhs position AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; return 0;}
开发者ID:Bitiquinho,项目名称:Scilab-Jupyter-Kernel,代码行数:38,
示例11: 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;}
开发者ID:quanpan302,项目名称:scilab,代码行数:24,
示例12: 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;}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:25,
示例13: write_booleanint write_boolean(char *fname, unsigned long fname_len){ SciErr sciErr; int i, j; //first variable info : boolean matrix of boolean 3 x 4 int iRows1 = 3; int iCols1 = 4; int* pboolOutput1 = NULL; //second variable info : boolean matrix of boolean 4 x 6 int iRows2 = 4; int iCols2 = 6; int* pboolOutput2 = NULL; /************************ * First variable * ************************/ //alloc array of data in OS memory pboolOutput1 = (int*)malloc(sizeof(int) * iRows1 * iCols1); //fill array with incremental values //[ %t %f %t %f // %t %f %t %f // %t %f %t %f ] for (i = 0 ; i < iRows1 ; i++) { for (j = 0 ; j < iCols1 ; j++) { pboolOutput1[i + iRows1 * j] = (i * iCols1 + j) % 2 == FALSE; } } //can be written in a single loop //for(i = 0 ; i < iRows1 * iCols1; i++) //{ // pboolOutput1[i] = i % 2 == FALSE; //} //create a variable from a existing data array sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pboolOutput1); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //after creation, we can free memory. free(pboolOutput1); /************************* * Second variable * *************************/ //reserve space in scilab memory and fill it sciErr = allocMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pboolOutput2); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //fill array with incremental values //[ %f %t %f %t %f %t // %f %t %f %t %f %t // %f %t %f %t %f %t // %f %t %f %t %f %t ] for (i = 0 ; i < iRows2 ; i++) { for (j = 0 ; j < iCols2 ; j++) { pboolOutput2[i + iRows2 * j] = (i * iCols2 + j) % 2 == TRUE; } } //can be written in a single loop //for(i = 0 ; i < iRows2 * iCols2; i++) //{ // pboolOutput2[i] = i % 2 == TRUE; //} // /!/ DO NOT FREE MEMORY, in this case, it's the Scilab memory //assign allocated variables to Lhs position AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; return 0;}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:86,
示例14: sci_getinstalledlookandfeels /*--------------------------------------------------------------------------*/ int sci_getinstalledlookandfeels(char *fname, unsigned long fname_len) { SciErr sciErr; 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) { char **lookandfeels = NULL; int nbElems = 0; int nbCol = 0; lookandfeels = lnf->getInstalledLookAndFeels(); nbElems = lnf->numbersOfInstalledLookAndFeels(); nbCol = 1; sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, nbElems, nbCol, lookandfeels); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(999, _("%s: Memory allocation error./n"), fname); return 1; } if (lookandfeels) { int i = 0; for (i = 0; i < nbElems; i++) { if (lookandfeels[i]) { delete[]lookandfeels[i]; } } delete[]lookandfeels; lookandfeels = NULL; } delete lnf; AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; returnArguments(pvApiCtx); } else { Scierror(999, _("%s: No more memory./n"), fname); } return 0; }
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:62,
示例15: sci_hdf5_listvar_v2//.........这里部分代码省略......... } iNbItem = getVariableNames(iFile, pstVarNameList); for (int i = 0; i < iNbItem; i++) { int iDataSetId = getDataSetIdFromName(iFile, pstVarNameList[i]); if (iDataSetId == 0) { break; } strncpy(pInfo[i].varName, pstVarNameList[i], sizeof(pInfo[i].varName) - 1); pInfo[i].iSize = 0; b = read_data(iDataSetId, 0, NULL, &pInfo[i]) == false; if (b) { break; } if (Lhs == 1) { sciprint("%s/n", pInfo[i].pstInfo); } } freeArrayOfString(pstVarNameList, iNbItem); } else { //no variable returms [] for each Lhs for (int i = 0 ; i < Lhs ; i++) { createEmptyMatrix(pvApiCtx, nbIn + i + 1); AssignOutputVariable(pvApiCtx, i + 1) = nbIn + i + 1; } ReturnArguments(pvApiCtx); return 0; } closeHDF5File(iFile); //1st Lhs char** pstVarName = (char**)MALLOC(sizeof(char*) * iNbItem); for (int i = 0 ; i < iNbItem ; i++) { pstVarName[i] = pInfo[i].varName; } sciErr = createMatrixOfString(pvApiCtx, nbIn + 1, iNbItem, 1, pstVarName); FREE(pstVarName); if (sciErr.iErr) { FREE(pInfo); printError(&sciErr, 0); return 1; } AssignOutputVariable(pvApiCtx, 1) = nbIn + 1; if (Lhs > 1) { //2nd Lhs double* pdblType; sciErr = allocMatrixOfDouble(pvApiCtx, nbIn + 2, iNbItem, 1, &pdblType); if (sciErr.iErr)
开发者ID:scitao,项目名称:scilab,代码行数:67,
示例16: sci_plot2d//.........这里部分代码省略......... } if (rect[0] <= 0. && logFlags[1] == 'l') /* xmin */ { if (freeStrf) { freeAllocatedSingleString(strf); } Scierror(999, _("%s: Bounds on x axis must be strictly positive to use logarithmic mode./n"), fname); return -1; } if (rect[1] <= 0. && logFlags[2] == 'l') /* ymin */ { if (freeStrf) { freeAllocatedSingleString(strf); } Scierror(999, _("%s: Bounds on y axis must be strictly positive to use logarithmic mode./n"), fname); return -1; } break; case '2' : case '4' : case '6' : case '8': case '9': /* computed from the x/y min/max */ if ((int)strlen(logFlags) < 1) { dataflag = 'g'; } else { dataflag = logFlags[0]; } switch (dataflag) { case 'e' : size_x = (m1 != 0) ? 2 : 0; break; case 'o' : size_x = m1; break; case 'g' : default : size_x = (n1 * m1); break; } if (size_x != 0) { if (logFlags[1] == 'l' && sciFindStPosMin((l1), size_x) <= 0.0) { if (freeStrf) { freeAllocatedSingleString(strf); } Scierror(999, _("%s: At least one x data must be strictly positive to compute the bounds and use logarithmic mode./n"), fname); return -1; } } size_y = (n1 * m1); if (size_y != 0) { if (logFlags[2] == 'l' && sciFindStPosMin((l2), size_y) <= 0.0) { if (freeStrf) { freeAllocatedSingleString(strf); } Scierror(999, _("%s: At least one y data must be strictly positive to compute the bounds and use logarithmic mode/n"), fname); return -1; } } break; } // open a figure if none already exists getOrCreateDefaultSubwin(); Objplot2d (1, logFlags, (l1), (l2), &n1, &m1, style, strf, legend, rect, nax, flagNax); // Allocated by sciGetStyle (get_style_arg function in GetCommandArg.c) FREE(style); if (freeStrf) { freeAllocatedSingleString(strf); } AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:101,
示例17: sci_umf_lufact//.........这里部分代码省略......... } Scierror(999, _("%s: Wrong size for input argument #%d./n"), fname, 1); return 1; } SciSparseToCcsSparse(&AA, &A); FREE(piNbItemRow); FREE(piColPos); FREE(pdblSpReal); if (pdblSpImg) { FREE(pdblSpImg); } /* symbolic factorization */ if (A.it == 1) { stat = umfpack_zi_symbolic(nA, mA, A.p, A.irow, A.R, A.I, &Symbolic, Control, Info); } else { stat = umfpack_di_symbolic(nA, mA, A.p, A.irow, A.R, &Symbolic, Control, Info); } if (stat != UMFPACK_OK) { freeCcsSparse(A); Scierror(999, _("%s: An error occurred: %s: %s/n"), fname, _("symbolic factorization"), UmfErrorMes(stat)); return 1; } /* numeric factorization */ if (A.it == 1) { stat = umfpack_zi_numeric(A.p, A.irow, A.R, A.I, Symbolic, &Numeric, Control, Info); } else { stat = umfpack_di_numeric(A.p, A.irow, A.R, Symbolic, &Numeric, Control, Info); } if (A.it == 1) { umfpack_zi_free_symbolic(&Symbolic); } else { umfpack_di_free_symbolic(&Symbolic); } if ( stat != UMFPACK_OK && stat != UMFPACK_WARNING_singular_matrix ) { freeCcsSparse(A); Scierror(999, _("%s: An error occurred: %s: %s/n"), fname, _("symbolic factorization"), UmfErrorMes(stat)); return 1; } if ( stat == UMFPACK_WARNING_singular_matrix && mA == nA ) { if (getWarningMode()) { Sciwarning("/n%s:%s/n", _("Warning"), _("The (square) matrix appears to be singular.")); } } /* add the pointer in the list ListNumeric */ if (! AddAdrToList(Numeric, A.it, &ListNumeric)) { /* AddAdrToList return 0 if malloc have failed : as it is just for storing 2 pointers this is unlikely to occurs but ... */ if (A.it == 1) { umfpack_zi_free_numeric(&Numeric); } else { umfpack_di_free_numeric(&Numeric); } freeCcsSparse(A); Scierror(999, _("%s: An error occurred: %s/n"), fname, _("no place to store the LU pointer in ListNumeric.")); return 1; } freeCcsSparse(A); /* create the scilab object to store the pointer onto the LU factors */ sciErr = createPointer(pvApiCtx, 2, Numeric); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } /* return the pointer */ AssignOutputVariable(pvApiCtx, 1) = 2; ReturnArguments(pvApiCtx); return 0;}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:101,
示例18: sci_uicontrol//.........这里部分代码省略......... if (isScalar(pvApiCtx, piAddr) == 0) { Scierror(999, _("%s: Wrong type for input argument #%d: string expected./n"), fname, 1); return FALSE; } if (getAllocatedSingleString(pvApiCtx, piAddr, &pstXmlfile)) { freeAllocatedSingleString(pstXmlfile); Scierror(999, _("%s: No more memory./n"), fname); return FALSE; } pstExpandedPath = expandPathVariable(pstXmlfile); freeAllocatedSingleString(pstXmlfile); iUicontrol = xmlload(pstExpandedPath); if (iUicontrol < 1) { Scierror(999, _("%s: can not read file %s./n"), fname, pstExpandedPath); FREE(pstExpandedPath); return 0; } FREE(pstExpandedPath); GraphicHandle = getHandle(iUicontrol); /* Create return variable */ if (createScalarHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, GraphicHandle)) { Scierror(999, _("%s: Memory allocation error./n"), fname); return 1; } AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; ReturnArguments(pvApiCtx); return TRUE; }#endif // Allow XML loading else /* Get parent ID */ { int* piAddr = NULL; long long hParent = 0; sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } if (isScalar(pvApiCtx, piAddr) == 0) { Scierror(999, _("%s: Wrong size for input argument #%d: A graphic handle expected./n"), fname, 1); return FALSE; } if (getScalarHandle(pvApiCtx, piAddr, &hParent)) { Scierror(202, _("%s: Wrong type for input argument #%d: Handle matrix expected./n"), fname, 1); return 1; } iParentUID = getObjectFromHandle((long)hParent); if (iParentUID != 0) { getGraphicObjectProperty(iParentUID, __GO_TYPE__, jni_int, (void **)&piParentType); if (iParentType == __GO_UICONTROL__) /* Focus management */
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:67,
示例19: 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,
示例20: sci_zneupd//.........这里部分代码省略......... if (mWORKev*nWORKev != 2 * pNCV[0]) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "WORKev", 2 * pNCV[0]); return 1; } if ((mV != pN[0]) || (nV != pNCV[0])) { Scierror(999, _("%s: Wrong size for input argument %s: A matrix of size %dx%d expected./n"), fname, "V", pN[0], pNCV[0]); return 1; } sizeWORKL = 3 * pNCV[0] * pNCV[0] + 5 * pNCV[0]; if ((mWORKL * nWORKL < sizeWORKL)) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "WORKL", sizeWORKL); return 1; } sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrpHOWMANY); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. if (getAllocatedSingleString(pvApiCtx, piAddrpHOWMANY, &pHOWMANY)) { Scierror(202, _("%s: Wrong type for argument #%d: A string expected./n"), fname, 2); return 1; } sciErr = getVarAddressFromPosition(pvApiCtx, 8, &piAddrpBMAT); if (sciErr.iErr) { freeAllocatedSingleString(pHOWMANY); printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 8. if (getAllocatedSingleString(pvApiCtx, piAddrpBMAT, &pBMAT)) { freeAllocatedSingleString(pHOWMANY); Scierror(202, _("%s: Wrong type for argument #%d: A string expected./n"), fname, 8); return 1; } sciErr = getVarAddressFromPosition(pvApiCtx, 10, &piAddrpWHICH); if (sciErr.iErr) { freeAllocatedSingleString(pHOWMANY); freeAllocatedSingleString(pBMAT); printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 10. if (getAllocatedSingleString(pvApiCtx, piAddrpWHICH, &pWHICH)) { freeAllocatedSingleString(pHOWMANY); freeAllocatedSingleString(pBMAT); Scierror(202, _("%s: Wrong type for argument #%d: A string expected./n"), fname, 10); return 1; } C2F(zneupd)(pRVEC, pHOWMANY, pSELECT, pD, pZ, &LDZ, pSIGMA, pWORKev, pBMAT, pN, pWHICH, pNEV, pTOL, pRESID, pNCV, pV, &LDV, pIPARAM, pIPNTR, pWORKD, pWORKL, &LWORKL, pRWORK, pINFO); freeAllocatedSingleString(pHOWMANY); freeAllocatedSingleString(pBMAT); freeAllocatedSingleString(pWHICH); if (pINFO[0] < 0) { C2F(errorinfo)("zneupd", pINFO, 6L); return 0; } AssignOutputVariable(pvApiCtx, 1) = D; AssignOutputVariable(pvApiCtx, 2) = Z; AssignOutputVariable(pvApiCtx, 3) = RESID; AssignOutputVariable(pvApiCtx, 4) = IPARAM; AssignOutputVariable(pvApiCtx, 5) = IPNTR; AssignOutputVariable(pvApiCtx, 6) = WORKD; AssignOutputVariable(pvApiCtx, 7) = WORKL; AssignOutputVariable(pvApiCtx, 8) = RWORK; AssignOutputVariable(pvApiCtx, 9) = INFO; ReturnArguments(pvApiCtx); return 0;}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:101,
示例21: 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,
示例22: sci_get_fftw_wisdom//.........这里部分代码省略......... n1++; if (Str1) { Str1 = (char **)REALLOC(Str1, sizeof(char *) * n1); } else { Str1 = (char **)MALLOC(sizeof(char *) * n1); } if (Str1 == NULL) { Scierror(999, _("%s: No more memory./n"), fname); if (Str) { // According to the FFTW documentation we should free Str // string but doing makes Scilab crash!? //free(Str); } return 1; } len = i - j; if ((Str1[n1 - 1] = (char *)MALLOC(sizeof(char) * (len + 1))) == NULL) { freeArrayOfString(Str1, n1 - 1); if (Str) { // According to the FFTW documentation we should free Str // string but doing makes Scilab crash!? //free(Str); } Scierror(999, _("%s: No more memory./n"), fname); return 1; } for (k = 0; k < len; k++) { Str1[n1 - 1][k] = Str[k + j]; } Str1[n1 - 1][len] = '/0'; j = i + 1; } } } n1++; if (Str1) { Str1 = (char **)REALLOC(Str1, sizeof(char *) * n1); } else { Str1 = (char **)MALLOC(sizeof(char *) * n1); } if (Str1 == NULL) { Scierror(999, _("%s: No more memory./n"), fname); if (Str) { // According to the FFTW documentation we should free Str // string but doing makes Scilab crash!? //free(Str); } return 1; } if ((Str1[n1 - 1] = (char *)MALLOC(sizeof(char))) == NULL) { freeArrayOfString(Str1, n1 - 1); if (Str) { // According to the FFTW documentation we should free Str // string but doing makes Scilab crash!? //free(Str); } Scierror(999, _("%s: No more memory./n"), fname); return 1; } Str1[n1 - 1][0] = '/0'; createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, n1, 1, Str1); freeArrayOfString(Str1, n1); if (Str) { // According to the FFTW documentation we should free Str // string but doing makes Scilab crash!? //free(Str); } AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; ReturnArguments(pvApiCtx); return 0;}
开发者ID:adrianafs,项目名称:scilab,代码行数:101,
示例23: sci_sym_set_int_paramint sci_sym_set_int_param(char *fname, unsigned long fname_len){ // Error management variable SciErr sciErr1,sciErr2; double status=1.0;//assume error status double num;//to store and check the value obtained is pure unsigned integer int output;//output variable to store the return value of symphony set integer function int value;//to store the value of integer to be set 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];//string to hold the name of variable's value to be set char *ptr=variable_name;//pointer to point to address of the variable name 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 variable to be set as a double value int err2=getScalarDouble(pvApiCtx, piAddressVarTwo, &num); //check for the integrity of integer value obtained if((double)(unsigned int)num!=(double)num) return 0; else value=(unsigned int)num;//if the value passed is an integer ,store it as an unsigned integer in value variable //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_int_param(global_sym_env,ptr,value);//symphony function to set the variable name pointed by the ptr pointer to the integer value stored in value variable. if(output==FUNCTION_TERMINATED_NORMALLY){ sciprint("setting of integer parameter function executed successfully/n"); status=0.0; } else if(output==FUNCTION_TERMINATED_ABNORMALLY){ sciprint("setting of integer parameter was unsuccessful.....check your parameter and value/n"); status=1.0; } else sciprint("/nerror while executing the setting integer function...check your parameter and value!!/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,代码行数:70,
示例24: sci_xrects//.........这里部分代码省略......... if (nbInputArgument(pvApiCtx) == 2) { sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDoubleAsInteger(pvApiCtx, piAddr2, &m2, &n2, &l2); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 2); return 1; } //CheckVector if (m2 != 1 && n2 != 1) { Scierror(999, _("%s: Wrong size for input argument #%d: Vector expected./n"), fname, 2); return 1; } if (m2 * n2 != n1) { Scierror(999, _("%s: Incompatible length for input arguments #%d and #%d./n"), fname, 1, 2); return 0; } } else { m2 = 1; n2 = n1; sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, 2, m2, n2, &l2); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(999, _("%s: Memory allocation error./n"), fname); return 1; } for (i = 0; i < n2; ++i) { l2[i] = 0; } } iSubwinUID = getOrCreateDefaultSubwin(); // Create compound. iCompoundUID = createGraphicObject(__GO_COMPOUND__); /* Sets the parent-child relationship for the Compound */ setGraphicObjectRelationship(iSubwinUID, iCompoundUID); /** Get Subwin line color */ getGraphicObjectProperty(iSubwinUID, __GO_LINE_COLOR__, jni_int, (void**)&piForeground); for (i = 0; i < n1; ++i) { /* j = (i==0) ? 0 : 1; */ if (l2[i] == 0) { /** fil(i) = 0 rectangle i is drawn using the current line style (or color).**/ /* color setting is done now */ Objrect((l1 + (4 * i)), (l1 + (4 * i) + 1), (l1 + (4 * i) + 2), (l1 + (4 * i) + 3), &foreground, NULL, FALSE, TRUE, &hdl); } else { if (l2[i] < 0) { /** fil(i) < 0 rectangle i is drawn using the line style (or color) **/ int tmp = - (*(int*)(l2 + i)); Objrect((l1 + (4 * i)), (l1 + (4 * i) + 1), (l1 + (4 * i) + 2), (l1 + (4 * i) + 3), &tmp, NULL, FALSE, TRUE, &hdl); } else { /** fil(i) > 0 rectangle i is filled using the pattern (or color) **/ Objrect((l1 + (4 * i)), (l1 + (4 * i) + 1), (l1 + (4 * i) + 2), (l1 + (4 * i) + 3), NULL, l2 + i, TRUE, FALSE, &hdl); } } // Add newly created object to Compound setGraphicObjectRelationship(iCompoundUID, getObjectFromHandle(hdl)); } /** make Compound current object **/ setCurrentObject(iCompoundUID); AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:101,
示例25: sci_dnaupd//.........这里部分代码省略......... return 1; } /* Check some sizes */ if (mIPARAM*nIPARAM != 11) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "IPARAM", 11); return 1; } if (mIPNTR*nIPNTR != 14) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "IPNTR", 14); return 1; } if (mRESID*nRESID != pN[0]) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "RESID", *(int*)(pN)); return 1; } if ((mV != pN[0]) || (nV != pNCV[0])) { Scierror(999, _("%s: Wrong size for input argument %s: A matrix of size %dx%d expected./n"), fname, "V", *(int*)(pN), *(int*)(pNCV)); return 1; } if (mWORKD * nWORKD < 3 * pN[0]) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "WORKD", 3 * *(int*)(pN)); return 1; } sizeWORKL = 3 * pNCV[0] * pNCV[0] + 6 * pNCV[0]; if (mWORKL * nWORKL < sizeWORKL) { Scierror(999, _("%s: Wrong size for input argument %s: An array of size %d expected./n"), fname, "WORKL", sizeWORKL); return 1; } sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrpBMAT); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. if (getAllocatedSingleString(pvApiCtx, piAddrpBMAT, &pBMAT)) { Scierror(202, _("%s: Wrong type for argument #%d: string expected./n"), fname, 2); return 1; } sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddrpWHICH); if (sciErr.iErr) { freeAllocatedSingleString(pBMAT); printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 4. if (getAllocatedSingleString(pvApiCtx, piAddrpWHICH, &pWHICH)) { freeAllocatedSingleString(pBMAT); Scierror(202, _("%s: Wrong type for argument #%d: string expected./n"), fname, 4); return 1; } C2F(dnaupd)(pIDO, pBMAT, pN, pWHICH, pNEV, pTOL, pRESID, pNCV, pV, &LDV, pIPARAM, pIPNTR, pWORKD, pWORKL, &LWORKL, pINFO, 1L, 2L); freeAllocatedSingleString(pBMAT); freeAllocatedSingleString(pWHICH); if (*pINFO < 0) { Scierror(998, _("%s: internal error, info=%d./n"), fname, *pINFO); return 0; } AssignOutputVariable(pvApiCtx, 1) = IDO; AssignOutputVariable(pvApiCtx, 2) = RESID; AssignOutputVariable(pvApiCtx, 3) = V; AssignOutputVariable(pvApiCtx, 4) = IPARAM; AssignOutputVariable(pvApiCtx, 5) = IPNTR; AssignOutputVariable(pvApiCtx, 6) = WORKD; AssignOutputVariable(pvApiCtx, 7) = WORKL; AssignOutputVariable(pvApiCtx, 8) = INFO; ReturnArguments(pvApiCtx); return 0;}
开发者ID:lucianofreitas,项目名称:scilab,代码行数:101,
示例26: sci_xgrid//.........这里部分代码省略......... setGraphicObjectProperty(iObjUID, __GO_X_AXIS_GRID_COLOR__, color, jni_int, 1); setGraphicObjectProperty(iObjUID, __GO_Y_AXIS_GRID_COLOR__, color + 1, jni_int, 1); setGraphicObjectProperty(iObjUID, __GO_Z_AXIS_GRID_COLOR__, color + 2, jni_int, 1); if (nbInputArgument(pvApiCtx) >= 2) { sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddrl); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDouble(pvApiCtx, piAddrl, &m, &n, &l); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 2); return 1; } mn = m * n; if (mn == 0 || mn > 3) { Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar or a row vector expected./n"), fname, 2); return 1; } if (mn == 1) { thickness[0] = l[0]; thickness[1] = l[0]; thickness[2] = l[0]; } else { for (i = 0; i < mn; i++) { thickness[i] = l[i]; } } setGraphicObjectProperty(iObjUID, __GO_X_AXIS_GRID_THICKNESS__, thickness, jni_double, 1); setGraphicObjectProperty(iObjUID, __GO_Y_AXIS_GRID_THICKNESS__, thickness + 1, jni_double, 1); setGraphicObjectProperty(iObjUID, __GO_Z_AXIS_GRID_THICKNESS__, thickness + 2, jni_double, 1); } if (nbInputArgument(pvApiCtx) == 3) { sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddrl); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDouble(pvApiCtx, piAddrl, &m, &n, &l); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 3); return 1; } mn = m * n; if (mn == 0 || mn > 3) { Scierror(999, _("%s: Wrong size for input argument #%d: A real scalar or a row vector expected./n"), fname, 3); return 1; } if (mn == 1) { style[0] = (int) l[0]; style[1] = style[0]; style[2] = style[0]; } else { for (i = 0; i < mn; i++) { style[i] = (int) l[i]; } } setGraphicObjectProperty(iObjUID, __GO_X_AXIS_GRID_STYLE__, style, jni_int, 1); setGraphicObjectProperty(iObjUID, __GO_Y_AXIS_GRID_STYLE__, style + 1, jni_int, 1); setGraphicObjectProperty(iObjUID, __GO_Z_AXIS_GRID_STYLE__, style + 2, jni_int, 1); } AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:101,
示例27: read_poly//.........这里部分代码省略......... sciErr = getPolyVariableName(pvApiCtx, piAddr, pstVarname, &iVarLen); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //First call: retrieve dimmension sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL, NULL); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //alloc array of coefficient piNbCoef = (int*)MALLOC(sizeof(int) * iRows * iCols); //Second call: retrieve coefficient sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, NULL, NULL); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //alloc arrays of data pdblReal = (double**)MALLOC(sizeof(double*) * iRows * iCols); pdblImg = (double**)MALLOC(sizeof(double*) * iRows * iCols); for (i = 0 ; i < iRows * iCols ; i++) { pdblReal[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]); pdblImg[i] = (double*)MALLOC(sizeof(double) * piNbCoef[i]); } //Third call: retrieve data sciErr = getComplexMatrixOfPoly(pvApiCtx, piAddr, &iRows, &iCols, piNbCoef, pdblReal, pdblImg); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //Do something with Data //Invert polynomials in the matrix and invert coefficients for (i = 0 ; i < (iRows * iCols) / 2 ; i++) { int iPos1 = iRows * iCols - 1 - i; double* pdblSave = NULL; int iNbCoefSave = 0; //switch array of coefficient pdblSave = pdblReal[i]; pdblReal[i] = pdblReal[iPos1]; pdblReal[iPos1] = pdblSave; pdblSave = pdblImg[i]; pdblImg[i] = pdblImg[iPos1]; pdblImg[iPos1] = pdblSave; //switch number of coefficient iNbCoefSave = piNbCoef[i]; piNbCoef[i] = piNbCoef[iPos1]; piNbCoef[iPos1] = iNbCoefSave; } //switch coefficient for (i = 0 ; i < iRows * iCols ; i++) { for (j = 0 ; j < piNbCoef[i] / 2 ; j++) { int iPos2 = piNbCoef[i] - 1 - j; double dblVal = pdblReal[i][j]; pdblReal[i][j] = pdblReal[i][iPos2]; pdblReal[i][iPos2] = dblVal; dblVal = pdblImg[i][j]; pdblImg[i][j] = pdblImg[i][iPos2]; pdblImg[i][iPos2] = dblVal; } } sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg); if (sciErr.iErr) { printError(&sciErr, 0); return 0; } //free OS memory FREE(pstVarname); FREE(piNbCoef); for (i = 0 ; i < iRows * iCols ; i++) { FREE(pdblReal[i]); FREE(pdblImg[i]); } FREE(pdblReal); FREE(pdblImg); //assign allocated variables to Lhs position AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; return 0;}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:101,
示例28: read_string//.........这里部分代码省略......... int iRows = 0; int iCols = 0; int* piAddr = NULL; int* piLen = NULL; char** pstData = NULL; //output variable int iRowsOut = 1; int iColsOut = 1; char* pstOut = NULL; //check input and output arguments CheckInputArgument(pvApiCtx, 1, 1); CheckOutputArgument(pvApiCtx, 1, 1); //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); if(sciErr.iErr) { printError(&sciErr, 0); return 0; } //fisrt call to retrieve dimensions sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); if(sciErr.iErr) { printError(&sciErr, 0); return 0; } piLen = (int*)malloc(sizeof(int) * iRows * iCols); //second call to retrieve length of each string sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); if(sciErr.iErr) { printError(&sciErr, 0); return 0; } pstData = (char**)malloc(sizeof(char*) * iRows * iCols); for(i = 0 ; i < iRows * iCols ; i++) { pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination } //third call to retrieve data sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); if(sciErr.iErr) { printError(&sciErr, 0); return 0; } //computer length of all strings for(i = 0 ; i < iRows * iCols ; i++) { iLen += piLen[i]; } //alloc output variable pstOut = (char*)malloc(sizeof(char) * (iLen + iRows * iCols)); //initialize string to 0x00 memset(pstOut, 0x00, sizeof(char) * (iLen + iRows * iCols)); //concat input strings in output string for(i = 0 ; i < iRows ; i++) { for(j = 0 ; j < iCols ; j++) { int iCurLen = strlen(pstOut); if(iCurLen) { strcat(pstOut, " "); } strcpy(pstOut + strlen(pstOut), pstData[j * iRows + i]); } } //create new variable sciErr = createMatrixOfString(pvApiCtx, InputArgument + 1, iRowsOut, iColsOut, &pstOut); if(sciErr.iErr) { printError(&sciErr, 0); return 0; } //free memory free(piLen); for(i = 0 ; i < iRows * iCols ; i++) { free(pstData[i]); } free(pstData); free(pstOut); AssignOutputVariable(1) = InputArgument + 1; return 0;}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:101,
示例29: sci_set_fftw_wisdom//.........这里部分代码省略......... if (withMKL()) { Scierror(999, _("%s: MKL fftw library does not implement wisdom functions yet./n"), fname); return 0; } CheckInputArgument(pvApiCtx, 1, 1); //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } if (isStringType(pvApiCtx, piAddr1) == 0) { Scierror(999, _("%s: Wrong type for input argument #%d: string expected./n"), fname, 1); return 1; } //fisrt call to retrieve dimensions sciErr = getMatrixOfString(pvApiCtx, piAddr1, &m1, &n1, NULL, NULL); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } piLen = (int*)MALLOC(sizeof(int) * m1 * n1); //second call to retrieve length of each string sciErr = getMatrixOfString(pvApiCtx, piAddr1, &m1, &n1, piLen, NULL); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } Str1 = (char**)MALLOC(sizeof(char*) * m1 * n1); for (i = 0 ; i < m1 * n1 ; i++) { Str1[i] = (char*)MALLOC(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination } //third call to retrieve data sciErr = getMatrixOfString(pvApiCtx, piAddr1, &m1, &n1, piLen, Str1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } for (j = 0; j < m1 * n1; j++) { len += (int)strlen(Str1[j]) + 1; if (Str) { Str = (char *)REALLOC(Str, sizeof(char) * (len)); } else { Str = (char *)MALLOC(sizeof(char) * (len)); } if (Str == NULL) { freeArrayOfString(Str1, m1 * n1); Scierror(999, _("%s: Cannot allocate more memory./n"), fname); return 1; } for (i = 0; i < (int)strlen(Str1[j]); i++) { Str[k + i] = Str1[j][i]; } Str[k + strlen(Str1[j])] = '/n'; k += (int)strlen(Str1[j]) + 1; } Str[k - 1] = '/0'; freeArrayOfString(Str1, m1 * n1); if (!(call_fftw_import_wisdom_from_string(Str))) { FREE(Str); Str = NULL; Scierror(999, _("%s: Wrong value for input argument #%d: a valid wisdom expected./n"), fname, 1); return 1; } FREE(Str); Str = NULL; AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:katchoua,项目名称:scilab,代码行数:101,
示例30: sci_xfarcs//.........这里部分代码省略......... int i = 0; double angle1 = 0.0; double angle2 = 0.0; CheckInputArgument(pvApiCtx, 1, 2); sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddrl1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDouble(pvApiCtx, piAddrl1, &m1, &n1, &l1); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 1); return 1; } if (m1 != 6) { Scierror(999, _("%s: Wrong size for input argument #%d: %s expected./n"), fname, 1, "(6,n)"); return 0; } if (nbInputArgument(pvApiCtx) == 2) { sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDoubleAsInteger(pvApiCtx, piAddr2, &m2, &n2, &l2); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(202, _("%s: Wrong type for argument #%d: A real expected./n"), fname, 2); return 1; } //CheckVector if (m2 != 1 && n2 != 1) { Scierror(999, _("%s: Wrong size for input argument #%d: Vector expected./n"), fname, 2); return 1; } if (n1 != m2 * n2) { Scierror(999, _("%s: Wrong size for input arguments #%d and #%d./n"), fname, 1, 2); return 0; } } else { m2 = 1; n2 = n1; sciErr = allocMatrixOfDoubleAsInteger(pvApiCtx, 2, m2, n2, &l2); if (sciErr.iErr) { printError(&sciErr, 0); Scierror(999, _("%s: Memory allocation error./n"), fname); return 1; } for (i = 0; i < n2; ++i) { *((int*)(l2 + i)) = i + 1; } } iCurrentSubWin = getOrCreateDefaultSubwin(); for (i = 0; i < n1; ++i) { angle1 = DEG2RAD(*(l1 + (6 * i) + 4) / 64.0); angle2 = DEG2RAD(*(l1 + (6 * i) + 5) / 64.0); Objarc(&angle1, &angle2, (l1 + (6 * i)), (l1 + (6 * i) + 1), (l1 + (6 * i) + 2), (l1 + (6 * i) + 3), (int*)(l2 + i), (int*)(l2 + i), TRUE, FALSE, &hdl); } /** Construct Compound and make it current object **/ { int o = createCompoundSeq(iCurrentSubWin, n1); setCurrentObject(o); } AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:101,
注:本文中的AssignOutputVariable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AssistPlayerInCombat函数代码示例 C++ AssignLength函数代码示例 |