summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-01-06 23:24:37 +0000
committerBram Moolenaar <Bram@vim.org>2005-01-06 23:24:37 +0000
commitde8866baa831be671f0be423a317178b8baf547a (patch)
tree1e9bf9f760264bb86aa109fa14fb173536518a59 /src
parent8a7e52f4c22c5c29d2ee4c5c9654cd67ce31970b (diff)
updated for version 7.0032
Diffstat (limited to 'src')
-rw-r--r--src/ex_eval.c34
-rw-r--r--src/structs.h4
-rw-r--r--src/version.h4
3 files changed, 22 insertions, 20 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index d2e4f3789f..38517e3e7f 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -18,8 +18,6 @@
static void free_msglist __ARGS((struct msglist *l));
static int throw_exception __ARGS((void *, int, char_u *));
static char_u *get_end_emsg __ARGS((struct condstack *cstack));
-static void rewind_conditionals __ARGS((struct condstack *,
- int, int, int *));
/*
* Exception handling terms:
@@ -863,8 +861,8 @@ ex_endif(eap)
{
did_endif = TRUE;
if (eap->cstack->cs_idx < 0
- || (eap->cstack->cs_flags[eap->cstack->cs_idx] &
- (CSF_WHILE | CSF_FOR | CSF_TRY)))
+ || (eap->cstack->cs_flags[eap->cstack->cs_idx]
+ & (CSF_WHILE | CSF_FOR | CSF_TRY)))
eap->errmsg = (char_u *)N_("E580: :endif without :if");
else
{
@@ -1031,14 +1029,14 @@ ex_while(eap)
{
/* Jumping here from a ":continue" or ":endfor": use the
* previously evaluated list. */
- fi = cstack->cs_fors[cstack->cs_idx];
+ fi = cstack->cs_forinfo[cstack->cs_idx];
error = FALSE;
}
else
{
/* Evaluate the argument and get the info in a structure. */
fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip);
- cstack->cs_fors[cstack->cs_idx] = fi;
+ cstack->cs_forinfo[cstack->cs_idx] = fi;
}
/* use the element at the start of the list and advance */
@@ -1050,7 +1048,7 @@ ex_while(eap)
if (!result)
{
free_for_info(fi);
- cstack->cs_fors[cstack->cs_idx] = NULL;
+ cstack->cs_forinfo[cstack->cs_idx] = NULL;
}
}
@@ -1098,8 +1096,7 @@ ex_continue(eap)
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
if ((cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)))
{
- if (cstack->cs_idx > idx)
- rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
+ rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
/*
* Set CSL_HAD_CONT, so do_cmdline() will jump back to the
@@ -1448,7 +1445,7 @@ ex_catch(eap)
eap->errmsg = (char_u *)N_("E604: :catch after :finally");
give_up = TRUE;
}
- else if (cstack->cs_idx > idx)
+ else
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
&cstack->cs_looplevel);
}
@@ -1602,8 +1599,7 @@ ex_finally(eap)
eap->errmsg = (char_u *)N_("E607: multiple :finally");
return;
}
- if (cstack->cs_idx > idx)
- rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
+ rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
&cstack->cs_looplevel);
/*
@@ -1678,8 +1674,8 @@ ex_finally(eap)
* exception. When emsg() is called for a missing ":endif" or
* a missing ":endwhile"/":endfor" detected here, the
* exception will be discarded. */
- if (did_throw && cstack->cs_exception[cstack->cs_idx] !=
- current_exception)
+ if (did_throw && cstack->cs_exception[cstack->cs_idx]
+ != current_exception)
EMSG(_(e_internal));
}
@@ -2033,8 +2029,9 @@ leave_cleanup(csp)
/*
* Make conditionals inactive and discard what's pending in finally clauses
* until the conditional type searched for or a try conditional not in its
- * finally clause is reached. If this is in an active catch clause, finish the
- * caught exception. Return the cstack index where the search stopped.
+ * finally clause is reached. If this is in an active catch clause, finish
+ * the caught exception.
+ * Return the cstack index where the search stopped.
* Values used for "searched_cond" are (CSF_WHILE | CSF_FOR) or CSF_TRY or 0,
* the latter meaning the innermost try conditional not in its finally clause.
* "inclusive" tells whether the conditional searched for should be made
@@ -2186,8 +2183,9 @@ get_end_emsg(cstack)
* "cond_level" specify a conditional type and the address of a level variable
* which is to be decremented with each skipped conditional of the specified
* type.
+ * Also free "for info" structures where needed.
*/
- static void
+ void
rewind_conditionals(cstack, idx, cond_type, cond_level)
struct condstack *cstack;
int idx;
@@ -2198,6 +2196,8 @@ rewind_conditionals(cstack, idx, cond_type, cond_level)
{
if (cstack->cs_flags[cstack->cs_idx] & cond_type)
--*cond_level;
+ if (cstack->cs_flags[cstack->cs_idx] & CSF_FOR)
+ free_for_info(cstack->cs_forinfo[cstack->cs_idx]);
--cstack->cs_idx;
}
}
diff --git a/src/structs.h b/src/structs.h
index f49b80beb6..4ceb0ce4fc 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -601,7 +601,7 @@ struct condstack
void *csp_rv[CSTACK_LEN]; /* return typeval for pending return */
void *csp_ex[CSTACK_LEN]; /* exception for pending throw */
} cs_pend;
- void *cs_fors[CSTACK_LEN]; /* info used by ":for" */
+ void *cs_forinfo[CSTACK_LEN]; /* info used by ":for" */
int cs_line[CSTACK_LEN]; /* line nr of ":while"/":for" line */
int cs_idx; /* current entry, or -1 if none */
int cs_looplevel; /* nr of nested ":while"s and ":for"s */
@@ -612,6 +612,8 @@ struct condstack
# define cs_rettv cs_pend.csp_rv
# define cs_exception cs_pend.csp_ex
+/* There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if"
+ * was used. */
# define CSF_TRUE 0x0001 /* condition was TRUE */
# define CSF_ACTIVE 0x0002 /* current state is active */
# define CSF_ELSE 0x0004 /* ":else" has been passed */
diff --git a/src/version.h b/src/version.h
index 8348c0d00c..67ce20babc 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 5)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 5, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 6)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 6, compiled "