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

C++ freeArrayOfString函数代码示例

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

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



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

示例1: checkPList

/*--------------------------------------------------------------------------*/
int checkPList(void* _pvCtx, int * _piAddress)
{
    int nb_param = 0, i = 0, var_type = 0;
    int m_label = 0, n_label = 0;
    int * len_label = NULL;
    char ** label_list = NULL;
    int result = 0;
    SciErr _SciErr;

    _SciErr.iErr = 0;
    _SciErr.iMsgCount = 0;

    _SciErr = getVarType(_pvCtx, _piAddress, &var_type);
    if (var_type != sci_mlist)
    {
        return 0;
    }

    _SciErr = getListItemNumber(_pvCtx, _piAddress, &nb_param);

    if (nb_param != 0)
    {
        _SciErr = getMatrixOfStringInList(_pvCtx, _piAddress, 1, &m_label, &n_label, NULL, NULL);

        len_label = (int *)MALLOC(m_label * n_label * sizeof(int));
        _SciErr = getMatrixOfStringInList(_pvCtx, _piAddress, 1, &m_label, &n_label, len_label, NULL);

        label_list = (char **)MALLOC(m_label * n_label * sizeof(char *));
        for (i = 0; i < n_label * m_label; i++)
        {
            label_list[i] = (char *)MALLOC((len_label[i] + 1) * sizeof(char));
        }
        _SciErr = getMatrixOfStringInList(_pvCtx, _piAddress, 1, &m_label, &n_label, len_label, label_list);
        if (strcmp(label_list[0], "plist") != 0)
        {
            if (len_label)
            {
                FREE(len_label);
                len_label = NULL;
            }
            freeArrayOfString(label_list, m_label * n_label);

            return 0;
        }

        if (len_label)
        {
            FREE(len_label);
            len_label = NULL;
        }
        freeArrayOfString(label_list, m_label * n_label);
    }

    result = 1;

    return result;
}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:58,代码来源:parameters.c


示例2: freeVar

// =============================================================================
static void freeVar(char** separator, char** decimal, char** filename, char** precisionFormat, char*** pHeadersLines, int sizeHeader)
{
    if (separator && *separator)
    {
        FREE(*separator);
        *separator = NULL;
    }

    if (decimal && *decimal)
    {
        FREE(*decimal);
        *decimal = NULL;
    }

    if (filename && *filename)
    {
        FREE(*filename);
        *filename = NULL;
    }

    if (precisionFormat && *precisionFormat)
    {
        FREE(*precisionFormat);
        *precisionFormat = NULL;
    }

    if (pHeadersLines && *pHeadersLines)
    {
        freeArrayOfString(*pHeadersLines, sizeHeader);
        *pHeadersLines = NULL;
    }

}
开发者ID:Macisia,项目名称:scilab,代码行数:34,代码来源:sci_csvWrite.c


示例3: createMatrixOfWideString

