Fossil SCM

Update autosetup to the latest version. This fixes bootstrap on systems with older compilers. Now './configure; make' works on Haiku R1/Alpha 3.

steveb 2011-07-22 22:07 trunk
Commit c32b23d6261f2ff21753133c56ae3edc9f614f40
--- autosetup/autosetup
+++ autosetup/autosetup
@@ -1,7 +1,7 @@
11
#!/bin/sh
2
-# Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
2
+# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
33
# All rights reserved
44
# vim:se syntax=tcl:
55
# \
66
dir=`dirname "$0"`; exec `"$dir/find-tclsh" || echo false` "$0" "$@"
77
@@ -84,11 +84,11 @@
8484
help:=local => "display help and options. Optionally specify a module name, such as --help=system"
8585
version => "display the version of autosetup"
8686
ref:=text manual:=text
8787
reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
8888
debug => "display debugging output as autosetup runs"
89
- install => "install autosetup to the current directory (in the 'autosetup/' subdirectory)"
89
+ install:=. => "install autosetup to the current or given directory (in the 'autosetup/' subdirectory)"
9090
force init => "create an initial 'configure' script if none exists"
9191
# Undocumented options
9292
option-checking=1
9393
nopager
9494
quiet
@@ -133,13 +133,13 @@
133133
if {[opt-bool init]} {
134134
use init
135135
autosetup_init
136136
}
137137
138
- if {[opt-bool install]} {
138
+ if {[opt-val install] ne ""} {
139139
use install
140
- autosetup_install
140
+ autosetup_install [opt-val install]
141141
}
142142
143143
if {![file exists $autosetup(autodef)]} {
144144
# Check for invalid option first
145145
options {}
@@ -1299,12 +1299,13 @@
12991299
# Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
13001300
# All rights reserved
13011301
13021302
# Module which can install autosetup
13031303
1304
-proc autosetup_install {} {
1304
+proc autosetup_install {dir} {
13051305
if {[catch {
1306
+ cd $dir
13061307
file mkdir autosetup
13071308
13081309
set f [open autosetup/autosetup w]
13091310
13101311
set publicmodules {}
13111312
--- autosetup/autosetup
+++ autosetup/autosetup
@@ -1,7 +1,7 @@
1 #!/bin/sh
2 # Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
3 # All rights reserved
4 # vim:se syntax=tcl:
5 # \
6 dir=`dirname "$0"`; exec `"$dir/find-tclsh" || echo false` "$0" "$@"
7
@@ -84,11 +84,11 @@
84 help:=local => "display help and options. Optionally specify a module name, such as --help=system"
85 version => "display the version of autosetup"
86 ref:=text manual:=text
87 reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
88 debug => "display debugging output as autosetup runs"
89 install => "install autosetup to the current directory (in the 'autosetup/' subdirectory)"
90 force init => "create an initial 'configure' script if none exists"
91 # Undocumented options
92 option-checking=1
93 nopager
94 quiet
@@ -133,13 +133,13 @@
133 if {[opt-bool init]} {
134 use init
135 autosetup_init
136 }
137
138 if {[opt-bool install]} {
139 use install
140 autosetup_install
141 }
142
143 if {![file exists $autosetup(autodef)]} {
144 # Check for invalid option first
145 options {}
@@ -1299,12 +1299,13 @@
1299 # Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
1300 # All rights reserved
1301
1302 # Module which can install autosetup
1303
1304 proc autosetup_install {} {
1305 if {[catch {
 
1306 file mkdir autosetup
1307
1308 set f [open autosetup/autosetup w]
1309
1310 set publicmodules {}
1311
--- autosetup/autosetup
+++ autosetup/autosetup
@@ -1,7 +1,7 @@
1 #!/bin/sh
2 # Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
3 # All rights reserved
4 # vim:se syntax=tcl:
5 # \
6 dir=`dirname "$0"`; exec `"$dir/find-tclsh" || echo false` "$0" "$@"
7
@@ -84,11 +84,11 @@
84 help:=local => "display help and options. Optionally specify a module name, such as --help=system"
85 version => "display the version of autosetup"
86 ref:=text manual:=text
87 reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
88 debug => "display debugging output as autosetup runs"
89 install:=. => "install autosetup to the current or given directory (in the 'autosetup/' subdirectory)"
90 force init => "create an initial 'configure' script if none exists"
91 # Undocumented options
92 option-checking=1
93 nopager
94 quiet
@@ -133,13 +133,13 @@
133 if {[opt-bool init]} {
134 use init
135 autosetup_init
136 }
137
138 if {[opt-val install] ne ""} {
139 use install
140 autosetup_install [opt-val install]
141 }
142
143 if {![file exists $autosetup(autodef)]} {
144 # Check for invalid option first
145 options {}
@@ -1299,12 +1299,13 @@
1299 # Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
1300 # All rights reserved
1301
1302 # Module which can install autosetup
1303
1304 proc autosetup_install {dir} {
1305 if {[catch {
1306 cd $dir
1307 file mkdir autosetup
1308
1309 set f [open autosetup/autosetup w]
1310
1311 set publicmodules {}
1312
--- autosetup/find-tclsh
+++ autosetup/find-tclsh
@@ -10,5 +10,6 @@
1010
for cc in ${CC_FOR_BUILD:-cc} gcc; do
1111
{ $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
1212
"$d/jimsh0" "$d/test-tclsh" && exit 0
1313
done
1414
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
15
+echo false
1516
--- autosetup/find-tclsh
+++ autosetup/find-tclsh
@@ -10,5 +10,6 @@
10 for cc in ${CC_FOR_BUILD:-cc} gcc; do
11 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
12 "$d/jimsh0" "$d/test-tclsh" && exit 0
13 done
14 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
 
15
--- autosetup/find-tclsh
+++ autosetup/find-tclsh
@@ -10,5 +10,6 @@
10 for cc in ${CC_FOR_BUILD:-cc} gcc; do
11 { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
12 "$d/jimsh0" "$d/test-tclsh" && exit 0
13 done
14 echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
15 echo false
16
+27 -41
--- autosetup/jimsh0.c
+++ autosetup/jimsh0.c
@@ -2597,11 +2597,11 @@
25972597
25982598
static int aio_cmd_buffering(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
25992599
{
26002600
AioFile *af = Jim_CmdPrivData(interp);
26012601
2602
- static const char *options[] = {
2602
+ static const char * const options[] = {
26032603
"none",
26042604
"line",
26052605
"full",
26062606
NULL
26072607
};
@@ -5156,17 +5156,17 @@
51565156
return result;
51575157
}
51585158
51595159
void Jim_ReapDetachedPids(struct WaitInfoTable *table)
51605160
{
5161
+ struct WaitInfo *waitPtr;
5162
+ int count;
5163
+
51615164
if (!table) {
51625165
return;
51635166
}
51645167
5165
- struct WaitInfo *waitPtr;
5166
- int count;
5167
-
51685168
for (waitPtr = table->info, count = table->used; count > 0; waitPtr++, count--) {
51695169
if (waitPtr->flags & WI_DETACHED) {
51705170
int status;
51715171
int pid = waitpid(waitPtr->pid, &status, WNOHANG);
51725172
if (pid > 0) {
@@ -6365,30 +6365,30 @@
63656365
return JIM_OK;
63666366
}
63676367
int Jim_InitStaticExtensions(Jim_Interp *interp)
63686368
{
63696369
extern int Jim_bootstrapInit(Jim_Interp *);
6370
-Jim_bootstrapInit(interp);
63716370
extern int Jim_aioInit(Jim_Interp *);
6372
-Jim_aioInit(interp);
63736371
extern int Jim_readdirInit(Jim_Interp *);
6374
-Jim_readdirInit(interp);
63756372
extern int Jim_globInit(Jim_Interp *);
6376
-Jim_globInit(interp);
63776373
extern int Jim_regexpInit(Jim_Interp *);
6378
-Jim_regexpInit(interp);
63796374
extern int Jim_fileInit(Jim_Interp *);
6375
+extern int Jim_execInit(Jim_Interp *);
6376
+extern int Jim_clockInit(Jim_Interp *);
6377
+extern int Jim_arrayInit(Jim_Interp *);
6378
+extern int Jim_stdlibInit(Jim_Interp *);
6379
+extern int Jim_tclcompatInit(Jim_Interp *);
6380
+Jim_bootstrapInit(interp);
6381
+Jim_aioInit(interp);
6382
+Jim_readdirInit(interp);
6383
+Jim_globInit(interp);
6384
+Jim_regexpInit(interp);
63806385
Jim_fileInit(interp);
6381
-extern int Jim_execInit(Jim_Interp *);
63826386
Jim_execInit(interp);
6383
-extern int Jim_clockInit(Jim_Interp *);
63846387
Jim_clockInit(interp);
6385
-extern int Jim_arrayInit(Jim_Interp *);
63866388
Jim_arrayInit(interp);
6387
-extern int Jim_stdlibInit(Jim_Interp *);
63886389
Jim_stdlibInit(interp);
6389
-extern int Jim_tclcompatInit(Jim_Interp *);
63906390
Jim_tclcompatInit(interp);
63916391
return JIM_OK;
63926392
}
63936393
63946394
/* Jim - A small embeddable Tcl interpreter
@@ -16669,15 +16669,16 @@
1666916669
i = 1;
1667016670
for (d = 0; d < cmd->u.proc.argListLen; d++) {
1667116671
Jim_Obj *nameObjPtr = cmd->u.proc.arglist[d].nameObjPtr;
1667216672
if (d == cmd->u.proc.argsPos) {
1667316673
/* assign $args */
16674
+ Jim_Obj *listObjPtr;
1667416675
int argsLen = 0;
1667516676
if (cmd->u.proc.reqArity + cmd->u.proc.optArity < argc - 1) {
1667616677
argsLen = argc - 1 - (cmd->u.proc.reqArity + cmd->u.proc.optArity);
1667716678
}
16678
- Jim_Obj *listObjPtr = Jim_NewListObj(interp, &argv[i], argsLen);
16679
+ listObjPtr = Jim_NewListObj(interp, &argv[i], argsLen);
1667916680
1668016681
/* It is possible to rename args. */
1668116682
if (cmd->u.proc.arglist[d].defaultObjPtr) {
1668216683
nameObjPtr =cmd->u.proc.arglist[d].defaultObjPtr;
1668316684
}
@@ -16813,11 +16814,10 @@
1681316814
{
1681416815
FILE *fp;
1681516816
char *buf;
1681616817
Jim_Obj *scriptObjPtr;
1681716818
Jim_Obj *prevScriptObj;
16818
- Jim_Stack *prevLocalProcs;
1681916819
struct stat sb;
1682016820
int retcode;
1682116821
int readlen;
1682216822
struct JimParseResult result;
1682316823
@@ -16872,20 +16872,12 @@
1687216872
}
1687316873
1687416874
prevScriptObj = interp->currentScriptObj;
1687516875
interp->currentScriptObj = scriptObjPtr;
1687616876
16877
- /* Install a new stack for local procs */
16878
- prevLocalProcs = interp->localProcs;
16879
- interp->localProcs = NULL;
16880
-
1688116877
retcode = Jim_EvalObj(interp, scriptObjPtr);
1688216878
16883
- /* Delete any local procs */
16884
- JimDeleteLocalProcs(interp);
16885
- interp->localProcs = prevLocalProcs;
16886
-
1688716879
/* Handle the JIM_RETURN return code */
1688816880
if (retcode == JIM_RETURN) {
1688916881
if (--interp->returnLevel <= 0) {
1689016882
retcode = interp->returnCode;
1689116883
interp->returnCode = JIM_OK;
@@ -18366,11 +18358,11 @@
1836618358
}
1836718359
1836818360
/* [lsort] */
1836918361
static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const argv[])
1837018362
{
18371
- const char *options[] = {
18363
+ static const char * const options[] = {
1837218364
"-ascii", "-nocase", "-increasing", "-decreasing", "-command", "-integer", "-index", NULL
1837318365
};
1837418366
enum
1837518367
{ OPT_ASCII, OPT_NOCASE, OPT_INCREASING, OPT_DECREASING, OPT_COMMAND, OPT_INTEGER, OPT_INDEX };
1837618368
Jim_Obj *resObj;
@@ -18488,11 +18480,11 @@
1848818480
1848918481
/* [debug] */
1849018482
static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
1849118483
{
1849218484
#ifdef JIM_DEBUG_COMMAND
18493
- const char *options[] = {
18485
+ static const char * const options[] = {
1849418486
"refcount", "objcount", "objects", "invstr", "scriptlen", "exprlen",
1849518487
"exprbc", "show",
1849618488
NULL
1849718489
};
1849818490
enum
@@ -18693,32 +18685,23 @@
1869318685
1869418686
/* [eval] */
1869518687
static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
1869618688
{
1869718689
int rc;
18698
- Jim_Stack *prevLocalProcs;
1869918690
1870018691
if (argc < 2) {
1870118692
Jim_WrongNumArgs(interp, 1, argv, "script ?...?");
1870218693
return JIM_ERR;
1870318694
}
1870418695
18705
- /* Install a new stack for local procs */
18706
- prevLocalProcs = interp->localProcs;
18707
- interp->localProcs = NULL;
18708
-
1870918696
if (argc == 2) {
1871018697
rc = Jim_EvalObj(interp, argv[1]);
1871118698
}
1871218699
else {
1871318700
rc = Jim_EvalObj(interp, Jim_ConcatObj(interp, argc - 1, argv + 1));
1871418701
}
1871518702
18716
- /* Delete any local procs */
18717
- JimDeleteLocalProcs(interp);
18718
- interp->localProcs = prevLocalProcs;
18719
-
1872018703
if (rc == JIM_ERR) {
1872118704
/* eval is "interesting", so add a stack frame here */
1872218705
interp->addStackTrace++;
1872318706
}
1872418707
return rc;
@@ -19504,12 +19487,12 @@
1950419487
else {
1950519488
exitCode = Jim_EvalObj(interp, argv[0]);
1950619489
}
1950719490
interp->signal_level -= sig;
1950819491
19509
- /* Catch or pass through? Only the first 64 codes can be passed through */
19510
- if (exitCode >= 0 && exitCode < (int)sizeof(mask) && ((1 << exitCode) & mask) == 0) {
19492
+ /* Catch or pass through? Only the first 32/64 codes can be passed through */
19493
+ if (exitCode >= 0 && exitCode < (int)sizeof(mask) * 8 && ((1 << exitCode) & mask) == 0) {
1951119494
/* Not caught, pass it up */
1951219495
return exitCode;
1951319496
}
1951419497
1951519498
if (sig && exitCode == JIM_SIGNAL) {
@@ -19736,11 +19719,11 @@
1973619719
/* [dict] */
1973719720
static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
1973819721
{
1973919722
Jim_Obj *objPtr;
1974019723
int option;
19741
- const char *options[] = {
19724
+ static const char * const options[] = {
1974219725
"create", "get", "set", "unset", "exists", "keys", "merge", "size", "with", NULL
1974319726
};
1974419727
enum
1974519728
{
1974619729
OPT_CREATE, OPT_GET, OPT_SET, OPT_UNSET, OPT_EXIST, OPT_KEYS, OPT_MERGE, OPT_SIZE, OPT_WITH,
@@ -19852,11 +19835,11 @@
1985219835
}
1985319836
1985419837
/* [subst] */
1985519838
static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
1985619839
{
19857
- const char *options[] = {
19840
+ static const char * const options[] = {
1985819841
"-nobackslashes", "-nocommands", "-novariables", NULL
1985919842
};
1986019843
enum
1986119844
{ OPT_NOBACKSLASHES, OPT_NOCOMMANDS, OPT_NOVARIABLES };
1986219845
int i;
@@ -21399,10 +21382,11 @@
2139921382
#endif
2140021383
#include <errno.h>
2140121384
#include <string.h>
2140221385
2140321386
#ifdef USE_LINENOISE
21387
+#include <unistd.h>
2140421388
#include "linenoise.h"
2140521389
#else
2140621390
2140721391
#define MAX_LINE_LEN 512
2140821392
@@ -21427,11 +21411,11 @@
2142721411
char *history_file = NULL;
2142821412
#ifdef USE_LINENOISE
2142921413
const char *home;
2143021414
2143121415
home = getenv("HOME");
21432
- if (home) {
21416
+ if (home && isatty(STDIN_FILENO)) {
2143321417
int history_len = strlen(home) + sizeof("/.jim_history");
2143421418
history_file = Jim_Alloc(history_len);
2143521419
snprintf(history_file, history_len, "%s/.jim_history", home);
2143621420
linenoiseHistoryLoad(history_file);
2143721421
}
@@ -21504,11 +21488,13 @@
2150421488
Jim_DecrRefCount(interp, scriptObjPtr);
2150521489
continue;
2150621490
}
2150721491
2150821492
linenoiseHistoryAdd(Jim_String(scriptObjPtr));
21509
- linenoiseHistorySave(history_file);
21493
+ if (history_file) {
21494
+ linenoiseHistorySave(history_file);
21495
+ }
2151021496
#endif
2151121497
retcode = Jim_EvalObj(interp, scriptObjPtr);
2151221498
Jim_DecrRefCount(interp, scriptObjPtr);
2151321499
2151421500
2151521501
--- autosetup/jimsh0.c
+++ autosetup/jimsh0.c
@@ -2597,11 +2597,11 @@
2597
2598 static int aio_cmd_buffering(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
2599 {
2600 AioFile *af = Jim_CmdPrivData(interp);
2601
2602 static const char *options[] = {
2603 "none",
2604 "line",
2605 "full",
2606 NULL
2607 };
@@ -5156,17 +5156,17 @@
5156 return result;
5157 }
5158
5159 void Jim_ReapDetachedPids(struct WaitInfoTable *table)
5160 {
 
 
 
5161 if (!table) {
5162 return;
5163 }
5164
5165 struct WaitInfo *waitPtr;
5166 int count;
5167
5168 for (waitPtr = table->info, count = table->used; count > 0; waitPtr++, count--) {
5169 if (waitPtr->flags & WI_DETACHED) {
5170 int status;
5171 int pid = waitpid(waitPtr->pid, &status, WNOHANG);
5172 if (pid > 0) {
@@ -6365,30 +6365,30 @@
6365 return JIM_OK;
6366 }
6367 int Jim_InitStaticExtensions(Jim_Interp *interp)
6368 {
6369 extern int Jim_bootstrapInit(Jim_Interp *);
6370 Jim_bootstrapInit(interp);
6371 extern int Jim_aioInit(Jim_Interp *);
6372 Jim_aioInit(interp);
6373 extern int Jim_readdirInit(Jim_Interp *);
6374 Jim_readdirInit(interp);
6375 extern int Jim_globInit(Jim_Interp *);
6376 Jim_globInit(interp);
6377 extern int Jim_regexpInit(Jim_Interp *);
6378 Jim_regexpInit(interp);
6379 extern int Jim_fileInit(Jim_Interp *);
 
 
 
 
 
 
 
 
 
 
6380 Jim_fileInit(interp);
6381 extern int Jim_execInit(Jim_Interp *);
6382 Jim_execInit(interp);
6383 extern int Jim_clockInit(Jim_Interp *);
6384 Jim_clockInit(interp);
6385 extern int Jim_arrayInit(Jim_Interp *);
6386 Jim_arrayInit(interp);
6387 extern int Jim_stdlibInit(Jim_Interp *);
6388 Jim_stdlibInit(interp);
6389 extern int Jim_tclcompatInit(Jim_Interp *);
6390 Jim_tclcompatInit(interp);
6391 return JIM_OK;
6392 }
6393
6394 /* Jim - A small embeddable Tcl interpreter
@@ -16669,15 +16669,16 @@
16669 i = 1;
16670 for (d = 0; d < cmd->u.proc.argListLen; d++) {
16671 Jim_Obj *nameObjPtr = cmd->u.proc.arglist[d].nameObjPtr;
16672 if (d == cmd->u.proc.argsPos) {
16673 /* assign $args */
 
16674 int argsLen = 0;
16675 if (cmd->u.proc.reqArity + cmd->u.proc.optArity < argc - 1) {
16676 argsLen = argc - 1 - (cmd->u.proc.reqArity + cmd->u.proc.optArity);
16677 }
16678 Jim_Obj *listObjPtr = Jim_NewListObj(interp, &argv[i], argsLen);
16679
16680 /* It is possible to rename args. */
16681 if (cmd->u.proc.arglist[d].defaultObjPtr) {
16682 nameObjPtr =cmd->u.proc.arglist[d].defaultObjPtr;
16683 }
@@ -16813,11 +16814,10 @@
16813 {
16814 FILE *fp;
16815 char *buf;
16816 Jim_Obj *scriptObjPtr;
16817 Jim_Obj *prevScriptObj;
16818 Jim_Stack *prevLocalProcs;
16819 struct stat sb;
16820 int retcode;
16821 int readlen;
16822 struct JimParseResult result;
16823
@@ -16872,20 +16872,12 @@
16872 }
16873
16874 prevScriptObj = interp->currentScriptObj;
16875 interp->currentScriptObj = scriptObjPtr;
16876
16877 /* Install a new stack for local procs */
16878 prevLocalProcs = interp->localProcs;
16879 interp->localProcs = NULL;
16880
16881 retcode = Jim_EvalObj(interp, scriptObjPtr);
16882
16883 /* Delete any local procs */
16884 JimDeleteLocalProcs(interp);
16885 interp->localProcs = prevLocalProcs;
16886
16887 /* Handle the JIM_RETURN return code */
16888 if (retcode == JIM_RETURN) {
16889 if (--interp->returnLevel <= 0) {
16890 retcode = interp->returnCode;
16891 interp->returnCode = JIM_OK;
@@ -18366,11 +18358,11 @@
18366 }
18367
18368 /* [lsort] */
18369 static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const argv[])
18370 {
18371 const char *options[] = {
18372 "-ascii", "-nocase", "-increasing", "-decreasing", "-command", "-integer", "-index", NULL
18373 };
18374 enum
18375 { OPT_ASCII, OPT_NOCASE, OPT_INCREASING, OPT_DECREASING, OPT_COMMAND, OPT_INTEGER, OPT_INDEX };
18376 Jim_Obj *resObj;
@@ -18488,11 +18480,11 @@
18488
18489 /* [debug] */
18490 static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
18491 {
18492 #ifdef JIM_DEBUG_COMMAND
18493 const char *options[] = {
18494 "refcount", "objcount", "objects", "invstr", "scriptlen", "exprlen",
18495 "exprbc", "show",
18496 NULL
18497 };
18498 enum
@@ -18693,32 +18685,23 @@
18693
18694 /* [eval] */
18695 static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
18696 {
18697 int rc;
18698 Jim_Stack *prevLocalProcs;
18699
18700 if (argc < 2) {
18701 Jim_WrongNumArgs(interp, 1, argv, "script ?...?");
18702 return JIM_ERR;
18703 }
18704
18705 /* Install a new stack for local procs */
18706 prevLocalProcs = interp->localProcs;
18707 interp->localProcs = NULL;
18708
18709 if (argc == 2) {
18710 rc = Jim_EvalObj(interp, argv[1]);
18711 }
18712 else {
18713 rc = Jim_EvalObj(interp, Jim_ConcatObj(interp, argc - 1, argv + 1));
18714 }
18715
18716 /* Delete any local procs */
18717 JimDeleteLocalProcs(interp);
18718 interp->localProcs = prevLocalProcs;
18719
18720 if (rc == JIM_ERR) {
18721 /* eval is "interesting", so add a stack frame here */
18722 interp->addStackTrace++;
18723 }
18724 return rc;
@@ -19504,12 +19487,12 @@
19504 else {
19505 exitCode = Jim_EvalObj(interp, argv[0]);
19506 }
19507 interp->signal_level -= sig;
19508
19509 /* Catch or pass through? Only the first 64 codes can be passed through */
19510 if (exitCode >= 0 && exitCode < (int)sizeof(mask) && ((1 << exitCode) & mask) == 0) {
19511 /* Not caught, pass it up */
19512 return exitCode;
19513 }
19514
19515 if (sig && exitCode == JIM_SIGNAL) {
@@ -19736,11 +19719,11 @@
19736 /* [dict] */
19737 static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
19738 {
19739 Jim_Obj *objPtr;
19740 int option;
19741 const char *options[] = {
19742 "create", "get", "set", "unset", "exists", "keys", "merge", "size", "with", NULL
19743 };
19744 enum
19745 {
19746 OPT_CREATE, OPT_GET, OPT_SET, OPT_UNSET, OPT_EXIST, OPT_KEYS, OPT_MERGE, OPT_SIZE, OPT_WITH,
@@ -19852,11 +19835,11 @@
19852 }
19853
19854 /* [subst] */
19855 static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
19856 {
19857 const char *options[] = {
19858 "-nobackslashes", "-nocommands", "-novariables", NULL
19859 };
19860 enum
19861 { OPT_NOBACKSLASHES, OPT_NOCOMMANDS, OPT_NOVARIABLES };
19862 int i;
@@ -21399,10 +21382,11 @@
21399 #endif
21400 #include <errno.h>
21401 #include <string.h>
21402
21403 #ifdef USE_LINENOISE
 
21404 #include "linenoise.h"
21405 #else
21406
21407 #define MAX_LINE_LEN 512
21408
@@ -21427,11 +21411,11 @@
21427 char *history_file = NULL;
21428 #ifdef USE_LINENOISE
21429 const char *home;
21430
21431 home = getenv("HOME");
21432 if (home) {
21433 int history_len = strlen(home) + sizeof("/.jim_history");
21434 history_file = Jim_Alloc(history_len);
21435 snprintf(history_file, history_len, "%s/.jim_history", home);
21436 linenoiseHistoryLoad(history_file);
21437 }
@@ -21504,11 +21488,13 @@
21504 Jim_DecrRefCount(interp, scriptObjPtr);
21505 continue;
21506 }
21507
21508 linenoiseHistoryAdd(Jim_String(scriptObjPtr));
21509 linenoiseHistorySave(history_file);
 
 
21510 #endif
21511 retcode = Jim_EvalObj(interp, scriptObjPtr);
21512 Jim_DecrRefCount(interp, scriptObjPtr);
21513
21514
21515
--- autosetup/jimsh0.c
+++ autosetup/jimsh0.c
@@ -2597,11 +2597,11 @@
2597
2598 static int aio_cmd_buffering(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
2599 {
2600 AioFile *af = Jim_CmdPrivData(interp);
2601
2602 static const char * const options[] = {
2603 "none",
2604 "line",
2605 "full",
2606 NULL
2607 };
@@ -5156,17 +5156,17 @@
5156 return result;
5157 }
5158
5159 void Jim_ReapDetachedPids(struct WaitInfoTable *table)
5160 {
5161 struct WaitInfo *waitPtr;
5162 int count;
5163
5164 if (!table) {
5165 return;
5166 }
5167
 
 
 
5168 for (waitPtr = table->info, count = table->used; count > 0; waitPtr++, count--) {
5169 if (waitPtr->flags & WI_DETACHED) {
5170 int status;
5171 int pid = waitpid(waitPtr->pid, &status, WNOHANG);
5172 if (pid > 0) {
@@ -6365,30 +6365,30 @@
6365 return JIM_OK;
6366 }
6367 int Jim_InitStaticExtensions(Jim_Interp *interp)
6368 {
6369 extern int Jim_bootstrapInit(Jim_Interp *);
 
6370 extern int Jim_aioInit(Jim_Interp *);
 
6371 extern int Jim_readdirInit(Jim_Interp *);
 
6372 extern int Jim_globInit(Jim_Interp *);
 
6373 extern int Jim_regexpInit(Jim_Interp *);
 
6374 extern int Jim_fileInit(Jim_Interp *);
6375 extern int Jim_execInit(Jim_Interp *);
6376 extern int Jim_clockInit(Jim_Interp *);
6377 extern int Jim_arrayInit(Jim_Interp *);
6378 extern int Jim_stdlibInit(Jim_Interp *);
6379 extern int Jim_tclcompatInit(Jim_Interp *);
6380 Jim_bootstrapInit(interp);
6381 Jim_aioInit(interp);
6382 Jim_readdirInit(interp);
6383 Jim_globInit(interp);
6384 Jim_regexpInit(interp);
6385 Jim_fileInit(interp);
 
6386 Jim_execInit(interp);
 
6387 Jim_clockInit(interp);
 
6388 Jim_arrayInit(interp);
 
6389 Jim_stdlibInit(interp);
 
6390 Jim_tclcompatInit(interp);
6391 return JIM_OK;
6392 }
6393
6394 /* Jim - A small embeddable Tcl interpreter
@@ -16669,15 +16669,16 @@
16669 i = 1;
16670 for (d = 0; d < cmd->u.proc.argListLen; d++) {
16671 Jim_Obj *nameObjPtr = cmd->u.proc.arglist[d].nameObjPtr;
16672 if (d == cmd->u.proc.argsPos) {
16673 /* assign $args */
16674 Jim_Obj *listObjPtr;
16675 int argsLen = 0;
16676 if (cmd->u.proc.reqArity + cmd->u.proc.optArity < argc - 1) {
16677 argsLen = argc - 1 - (cmd->u.proc.reqArity + cmd->u.proc.optArity);
16678 }
16679 listObjPtr = Jim_NewListObj(interp, &argv[i], argsLen);
16680
16681 /* It is possible to rename args. */
16682 if (cmd->u.proc.arglist[d].defaultObjPtr) {
16683 nameObjPtr =cmd->u.proc.arglist[d].defaultObjPtr;
16684 }
@@ -16813,11 +16814,10 @@
16814 {
16815 FILE *fp;
16816 char *buf;
16817 Jim_Obj *scriptObjPtr;
16818 Jim_Obj *prevScriptObj;
 
16819 struct stat sb;
16820 int retcode;
16821 int readlen;
16822 struct JimParseResult result;
16823
@@ -16872,20 +16872,12 @@
16872 }
16873
16874 prevScriptObj = interp->currentScriptObj;
16875 interp->currentScriptObj = scriptObjPtr;
16876
 
 
 
 
16877 retcode = Jim_EvalObj(interp, scriptObjPtr);
16878
 
 
 
 
16879 /* Handle the JIM_RETURN return code */
16880 if (retcode == JIM_RETURN) {
16881 if (--interp->returnLevel <= 0) {
16882 retcode = interp->returnCode;
16883 interp->returnCode = JIM_OK;
@@ -18366,11 +18358,11 @@
18358 }
18359
18360 /* [lsort] */
18361 static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const argv[])
18362 {
18363 static const char * const options[] = {
18364 "-ascii", "-nocase", "-increasing", "-decreasing", "-command", "-integer", "-index", NULL
18365 };
18366 enum
18367 { OPT_ASCII, OPT_NOCASE, OPT_INCREASING, OPT_DECREASING, OPT_COMMAND, OPT_INTEGER, OPT_INDEX };
18368 Jim_Obj *resObj;
@@ -18488,11 +18480,11 @@
18480
18481 /* [debug] */
18482 static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
18483 {
18484 #ifdef JIM_DEBUG_COMMAND
18485 static const char * const options[] = {
18486 "refcount", "objcount", "objects", "invstr", "scriptlen", "exprlen",
18487 "exprbc", "show",
18488 NULL
18489 };
18490 enum
@@ -18693,32 +18685,23 @@
18685
18686 /* [eval] */
18687 static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
18688 {
18689 int rc;
 
18690
18691 if (argc < 2) {
18692 Jim_WrongNumArgs(interp, 1, argv, "script ?...?");
18693 return JIM_ERR;
18694 }
18695
 
 
 
 
18696 if (argc == 2) {
18697 rc = Jim_EvalObj(interp, argv[1]);
18698 }
18699 else {
18700 rc = Jim_EvalObj(interp, Jim_ConcatObj(interp, argc - 1, argv + 1));
18701 }
18702
 
 
 
 
18703 if (rc == JIM_ERR) {
18704 /* eval is "interesting", so add a stack frame here */
18705 interp->addStackTrace++;
18706 }
18707 return rc;
@@ -19504,12 +19487,12 @@
19487 else {
19488 exitCode = Jim_EvalObj(interp, argv[0]);
19489 }
19490 interp->signal_level -= sig;
19491
19492 /* Catch or pass through? Only the first 32/64 codes can be passed through */
19493 if (exitCode >= 0 && exitCode < (int)sizeof(mask) * 8 && ((1 << exitCode) & mask) == 0) {
19494 /* Not caught, pass it up */
19495 return exitCode;
19496 }
19497
19498 if (sig && exitCode == JIM_SIGNAL) {
@@ -19736,11 +19719,11 @@
19719 /* [dict] */
19720 static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
19721 {
19722 Jim_Obj *objPtr;
19723 int option;
19724 static const char * const options[] = {
19725 "create", "get", "set", "unset", "exists", "keys", "merge", "size", "with", NULL
19726 };
19727 enum
19728 {
19729 OPT_CREATE, OPT_GET, OPT_SET, OPT_UNSET, OPT_EXIST, OPT_KEYS, OPT_MERGE, OPT_SIZE, OPT_WITH,
@@ -19852,11 +19835,11 @@
19835 }
19836
19837 /* [subst] */
19838 static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
19839 {
19840 static const char * const options[] = {
19841 "-nobackslashes", "-nocommands", "-novariables", NULL
19842 };
19843 enum
19844 { OPT_NOBACKSLASHES, OPT_NOCOMMANDS, OPT_NOVARIABLES };
19845 int i;
@@ -21399,10 +21382,11 @@
21382 #endif
21383 #include <errno.h>
21384 #include <string.h>
21385
21386 #ifdef USE_LINENOISE
21387 #include <unistd.h>
21388 #include "linenoise.h"
21389 #else
21390
21391 #define MAX_LINE_LEN 512
21392
@@ -21427,11 +21411,11 @@
21411 char *history_file = NULL;
21412 #ifdef USE_LINENOISE
21413 const char *home;
21414
21415 home = getenv("HOME");
21416 if (home && isatty(STDIN_FILENO)) {
21417 int history_len = strlen(home) + sizeof("/.jim_history");
21418 history_file = Jim_Alloc(history_len);
21419 snprintf(history_file, history_len, "%s/.jim_history", home);
21420 linenoiseHistoryLoad(history_file);
21421 }
@@ -21504,11 +21488,13 @@
21488 Jim_DecrRefCount(interp, scriptObjPtr);
21489 continue;
21490 }
21491
21492 linenoiseHistoryAdd(Jim_String(scriptObjPtr));
21493 if (history_file) {
21494 linenoiseHistorySave(history_file);
21495 }
21496 #endif
21497 retcode = Jim_EvalObj(interp, scriptObjPtr);
21498 Jim_DecrRefCount(interp, scriptObjPtr);
21499
21500
21501

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button