Scilab 6.0.2
- Scilab Help
- API Scilab
- legacy
- List manipulation
- isListType, isTListType, isMListType
- Boolean reading (Scilab gateway)
- Boolean writing (Scilab gateway)
- Boolean sparse reading (Scilab gateway)
- Boolean sparse writing (Scilab gateway)
- Create List (Scilab gateway)
- Double reading (Scilab gateway)
- Double writing (Scilab gateway)
- Get child item (Scilab gateway)
- Item Number (Scilab gateway)
- Integer reading (Scilab gateway)
- Integer writing (Scilab gateway)
- Pointer reading (Scilab gateway)
- Pointer writing (Scilab gateway)
- Polynomial reading (Scilab gateway)
- Polynomial writing (Scilab gateway)
- Sparse reading (Scilab gateway)
- Sparse writing (Scilab gateway)
- String reading (Scilab gateway)
- String writing (Scilab gateway)
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.
isListType, isTListType, isMListType
Check if it is a list, mlist, tlist variable.
Syntax
int isListType(void* _pvCtx, int* _piAddress)
int isNamedListType(void* _pvCtx, const char* _pstName)
int isTListType(void* _pvCtx, int* _piAddress)
int isNamedTListType(void* _pvCtx, const char* _pstName)
int isMListType(void* _pvCtx, int* _piAddress)
int isNamedMListType(void* _pvCtx, const char* _pstName)
Arguments
- _pvCtx
Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h.
- _piAddress
Position in the Scilab memory where you want to put the variable.
- _pstName
Name of the variable for "named" functions.
Return value
1 if variable is a list type, otherwise 0
Scilab test script
fileData = [ '#include <api_scilab.h>' '#include <Scierror.h>' '#include <MALLOC.h>' '/* ========================================================================== */' 'int sci_getListType(char *fname)' '{' ' int* piAddr = NULL;' ' char pstRet[64];' '' ' getVarAddressFromPosition(pvApiCtx, 1, &piAddr);' '' ' if(isStringType(pvApiCtx, piAddr))' ' {//named check' ' char* pstVar = NULL;' ' getAllocatedSingleString(pvApiCtx, piAddr, &pstVar);' '' ' if(isNamedListType(pvApiCtx, pstVar))' ' {' ' sprintf(pstRet, ""%s"", ""isNamedList"");' ' }' ' else if(isNamedTListType(pvApiCtx, pstVar))' ' {' ' sprintf(pstRet, ""%s"", ""isNamedTList"");' ' }' ' else if(isNamedMListType(pvApiCtx, pstVar))' ' {' ' sprintf(pstRet, ""%s"", ""isNamedMList"");' ' }' ' else' ' {' ' sprintf(pstRet, ""%s"", ""unmanaged named type"");' ' }' ' FREE(pstVar);' ' }' ' else' ' {' ' if(isListType(pvApiCtx, piAddr))' ' {' ' sprintf(pstRet, ""%s"", ""isList"");' ' }' ' else if(isTListType(pvApiCtx, piAddr))' ' {' ' sprintf(pstRet, ""%s"", ""isTList"");' ' }' ' else if(isMListType(pvApiCtx, piAddr))' ' {' ' sprintf(pstRet, ""%s"", ""isMList"");' ' }' ' else' ' {' ' sprintf(pstRet, ""%s"", ""unmanaged type"");' ' }' ' }' ' createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstRet);' ' AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;' ' return 0;' '}' ] currentPath = pwd(); mkdir(TMPDIR + "/getListType"); cd(TMPDIR + "/getListType"); mputl(fileData, "getListType.c"); ilib_verbose(0); files = ['getListType.c']; ilib_build('libgetListType', ['getListType', 'sci_getListType'], files, []); exec loader.sce; a = list(); b = tlist("test"); c = mlist("test"); d = 1; assert_checkequal(getListType(a), "isList"); assert_checkequal(getListType(b), "isTList"); assert_checkequal(getListType(c), "isMList"); assert_checkequal(getListType(d), "unmanaged type"); assert_checkequal(getListType("a"), "isNamedList"); assert_checkequal(getListType("b"), "isNamedTList"); assert_checkequal(getListType("c"), "isNamedMList"); assert_checkequal(getListType("d"), "unmanaged named type"); //unload lib [bOK, ilib] = c_link('libgetListType'); if bOK then ulink(ilib); end cd(currentPath);
Report an issue | ||
<< List manipulation | List manipulation | Boolean reading (Scilab gateway) >> |