/*--------------------------------------------------------------------------*/
SciErr createMatrixOfWideString(void* _pvCtx, int _iVar, int _iRows, int _iCols, const wchar_t* const* _pstwStrings)
{
    char **pStrings = NULL;

    //return empty matrix
    if (_iRows == 0 && _iCols == 0)
    {
        double dblReal = 0;
        SciErr sciErr = createMatrixOfDouble(_pvCtx, _iVar, 0, 0, &dblReal);
        if (sciErr.iErr)
        {
            addErrorMessage(&sciErr, API_ERROR_CREATE_EMPTY_MATRIX, _("%s: Unable to create variable in Scilab memory"), "createEmptyMatrix");
        }
        return sciErr;
    }

    pStrings = (char**)MALLOC( sizeof(char*) * (_iRows * _iCols) );

    for (int i = 0; i < (_iRows * _iCols) ; i++)
    {
        pStrings[i] = wide_string_to_UTF8(_pstwStrings[i]);
    }

    SciErr sciErr = createMatrixOfString(_pvCtx, _iVar, _iRows, _iCols, pStrings);
    if (sciErr.iErr)
    {
        addErrorMessage(&sciErr, API_ERROR_CREATE_WIDE_STRING, _("%s: Unable to create variable in Scilab memory"), "createMatrixOfWideString");
    }

    freeArrayOfString(pStrings, _iRows * _iCols);

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


示例4: sci_librarieslist

/*--------------------------------------------------------------------------*/
int sci_librarieslist(char *fname, unsigned long fname_len)
{
    char **libraries = NULL;
    int sizelibraries = 0;

    CheckRhs(0, 0);
    CheckLhs(0, 1);

    libraries = getlibrarieslist(&sizelibraries);

    if (libraries)
    {
        int m = 0, n = 0;
        m = sizelibraries;
        n = 1;
        CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &m, &n, libraries);
    }
    else
    {
        int m = 0, n = 0, l = 0;
        CreateVarFromPtr(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE, &n, &m, &l);
    }

    LhsVar(1) = Rhs + 1;

    freeArrayOfString(libraries, sizelibraries);

    PutLhsVar();
    return 0;
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:31,代码来源:sci_librarieslist.c


示例5: OneLhs

 /*--------------------------------------------------------------------------*/
 static int OneLhs(struct VariableStruct* Vstruct,int lenStructArray,BOOL Sorted)
 {
	 int i=0;
	 int m=0;
	 int n=0;

	 char **LocalTab = NULL;

	 if (Sorted) SortVarsStructByStrings(Vstruct,lenStructArray);

	 LocalTab=(char **)MALLOC(sizeof(char*)*(lenStructArray));

	 for (i=0;i<lenStructArray;i++)
	 {
		 if (strlen(Vstruct[i].NameVariable)>0)
		 {
			 LocalTab[i] = strdup(Vstruct[i].NameVariable);
		 }
	 }

	 m=lenStructArray;
	 n=1;
	 CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &m, &n,LocalTab);
	 LhsVar(1)=Rhs+1;

	 freeArrayOfString(LocalTab, lenStructArray);
	 PutLhsVar();
	 return 0;
 }
开发者ID:rossdrummond,项目名称:scilab,代码行数:30,代码来源:sci_who.c


示例6: TwoLhs

/*--------------------------------------------------------------------------*/
 static int TwoLhs(struct VariableStruct* Vstruct,int lenStructArray,BOOL Sorted)
 {
	 char **Tab=NULL;
	 int *Size=NULL;
	 int i=0;
	 int m=0;
	 int n=0;

	 if (Sorted) SortVarsStructByStrings(Vstruct,lenStructArray);

	 Tab=(char **)MALLOC(sizeof(char*)*lenStructArray);
	 Size=(int *)MALLOC(sizeof(int)*lenStructArray);

	 for (i=0;i<lenStructArray;i++)
	 {
		 Tab[i] = strdup(Vstruct[i].NameVariable);
		 Size[i]=Vstruct[i].SizeVariable;
	 }

	 m=lenStructArray;
	 n=1;

	 CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &m, &n, Tab);
	 LhsVar(1) = Rhs+1;

	 CreateVarFromPtr(Rhs+2,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &Size);
	 LhsVar(2) = Rhs+2;

	 freeArrayOfString(Tab, lenStructArray);
	 if (Size) {FREE(Size);Size=NULL;}

     PutLhsVar();
	 return 0;
 }
开发者ID:rossdrummond,项目名称:scilab,代码行数:35,代码来源:sci_who.c


示例7: freeFscanfMatResult

/*--------------------------------------------------------------------------*/
void freeFscanfMatResult(fscanfMatResult *resultStruct)
{
    if (resultStruct)
    {
        if (resultStruct->text)
        {
            freeArrayOfString(resultStruct->text, resultStruct->sizeText);
            resultStruct->text = NULL;
        }

        if (resultStruct->values)
        {
            FREE(resultStruct->values);
            resultStruct->values = NULL;
        }

        resultStruct->err = FSCANFMAT_ERROR;
        resultStruct->m = 0;
        resultStruct->n = 0;
        resultStruct->sizeText = 0;

        FREE(resultStruct);
        resultStruct = NULL;
    }
}
开发者ID:leowzukw,项目名称:scilab-mirror,代码行数:26,代码来源:fscanfMat.c


示例8: scitokenize

