当前位置: 首页>>代码示例>>C++>>正文


C++ freeArrayOfString函数代码示例

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


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


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