/*--------------------------------------------------------------------------*/ static void DispCommands(void) { int i=0; int sizecommandwords = 0; char **commandwords = getcommandkeywords(&sizecommandwords); sciprint("\n"); sciprint(_("Commands:\n")); sciprint("\n"); for (i=0;i <sizecommandwords;i++) { sciprint("%+24s ",commandwords[i]); if ((i+1)%4==0) sciprint("\n"); } sciprint("\n"); freeArrayOfString(commandwords, sizecommandwords); }
/*--------------------------------------------------------------------------*/ 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; }
/*--------------------------------------------------------------------------*/ 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; }