/*--------------------------------------------------------------------------*/
int scitokenize(char * legend, char *** Strptr, int *n)
{
    int arobaseIndex = 0;
    int i = 0;
    int count = 1;
    int prevIndex = 0;
    int stringLength = 0, j = 0;
    char **Str = NULL;
    int lenlegend = (int)strlen(legend);

    /* first get the number of tokens */
    for (i = 0; i < lenlegend; i++)
    {
        if (legend[i] == '@')
        {
            count++;
        }
    }
    *Strptr = (char **)MALLOC(count * sizeof(char *));
    Str = *Strptr;
    if (Str == NULL)
    {
        return 1;    /* not enough memory */
    }
    for (i = 0; i < count; i++)
    {
        Str[i] = NULL;
    }

    for (i = 0; i < count; i++)
    {
        while (legend[arobaseIndex] != '@' && legend[arobaseIndex] != 0)
        {
            arobaseIndex++;
        }
        /* we found a token */
        stringLength =  arobaseIndex - prevIndex;
        Str[i] = (char *)MALLOC((stringLength + 1) * sizeof(char)); /*  +1 for null terminating character*/

        if (Str[i] == NULL)
        {
            freeArrayOfString(Str, i - 1);
            return 1;
        }

        for (j = 0; j < stringLength; j++)
        {
            Str[i][j] = legend[prevIndex + j];
        }
        Str[i][stringLength] = 0;

        /* skip the @*/
        arobaseIndex++;
        prevIndex = arobaseIndex;
    }
    *n = count;
    return 0;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:59,代码来源:scitokenize.c


示例9: CleanBuffers

/*--------------------------------------------------------------------------*/
static BOOL CleanBuffers(char *bufCommands, char **LOCALJOBS, int numberjobs)
{
    if (bufCommands)
    {
        FREE(bufCommands);
        bufCommands = NULL;
    }
    freeArrayOfString(LOCALJOBS, numberjobs);
    return TRUE;
}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:11,代码来源:SendScilabJobs.c


示例10: isTypeNameAlreadyExist

/*--------------------------------------------------------------------------*/
BOOL isTypeNameAlreadyExist(char *name)
{
    int sizeArray = 0;
    char **TypeNames = getAllTypesName(&sizeArray);
    int i = 0;

    if (TypeNames)
    {
        for (i = 0; i < sizeArray; i++)
        {
            if (strcmp(name, TypeNames[i]) == 0)
            {
                freeArrayOfString(TypeNames, sizeArray);
                return TRUE;
            }
        }
        freeArrayOfString(TypeNames, sizeArray);
    }
    return FALSE;
}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:21,代码来源:typename.c


示例11: IsACommand

/*--------------------------------------------------------------------------*/
static int IsACommand(char *primitive)
{
    int sizecommandwords = 0;
    char **commandwords = getcommandkeywords(&sizecommandwords);
    int bOK = FALSE;
    int i = 0;

    for (i = 0; i < sizecommandwords ; i++)
    {
        if (strcmp(commandwords[i], primitive) == 0)
        {
            freeArrayOfString(commandwords, sizecommandwords);
            return TRUE;
        }
    }

    freeArrayOfString(commandwords, sizecommandwords);

    return bOK;
}
开发者ID:quanpan302,项目名称:scilab,代码行数:21,代码来源:sci_what.c


示例12: getSizeAllLinesOfScilabHistory

/*------------------------------------------------------------------------*/
int getSizeAllLinesOfScilabHistory(void)
{
    int nbElements = 0;
    char **lines = NULL;

    if (ScilabHistory)
        lines = ScilabHistory->getAllLines(&nbElements);

    freeArrayOfString(lines, nbElements);

    return nbElements;
}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:13,代码来源:HistoryManager.cpp


示例13: freeCsvResult

// =============================================================================
void freeCsvResult(csvResult *result)
{
    if (result)
    {
        if (result->pstrValues)
        {
            freeArrayOfString(result->pstrValues, result->m * result->n);
            result->pstrValues = NULL;
        }
        result->m = 0;
        result->n = 0;

        if (result->pstrComments)
        {
            freeArrayOfString(result->pstrComments, result->nbComments);
            result->pstrComments = NULL;
        }
        result->err = CSV_READ_ERROR;
        FREE(result);
        result = NULL;
    }
}
开发者ID:scitao,项目名称:scilab,代码行数:23,代码来源:csvRead.c


示例14: sci_strrev

/*----------------------------------------------------------------------------*/
int sci_strrev(char *fname,unsigned long fname_len)
{
	CheckRhs(1,1);
	CheckLhs(0,1);

	if (GetType(1) == sci_strings)
	{
		int m1 = 0; int n1 = 0;
		char **InputStrings = NULL;
		int m1n1 = 0; /* m1 * n1 */

		char **OutputStrings = NULL;

		GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&InputStrings);
		m1n1 = m1 * n1;

		OutputStrings = strings_strrev(InputStrings,m1n1);

		if (OutputStrings)
		{
			CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,OutputStrings);
			freeArrayOfString(InputStrings,m1n1);
			freeArrayOfString(OutputStrings,m1n1);
            LhsVar(1) = Rhs+1 ;
            PutLhsVar();
		}
		else
		{
			freeArrayOfString(InputStrings,m1n1);
			Scierror(999,_("%s: No more memory.\n"),fname);
			return 0;
		}
	}
	else
	{
		Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,1);
	}
	return 0;
}
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:40,代码来源:sci_strrev.c


示例15: C2F

/*--------------------------------------------------------------------------*/
int C2F(sci_what)(char *fname, unsigned long fname_len)
{
    int sizecommandwords = 0;
    char **commandwords = getcommandkeywords(&sizecommandwords);

    Rhs = Max(0, Rhs);
    CheckRhs(0, 0);
    CheckLhs(1, 2);

    CreateLocalFunctionsTab();
    qsort( LocalFunctionsTab , SizeLocalFunctionsTab ,  sizeof (char *)  , cmpfunctionnames);

    if (Lhs == 1)
    {
        DispInternalFunctions();
        DispCommands();
        LhsVar(1) = 0;
    }
    else /* Lhs == 2 */
    {
        int ncol = 1;
        int nrowFunctions = SizeLocalFunctionsTab;
        int nrowCommands = sizecommandwords;

        CreateVarFromPtr(Rhs + 1, MATRIX_OF_STRING_DATATYPE, &nrowFunctions, &ncol, LocalFunctionsTab);
        LhsVar(1) = Rhs + 1;

        CreateVarFromPtr(Rhs + 2, MATRIX_OF_STRING_DATATYPE, &nrowCommands, &ncol, commandwords);
        LhsVar(2) = Rhs + 2;

        freeArrayOfString(LocalFunctionsTab, nrowFunctions);
        freeArrayOfString(commandwords, nrowCommands);

    }

    PutLhsVar();
    return 0;
}
开发者ID:quanpan302,项目名称:scilab,代码行数:39,代码来源:sci_what.c


示例16: CreateLocalFunctionsTab

/*--------------------------------------------------------------------------*/
static int CreateLocalFunctionsTab(void)
{
    char **LocalFunctionsTabTmp = NULL;
    int i = 0;
    int j = 0;
    int SizeTab = 0;
    int MaxSizeWithoutCommands = 0;

    LocalFunctionsTabTmp = GetFunctionsList(&SizeTab);

    if (LocalFunctionsTabTmp)
    {
        for (i = 0; i < SizeTab; i++)
        {
            if ( !IsACommand(LocalFunctionsTabTmp[i]) )
            {
                MaxSizeWithoutCommands++;
            }
        }

        LocalFunctionsTab = (char **)MALLOC(sizeof(char**) * MaxSizeWithoutCommands);

        if (LocalFunctionsTab == NULL)
        {
            SizeLocalFunctionsTab = 0;
            return FALSE;
        }

        j = 0;
        for (i = 0; i < SizeTab; i++)
        {
            if ( !IsACommand(LocalFunctionsTabTmp[i]) )
            {
                LocalFunctionsTab[j] = strdup(LocalFunctionsTabTmp[i]);
                j++;
            }
        }

        freeArrayOfString(LocalFunctionsTabTmp, SizeTab);
    }
    else
    {
        SizeLocalFunctionsTab = 0;
        return FALSE;
    }

    SizeLocalFunctionsTab = MaxSizeWithoutCommands;

    return TRUE;
}
开发者ID:quanpan302,项目名称:scilab,代码行数:51,代码来源:sci_what.c


示例17: export_strings

