diff options
author | antirez <antirez> | 2005-03-17 21:39:24 +0000 |
---|---|---|
committer | antirez <antirez> | 2005-03-17 21:39:24 +0000 |
commit | 54746f5b4b838e8b22840215eae047bd4f997b56 (patch) | |
tree | 7ff2b0f875fcdc85a2b82d740d986291396bd4d2 | |
parent | cdf54b6cc919cb9fdb129a61bbe57c6e2d259a56 (diff) | |
download | jimtcl-54746f5b4b838e8b22840215eae047bd4f997b56.zip jimtcl-54746f5b4b838e8b22840215eae047bd4f997b56.tar.gz jimtcl-54746f5b4b838e8b22840215eae047bd4f997b56.tar.bz2 |
[lreverse]
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | jim.c | 25 |
4 files changed, 29 insertions, 3 deletions
@@ -1,3 +1,7 @@ +2005-03-17 15:56 antirez + + * ChangeLog, TODO: TODO file updated, things already done removed. + 2005-03-17 15:47 antirez * ChangeLog, jim.c: Applied PATCH #389 "debug command is missing @@ -215,6 +215,8 @@ Thanks to... - First of all, thanks to every guy that are listed in the AUTHORS file, that directly helped with code and ideas. Also check the ChangeLog file for additional credits about patches or bug reports. +- Elisa Manara that helped me to select this ill conceived name for + an interpreter. - Many people on the Tclers Chat that helped me to explore issues about the use and the implementation of the Tcl programming language. - David Welton for the tech info sharing and our chats about @@ -15,7 +15,6 @@ CORE COMMANDS - [onleave] command, executing something as soon as the current procedure returns. With no arguments it returns the script set, with one appends the onleave script. There should be a way to reset. -- List commands to add: [lreverse], [squeeze] OTHER COMMANDS NOT IN TCL BUT THAT SHOULD BE IN JIM @@ -1,7 +1,7 @@ /* Jim - A small embeddable Tcl interpreter * Copyright 2005 Salvatore Sanfilippo <antirez@invece.org> * - * $Id: jim.c,v 1.117 2005/03/17 14:47:35 antirez Exp $ + * $Id: jim.c,v 1.118 2005/03/17 21:39:24 antirez Exp $ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -9960,6 +9960,26 @@ static int Jim_SourceCoreCommand(Jim_Interp *interp, int argc, return retval; } +/* [lreverse] */ +static int Jim_LreverseCoreCommand(Jim_Interp *interp, int argc, + Jim_Obj *const *argv) +{ + Jim_Obj *revObjPtr, **ele; + int len; + + if (argc != 2) { + Jim_WrongNumArgs(interp, 1, argv, "list"); + return JIM_ERR; + } + JimListGetElements(interp, argv[1], &len, &ele); + len--; + revObjPtr = Jim_NewListObj(interp, NULL, 0); + while (len >= 0) + ListAppendElement(revObjPtr, ele[len--]); + Jim_SetResult(interp, revObjPtr); + return JIM_OK; +} + static struct { const char *name; Jim_CmdProc cmdProc; @@ -10017,6 +10037,7 @@ static struct { {"lrange", Jim_LrangeCoreCommand}, {"env", Jim_EnvCoreCommand}, {"source", Jim_SourceCoreCommand}, + {"lreverse", Jim_LreverseCoreCommand}, {NULL, NULL}, }; @@ -10135,7 +10156,7 @@ int Jim_InteractivePrompt(Jim_Interp *interp) printf("Welcome to Jim version %d.%d, " "Copyright (c) 2005 Salvatore Sanfilippo\n", JIM_VERSION / 100, JIM_VERSION % 100); - printf("CVS ID: $Id: jim.c,v 1.117 2005/03/17 14:47:35 antirez Exp $\n"); + printf("CVS ID: $Id: jim.c,v 1.118 2005/03/17 21:39:24 antirez Exp $\n"); while (1) { char buf[1024]; const char *result; |