diff options
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | BUGS | 3 | ||||
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | jim-posix.c | 10 | ||||
-rw-r--r-- | jim-win32.c | 22 | ||||
-rw-r--r-- | jim.c | 94 | ||||
-rw-r--r-- | jim.h | 3 |
7 files changed, 78 insertions, 64 deletions
@@ -1 +1,6 @@ Salvatore Sanfilippo <antirez@invece.org> + +with the help (patches, bug reports, ideas) of: + +Pat Thoyts +Clemens Hintze @@ -7,3 +7,6 @@ jim::libPath variable is accessed in the local context instead than globally, so the [load] command will fail inside procs. [subst] ingores special meaning of JIM_BREAK and alike. + +[info level ?level?] takes the level argument like [uplevel], but +it should be different, positive is absolute, negative is relative. @@ -7,11 +7,6 @@ Copyright (C) 2005 Salvatore Sanfilippo All Rights Reserved This software is under the APACHE 2.0 LICENSE -CREDITS (people that contributed source code/patches/ideas) - -- Pat Thoyts -- Clemens Hintze - ALSO THANKS TO: - Many people on the Tclers Chat that helped me to explore issues diff --git a/jim-posix.c b/jim-posix.c index 5466101..ed172f0 100644 --- a/jim-posix.c +++ b/jim-posix.c @@ -103,10 +103,10 @@ static int Jim_PosixSethostnameCommand(Jim_Interp *interp, int argc, int Jim_OnLoad(Jim_Interp *interp) { Jim_InitExtension(interp, "1.0"); - Jim_CreateCommand(interp, "os.fork", Jim_PosixForkCommand, 1, 1, NULL); - Jim_CreateCommand(interp, "os.sleep", Jim_PosixSleepCommand, 2, 2, NULL); - Jim_CreateCommand(interp, "os.getids", Jim_PosixGetidsCommand, 1, 2, NULL); - Jim_CreateCommand(interp, "os.gethostname", Jim_PosixGethostnameCommand, 1, 1, NULL); - Jim_CreateCommand(interp, "os.sethostname", Jim_PosixSethostnameCommand, 2, 2, NULL); + Jim_CreateCommand(interp, "os.fork", Jim_PosixForkCommand, NULL); + Jim_CreateCommand(interp, "os.sleep", Jim_PosixSleepCommand, NULL); + Jim_CreateCommand(interp, "os.getids", Jim_PosixGetidsCommand, NULL); + Jim_CreateCommand(interp, "os.gethostname", Jim_PosixGethostnameCommand, NULL); + Jim_CreateCommand(interp, "os.sethostname", Jim_PosixSethostnameCommand, NULL); return JIM_OK; } diff --git a/jim-win32.c b/jim-win32.c index d69ebe9..aa12bbe 100644 --- a/jim-win32.c +++ b/jim-win32.c @@ -1,3 +1,23 @@ +/* WIN32 extension
+ *
+ * Copyright(C) 2005 Pat Thoyts.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * A copy of the license is also included in the source distribution
+ * of Jim, as a TXT file name called LICENSE.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -37,6 +57,6 @@ int Jim_OnLoad(Jim_Interp *interp)
{
Jim_InitExtension(interp, "1.0");
- Jim_CreateCommand(interp, "win32.shellexecute", Win32_ShellExecute, 3, 4, NULL);
+ Jim_CreateCommand(interp, "win32.shellexecute", Win32_ShellExecute, NULL);
return JIM_OK;
}
@@ -2487,7 +2487,7 @@ Jim_HashTableType Jim_CommandsHashTableType = { /* ------------------------- Commands related functions --------------------- */ int Jim_CreateCommand(Jim_Interp *interp, char *cmdName, Jim_CmdProc cmdProc, - int arityMin, int arityMax, void *privData) + void *privData) { Jim_HashEntry *he; Jim_Cmd *cmdPtr; @@ -2496,8 +2496,6 @@ int Jim_CreateCommand(Jim_Interp *interp, char *cmdName, Jim_CmdProc cmdProc, if (he == NULL) { /* New command to create */ cmdPtr = Jim_Alloc(sizeof(*cmdPtr)); cmdPtr->cmdProc = cmdProc; - cmdPtr->arityMin = arityMin; - cmdPtr->arityMax = arityMax; cmdPtr->privData = privData; Jim_AddHashEntry(&interp->commands, cmdName, cmdPtr); } else { @@ -2508,8 +2506,6 @@ int Jim_CreateCommand(Jim_Interp *interp, char *cmdName, Jim_CmdProc cmdProc, Jim_DecrRefCount(interp, cmdPtr->bodyObjPtr); } cmdPtr->cmdProc = cmdProc; - cmdPtr->arityMin = arityMin; - cmdPtr->arityMax = arityMax; cmdPtr->privData = privData; } /* There is no need to increment the 'proc epoch' because @@ -2587,7 +2583,6 @@ int Jim_RenameCommand(Jim_Interp *interp, char *oldName, char *newName) Jim_DecrRefCount(interp, cmdPtr->bodyObjPtr); } else { /* Or C-coded command. */ Jim_CreateCommand(interp, newName, cmdPtr->cmdProc, - cmdPtr->arityMin, cmdPtr->arityMax, cmdPtr->privData); } /* DeleteCommand will incr the proc epoch */ @@ -8102,50 +8097,49 @@ int Jim_InfoCoreCommand(Jim_Interp *interp, int argc, Jim_Obj **argv) struct { char *name; Jim_CmdProc cmdProc; - int arityMin, arityMax; } Jim_CoreCommandsTable[] = { - {"set", Jim_SetCoreCommand, 2, 3}, - {"unset", Jim_UnsetCoreCommand, 2, -1}, - {"puts", Jim_PutsCoreCommand, 2, 2}, - {"+", Jim_AddCoreCommand, 1, -1}, - {"*", Jim_MulCoreCommand, 1, -1}, - {"-", Jim_SubCoreCommand, 2, -1}, - {"/", Jim_DivCoreCommand, 2, -1}, - {"incr", Jim_IncrCoreCommand, 2, 3}, - {"while", Jim_WhileCoreCommand, 3, 3}, - {"for", Jim_ForCoreCommand, 5, 5}, - {"if", Jim_IfCoreCommand, 3, -1}, - {"list", Jim_ListCoreCommand, 1, -1}, - {"lindex", Jim_LindexCoreCommand, 3, -1}, - {"lset", Jim_LsetCoreCommand, 4, -1}, - {"llength", Jim_LlengthCoreCommand, 2, 2}, - {"lappend", Jim_LappendCoreCommand, 2, -1}, - {"append", Jim_AppendCoreCommand, 2, -1}, - {"debug", Jim_DebugCoreCommand, 2, -1}, - {"eval", Jim_EvalCoreCommand, 2, -1}, - {"uplevel", Jim_UplevelCoreCommand, 2, -1}, - {"expr", Jim_ExprCoreCommand, 2, -1}, - {"break", Jim_BreakCoreCommand, 1, 1}, - {"continue", Jim_ContinueCoreCommand, 1, 1}, - {"proc", Jim_ProcCoreCommand, 4, 4}, - {"concat", Jim_ConcatCoreCommand, 1, -1}, - {"return", Jim_ReturnCoreCommand, 1, 4}, - {"upvar", Jim_UpvarCoreCommand, 3, -1}, - {"global", Jim_GlobalCoreCommand, 2, -1}, - {"string", Jim_StringCoreCommand, 3, -1}, - {"time", Jim_TimeCoreCommand, 2, 3}, - {"exit", Jim_ExitCoreCommand, 1, 2}, - {"catch", Jim_CatchCoreCommand, 2, 3}, - {"ref", Jim_RefCoreCommand, 2, 3}, - {"getref", Jim_GetrefCoreCommand, 2, 2}, - {"setref", Jim_SetrefCoreCommand, 3, 3}, - {"collect", Jim_CollectCoreCommand, 1, 1}, - {"rename", Jim_RenameCoreCommand, 3, 3}, - {"dict", Jim_DictCoreCommand, 2, -1}, - {"load", Jim_LoadCoreCommand, 2, 2}, - {"subst", Jim_SubstCoreCommand, 2, -1}, - {"info", Jim_InfoCoreCommand, 2, -1}, - {NULL, NULL, 0, 0} + {"set", Jim_SetCoreCommand}, + {"unset", Jim_UnsetCoreCommand}, + {"puts", Jim_PutsCoreCommand}, + {"+", Jim_AddCoreCommand}, + {"*", Jim_MulCoreCommand}, + {"-", Jim_SubCoreCommand}, + {"/", Jim_DivCoreCommand}, + {"incr", Jim_IncrCoreCommand}, + {"while", Jim_WhileCoreCommand}, + {"for", Jim_ForCoreCommand}, + {"if", Jim_IfCoreCommand}, + {"list", Jim_ListCoreCommand}, + {"lindex", Jim_LindexCoreCommand}, + {"lset", Jim_LsetCoreCommand}, + {"llength", Jim_LlengthCoreCommand}, + {"lappend", Jim_LappendCoreCommand}, + {"append", Jim_AppendCoreCommand}, + {"debug", Jim_DebugCoreCommand}, + {"eval", Jim_EvalCoreCommand}, + {"uplevel", Jim_UplevelCoreCommand}, + {"expr", Jim_ExprCoreCommand}, + {"break", Jim_BreakCoreCommand}, + {"continue", Jim_ContinueCoreCommand}, + {"proc", Jim_ProcCoreCommand}, + {"concat", Jim_ConcatCoreCommand}, + {"return", Jim_ReturnCoreCommand}, + {"upvar", Jim_UpvarCoreCommand}, + {"global", Jim_GlobalCoreCommand}, + {"string", Jim_StringCoreCommand}, + {"time", Jim_TimeCoreCommand}, + {"exit", Jim_ExitCoreCommand}, + {"catch", Jim_CatchCoreCommand}, + {"ref", Jim_RefCoreCommand}, + {"getref", Jim_GetrefCoreCommand}, + {"setref", Jim_SetrefCoreCommand}, + {"collect", Jim_CollectCoreCommand}, + {"rename", Jim_RenameCoreCommand}, + {"dict", Jim_DictCoreCommand}, + {"load", Jim_LoadCoreCommand}, + {"subst", Jim_SubstCoreCommand}, + {"info", Jim_InfoCoreCommand}, + {NULL, NULL}, }; /* Some Jim core command is actually a procedure written in Jim itself. */ @@ -8171,8 +8165,6 @@ void Jim_RegisterCoreCommands(Jim_Interp *interp) Jim_CreateCommand(interp, Jim_CoreCommandsTable[i].name, Jim_CoreCommandsTable[i].cmdProc, - Jim_CoreCommandsTable[i].arityMin, - Jim_CoreCommandsTable[i].arityMax, NULL); i++; } @@ -481,8 +481,7 @@ void JIM_API(Jim_FreeInterp) (Jim_Interp *i); /* commands */ void JIM_API(Jim_RegisterCoreCommands) (Jim_Interp *interp); int JIM_API(Jim_CreateCommand) (Jim_Interp *interp, char *cmdName, - Jim_CmdProc cmdProc, int arityMin, int arityMax, - void *privData); + Jim_CmdProc cmdProc, void *privData); int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp, char *cmdName, Jim_Obj *argListObjPtr, Jim_Obj *bodyObjPtr, int arityMin, int arityMax); |