static bool export_strings(int _iH5File, int *_piVar, char* _pstName)
{
    int iRet = 0;
    int* piLen = NULL;
    char** pstData = NULL;
    int piDims[2];

    SciErr sciErr = getMatrixOfString(pvApiCtx, _piVar, &piDims[0], &piDims[1], NULL, NULL);
    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return false;
    }

    piLen = (int*)MALLOC(piDims[0] * piDims[1] * sizeof(int));
    sciErr = getMatrixOfString(pvApiCtx, _piVar, &piDims[0], &piDims[1], piLen, NULL);
    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return false;
    }

    pstData = (char**)MALLOC(sizeof(char*) * piDims[0] * piDims[1]);
    for (int i = 0 ; i < piDims[0] * piDims[1] ; i++)
    {
        pstData[i] = (char*)MALLOC(sizeof(char) * (piLen[i] + 1));// for null termination
    }

    sciErr = getMatrixOfString(pvApiCtx, _piVar, &piDims[0], &piDims[1], piLen, pstData);
    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return false;
    }

    iRet = writeStringMatrix(_iH5File, _pstName, 2, piDims, pstData);

    if (iRet)
    {
        return false;
    }

    char pstMsg[512];
    sprintf(pstMsg, "string (%d x %d)", piDims[0], piDims[1]);
    print_type(pstMsg);

    freeArrayOfString(pstData, piDims[0] * piDims[1]);
    return true;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:49,代码来源:sci_export_to_hdf5.cpp


示例18: setInternalLastErrorMessage

/*--------------------------------------------------------------------------*/ 
int setInternalLastErrorMessage(char** strErrorMessage, int iNbLines)
{
    int i = 0;
    if (strLastErrorMessage)
    {
        freeArrayOfString(strLastErrorMessage, iLastErrorMessageNbLines);
    }
    allocLastErrorMessage();

    for (i = 0; i < iNbLines; i++)
    {
        appendStringToInternalLastErrorMessage(strErrorMessage[i]);
    }
    return 0;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:16,代码来源:lasterror.c


示例19: C2F

/*------------------------------------------------------------------------*/
errorLoadHistoryCode HistoryFile::loadFromFile(std::string filename)
{
    errorLoadHistoryCode returnedError = ERROR_HISTORY_NOT_LOADED;
    int fd = 0;
    int f_swap = 0;
    double res = 0.0;
    int errMOPEN = MOPEN_INVALID_STATUS;
    double dErrClose = 0.;


    C2F(mopen)(&fd, (char*)filename.c_str(), "rt", &f_swap, &res, &errMOPEN);
    if (errMOPEN == MOPEN_NO_ERROR)
    {
        int errMGETL = MGETL_ERROR;
        int nblines = 0;
        char **lines = mgetl(fd, -1, &nblines, &errMGETL);

        C2F(mclose)(&fd, &dErrClose);
        if (errMGETL == MGETL_NO_ERROR)
        {
            if (lines)
            {
                int iStart = 0;
                int iEnd = 0;
                if (nblines > getDefaultMaxNbLines())
                {
                    iStart = nblines - getDefaultMaxNbLines();
                    returnedError = HISTORY_TRUNCATED;
                }
                else
                {
                    iStart = 0;
                    returnedError = NO_ERROR_HISTORY_LOADED;
                }
                iEnd = nblines;

                for (int i = iStart; i < iEnd; i++)
                {
                    CommandLine Line(lines[i]);
                    this->Commands.push_back(Line);
                }
                freeArrayOfString(lines, nblines);
                lines = NULL;
            }
        }
    }
    return returnedError;
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:49,代码来源:HistoryFile.cpp


示例20: C2F

/*--------------------------------------------------------------------------*/
int C2F(msgstore)(char *str, int *n)
{
    int iRes = 0;

    char **multilines = NULL;
    int nbLines = 0;
    int i = 0;
    char *msg = NULL;
    char *msgTmp = NULL;

    if (str == NULL) return 1;
    msg = strdup(str);
    if (msg)
    {
        msg[*n] = 0;
    }

    // remove duplicate percent bug 9571
    msgTmp = strsub(msg, "%%", "%");
    if (msgTmp)
    {
        FREE(msg);
        msg = msgTmp;
    }
    multilines = splitErrorMessage(msg, &nbLines);
    if (multilines)
    {
        for (i = 0; i < nbLines; i++)
        {
            iRes = appendStringToInternalLastErrorMessage(multilines[i]);
            if (iRes) break;
        }
        freeArrayOfString(multilines, nbLines);
        multilines = NULL;
    }
    else
    {
        iRes = appendStringToInternalLastErrorMessage(msg);
    }

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

    return iRes;
}
开发者ID:rossdrummond,项目名称:scilab,代码行数:49,代码来源:msgstore.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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