summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-02 14:51:04 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-02 14:51:04 (GMT)
commit4f31953cdce3f382551e258f2ff7c157d7c4908f (patch)
tree26e138a11c8ea34a812efae189c0b32260bed314 /generic
parent41aa65744a309bd290f9d3a764be958446340687 (diff)
downloadtcl-4f31953cdce3f382551e258f2ff7c157d7c4908f.zip
tcl-4f31953cdce3f382551e258f2ff7c157d7c4908f.tar.gz
tcl-4f31953cdce3f382551e258f2ff7c157d7c4908f.tar.bz2
ANSIfy; generic/*.c now all done except for test code
Diffstat (limited to 'generic')
-rw-r--r--generic/regcomp.c266
-rw-r--r--generic/regex.h16
-rw-r--r--generic/regexec.c52
-rw-r--r--generic/tclCompCmds.c346
-rw-r--r--generic/tclCompExpr.c85
-rw-r--r--generic/tclDate.c10
-rw-r--r--generic/tclGetDate.y12
-rw-r--r--generic/tclParse.c221
-rw-r--r--generic/tclPipe.c187
-rw-r--r--generic/tclStubLib.c66
10 files changed, 635 insertions, 626 deletions
diff --git a/generic/regcomp.c b/generic/regcomp.c
index 29be00f..b94cb8f 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -38,155 +38,155 @@
/* =====^!^===== begin forwards =====^!^===== */
/* automatically gathered by fwd; do not hand-edit */
/* === regcomp.c === */
-int compile _ANSI_ARGS_((regex_t *, CONST chr *, size_t, int));
-static VOID moresubs _ANSI_ARGS_((struct vars *, int));
-static int freev _ANSI_ARGS_((struct vars *, int));
-static VOID makesearch _ANSI_ARGS_((struct vars *, struct nfa *));
-static struct subre *parse _ANSI_ARGS_((struct vars *, int, int, struct state *, struct state *));
-static struct subre *parsebranch _ANSI_ARGS_((struct vars *, int, int, struct state *, struct state *, int));
-static VOID parseqatom _ANSI_ARGS_((struct vars *, int, int, struct state *, struct state *, struct subre *));
-static VOID nonword _ANSI_ARGS_((struct vars *, int, struct state *, struct state *));
-static VOID word _ANSI_ARGS_((struct vars *, int, struct state *, struct state *));
-static int scannum _ANSI_ARGS_((struct vars *));
-static VOID repeat _ANSI_ARGS_((struct vars *, struct state *, struct state *, int, int));
-static VOID bracket _ANSI_ARGS_((struct vars *, struct state *, struct state *));
-static VOID cbracket _ANSI_ARGS_((struct vars *, struct state *, struct state *));
-static VOID brackpart _ANSI_ARGS_((struct vars *, struct state *, struct state *));
-static chr *scanplain _ANSI_ARGS_((struct vars *));
-static VOID leaders _ANSI_ARGS_((struct vars *, struct cvec *));
-static VOID onechr _ANSI_ARGS_((struct vars *, pchr, struct state *, struct state *));
-static VOID dovec _ANSI_ARGS_((struct vars *, struct cvec *, struct state *, struct state *));
-static celt nextleader _ANSI_ARGS_((struct vars *, pchr, pchr));
-static VOID wordchrs _ANSI_ARGS_((struct vars *));
-static struct subre *subre _ANSI_ARGS_((struct vars *, int, int, struct state *, struct state *));
-static VOID freesubre _ANSI_ARGS_((struct vars *, struct subre *));
-static VOID freesrnode _ANSI_ARGS_((struct vars *, struct subre *));
-static VOID optst _ANSI_ARGS_((struct vars *, struct subre *));
-static int numst _ANSI_ARGS_((struct subre *, int));
-static VOID markst _ANSI_ARGS_((struct subre *));
-static VOID cleanst _ANSI_ARGS_((struct vars *));
-static long nfatree _ANSI_ARGS_((struct vars *, struct subre *, FILE *));
-static long nfanode _ANSI_ARGS_((struct vars *, struct subre *, FILE *));
-static int newlacon _ANSI_ARGS_((struct vars *, struct state *, struct state *, int));
-static VOID freelacons _ANSI_ARGS_((struct subre *, int));
-static VOID rfree _ANSI_ARGS_((regex_t *));
-static VOID dump _ANSI_ARGS_((regex_t *, FILE *));
-static VOID dumpst _ANSI_ARGS_((struct subre *, FILE *, int));
-static VOID stdump _ANSI_ARGS_((struct subre *, FILE *, int));
-static char *stid _ANSI_ARGS_((struct subre *, char *, size_t));
+int compile(regex_t *, CONST chr *, size_t, int);
+static VOID moresubs(struct vars *, int);
+static int freev(struct vars *, int);
+static VOID makesearch(struct vars *, struct nfa *);
+static struct subre *parse(struct vars *, int, int, struct state *, struct state *);
+static struct subre *parsebranch(struct vars *, int, int, struct state *, struct state *, int);
+static VOID parseqatom(struct vars *, int, int, struct state *, struct state *, struct subre *);
+static VOID nonword(struct vars *, int, struct state *, struct state *);
+static VOID word(struct vars *, int, struct state *, struct state *);
+static int scannum(struct vars *);
+static VOID repeat(struct vars *, struct state *, struct state *, int, int);
+static VOID bracket(struct vars *, struct state *, struct state *);
+static VOID cbracket(struct vars *, struct state *, struct state *);
+static VOID brackpart(struct vars *, struct state *, struct state *);
+static chr *scanplain(struct vars *);
+static VOID leaders(struct vars *, struct cvec *);
+static VOID onechr(struct vars *, pchr, struct state *, struct state *);
+static VOID dovec(struct vars *, struct cvec *, struct state *, struct state *);
+static celt nextleader(struct vars *, pchr, pchr);
+static VOID wordchrs(struct vars *);
+static struct subre *subre(struct vars *, int, int, struct state *, struct state *);
+static VOID freesubre(struct vars *, struct subre *);
+static VOID freesrnode(struct vars *, struct subre *);
+static VOID optst(struct vars *, struct subre *);
+static int numst(struct subre *, int);
+static VOID markst(struct subre *);
+static VOID cleanst(struct vars *);
+static long nfatree(struct vars *, struct subre *, FILE *);
+static long nfanode(struct vars *, struct subre *, FILE *);
+static int newlacon(struct vars *, struct state *, struct state *, int);
+static VOID freelacons(struct subre *, int);
+static VOID rfree(regex_t *);
+static VOID dump(regex_t *, FILE *);
+static VOID dumpst(struct subre *, FILE *, int);
+static VOID stdump(struct subre *, FILE *, int);
+static char *stid(struct subre *, char *, size_t);
/* === regc_lex.c === */
-static VOID lexstart _ANSI_ARGS_((struct vars *));
-static VOID prefixes _ANSI_ARGS_((struct vars *));
-static VOID lexnest _ANSI_ARGS_((struct vars *, chr *, chr *));
-static VOID lexword _ANSI_ARGS_((struct vars *));
-static int next _ANSI_ARGS_((struct vars *));
-static int lexescape _ANSI_ARGS_((struct vars *));
-static chr lexdigits _ANSI_ARGS_((struct vars *, int, int, int));
-static int brenext _ANSI_ARGS_((struct vars *, pchr));
-static VOID skip _ANSI_ARGS_((struct vars *));
-static chr newline _ANSI_ARGS_((NOPARMS));
+static VOID lexstart(struct vars *);
+static VOID prefixes(struct vars *);
+static VOID lexnest(struct vars *, chr *, chr *);
+static VOID lexword(struct vars *);
+static int next(struct vars *);
+static int lexescape(struct vars *);
+static chr lexdigits(struct vars *, int, int, int);
+static int brenext(struct vars *, pchr);
+static VOID skip(struct vars *);
+static chr newline(NOPARMS);
#ifdef REG_DEBUG
-static chr *ch _ANSI_ARGS_((NOPARMS));
+static chr *ch(NOPARMS);
#endif
-static chr chrnamed _ANSI_ARGS_((struct vars *, chr *, chr *, pchr));
+static chr chrnamed(struct vars *, chr *, chr *, pchr);
/* === regc_color.c === */
-static VOID initcm _ANSI_ARGS_((struct vars *, struct colormap *));
-static VOID freecm _ANSI_ARGS_((struct colormap *));
-static VOID cmtreefree _ANSI_ARGS_((struct colormap *, union tree *, int));
-static color setcolor _ANSI_ARGS_((struct colormap *, pchr, pcolor));
-static color maxcolor _ANSI_ARGS_((struct colormap *));
-static color newcolor _ANSI_ARGS_((struct colormap *));
-static VOID freecolor _ANSI_ARGS_((struct colormap *, pcolor));
-static color pseudocolor _ANSI_ARGS_((struct colormap *));
-static color subcolor _ANSI_ARGS_((struct colormap *, pchr c));
-static color newsub _ANSI_ARGS_((struct colormap *, pcolor));
-static VOID subrange _ANSI_ARGS_((struct vars *, pchr, pchr, struct state *, struct state *));
-static VOID subblock _ANSI_ARGS_((struct vars *, pchr, struct state *, struct state *));
-static VOID okcolors _ANSI_ARGS_((struct nfa *, struct colormap *));
-static VOID colorchain _ANSI_ARGS_((struct colormap *, struct arc *));
-static VOID uncolorchain _ANSI_ARGS_((struct colormap *, struct arc *));
-static int singleton _ANSI_ARGS_((struct colormap *, pchr c));
-static VOID rainbow _ANSI_ARGS_((struct nfa *, struct colormap *, int, pcolor, struct state *, struct state *));
-static VOID colorcomplement _ANSI_ARGS_((struct nfa *, struct colormap *, int, struct state *, struct state *, struct state *));
+static VOID initcm(struct vars *, struct colormap *);
+static VOID freecm(struct colormap *);
+static VOID cmtreefree(struct colormap *, union tree *, int);
+static color setcolor(struct colormap *, pchr, pcolor);
+static color maxcolor(struct colormap *);
+static color newcolor(struct colormap *);
+static VOID freecolor(struct colormap *, pcolor);
+static color pseudocolor(struct colormap *);
+static color subcolor(struct colormap *, pchr c);
+static color newsub(struct colormap *, pcolor);
+static VOID subrange(struct vars *, pchr, pchr, struct state *, struct state *);
+static VOID subblock(struct vars *, pchr, struct state *, struct state *);
+static VOID okcolors(struct nfa *, struct colormap *);
+static VOID colorchain(struct colormap *, struct arc *);
+static VOID uncolorchain(struct colormap *, struct arc *);
+static int singleton(struct colormap *, pchr c);
+static VOID rainbow(struct nfa *, struct colormap *, int, pcolor, struct state *, struct state *);
+static VOID colorcomplement(struct nfa *, struct colormap *, int, struct state *, struct state *, struct state *);
#ifdef REG_DEBUG
-static VOID dumpcolors _ANSI_ARGS_((struct colormap *, FILE *));
-static VOID fillcheck _ANSI_ARGS_((struct colormap *, union tree *, int, FILE *));
-static VOID dumpchr _ANSI_ARGS_((pchr, FILE *));
+static VOID dumpcolors(struct colormap *, FILE *);
+static VOID fillcheck(struct colormap *, union tree *, int, FILE *);
+static VOID dumpchr(pchr, FILE *);
#endif
/* === regc_nfa.c === */
-static struct nfa *newnfa _ANSI_ARGS_((struct vars *, struct colormap *, struct nfa *));
-static VOID freenfa _ANSI_ARGS_((struct nfa *));
-static struct state *newstate _ANSI_ARGS_((struct nfa *));
-static struct state *newfstate _ANSI_ARGS_((struct nfa *, int flag));
-static VOID dropstate _ANSI_ARGS_((struct nfa *, struct state *));
-static VOID freestate _ANSI_ARGS_((struct nfa *, struct state *));
-static VOID destroystate _ANSI_ARGS_((struct nfa *, struct state *));
-static VOID newarc _ANSI_ARGS_((struct nfa *, int, pcolor, struct state *, struct state *));
-static struct arc *allocarc _ANSI_ARGS_((struct nfa *, struct state *));
-static VOID freearc _ANSI_ARGS_((struct nfa *, struct arc *));
-static struct arc *findarc _ANSI_ARGS_((struct state *, int, pcolor));
-static VOID cparc _ANSI_ARGS_((struct nfa *, struct arc *, struct state *, struct state *));
-static VOID moveins _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID copyins _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID moveouts _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID copyouts _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID cloneouts _ANSI_ARGS_((struct nfa *, struct state *, struct state *, struct state *, int));
-static VOID delsub _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID deltraverse _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID dupnfa _ANSI_ARGS_((struct nfa *, struct state *, struct state *, struct state *, struct state *));
-static VOID duptraverse _ANSI_ARGS_((struct nfa *, struct state *, struct state *));
-static VOID cleartraverse _ANSI_ARGS_((struct nfa *, struct state *));
-static VOID specialcolors _ANSI_ARGS_((struct nfa *));
-static long optimize _ANSI_ARGS_((struct nfa *, FILE *));
-static VOID pullback _ANSI_ARGS_((struct nfa *, FILE *));
-static int pull _ANSI_ARGS_((struct nfa *, struct arc *));
-static VOID pushfwd _ANSI_ARGS_((struct nfa *, FILE *));
-static int push _ANSI_ARGS_((struct nfa *, struct arc *));
+static struct nfa *newnfa(struct vars *, struct colormap *, struct nfa *);
+static VOID freenfa(struct nfa *);
+static struct state *newstate(struct nfa *);
+static struct state *newfstate(struct nfa *, int flag);
+static VOID dropstate(struct nfa *, struct state *);
+static VOID freestate(struct nfa *, struct state *);
+static VOID destroystate(struct nfa *, struct state *);
+static VOID newarc(struct nfa *, int, pcolor, struct state *, struct state *);
+static struct arc *allocarc(struct nfa *, struct state *);
+static VOID freearc(struct nfa *, struct arc *);
+static struct arc *findarc(struct state *, int, pcolor);
+static VOID cparc(struct nfa *, struct arc *, struct state *, struct state *);
+static VOID moveins(struct nfa *, struct state *, struct state *);
+static VOID copyins(struct nfa *, struct state *, struct state *);
+static VOID moveouts(struct nfa *, struct state *, struct state *);
+static VOID copyouts(struct nfa *, struct state *, struct state *);
+static VOID cloneouts(struct nfa *, struct state *, struct state *, struct state *, int);
+static VOID delsub(struct nfa *, struct state *, struct state *);
+static VOID deltraverse(struct nfa *, struct state *, struct state *);
+static VOID dupnfa(struct nfa *, struct state *, struct state *, struct state *, struct state *);
+static VOID duptraverse(struct nfa *, struct state *, struct state *);
+static VOID cleartraverse(struct nfa *, struct state *);
+static VOID specialcolors(struct nfa *);
+static long optimize(struct nfa *, FILE *);
+static VOID pullback(struct nfa *, FILE *);
+static int pull(struct nfa *, struct arc *);
+static VOID pushfwd(struct nfa *, FILE *);
+static int push(struct nfa *, struct arc *);
#define INCOMPATIBLE 1 /* destroys arc */
#define SATISFIED 2 /* constraint satisfied */
#define COMPATIBLE 3 /* compatible but not satisfied yet */
-static int combine _ANSI_ARGS_((struct arc *, struct arc *));
-static VOID fixempties _ANSI_ARGS_((struct nfa *, FILE *));
-static int unempty _ANSI_ARGS_((struct nfa *, struct arc *));
-static VOID cleanup _ANSI_ARGS_((struct nfa *));
-static VOID markreachable _ANSI_ARGS_((struct nfa *, struct state *, struct state *, struct state *));
-static VOID markcanreach _ANSI_ARGS_((struct nfa *, struct state *, struct state *, struct state *));
-static long analyze _ANSI_ARGS_((struct nfa *));
-static VOID compact _ANSI_ARGS_((struct nfa *, struct cnfa *));
-static VOID carcsort _ANSI_ARGS_((struct carc *, struct carc *));
-static VOID freecnfa _ANSI_ARGS_((struct cnfa *));
-static VOID dumpnfa _ANSI_ARGS_((struct nfa *, FILE *));
+static int combine(struct arc *, struct arc *);
+static VOID fixempties(struct nfa *, FILE *);
+static int unempty(struct nfa *, struct arc *);
+static VOID cleanup(struct nfa *);
+static VOID markreachable(struct nfa *, struct state *, struct state *, struct state *);
+static VOID markcanreach(struct nfa *, struct state *, struct state *, struct state *);
+static long analyze(struct nfa *);
+static VOID compact(struct nfa *, struct cnfa *);
+static VOID carcsort(struct carc *, struct carc *);
+static VOID freecnfa(struct cnfa *);
+static VOID dumpnfa(struct nfa *, FILE *);
#ifdef REG_DEBUG
-static VOID dumpstate _ANSI_ARGS_((struct state *, FILE *));
-static VOID dumparcs _ANSI_ARGS_((struct state *, FILE *));
-static int dumprarcs _ANSI_ARGS_((struct arc *, struct state *, FILE *, int));
-static VOID dumparc _ANSI_ARGS_((struct arc *, struct state *, FILE *));
+static VOID dumpstate(struct state *, FILE *);
+static VOID dumparcs(struct state *, FILE *);
+static int dumprarcs(struct arc *, struct state *, FILE *, int);
+static VOID dumparc(struct arc *, struct state *, FILE *);
#endif
-static VOID dumpcnfa _ANSI_ARGS_((struct cnfa *, FILE *));
+static VOID dumpcnfa(struct cnfa *, FILE *);
#ifdef REG_DEBUG
-static VOID dumpcstate _ANSI_ARGS_((int, struct carc *, struct cnfa *, FILE *));
+static VOID dumpcstate(int, struct carc *, struct cnfa *, FILE *);
#endif
/* === regc_cvec.c === */
-static struct cvec *newcvec _ANSI_ARGS_((int, int, int));
-static struct cvec *clearcvec _ANSI_ARGS_((struct cvec *));
-static VOID addchr _ANSI_ARGS_((struct cvec *, pchr));
-static VOID addrange _ANSI_ARGS_((struct cvec *, pchr, pchr));
-static VOID addmcce _ANSI_ARGS_((struct cvec *, chr *, chr *));
-static int haschr _ANSI_ARGS_((struct cvec *, pchr));
-static struct cvec *getcvec _ANSI_ARGS_((struct vars *, int, int, int));
-static VOID freecvec _ANSI_ARGS_((struct cvec *));
+static struct cvec *newcvec(int, int, int);
+static struct cvec *clearcvec(struct cvec *);
+static VOID addchr(struct cvec *, pchr);
+static VOID addrange(struct cvec *, pchr, pchr);
+static VOID addmcce(struct cvec *, chr *, chr *);
+static int haschr(struct cvec *, pchr);
+static struct cvec *getcvec(struct vars *, int, int, int);
+static VOID freecvec(struct cvec *);
/* === regc_locale.c === */
-static int nmcces _ANSI_ARGS_((struct vars *));
-static int nleaders _ANSI_ARGS_((struct vars *));
-static struct cvec *allmcces _ANSI_ARGS_((struct vars *, struct cvec *));
-static celt element _ANSI_ARGS_((struct vars *, chr *, chr *));
-static struct cvec *range _ANSI_ARGS_((struct vars *, celt, celt, int));
-static int before _ANSI_ARGS_((celt, celt));
-static struct cvec *eclass _ANSI_ARGS_((struct vars *, celt, int));
-static struct cvec *cclass _ANSI_ARGS_((struct vars *, chr *, chr *, int));
-static struct cvec *allcases _ANSI_ARGS_((struct vars *, pchr));
-static int cmp _ANSI_ARGS_((CONST chr *, CONST chr *, size_t));
-static int casecmp _ANSI_ARGS_((CONST chr *, CONST chr *, size_t));
+static int nmcces(struct vars *);
+static int nleaders(struct vars *);
+static struct cvec *allmcces(struct vars *, struct cvec *);
+static celt element(struct vars *, chr *, chr *);
+static struct cvec *range(struct vars *, celt, celt, int);
+static int before(celt, celt);
+static struct cvec *eclass(struct vars *, celt, int);
+static struct cvec *cclass(struct vars *, chr *, chr *, int);
+static struct cvec *allcases(struct vars *, pchr);
+static int cmp(CONST chr *, CONST chr *, size_t);
+static int casecmp(CONST chr *, CONST chr *, size_t);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
diff --git a/generic/regex.h b/generic/regex.h
index 8289a50..bb1080a 100644
--- a/generic/regex.h
+++ b/generic/regex.h
@@ -305,25 +305,25 @@ typedef struct {
/* automatically gathered by fwd; do not hand-edit */
/* === regproto.h === */
#ifndef __REG_NOCHAR
-int re_comp _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, int));
+int re_comp(regex_t *, __REG_CONST char *, size_t, int);
#endif
#ifndef __REG_NOFRONT
-int regcomp _ANSI_ARGS_((regex_t *, __REG_CONST char *, int));
+int regcomp(regex_t *, __REG_CONST char *, int);
#endif
#ifdef __REG_WIDE_T
-int __REG_WIDE_COMPILE _ANSI_ARGS_((regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int));
+int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
#endif
#ifndef __REG_NOCHAR
-int re_exec _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int));
+int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
#ifndef __REG_NOFRONT
-int regexec _ANSI_ARGS_((regex_t *, __REG_CONST char *, size_t, regmatch_t [], int));
+int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
#endif
#ifdef __REG_WIDE_T
-int __REG_WIDE_EXEC _ANSI_ARGS_((regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int));
+int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
-re_void regfree _ANSI_ARGS_((regex_t *));
-extern size_t regerror _ANSI_ARGS_((int, __REG_CONST regex_t *, char *, size_t));
+re_void regfree(regex_t *);
+extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
diff --git a/generic/regexec.c b/generic/regexec.c
index 41d49bd..5372fca 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -123,33 +123,33 @@ struct vars {
/* =====^!^===== begin forwards =====^!^===== */
/* automatically gathered by fwd; do not hand-edit */
/* === regexec.c === */
-int exec _ANSI_ARGS_((regex_t *, CONST chr *, size_t, rm_detail_t *, size_t, regmatch_t [], int));
-static int find _ANSI_ARGS_((struct vars *, struct cnfa *, struct colormap *));
-static int cfind _ANSI_ARGS_((struct vars *, struct cnfa *, struct colormap *));
-static int cfindloop _ANSI_ARGS_((struct vars *, struct cnfa *, struct colormap *, struct dfa *, struct dfa *, chr **));
-static VOID zapsubs _ANSI_ARGS_((regmatch_t *, size_t));
-static VOID zapmem _ANSI_ARGS_((struct vars *, struct subre *));
-static VOID subset _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int dissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int condissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int altdissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int cdissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int ccondissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int crevdissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int cbrdissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
-static int caltdissect _ANSI_ARGS_((struct vars *, struct subre *, chr *, chr *));
+int exec(regex_t *, CONST chr *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
+static int find(struct vars *, struct cnfa *, struct colormap *);
+static int cfind(struct vars *, struct cnfa *, struct colormap *);
+static int cfindloop(struct vars *, struct cnfa *, struct colormap *, struct dfa *, struct dfa *, chr **);
+static VOID zapsubs(regmatch_t *, size_t);
+static VOID zapmem(struct vars *, struct subre *);
+static VOID subset(struct vars *, struct subre *, chr *, chr *);
+static int dissect(struct vars *, struct subre *, chr *, chr *);
+static int condissect(struct vars *, struct subre *, chr *, chr *);
+static int altdissect(struct vars *, struct subre *, chr *, chr *);
+static int cdissect(struct vars *, struct subre *, chr *, chr *);
+static int ccondissect(struct vars *, struct subre *, chr *, chr *);
+static int crevdissect(struct vars *, struct subre *, chr *, chr *);
+static int cbrdissect(struct vars *, struct subre *, chr *, chr *);
+static int caltdissect(struct vars *, struct subre *, chr *, chr *);
/* === rege_dfa.c === */
-static chr *longest _ANSI_ARGS_((struct vars *, struct dfa *, chr *, chr *, int *));
-static chr *shortest _ANSI_ARGS_((struct vars *, struct dfa *, chr *, chr *, chr *, chr **, int *));
-static chr *lastcold _ANSI_ARGS_((struct vars *, struct dfa *));
-static struct dfa *newdfa _ANSI_ARGS_((struct vars *, struct cnfa *, struct colormap *, struct smalldfa *));
-static VOID freedfa _ANSI_ARGS_((struct dfa *));
-static unsigned hash _ANSI_ARGS_((unsigned *, int));
-static struct sset *initialize _ANSI_ARGS_((struct vars *, struct dfa *, chr *));
-static struct sset *miss _ANSI_ARGS_((struct vars *, struct dfa *, struct sset *, pcolor, chr *, chr *));
-static int lacon _ANSI_ARGS_((struct vars *, struct cnfa *, chr *, pcolor));
-static struct sset *getvacant _ANSI_ARGS_((struct vars *, struct dfa *, chr *, chr *));
-static struct sset *pickss _ANSI_ARGS_((struct vars *, struct dfa *, chr *, chr *));
+static chr *longest(struct vars *, struct dfa *, chr *, chr *, int *);
+static chr *shortest(struct vars *, struct dfa *, chr *, chr *, chr *, chr **, int *);
+static chr *lastcold(struct vars *, struct dfa *);
+static struct dfa *newdfa(struct vars *, struct cnfa *, struct colormap *, struct smalldfa *);
+static VOID freedfa(struct dfa *);
+static unsigned hash(unsigned *, int);
+static struct sset *initialize(struct vars *, struct dfa *, chr *);
+static struct sset *miss(struct vars *, struct dfa *, struct sset *, pcolor, chr *, chr *);
+static int lacon(struct vars *, struct cnfa *, chr *, pcolor);
+static struct sset *getvacant(struct vars *, struct dfa *, chr *, chr *);
+static struct sset *pickss(struct vars *, struct dfa *, chr *, chr *);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 6ed09ca..de87da3 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.80 2005/10/19 18:39:58 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.81 2005/11/02 14:51:04 dkf Exp $
*/
#include "tclInt.h"
@@ -20,7 +20,7 @@
/*
* Macro that encapsulates an efficiency trick that avoids a function call for
- * the simplest of compiles. The ANSI C "prototype" for this macro is:
+ * the simplest of compiles. The ANSI C "prototype" for this macro is:
*
* static void CompileWord(CompileEnv *envPtr, Tcl_Token *tokenPtr,
* Tcl_Interp *interp);
@@ -114,11 +114,12 @@
* Prototypes for procedures defined later in this file:
*/
-static ClientData DupForeachInfo _ANSI_ARGS_((ClientData clientData));
-static void FreeForeachInfo _ANSI_ARGS_((ClientData clientData));
-static int PushVarName _ANSI_ARGS_((Tcl_Interp *interp,
- Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags,
- int *localIndexPtr, int *simpleVarNamePtr, int *isScalarPtr));
+static ClientData DupForeachInfo(ClientData clientData);
+static void FreeForeachInfo(ClientData clientData);
+static int PushVarName(Tcl_Interp *interp,
+ Tcl_Token *varTokenPtr, CompileEnv *envPtr,
+ int flags, int *localIndexPtr,
+ int *simpleVarNamePtr, int *isScalarPtr);
/*
* Flags bits used by PushVarName.
@@ -145,7 +146,7 @@ AuxDataType tclForeachInfoType = {
* Procedure called to compile the "append" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -156,11 +157,11 @@ AuxDataType tclForeachInfoType = {
*/
int
-TclCompileAppendCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileAppendCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int simpleVarName, isScalar, localIndex, numWords;
@@ -195,7 +196,7 @@ TclCompileAppendCmd(interp, parsePtr, envPtr)
/*
* We are doing an assignment, otherwise TclCompileSetCmd was called, so
- * push the new value. This will need to be extended to push a value for
+ * push the new value. This will need to be extended to push a value for
* each argument.
*/
@@ -241,7 +242,7 @@ TclCompileAppendCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "break" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -252,11 +253,11 @@ TclCompileAppendCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileBreakCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileBreakCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
if (parsePtr->numWords != 1) {
return TCL_ERROR;
@@ -278,7 +279,7 @@ TclCompileBreakCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "catch" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -289,11 +290,11 @@ TclCompileBreakCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileCatchCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileCatchCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
JumpFixup jumpFixup;
Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr;
@@ -338,7 +339,7 @@ TclCompileCatchCmd(interp, parsePtr, envPtr)
resultNameTokenPtr[1].size, /*create*/ 1, VAR_SCALAR,
envPtr->procPtr);
} else {
- return TCL_ERROR;
+ return TCL_ERROR;
}
/* DKF */
if (parsePtr->numWords == 4) {
@@ -475,7 +476,7 @@ TclCompileCatchCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "continue" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -486,11 +487,11 @@ TclCompileCatchCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileContinueCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileContinueCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
* There should be no argument after the "continue".
@@ -516,7 +517,7 @@ TclCompileContinueCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "dict" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -527,11 +528,11 @@ TclCompileContinueCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileDictCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileDictCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int numWords, size, i;
@@ -1011,7 +1012,7 @@ TclCompileDictCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "expr" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -1022,11 +1023,11 @@ TclCompileDictCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileExprCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileExprCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *firstWordPtr;
@@ -1047,7 +1048,7 @@ TclCompileExprCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "for" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -1056,12 +1057,13 @@ TclCompileExprCmd(interp, parsePtr, envPtr)
*
*----------------------------------------------------------------------
*/
+
int
-TclCompileForCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileForCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr;
JumpFixup jumpEvalCondFixup;
@@ -1207,7 +1209,7 @@ TclCompileForCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "foreach" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -1218,11 +1220,11 @@ n*----------------------------------------------------------------------
*/
int
-TclCompileForeachCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileForeachCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Proc *procPtr = envPtr->procPtr;
ForeachInfo *infoPtr; /* Points to the structure describing this
@@ -1312,7 +1314,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr)
}
/*
- * Lots of copying going on here. Need a ListObj wizard to show a
+ * Lots of copying going on here. Need a ListObj wizard to show a
* better way.
*/
@@ -1337,7 +1339,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr)
}
/*
- * We will compile the foreach command. Reserve (numLists + 1) temporary
+ * We will compile the foreach command. Reserve (numLists + 1) temporary
* variables:
* - numLists temps to hold each value list
* - 1 temp for the loop counter (index of next element in each list)
@@ -1494,7 +1496,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr)
done:
for (loopIndex = 0; loopIndex < numLists; loopIndex++) {
- if (varvList[loopIndex] != (CONST char **) NULL) {
+ if (varvList[loopIndex] != NULL) {
ckfree((char *) varvList[loopIndex]);
}
}
@@ -1528,9 +1530,9 @@ TclCompileForeachCmd(interp, parsePtr, envPtr)
*/
static ClientData
-DupForeachInfo(clientData)
- ClientData clientData; /* The foreach command's compilation
- * auxiliary data to duplicate. */
+DupForeachInfo(
+ ClientData clientData) /* The foreach command's compilation auxiliary
+ * data to duplicate. */
{
register ForeachInfo *srcPtr = (ForeachInfo *) clientData;
ForeachInfo *dupPtr;
@@ -1578,9 +1580,9 @@ DupForeachInfo(clientData)
*/
static void
-FreeForeachInfo(clientData)
- ClientData clientData; /* The foreach command's compilation
- * auxiliary data to free. */
+FreeForeachInfo(
+ ClientData clientData) /* The foreach command's compilation auxiliary
+ * data to free. */
{
register ForeachInfo *infoPtr = (ForeachInfo *) clientData;
register ForeachVarList *listPtr;
@@ -1602,7 +1604,7 @@ FreeForeachInfo(clientData)
* Procedure called to compile the "if" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -1612,11 +1614,11 @@ FreeForeachInfo(clientData)
*----------------------------------------------------------------------
*/
int
-TclCompileIfCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileIfCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
JumpFixupArray jumpFalseFixupArray;
/* Used to fix the ifFalse jump after each
@@ -1913,7 +1915,7 @@ TclCompileIfCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "incr" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -1924,11 +1926,11 @@ TclCompileIfCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileIncrCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileIncrCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *incrTokenPtr;
int simpleVarName, isScalar, localIndex, haveImmValue, immValue;
@@ -2027,7 +2029,7 @@ TclCompileIncrCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "lappend" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2038,11 +2040,11 @@ TclCompileIncrCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileLappendCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileLappendCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int simpleVarName, isScalar, localIndex, numWords;
@@ -2079,7 +2081,7 @@ TclCompileLappendCmd(interp, parsePtr, envPtr)
&localIndex, &simpleVarName, &isScalar);
/*
- * If we are doing an assignment, push the new value. In the no values
+ * If we are doing an assignment, push the new value. In the no values
* case, create an empty object.
*/
@@ -2129,7 +2131,7 @@ TclCompileLappendCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "lassign" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2140,11 +2142,11 @@ TclCompileLappendCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileLassignCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileLassignCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int simpleVarName, isScalar, localIndex, numWords, idx;
@@ -2234,7 +2236,7 @@ TclCompileLassignCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "lindex" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2245,11 +2247,11 @@ TclCompileLassignCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileLindexCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileLindexCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int i, numWords = parsePtr->numWords;
@@ -2324,7 +2326,7 @@ TclCompileLindexCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "list" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2335,11 +2337,11 @@ TclCompileLindexCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileListCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileListCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
* If we're not in a procedure, don't compile.
@@ -2382,7 +2384,7 @@ TclCompileListCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "llength" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2393,11 +2395,11 @@ TclCompileListCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileLlengthCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileLlengthCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
@@ -2419,7 +2421,7 @@ TclCompileLlengthCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "lset" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2442,7 +2444,7 @@ TclCompileLlengthCmd(interp, parsePtr, envPtr)
* varName? arrayElementName? index1 index2 ... newValue oldList
* The compiler emits one of INST_LSET_FLAT or INST_LSET_LIST
* according as whether there is exactly one index element (LIST) or
- * either zero or else two or more (FLAT). This instruction removes
+ * either zero or else two or more (FLAT). This instruction removes
* everything from the stack except for the two names and pushes the
* new value of the variable.
* (7) Finally, INST_STORE_* stores the new value in the variable and
@@ -2452,11 +2454,11 @@ TclCompileLlengthCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileLsetCmd(interp, parsePtr, envPtr)
- Tcl_Interp* interp; /* Tcl interpreter for error reporting */
- Tcl_Parse* parsePtr; /* Points to a parse structure for the
+TclCompileLsetCmd(
+ Tcl_Interp* interp, /* Tcl interpreter for error reporting */
+ Tcl_Parse* parsePtr, /* Points to a parse structure for the
* command */
- CompileEnv* envPtr; /* Holds the resulting instructions */
+ CompileEnv* envPtr) /* Holds the resulting instructions */
{
int tempDepth; /* Depth used for emitting one part of the
* code burst. */
@@ -2590,7 +2592,7 @@ TclCompileLsetCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "regexp" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2601,11 +2603,11 @@ TclCompileLsetCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileRegexpCmd(interp, parsePtr, envPtr)
- Tcl_Interp* interp; /* Tcl interpreter for error reporting */
- Tcl_Parse* parsePtr; /* Points to a parse structure for the
+TclCompileRegexpCmd(
+ Tcl_Interp* interp, /* Tcl interpreter for error reporting */
+ Tcl_Parse* parsePtr, /* Points to a parse structure for the
* command */
- CompileEnv* envPtr; /* Holds the resulting instructions */
+ CompileEnv* envPtr) /* Holds the resulting instructions */
{
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
* parse of the RE or string */
@@ -2613,11 +2615,12 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
char *str;
/*
- * We are only interested in compiling simple regexp cases. Currently
+ * We are only interested in compiling simple regexp cases. Currently
* supported compile cases are:
* regexp ?-nocase? ?--? staticString $var
* regexp ?-nocase? ?--? {^staticString$} $var
*/
+
if (parsePtr->numWords < 3) {
return TCL_ERROR;
}
@@ -2626,10 +2629,11 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
varTokenPtr = parsePtr->tokenPtr;
/*
- * We only look for -nocase and -- as options. Everything else gets
- * pushed to runtime execution. This is different than regexp's runtime
- * option handling, but satisfies our stricter needs.
+ * We only look for -nocase and -- as options. Everything else gets pushed
+ * to runtime execution. This is different than regexp's runtime option
+ * handling, but satisfies our stricter needs.
*/
+
for (i = 1; i < parsePtr->numWords - 2; i++) {
varTokenPtr = TokenAfter(varTokenPtr);
if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
@@ -2655,9 +2659,10 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
}
/*
- * Get the regexp string. If it is not a simple string, punt to runtime.
+ * Get the regexp string. If it is not a simple string, punt to runtime.
* If it has a '-', it could be an incorrectly formed regexp command.
*/
+
varTokenPtr = TokenAfter(varTokenPtr);
str = (char *) varTokenPtr[1].start;
len = varTokenPtr[1].size;
@@ -2669,6 +2674,7 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
/*
* The semantics of regexp are always match on re == "".
*/
+
PushLiteral(envPtr, "1", 1);
return TCL_OK;
}
@@ -2677,6 +2683,7 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
* Make a copy of the string that is null-terminated for checks which
* require such.
*/
+
str = (char *) ckalloc((unsigned) len + 1);
strncpy(str, varTokenPtr[1].start, (size_t) len);
str[len] = '\0';
@@ -2686,6 +2693,7 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
* Check for anchored REs (ie ^foo$), so we can use string equal if
* possible. Do not alter the start of str so we can free it correctly.
*/
+
if (str[0] == '^') {
start++;
anchorLeft = 1;
@@ -2701,8 +2709,9 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
/*
* On the first (pattern) arg, check to see if any RE special characters
- * are in the word. If not, this is the same as 'string equal'.
+ * are in the word. If not, this is the same as 'string equal'.
*/
+
if ((len > 1+start) && (str[start] == '.') && (str[start+1] == '*')) {
start += 2;
anchorLeft = 0;
@@ -2719,6 +2728,7 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
* is a bad RE (do this at the end because it can be expensive). If so,
* let it complain at runtime.
*/
+
if ((strpbrk(str + start, "*+?{}()[].\\|^$") != NULL)
|| (Tcl_RegExpCompile(NULL, str) == NULL)) {
ckfree((char *) str);
@@ -2732,6 +2742,7 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
* This needs to find the substring anywhere in the string, so use
* [string match] and *foo*, with appropriate anchoring.
*/
+
char *newStr = ckalloc((unsigned) len + 3);
len -= start;
@@ -2774,7 +2785,7 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "return" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2785,11 +2796,11 @@ TclCompileRegexpCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileReturnCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the
- * command created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+TclCompileReturnCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
/*
* General syntax: [return ?-option value ...? ?result?]
@@ -2837,8 +2848,8 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
}
/*
- * Scan through the return options. If any are unknown at compile time,
- * there is no value in bytecompiling. Save the option values known in an
+ * Scan through the return options. If any are unknown at compile time,
+ * there is no value in bytecompiling. Save the option values known in an
* objv array for merging into a return options dictionary.
*/
@@ -2936,7 +2947,7 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "set" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -2947,11 +2958,11 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileSetCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileSetCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isAssignment, isScalar, simpleVarName, localIndex, numWords;
@@ -3033,7 +3044,7 @@ TclCompileSetCmd(interp, parsePtr, envPtr)
* command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -3044,11 +3055,11 @@ TclCompileSetCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileStringCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileStringCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *opTokenPtr, *varTokenPtr;
Tcl_Obj *opObj;
@@ -3060,7 +3071,7 @@ TclCompileStringCmd(interp, parsePtr, envPtr)
"map", "match", "range", "repeat",
"replace", "tolower", "toupper", "totitle",
"trim", "trimleft", "trimright",
- "wordend", "wordstart", (char *) NULL
+ "wordend", "wordstart", NULL
};
enum options {
STR_BYTELENGTH, STR_COMPARE, STR_EQUAL, STR_FIRST,
@@ -3241,11 +3252,11 @@ TclCompileStringCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileSwitchCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileSwitchCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr; /* Pointer to tokens in command */
int numWords; /* Number of words in command */
@@ -3337,7 +3348,7 @@ TclCompileSwitchCmd(interp, parsePtr, envPtr)
/*
* The switch command has many flags we cannot compile at all (e.g.
- * all the RE-related ones) which we must have encountered. Either
+ * all the RE-related ones) which we must have encountered. Either
* that or we have run off the end. The action here is the same: punt
* to interpreted version.
*/
@@ -3599,7 +3610,7 @@ TclCompileSwitchCmd(interp, parsePtr, envPtr)
}
/*
- * Generate the body for the arm. This is guaranteed not to be a
+ * Generate the body for the arm. This is guaranteed not to be a
* fall-through case, but it might have preceding fall-through cases,
* so we must process those first.
*/
@@ -3647,8 +3658,8 @@ TclCompileSwitchCmd(interp, parsePtr, envPtr)
}
/*
- * Do jump fixups for arms that were executed. First, fill in the jumps
- * of all jumps that don't point elsewhere to point to here.
+ * Do jump fixups for arms that were executed. First, fill in the jumps of
+ * all jumps that don't point elsewhere to point to here.
*/
for (i=0 ; i<fixupCount ; i++) {
@@ -3659,7 +3670,7 @@ TclCompileSwitchCmd(interp, parsePtr, envPtr)
/*
* Now scan backwards over all the jumps (all of which are forward jumps)
- * doing each one. When we do one and there is a size changes, we must
+ * doing each one. When we do one and there is a size changes, we must
* scan back over all the previous ones and see if they need adjusting
* before proceeding with further jump fixups (the interleaved nature of
* all the jumps makes this impossible to do without nested loops).
@@ -3701,11 +3712,11 @@ TclCompileSwitchCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileVariableCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileVariableCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int i, numWords;
@@ -3757,7 +3768,7 @@ TclCompileVariableCmd(interp, parsePtr, envPtr)
* Procedure called to compile the "while" command.
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -3768,11 +3779,11 @@ TclCompileVariableCmd(interp, parsePtr, envPtr)
*/
int
-TclCompileWhileCmd(interp, parsePtr, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Parse *parsePtr; /* Points to a parse structure for the command
+TclCompileWhileCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *testTokenPtr, *bodyTokenPtr;
JumpFixup jumpEvalCondFixup;
@@ -3823,7 +3834,7 @@ TclCompileWhileCmd(interp, parsePtr, envPtr)
loopMayEnd = 0;
} else {
/*
- * This is an empty loop: "while 0 {...}" or such. Compile no
+ * This is an empty loop: "while 0 {...}" or such. Compile no
* bytecodes.
*/
@@ -3929,7 +3940,7 @@ TclCompileWhileCmd(interp, parsePtr, envPtr)
* necessary (append, lappend, set).
*
* Results:
- * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
+ * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer
* evaluation to runtime.
*
* Side effects:
@@ -3940,15 +3951,14 @@ TclCompileWhileCmd(interp, parsePtr, envPtr)
*/
static int
-PushVarName(interp, varTokenPtr, envPtr, flags, localIndexPtr,
- simpleVarNamePtr, isScalarPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tcl_Token *varTokenPtr; /* Points to a variable token. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
- int flags; /* TCL_CREATE_VAR or TCL_NO_LARGE_INDEX */
- int *localIndexPtr; /* must not be NULL */
- int *simpleVarNamePtr; /* must not be NULL */
- int *isScalarPtr; /* must not be NULL */
+PushVarName(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Token *varTokenPtr, /* Points to a variable token. */
+ CompileEnv *envPtr, /* Holds resulting instructions. */
+ int flags, /* TCL_CREATE_VAR or TCL_NO_LARGE_INDEX */
+ int *localIndexPtr, /* must not be NULL */
+ int *simpleVarNamePtr, /* must not be NULL */
+ int *isScalarPtr) /* must not be NULL */
{
register CONST char *p;
CONST char *name, *elName;
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 7741d1d..7e808e9 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.29 2005/10/08 14:42:45 dgp Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.30 2005/11/02 14:51:04 dkf Exp $
*/
#include "tclInt.h"
@@ -136,21 +136,19 @@ static Tcl_HashTable opHashTable;
* Declarations for local procedures to this file:
*/
-static int CompileCondExpr _ANSI_ARGS_((
+static int CompileCondExpr(
Tcl_Token *exprTokenPtr, ExprInfo *infoPtr,
- CompileEnv *envPtr, Tcl_Token **endPtrPtr));
-static int CompileLandOrLorExpr _ANSI_ARGS_((
+ CompileEnv *envPtr, Tcl_Token **endPtrPtr);
+static int CompileLandOrLorExpr(
Tcl_Token *exprTokenPtr, int opIndex,
ExprInfo *infoPtr, CompileEnv *envPtr,
- Tcl_Token **endPtrPtr));
-static int CompileMathFuncCall _ANSI_ARGS_((
- Tcl_Token *exprTokenPtr, CONST char *funcName,
- ExprInfo *infoPtr, CompileEnv *envPtr,
- Tcl_Token **endPtrPtr));
-static int CompileSubExpr _ANSI_ARGS_((
- Tcl_Token *exprTokenPtr, ExprInfo *infoPtr,
- CompileEnv *envPtr));
-static void LogSyntaxError _ANSI_ARGS_((ExprInfo *infoPtr));
+ Tcl_Token **endPtrPtr);
+static int CompileMathFuncCall(Tcl_Token *exprTokenPtr,
+ CONST char *funcName, ExprInfo *infoPtr,
+ CompileEnv *envPtr, Tcl_Token **endPtrPtr);
+static int CompileSubExpr(Tcl_Token *exprTokenPtr,
+ ExprInfo *infoPtr, CompileEnv *envPtr);
+static void LogSyntaxError(ExprInfo *infoPtr);
/*
* Macro used to debug the execution of the expression compiler.
@@ -189,13 +187,13 @@ static void LogSyntaxError _ANSI_ARGS_((ExprInfo *infoPtr));
*/
int
-TclCompileExpr(interp, script, numBytes, envPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- CONST char *script; /* The source script to compile. */
- int numBytes; /* Number of bytes in script. If < 0, the
+TclCompileExpr(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ CONST char *script, /* The source script to compile. */
+ int numBytes, /* Number of bytes in script. If < 0, the
* string consists of all bytes up to the
* first null character. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
ExprInfo info;
Tcl_Parse parse;
@@ -286,7 +284,7 @@ TclCompileExpr(interp, script, numBytes, envPtr)
*/
void
-TclFinalizeCompilation()
+TclFinalizeCompilation(void)
{
Tcl_MutexLock(&opMutex);
if (opTableInitialized) {
@@ -317,12 +315,12 @@ TclFinalizeCompilation()
*/
static int
-CompileSubExpr(exprTokenPtr, infoPtr, envPtr)
- Tcl_Token *exprTokenPtr; /* Points to TCL_TOKEN_SUB_EXPR token to
+CompileSubExpr(
+ Tcl_Token *exprTokenPtr, /* Points to TCL_TOKEN_SUB_EXPR token to
* compile. */
- ExprInfo *infoPtr; /* Describes the compilation state for the
+ ExprInfo *infoPtr, /* Describes the compilation state for the
* expression being compiled. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Interp *interp = infoPtr->interp;
Tcl_Token *tokenPtr, *endPtr, *afterSubexprPtr;
@@ -366,7 +364,7 @@ CompileSubExpr(exprTokenPtr, infoPtr, envPtr)
break;
case TCL_TOKEN_BS:
- length = Tcl_UtfBackslash(tokenPtr->start, (int *) NULL, buffer);
+ length = Tcl_UtfBackslash(tokenPtr->start, NULL, buffer);
if (length > 0) {
objIndex = TclRegisterNewLiteral(envPtr, buffer, length);
} else {
@@ -547,15 +545,15 @@ CompileSubExpr(exprTokenPtr, infoPtr, envPtr)
*/
static int
-CompileLandOrLorExpr(exprTokenPtr, opIndex, infoPtr, envPtr, endPtrPtr)
- Tcl_Token *exprTokenPtr; /* Points to TCL_TOKEN_SUB_EXPR token
+CompileLandOrLorExpr(
+ Tcl_Token *exprTokenPtr, /* Points to TCL_TOKEN_SUB_EXPR token
* containing the "&&" or "||" operator. */
- int opIndex; /* A code describing the expression operator:
+ int opIndex, /* A code describing the expression operator:
* either OP_LAND or OP_LOR. */
- ExprInfo *infoPtr; /* Describes the compilation state for the
+ ExprInfo *infoPtr, /* Describes the compilation state for the
* expression being compiled. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
- Tcl_Token **endPtrPtr; /* If successful, a pointer to the token just
+ CompileEnv *envPtr, /* Holds resulting instructions. */
+ Tcl_Token **endPtrPtr) /* If successful, a pointer to the token just
* after the last token in the subexpression
* is stored here. */
{
@@ -665,13 +663,13 @@ CompileLandOrLorExpr(exprTokenPtr, opIndex, infoPtr, envPtr, endPtrPtr)
*/
static int
-CompileCondExpr(exprTokenPtr, infoPtr, envPtr, endPtrPtr)
- Tcl_Token *exprTokenPtr; /* Points to TCL_TOKEN_SUB_EXPR token
+CompileCondExpr(
+ Tcl_Token *exprTokenPtr, /* Points to TCL_TOKEN_SUB_EXPR token
* containing the "?" operator. */
- ExprInfo *infoPtr; /* Describes the compilation state for the
+ ExprInfo *infoPtr, /* Describes the compilation state for the
* expression being compiled. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
- Tcl_Token **endPtrPtr; /* If successful, a pointer to the token just
+ CompileEnv *envPtr, /* Holds resulting instructions. */
+ Tcl_Token **endPtrPtr) /* If successful, a pointer to the token just
* after the last token in the subexpression
* is stored here. */
{
@@ -790,14 +788,14 @@ CompileCondExpr(exprTokenPtr, infoPtr, envPtr, endPtrPtr)
*/
static int
-CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
- Tcl_Token *exprTokenPtr; /* Points to TCL_TOKEN_SUB_EXPR token
+CompileMathFuncCall(
+ Tcl_Token *exprTokenPtr, /* Points to TCL_TOKEN_SUB_EXPR token
* containing the math function call. */
- CONST char *funcName; /* Name of the math function. */
- ExprInfo *infoPtr; /* Describes the compilation state for the
+ CONST char *funcName, /* Name of the math function. */
+ ExprInfo *infoPtr, /* Describes the compilation state for the
* expression being compiled. */
- CompileEnv *envPtr; /* Holds resulting instructions. */
- Tcl_Token **endPtrPtr; /* If successful, a pointer to the token just
+ CompileEnv *envPtr, /* Holds resulting instructions. */
+ Tcl_Token **endPtrPtr) /* If successful, a pointer to the token just
* after the last token in the subexpression
* is stored here. */
{
@@ -870,12 +868,13 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
*/
static void
-LogSyntaxError(infoPtr)
- ExprInfo *infoPtr; /* Describes the compilation state for the
+LogSyntaxError(
+ ExprInfo *infoPtr) /* Describes the compilation state for the
* expression being compiled. */
{
Tcl_Obj *result =
Tcl_NewStringObj("syntax error in expression \"", -1);
+
TclAppendLimitedToObj(result, infoPtr->expr,
(int)(infoPtr->lastChar - infoPtr->expr), 60, "");
Tcl_AppendToObj(result, "\"", -1);
diff --git a/generic/tclDate.c b/generic/tclDate.c
index ee07443..7761fa2 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -243,11 +243,11 @@ typedef enum _MERIDIAN {
/*
* Prototypes of internal functions.
*/
-static void TclDateerror _ANSI_ARGS_((char *s));
-static time_t ToSeconds _ANSI_ARGS_((time_t Hours, time_t Minutes,
- time_t Seconds, MERIDIAN Meridian));
-static int LookupWord _ANSI_ARGS_((char *buff));
-static int TclDatelex _ANSI_ARGS_((void* info));
+static void TclDateerror(char *s);
+static time_t ToSeconds(time_t Hours, time_t Minutes,
+ time_t Seconds, MERIDIAN Meridian);
+static int LookupWord(char *buff);
+static int TclDatelex(void* info);
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index 800c04b..6f67e50 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclGetDate.y,v 1.27 2005/05/10 18:34:38 kennykb Exp $
+ * RCS: @(#) $Id: tclGetDate.y,v 1.28 2005/11/02 14:51:04 dkf Exp $
*/
%{
@@ -151,11 +151,11 @@ typedef enum _MERIDIAN {
/*
* Prototypes of internal functions.
*/
-static void TclDateerror _ANSI_ARGS_((char *s));
-static time_t ToSeconds _ANSI_ARGS_((time_t Hours, time_t Minutes,
- time_t Seconds, MERIDIAN Meridian));
-static int LookupWord _ANSI_ARGS_((char *buff));
-static int TclDatelex _ANSI_ARGS_((void* info));
+static void TclDateerror(char *s);
+static time_t ToSeconds(time_t Hours, time_t Minutes,
+ time_t Seconds, MERIDIAN Meridian);
+static int LookupWord(char *buff);
+static int TclDatelex(void* info);
%}
diff --git a/generic/tclParse.c b/generic/tclParse.c
index eac35be..5da1abb 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclParse.c,v 1.44 2005/10/04 23:49:45 hobbs Exp $
+ * RCS: @(#) $Id: tclParse.c,v 1.45 2005/11/02 14:51:04 dkf Exp $
*/
#include "tclInt.h"
@@ -171,12 +171,11 @@ static CONST char charTypeTable[] = {
* Prototypes for local functions defined in this file:
*/
-static int CommandComplete _ANSI_ARGS_((CONST char *script,
- int numBytes));
-static int ParseComment _ANSI_ARGS_((CONST char *src,
- int numBytes, Tcl_Parse *parsePtr));
-static int ParseTokens _ANSI_ARGS_((CONST char *src, int numBytes,
- int mask, int flags, Tcl_Parse *parsePtr));
+static int CommandComplete(CONST char *script, int numBytes);
+static int ParseComment(CONST char *src, int numBytes,
+ Tcl_Parse *parsePtr);
+static int ParseTokens(CONST char *src, int numBytes,
+ int mask, int flags, Tcl_Parse *parsePtr);
/*
*----------------------------------------------------------------------
@@ -195,13 +194,13 @@ static int ParseTokens _ANSI_ARGS_((CONST char *src, int numBytes,
*/
void
-TclParseInit(interp, string, numBytes, parsePtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting */
- CONST char *string; /* String to be parsed. */
- int numBytes; /* Total number of bytes in string. If < 0,
+TclParseInit(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting */
+ CONST char *string, /* String to be parsed. */
+ int numBytes, /* Total number of bytes in string. If < 0,
* the script consists of all bytes up to the
* first null character. */
- Tcl_Parse *parsePtr; /* Points to struct to initialize */
+ Tcl_Parse *parsePtr) /* Points to struct to initialize */
{
parsePtr->numWords = 0;
parsePtr->tokenPtr = parsePtr->staticTokens;
@@ -239,19 +238,19 @@ TclParseInit(interp, string, numBytes, parsePtr)
*/
int
-Tcl_ParseCommand(interp, start, numBytes, nested, parsePtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting; if
+Tcl_ParseCommand(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
- CONST char *start; /* First character of string containing one or
+ CONST char *start, /* First character of string containing one or
* more Tcl commands. */
- register int numBytes; /* Total number of bytes in string. If < 0,
+ register int numBytes, /* Total number of bytes in string. If < 0,
* the script consists of all bytes up to the
* first null character. */
- int nested; /* Non-zero means this is a nested command:
+ int nested, /* Non-zero means this is a nested command:
* close bracket should be considered a
* command terminator. If zero, then close
* bracket has no special meaning. */
- register Tcl_Parse *parsePtr;
+ register Tcl_Parse *parsePtr)
/* Structure to fill in with information about
* the parsed command; any previous
* information in the structure is ignored. */
@@ -499,13 +498,13 @@ Tcl_ParseCommand(interp, start, numBytes, nested, parsePtr)
*/
int
-TclParseWhiteSpace(src, numBytes, parsePtr, typePtr)
- CONST char *src; /* First character to parse. */
- register int numBytes; /* Max number of bytes to scan. */
- Tcl_Parse *parsePtr; /* Information about parse in progress.
+TclParseWhiteSpace(
+ CONST char *src, /* First character to parse. */
+ register int numBytes, /* Max number of bytes to scan. */
+ Tcl_Parse *parsePtr, /* Information about parse in progress.
* Updated if parsing indicates an incomplete
* command. */
- char *typePtr; /* Points to location to store character type
+ char *typePtr) /* Points to location to store character type
* of character that ends run of whitespace */
{
register char type = TYPE_NORMAL;
@@ -562,10 +561,10 @@ TclParseWhiteSpace(src, numBytes, parsePtr, typePtr)
*/
int
-TclParseHex(src, numBytes, resultPtr)
- CONST char *src; /* First character to parse. */
- int numBytes; /* Max number of byes to scan */
- Tcl_UniChar *resultPtr; /* Points to storage provided by caller where
+TclParseHex(
+ CONST char *src, /* First character to parse. */
+ int numBytes, /* Max number of byes to scan */
+ Tcl_UniChar *resultPtr) /* Points to storage provided by caller where
* the Tcl_UniChar resulting from the
* conversion is to be written. */
{
@@ -617,13 +616,13 @@ TclParseHex(src, numBytes, resultPtr)
*/
int
-TclParseBackslash(src, numBytes, readPtr, dst)
- CONST char *src; /* Points to the backslash character of a a
+TclParseBackslash(
+ CONST char *src, /* Points to the backslash character of a a
* backslash sequence. */
- int numBytes; /* Max number of bytes to scan. */
- int *readPtr; /* NULL, or points to storage where the number
+ int numBytes, /* Max number of bytes to scan. */
+ int *readPtr, /* NULL, or points to storage where the number
* of bytes scanned should be written. */
- char *dst; /* NULL, or points to buffer where the UTF-8
+ char *dst) /* NULL, or points to buffer where the UTF-8
* encoding of the backslash sequence is to be
* written. At most TCL_UTF_MAX bytes will be
* written there. */
@@ -790,10 +789,10 @@ TclParseBackslash(src, numBytes, readPtr, dst)
*/
static int
-ParseComment(src, numBytes, parsePtr)
- CONST char *src; /* First character to parse. */
- register int numBytes; /* Max number of bytes to scan. */
- Tcl_Parse *parsePtr; /* Information about parse in progress.
+ParseComment(
+ CONST char *src, /* First character to parse. */
+ register int numBytes, /* Max number of bytes to scan. */
+ Tcl_Parse *parsePtr) /* Information about parse in progress.
* Updated if parsing indicates an incomplete
* command. */
{
@@ -872,18 +871,18 @@ ParseComment(src, numBytes, parsePtr)
*/
static int
-ParseTokens(src, numBytes, mask, flags, parsePtr)
- register CONST char *src; /* First character to parse. */
- register int numBytes; /* Max number of bytes to scan. */
- int flags; /* OR-ed bits indicating what substitutions to
- perform: TCL_SUBST_COMMANDS,
- TCL_SUBST_VARIABLES, and
- TCL_SUBST_BACKSLASHES */
- int mask; /* Specifies when to stop parsing. The parse
+ParseTokens(
+ register CONST char *src, /* First character to parse. */
+ register int numBytes, /* Max number of bytes to scan. */
+ int mask, /* Specifies when to stop parsing. The parse
* stops at the first unquoted character whose
* CHAR_TYPE contains any of the bits in
* mask. */
- Tcl_Parse *parsePtr; /* Information about parse in progress.
+ int flags, /* OR-ed bits indicating what substitutions to
+ * perform: TCL_SUBST_COMMANDS,
+ * TCL_SUBST_VARIABLES, and
+ * TCL_SUBST_BACKSLASHES */
+ Tcl_Parse *parsePtr) /* Information about parse in progress.
* Updated with additional tokens and
* termination information. */
{
@@ -1071,8 +1070,8 @@ ParseTokens(src, numBytes, mask, flags, parsePtr)
}
if (parsePtr->numTokens == originalTokens) {
/*
- * There was nothing in this range of text. Add an empty token for
- * the empty range, so that there is always at least one token added.
+ * There was nothing in this range of text. Add an empty token for the
+ * empty range, so that there is always at least one token added.
*/
if (parsePtr->numTokens == parsePtr->tokensAvailable) {
@@ -1110,8 +1109,8 @@ ParseTokens(src, numBytes, mask, flags, parsePtr)
*/
void
-Tcl_FreeParse(parsePtr)
- Tcl_Parse *parsePtr; /* Structure that was filled in by a previous
+Tcl_FreeParse(
+ Tcl_Parse *parsePtr) /* Structure that was filled in by a previous
* call to Tcl_ParseCommand. */
{
if (parsePtr->tokenPtr != parsePtr->staticTokens) {
@@ -1140,8 +1139,8 @@ Tcl_FreeParse(parsePtr)
*/
void
-TclExpandTokenArray(parsePtr)
- Tcl_Parse *parsePtr; /* Parse structure whose token space has
+TclExpandTokenArray(
+ Tcl_Parse *parsePtr) /* Parse structure whose token space has
* overflowed. */
{
int newCount;
@@ -1164,7 +1163,7 @@ TclExpandTokenArray(parsePtr)
* Tcl_ParseVarName --
*
* Given a string starting with a $ sign, parse off a variable name and
- * return information about the parse. No more than numBytes bytes will
+ * return information about the parse. No more than numBytes bytes will
* be scanned.
*
* Results:
@@ -1186,17 +1185,17 @@ TclExpandTokenArray(parsePtr)
*/
int
-Tcl_ParseVarName(interp, start, numBytes, parsePtr, append)
- Tcl_Interp *interp; /* Interpreter to use for error reporting; if
+Tcl_ParseVarName(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
- CONST char *start; /* Start of variable substitution string.
+ CONST char *start, /* Start of variable substitution string.
* First character must be "$". */
- register int numBytes; /* Total number of bytes in string. If < 0,
+ register int numBytes, /* Total number of bytes in string. If < 0,
* the string consists of all bytes up to the
* first null character. */
- Tcl_Parse *parsePtr; /* Structure to fill in with information about
+ Tcl_Parse *parsePtr, /* Structure to fill in with information about
* the variable name. */
- int append; /* Non-zero means append tokens to existing
+ int append) /* Non-zero means append tokens to existing
* information in parsePtr; zero means ignore
* existing tokens in parsePtr and
* reinitialize it. */
@@ -1248,12 +1247,12 @@ Tcl_ParseVarName(interp, start, numBytes, parsePtr, append)
* 1. The $ sign is followed by an open curly brace. Then the variable
* name is everything up to the next close curly brace, and the
* variable is a scalar variable.
- * 2. The $ sign is not followed by an open curly brace. Then the
- * variable name is everything up to the next character that isn't a
- * letter, digit, or underscore. :: sequences are also considered part
- * of the variable name, in order to support namespaces. If the
- * following character is an open parenthesis, then the information
- * between parentheses is the array element name.
+ * 2. The $ sign is not followed by an open curly brace. Then the variable
+ * name is everything up to the next character that isn't a letter,
+ * digit, or underscore. :: sequences are also considered part of the
+ * variable name, in order to support namespaces. If the following
+ * character is an open parenthesis, then the information between
+ * parentheses is the array element name.
* 3. The $ sign is followed by something that isn't a letter, digit, or
* underscore: in this case, there is no variable name and the token is
* just "$".
@@ -1357,7 +1356,7 @@ Tcl_ParseVarName(interp, start, numBytes, parsePtr, append)
return TCL_OK;
/*
- * The dollar sign isn't followed by a variable name. Replace the
+ * The dollar sign isn't followed by a variable name. Replace the
* TCL_TOKEN_VARIABLE token with a TCL_TOKEN_TEXT token for the dollar
* sign.
*/
@@ -1384,9 +1383,9 @@ Tcl_ParseVarName(interp, start, numBytes, parsePtr, append)
*
* Results:
* The return value is the contents of the variable given by the leading
- * characters of string. If termPtr isn't NULL, *termPtr gets filled in
+ * characters of string. If termPtr isn't NULL, *termPtr gets filled in
* with the address of the character just after the last one in the
- * variable specifier. If the variable doesn't exist, then the return
+ * variable specifier. If the variable doesn't exist, then the return
* value is NULL and an error message will be left in interp's result.
*
* Side effects:
@@ -1396,11 +1395,11 @@ Tcl_ParseVarName(interp, start, numBytes, parsePtr, append)
*/
CONST char *
-Tcl_ParseVar(interp, start, termPtr)
- Tcl_Interp *interp; /* Context for looking up variable. */
- register CONST char *start; /* Start of variable substitution.
+Tcl_ParseVar(
+ Tcl_Interp *interp, /* Context for looking up variable. */
+ register CONST char *start, /* Start of variable substitution.
* First character must be "$". */
- CONST char **termPtr; /* If non-NULL, points to word to fill
+ CONST char **termPtr) /* If non-NULL, points to word to fill
* in with character just after last
* one in the variable specifier. */
{
@@ -1476,22 +1475,22 @@ Tcl_ParseVar(interp, start, termPtr)
*/
int
-Tcl_ParseBraces(interp, start, numBytes, parsePtr, append, termPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting; if
+Tcl_ParseBraces(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
- CONST char *start; /* Start of string enclosed in braces. The
+ CONST char *start, /* Start of string enclosed in braces. The
* first character must be {'. */
- register int numBytes; /* Total number of bytes in string. If < 0,
+ register int numBytes, /* Total number of bytes in string. If < 0,
* the string consists of all bytes up to the
* first null character. */
- register Tcl_Parse *parsePtr;
+ register Tcl_Parse *parsePtr,
/* Structure to fill in with information about
* the string. */
- int append; /* Non-zero means append tokens to existing
+ int append, /* Non-zero means append tokens to existing
* information in parsePtr; zero means ignore
* existing tokens in parsePtr and
* reinitialize it. */
- CONST char **termPtr; /* If non-NULL, points to word in which to
+ CONST char **termPtr) /* If non-NULL, points to word in which to
* store a pointer to the character just after
* the terminating '}' if the parse was
* successful. */
@@ -1683,22 +1682,22 @@ Tcl_ParseBraces(interp, start, numBytes, parsePtr, append, termPtr)
*/
int
-Tcl_ParseQuotedString(interp, start, numBytes, parsePtr, append, termPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting; if
+Tcl_ParseQuotedString(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
- CONST char *start; /* Start of the quoted string. The first
+ CONST char *start, /* Start of the quoted string. The first
* character must be '"'. */
- register int numBytes; /* Total number of bytes in string. If < 0,
+ register int numBytes, /* Total number of bytes in string. If < 0,
* the string consists of all bytes up to the
* first null character. */
- register Tcl_Parse *parsePtr;
+ register Tcl_Parse *parsePtr,
/* Structure to fill in with information about
* the string. */
- int append; /* Non-zero means append tokens to existing
+ int append, /* Non-zero means append tokens to existing
* information in parsePtr; zero means ignore
* existing tokens in parsePtr and
* reinitialize it. */
- CONST char **termPtr; /* If non-NULL, points to word in which to
+ CONST char **termPtr) /* If non-NULL, points to word in which to
* store a pointer to the character just after
* the quoted string's terminating close-quote
* if the parse succeeds. */
@@ -1756,10 +1755,10 @@ Tcl_ParseQuotedString(interp, start, numBytes, parsePtr, append, termPtr)
*/
Tcl_Obj *
-Tcl_SubstObj(interp, objPtr, flags)
- Tcl_Interp *interp; /* Interpreter in which substitution occurs */
- Tcl_Obj *objPtr; /* The value to be substituted. */
- int flags; /* What substitutions to do. */
+Tcl_SubstObj(
+ Tcl_Interp *interp, /* Interpreter in which substitution occurs */
+ Tcl_Obj *objPtr, /* The value to be substituted. */
+ int flags) /* What substitutions to do. */
{
int length, tokensLeft, code;
Tcl_Parse parse;
@@ -1867,15 +1866,15 @@ Tcl_SubstObj(interp, objPtr, flags)
length = parse.end - p;
if (length == 0) {
/*
- * No commands, just an unmatched [. As in previous cases,
+ * No commands, just an unmatched [. As in previous cases,
* existing token stream is OK.
*/
} else {
/*
* We want to add the parsing of as many commands as we can
* within that substitution until we reach the actual parse
- * error. We'll do additional parsing to determine what
- * length to claim for the final TCL_TOKEN_COMMAND token.
+ * error. We'll do additional parsing to determine what length
+ * to claim for the final TCL_TOKEN_COMMAND token.
*/
Tcl_Token *tokenPtr;
@@ -1901,8 +1900,8 @@ Tcl_SubstObj(interp, objPtr, flags)
if (lastTerm == parse.term) {
/*
- * Parse error in first command. No commands to subst,
- * add no more tokens.
+ * Parse error in first command. No commands to subst, add
+ * no more tokens.
*/
break;
}
@@ -2005,15 +2004,15 @@ Tcl_SubstObj(interp, objPtr, flags)
*/
int
-TclSubstTokens(interp, tokenPtr, count, tokensLeftPtr)
- Tcl_Interp *interp; /* Interpreter in which to lookup variables,
+TclSubstTokens(
+ Tcl_Interp *interp, /* Interpreter in which to lookup variables,
* execute nested commands, and report
* errors. */
- Tcl_Token *tokenPtr; /* Pointer to first in an array of tokens to
+ Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
- int count; /* Number of tokens to consider at tokenPtr.
+ int count, /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
- int *tokensLeftPtr; /* If not NULL, points to memory where an
+ int *tokensLeftPtr) /* If not NULL, points to memory where an
* integer representing the number of tokens
* left to be substituted will be written */
{
@@ -2191,9 +2190,9 @@ TclSubstTokens(interp, tokenPtr, count, tokensLeftPtr)
*/
static int
-CommandComplete(script, numBytes)
- CONST char *script; /* Script to check. */
- int numBytes; /* Number of bytes in script. */
+CommandComplete(
+ CONST char *script, /* Script to check. */
+ int numBytes) /* Number of bytes in script. */
{
Tcl_Parse parse;
CONST char *p, *end;
@@ -2228,7 +2227,7 @@ CommandComplete(script, numBytes)
* and quotes and brackets.
*
* Results:
- * 1 is returned if the script is complete, 0 otherwise. 1 is also
+ * 1 is returned if the script is complete, 0 otherwise. 1 is also
* returned if there is a parse error in the script other than unmatched
* delimiters.
*
@@ -2239,8 +2238,8 @@ CommandComplete(script, numBytes)
*/
int
-Tcl_CommandComplete(script)
- CONST char *script; /* Script to check. */
+Tcl_CommandComplete(
+ CONST char *script) /* Script to check. */
{
return CommandComplete(script, (int) strlen(script));
}
@@ -2264,8 +2263,8 @@ Tcl_CommandComplete(script)
*/
int
-TclObjCommandComplete(objPtr)
- Tcl_Obj *objPtr; /* Points to object holding script to
+TclObjCommandComplete(
+ Tcl_Obj *objPtr) /* Points to object holding script to
* check. */
{
CONST char *script;
@@ -2293,9 +2292,9 @@ TclObjCommandComplete(objPtr)
*/
int
-TclIsLocalScalar(src, len)
- CONST char *src;
- int len;
+TclIsLocalScalar(
+ CONST char *src,
+ int len)
{
CONST char *p;
CONST char *lastChar = src + (len - 1);
@@ -2311,7 +2310,7 @@ TclIsLocalScalar(src, len)
return 0;
}
- if (*p == '(') {
+ if (*p == '(') {
if (*lastChar == ')') { /* we have an array element */
return 0;
}
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 082fcda..0afc584 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclPipe.c --
*
* This file contains the generic portion of the command channel driver
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPipe.c,v 1.13 2005/10/05 22:09:04 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclPipe.c,v 1.14 2005/11/02 14:51:05 dkf Exp $
*/
#include "tclInt.h"
@@ -34,10 +34,10 @@ TCL_DECLARE_MUTEX(pipeMutex) /* Guard access to detList. */
* Declarations for local functions defined in this file:
*/
-static TclFile FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp,
- CONST char *spec, int atOk, CONST char *arg,
- CONST char *nextArg, int flags, int *skipPtr,
- int *closePtr, int *releasePtr));
+static TclFile FileForRedirect(Tcl_Interp *interp, CONST char *spec,
+ int atOk, CONST char *arg, CONST char *nextArg,
+ int flags, int *skipPtr, int *closePtr,
+ int *releasePtr);
/*
*----------------------------------------------------------------------
@@ -61,34 +61,33 @@ static TclFile FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp,
*/
static TclFile
-FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
- releasePtr)
- Tcl_Interp *interp; /* Intepreter to use for error reporting. */
- CONST char *spec; /* Points to character just after redirection
+FileForRedirect(
+ Tcl_Interp *interp, /* Intepreter to use for error reporting. */
+ CONST char *spec, /* Points to character just after redirection
* character. */
- int atOK; /* Non-zero means that '@' notation can be
+ int atOK, /* Non-zero means that '@' notation can be
* used to specify a channel, zero means that
* it isn't. */
- CONST char *arg; /* Pointer to entire argument containing spec:
+ CONST char *arg, /* Pointer to entire argument containing spec:
* used for error reporting. */
- CONST char *nextArg; /* Next argument in argc/argv array, if needed
+ CONST char *nextArg, /* Next argument in argc/argv array, if needed
* for file name or channel name. May be
* NULL. */
- int flags; /* Flags to use for opening file or to specify
+ int flags, /* Flags to use for opening file or to specify
* mode for channel. */
- int *skipPtr; /* Filled with 1 if redirection target was in
+ int *skipPtr, /* Filled with 1 if redirection target was in
* spec, 2 if it was in nextArg. */
- int *closePtr; /* Filled with one if the caller should close
+ int *closePtr, /* Filled with one if the caller should close
* the file when done with it, zero
* otherwise. */
- int *releasePtr;
+ int *releasePtr)
{
int writing = (flags & O_WRONLY);
Tcl_Channel chan;
TclFile file;
*skipPtr = 1;
- if ((atOK != 0) && (*spec == '@')) {
+ if ((atOK != 0) && (*spec == '@')) {
spec++;
if (*spec == '\0') {
spec = nextArg;
@@ -105,7 +104,7 @@ FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
if (file == NULL) {
Tcl_AppendResult(interp, "channel \"", Tcl_GetChannelName(chan),
"\" wasn't opened for ",
- ((writing) ? "writing" : "reading"), (char *) NULL);
+ ((writing) ? "writing" : "reading"), NULL);
return NULL;
}
*releasePtr = 1;
@@ -138,7 +137,7 @@ FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
if (file == NULL) {
Tcl_AppendResult(interp, "couldn't ",
((writing) ? "write" : "read"), " file \"", spec, "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
return NULL;
}
*closePtr = 1;
@@ -147,7 +146,7 @@ FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
badLastArg:
Tcl_AppendResult(interp, "can't specify \"", arg,
- "\" as last word in command", (char *) NULL);
+ "\" as last word in command", NULL);
return NULL;
}
@@ -170,10 +169,10 @@ FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr,
*/
void
-Tcl_DetachPids(numPids, pidPtr)
- int numPids; /* Number of pids to detach: gives size of
+Tcl_DetachPids(
+ int numPids, /* Number of pids to detach: gives size of
* array pointed to by pidPtr. */
- Tcl_Pid *pidPtr; /* Array of pids to detach. */
+ Tcl_Pid *pidPtr) /* Array of pids to detach. */
{
register Detached *detPtr;
int i;
@@ -209,7 +208,7 @@ Tcl_DetachPids(numPids, pidPtr)
*/
void
-Tcl_ReapDetachedProcs()
+Tcl_ReapDetachedProcs(void)
{
register Detached *detPtr;
Detached *nextPtr, *prevPtr;
@@ -259,11 +258,11 @@ Tcl_ReapDetachedProcs()
*/
int
-TclCleanupChildren(interp, numPids, pidPtr, errorChan)
- Tcl_Interp *interp; /* Used for error messages. */
- int numPids; /* Number of entries in pidPtr array. */
- Tcl_Pid *pidPtr; /* Array of process ids of children. */
- Tcl_Channel errorChan; /* Channel for file containing stderr output
+TclCleanupChildren(
+ Tcl_Interp *interp, /* Used for error messages. */
+ int numPids, /* Number of entries in pidPtr array. */
+ Tcl_Pid *pidPtr, /* Array of process ids of children. */
+ Tcl_Channel errorChan) /* Channel for file containing stderr output
* from pipeline. NULL means there isn't any
* stderr output. */
{
@@ -286,7 +285,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
pid = Tcl_WaitPid(pidPtr[i], (int *) &waitStatus, 0);
if (pid == (Tcl_Pid) -1) {
result = TCL_ERROR;
- if (interp != (Tcl_Interp *) NULL) {
+ if (interp != NULL) {
msg = Tcl_PosixError(interp);
if (errno == ECHILD) {
/*
@@ -299,7 +298,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
"child process lost (is SIGCHLD ignored or trapped?)";
}
Tcl_AppendResult(interp, "error waiting for process to exit: ",
- msg, (char *) NULL);
+ msg, NULL);
}
continue;
}
@@ -319,37 +318,28 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
if (WIFEXITED(waitStatus)) {
if (interp != (Tcl_Interp *) NULL) {
sprintf(msg2, "%hu", WEXITSTATUS(waitStatus));
- Tcl_SetErrorCode(interp, "CHILDSTATUS", msg1, msg2,
- (char *) NULL);
+ Tcl_SetErrorCode(interp, "CHILDSTATUS", msg1, msg2, NULL);
}
abnormalExit = 1;
- } else if (WIFSIGNALED(waitStatus)) {
- if (interp != (Tcl_Interp *) NULL) {
- CONST char *p;
-
+ } else if (interp != NULL) {
+ CONST char *p;
+
+ if (WIFSIGNALED(waitStatus)) {
p = Tcl_SignalMsg((int) (WTERMSIG(waitStatus)));
Tcl_SetErrorCode(interp, "CHILDKILLED", msg1,
Tcl_SignalId((int) (WTERMSIG(waitStatus))), p,
- (char *) NULL);
- Tcl_AppendResult(interp, "child killed: ", p, "\n",
- (char *) NULL);
- }
- } else if (WIFSTOPPED(waitStatus)) {
- if (interp != (Tcl_Interp *) NULL) {
- CONST char *p;
-
+ NULL);
+ Tcl_AppendResult(interp, "child killed: ", p, "\n", NULL);
+ } else if (WIFSTOPPED(waitStatus)) {
p = Tcl_SignalMsg((int) (WSTOPSIG(waitStatus)));
Tcl_SetErrorCode(interp, "CHILDSUSP", msg1,
- Tcl_SignalId((int) (WSTOPSIG(waitStatus))),
- p, (char *) NULL);
+ Tcl_SignalId((int) (WSTOPSIG(waitStatus))), p,
+ NULL);
Tcl_AppendResult(interp, "child suspended: ", p, "\n",
- (char *) NULL);
- }
- } else {
- if (interp != (Tcl_Interp *) NULL) {
+ NULL);
+ } else {
Tcl_AppendResult(interp,
- "child wait status didn't make sense\n",
- (char *) NULL);
+ "child wait status didn't make sense\n", NULL);
}
}
}
@@ -369,7 +359,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
if (interp != NULL) {
int count;
Tcl_Obj *objPtr;
-
+
Tcl_Seek(errorChan, (Tcl_WideInt)0, SEEK_SET);
objPtr = Tcl_NewObj();
count = Tcl_ReadChars(errorChan, objPtr, -1, 0);
@@ -396,8 +386,7 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
*/
if ((abnormalExit != 0) && (anyErrorInfo == 0) && (interp != NULL)) {
- Tcl_AppendResult(interp, "child process exited abnormally",
- (char *) NULL);
+ Tcl_AppendResult(interp, "child process exited abnormally", NULL);
}
return result;
}
@@ -432,30 +421,29 @@ TclCleanupChildren(interp, numPids, pidPtr, errorChan)
*/
int
-TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
- outPipePtr, errFilePtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- int argc; /* Number of entries in argv. */
- CONST char **argv; /* Array of strings describing commands in
+TclCreatePipeline(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ int argc, /* Number of entries in argv. */
+ CONST char **argv, /* Array of strings describing commands in
* pipeline plus I/O redirection with <, <<,
* >, etc. Argv[argc] must be NULL. */
- Tcl_Pid **pidArrayPtr; /* Word at *pidArrayPtr gets filled in with
+ Tcl_Pid **pidArrayPtr, /* Word at *pidArrayPtr gets filled in with
* address of array of pids for processes in
* pipeline (first pid is first process in
* pipeline). */
- TclFile *inPipePtr; /* If non-NULL, input to the pipeline comes
+ TclFile *inPipePtr, /* If non-NULL, input to the pipeline comes
* from a pipe (unless overridden by
* redirection in the command). The file id
* with which to write to this pipe is stored
* at *inPipePtr. NULL means command specified
* its own input source. */
- TclFile *outPipePtr; /* If non-NULL, output to the pipeline goes to
+ TclFile *outPipePtr, /* If non-NULL, output to the pipeline goes to
* a pipe, unless overriden by redirection in
* the command. The file id with which to read
* frome this pipe is stored at *outPipePtr.
* NULL means command specified its own output
* sink. */
- TclFile *errFilePtr; /* If non-NULL, all stderr output from the
+ TclFile *errFilePtr) /* If non-NULL, all stderr output from the
* pipeline will go to a temporary file
* created here, and a descriptor to read the
* file will be left at *errFilePtr. The file
@@ -514,7 +502,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
}
Tcl_DStringInit(&execBuffer);
-
+
pipeIn = NULL;
curInFile = NULL;
curOutFile = NULL;
@@ -572,7 +560,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
inputLiteral = ((i + 1) == argc) ? NULL : argv[i + 1];
if (inputLiteral == NULL) {
Tcl_AppendResult(interp, "can't specify \"", argv[i],
- "\" as last word in command", (char *) NULL);
+ "\" as last word in command", NULL);
goto error;
}
skip = 2;
@@ -680,7 +668,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
if (i != argc-1) {
Tcl_AppendResult(interp, "must specify \"", argv[i],
- "\" as last word in command", (char *) NULL);
+ "\" as last word in command", NULL);
goto error;
}
errorFile = outputFile;
@@ -688,7 +676,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
skip = 1;
} else {
nextArg = ((i + 1) == argc) ? NULL : argv[i + 1];
- errorFile = FileForRedirect(interp, p, atOK, argv[i],
+ errorFile = FileForRedirect(interp, p, atOK, argv[i],
nextArg, flags, &skip, &errorClose, &errorRelease);
if (errorFile == NULL) {
goto error;
@@ -718,7 +706,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
if (inputFile == NULL) {
Tcl_AppendResult(interp,
"couldn't create input file for command: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
inputClose = 1;
@@ -729,9 +717,9 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
*/
if (TclpCreatePipe(&inputFile, inPipePtr) == 0) {
- Tcl_AppendResult(interp,
+ Tcl_AppendResult(interp,
"couldn't create input pipe for command: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
inputClose = 1;
@@ -758,9 +746,9 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
*/
if (TclpCreatePipe(outPipePtr, &outputFile) == 0) {
- Tcl_AppendResult(interp,
+ Tcl_AppendResult(interp,
"couldn't create output pipe for command: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
outputClose = 1;
@@ -800,7 +788,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
if (errorFile == NULL) {
Tcl_AppendResult(interp,
"couldn't create error file for command: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
*errFilePtr = errorFile;
@@ -818,7 +806,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
}
}
}
-
+
/*
* Scan through the argc array, creating a process for each group of
* arguments between the "|" characters.
@@ -829,13 +817,13 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
curInFile = inputFile;
- for (i = 0; i < argc; i = lastArg + 1) {
+ for (i = 0; i < argc; i = lastArg + 1) {
int result, joinThisError;
Tcl_Pid pid;
CONST char *oldName;
/*
- * Convert the program name into native form.
+ * Convert the program name into native form.
*/
if (Tcl_TranslateFileName(interp, argv[i], &execBuffer) == NULL) {
@@ -848,14 +836,15 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
joinThisError = 0;
for (lastArg = i; lastArg < argc; lastArg++) {
- if (argv[lastArg][0] == '|') {
- if (argv[lastArg][1] == '\0') {
- break;
- }
- if ((argv[lastArg][1] == '&') && (argv[lastArg][2] == '\0')) {
- joinThisError = 1;
- break;
- }
+ if (argv[lastArg][0] != '|') {
+ continue;
+ }
+ if (argv[lastArg][1] == '\0') {
+ break;
+ }
+ if ((argv[lastArg][1] == '&') && (argv[lastArg][2] == '\0')) {
+ joinThisError = 1;
+ break;
}
}
@@ -871,7 +860,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
argv[lastArg] = NULL;
if (TclpCreatePipe(&pipeIn, &curOutFile) == 0) {
Tcl_AppendResult(interp, "couldn't create pipe: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
}
@@ -886,7 +875,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
* Restore argv[i], since a caller wouldn't expect the contents of
* argv to be modified.
*/
-
+
oldName = argv[i];
argv[i] = Tcl_DStringValue(&execBuffer);
result = TclpCreateProcess(interp, lastArg - i, argv + i,
@@ -1016,12 +1005,12 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
*/
Tcl_Channel
-Tcl_OpenCommandChannel(interp, argc, argv, flags)
- Tcl_Interp *interp; /* Interpreter for error reporting. Can NOT be
+Tcl_OpenCommandChannel(
+ Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
* NULL. */
- int argc; /* How many arguments. */
- CONST char **argv; /* Array of arguments for command pipe. */
- int flags; /* Or'ed combination of TCL_STDIN, TCL_STDOUT,
+ int argc, /* How many arguments. */
+ CONST char **argv, /* Array of arguments for command pipe. */
+ int flags) /* Or'ed combination of TCL_STDIN, TCL_STDOUT,
* TCL_STDERR, and TCL_ENFORCE_MODE. */
{
TclFile *inPipePtr, *outPipePtr, *errFilePtr;
@@ -1035,7 +1024,7 @@ Tcl_OpenCommandChannel(interp, argc, argv, flags)
inPipePtr = (flags & TCL_STDIN) ? &inPipe : NULL;
outPipePtr = (flags & TCL_STDOUT) ? &outPipe : NULL;
errFilePtr = (flags & TCL_STDERR) ? &errFile : NULL;
-
+
numPids = TclCreatePipeline(interp, argc, argv, &pidPtr, inPipePtr,
outPipePtr, errFilePtr);
@@ -1051,22 +1040,22 @@ Tcl_OpenCommandChannel(interp, argc, argv, flags)
if (flags & TCL_ENFORCE_MODE) {
if ((flags & TCL_STDOUT) && (outPipe == NULL)) {
Tcl_AppendResult(interp, "can't read output from command:",
- " standard output was redirected", (char *) NULL);
+ " standard output was redirected", NULL);
goto error;
}
if ((flags & TCL_STDIN) && (inPipe == NULL)) {
Tcl_AppendResult(interp, "can't write input to command:",
- " standard input was redirected", (char *) NULL);
+ " standard input was redirected", NULL);
goto error;
}
}
-
+
channel = TclpCreateCommandChannel(outPipe, inPipe, errFile,
numPids, pidPtr);
if (channel == (Tcl_Channel) NULL) {
Tcl_AppendResult(interp, "pipe for command could not be created",
- (char *) NULL);
+ NULL);
goto error;
}
return channel;
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index f246f35..369a73a 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -1,22 +1,22 @@
-/*
+/*
* tclStubLib.c --
*
- * Stub object that will be statically linked into extensions that wish
+ * Stub object that will be statically linked into extensions that want
* to access Tcl.
*
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 1998 Paul Duffin.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubLib.c,v 1.8 2004/04/06 22:25:55 dgp Exp $
+ * RCS: @(#) $Id: tclStubLib.c,v 1.9 2005/11/02 14:51:05 dkf Exp $
*/
/*
- * We need to ensure that we use the stub macros so that this file contains
- * no references to any of the stub functions. This will make it possible
- * to build an extension that references Tcl_InitStubs but doesn't end up
+ * We need to ensure that we use the stub macros so that this file contains no
+ * references to any of the stub functions. This will make it possible to
+ * build an extension that references Tcl_InitStubs but doesn't end up
* including the rest of the stub functions.
*/
@@ -28,7 +28,7 @@
#include "tclInt.h"
/*
- * Ensure that Tcl_InitStubs is built as an exported symbol. The other stub
+ * Ensure that Tcl_InitStubs is built as an exported symbol. The other stub
* functions should be built as non-exported symbols.
*/
@@ -40,20 +40,21 @@ TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
-static TclStubs * HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp));
+static TclStubs * HasStubSupport(Tcl_Interp *interp);
static TclStubs *
-HasStubSupport (interp)
- Tcl_Interp *interp;
+HasStubSupport(
+ Tcl_Interp *interp)
{
Interp *iPtr = (Interp *) interp;
if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
return iPtr->stubTable;
}
- interp->result = "This interpreter does not support stubs-enabled extensions.";
- interp->freeProc = TCL_STATIC;
+ interp->result =
+ "This interpreter does not support stubs-enabled extensions.";
+ interp->freeProc = TCL_STATIC;
return NULL;
}
@@ -62,12 +63,12 @@ HasStubSupport (interp)
*
* Tcl_InitStubs --
*
- * Tries to initialise the stub table pointers and ensures that
- * the correct version of Tcl is loaded.
+ * Tries to initialise the stub table pointers and ensures that the
+ * correct version of Tcl is loaded.
*
* Results:
- * The actual version of Tcl that satisfies the request, or
- * NULL to indicate that an error occurred.
+ * The actual version of Tcl that satisfies the request, or NULL to
+ * indicate that an error occurred.
*
* Side effects:
* Sets the stub table pointers.
@@ -80,19 +81,19 @@ HasStubSupport (interp)
#endif
CONST char *
-Tcl_InitStubs (interp, version, exact)
- Tcl_Interp *interp;
- CONST char *version;
- int exact;
+Tcl_InitStubs(
+ Tcl_Interp *interp,
+ CONST char *version,
+ int exact)
{
CONST char *actualVersion = NULL;
TclStubs *tmp;
TclStubs **tmpp;
/*
- * We can't optimize this check by caching tclStubsPtr because
- * that prevents apps from being able to load/unload Tcl dynamically
- * multiple times. [Bug 615304]
+ * We can't optimize this check by caching tclStubsPtr because that
+ * prevents apps from being able to load/unload Tcl dynamically multiple
+ * times. [Bug 615304]
*/
tclStubsPtr = HasStubSupport(interp);
@@ -100,7 +101,10 @@ Tcl_InitStubs (interp, version, exact)
return NULL;
}
- /* This is needed to satisfy GCC 3.3's strict aliasing rules */
+ /*
+ * This is needed to satisfy GCC 3.3's strict aliasing rules.
+ */
+
tmpp = &tmp;
actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact,
(ClientData *) tmpp);
@@ -118,6 +122,14 @@ Tcl_InitStubs (interp, version, exact)
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
-
+
return actualVersion;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */