aboutsummaryrefslogtreecommitdiff
path: root/src/ex_eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c139
1 files changed, 47 insertions, 92 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 5f845c3f33..e4148068f5 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -12,6 +12,14 @@
*/
#include "vim.h"
+#include "ex_eval.h"
+#include "charset.h"
+#include "eval.h"
+#include "ex_cmds2.h"
+#include "ex_docmd.h"
+#include "message.h"
+#include "misc2.h"
+#include "regexp.h"
static void free_msglist __ARGS((struct msglist *l));
@@ -84,7 +92,7 @@ static int cause_abort = FALSE;
* cancellation of an expression evaluation after an aborting function call or
* due to a parsing error, aborting() always returns the same value.
*/
-int aborting() {
+int aborting(void) {
return (did_emsg && force_abort) || got_int || did_throw;
}
@@ -94,7 +102,7 @@ int aborting() {
* be necessary to restore "force_abort" even before the throw point for the
* error message has been reached. update_force_abort() should be called then.
*/
-void update_force_abort() {
+void update_force_abort(void) {
if (cause_abort)
force_abort = TRUE;
}
@@ -105,8 +113,7 @@ void update_force_abort() {
* execution of a failing subcommand as long as the error message has not been
* displayed and actually caused the abortion.
*/
-int should_abort(retcode)
-int retcode;
+int should_abort(int retcode)
{
return (retcode == FAIL && trylevel != 0 && !emsg_silent) || aborting();
}
@@ -117,7 +124,7 @@ int retcode;
* to find finally clauses to be executed, and that some errors in skipped
* commands are still reported.
*/
-int aborted_in_try() {
+int aborted_in_try(void) {
/* This function is only called after an error. In this case, "force_abort"
* determines whether searching for finally clauses is necessary. */
return force_abort;
@@ -132,10 +139,7 @@ int aborted_in_try() {
* most specific one and used as the exception value. The "severe" flag can be
* set to TRUE, if a later but severer message should be used instead.
*/
-int cause_errthrow(mesg, severe, ignore)
-char_u *mesg;
-int severe;
-int *ignore;
+int cause_errthrow(char_u *mesg, int severe, int *ignore)
{
struct msglist *elem;
struct msglist **plist;
@@ -275,8 +279,7 @@ int *ignore;
/*
* Free a "msg_list" and the messages it contains.
*/
-static void free_msglist(l)
-struct msglist *l;
+static void free_msglist(struct msglist *l)
{
struct msglist *messages, *next;
@@ -293,7 +296,7 @@ struct msglist *l;
* Free global "*msg_list" and the messages it contains, then set "*msg_list"
* to NULL.
*/
-void free_global_msglist() {
+void free_global_msglist(void) {
free_msglist(*msg_list);
*msg_list = NULL;
}
@@ -303,9 +306,7 @@ void free_global_msglist() {
* error exception. If cstack is NULL, postpone the throw until do_cmdline()
* has returned (see do_one_cmd()).
*/
-void do_errthrow(cstack, cmdname)
-struct condstack *cstack;
-char_u *cmdname;
+void do_errthrow(struct condstack *cstack, char_u *cmdname)
{
/*
* Ensure that all commands in nested function calls and sourced files
@@ -337,8 +338,7 @@ char_u *cmdname;
* exception if appropriate. Return TRUE if the current exception is discarded,
* FALSE otherwise.
*/
-int do_intthrow(cstack)
-struct condstack *cstack;
+int do_intthrow(struct condstack *cstack)
{
/*
* If no interrupt occurred or no try conditional is active and no exception
@@ -384,11 +384,7 @@ struct condstack *cstack;
/*
* Get an exception message that is to be stored in current_exception->value.
*/
-char_u * get_exception_string(value, type, cmdname, should_free)
-void *value;
-int type;
-char_u *cmdname;
-int *should_free;
+char_u *get_exception_string(void *value, int type, char_u *cmdname, int *should_free)
{
char_u *ret, *mesg;
int cmdlen;
@@ -457,10 +453,7 @@ int *should_free;
* user or interrupt exception, or points to a message list in case of an
* error exception.
*/
-static int throw_exception(value, type, cmdname)
-void *value;
-int type;
-char_u *cmdname;
+static int throw_exception(void *value, int type, char_u *cmdname)
{
except_T *excp;
int should_free;
@@ -541,9 +534,7 @@ fail:
* Discard an exception. "was_finished" is set when the exception has been
* caught and the catch clause has been ended normally.
*/
-static void discard_exception(excp, was_finished)
-except_T *excp;
-int was_finished;
+static void discard_exception(except_T *excp, int was_finished)
{
char_u *saved_IObuff;
@@ -589,7 +580,7 @@ int was_finished;
/*
* Discard the exception currently being thrown.
*/
-void discard_current_exception() {
+void discard_current_exception(void) {
discard_exception(current_exception, FALSE);
current_exception = NULL;
did_throw = FALSE;
@@ -599,8 +590,7 @@ void discard_current_exception() {
/*
* Put an exception on the caught stack.
*/
-static void catch_exception(excp)
-except_T *excp;
+static void catch_exception(except_T *excp)
{
excp->caught = caught_stack;
caught_stack = excp;
@@ -643,8 +633,7 @@ except_T *excp;
/*
* Remove an exception from the caught stack.
*/
-static void finish_exception(excp)
-except_T *excp;
+static void finish_exception(except_T *excp)
{
if (excp != caught_stack)
EMSG(_(e_internal));
@@ -687,10 +676,7 @@ except_T *excp;
* what is pending. "value" specifies the return value for a pending ":return"
* or the exception value for a pending exception.
*/
-static void report_pending(action, pending, value)
-int action;
-int pending;
-void *value;
+static void report_pending(int action, int pending, void *value)
{
char_u *mesg;
char *s;
@@ -765,9 +751,7 @@ void *value;
* If something is made pending in a finally clause, report it if required by
* the 'verbose' option or when debugging.
*/
-void report_make_pending(pending, value)
-int pending;
-void *value;
+void report_make_pending(int pending, void *value)
{
if (p_verbose >= 14 || debug_break_level > 0) {
if (debug_break_level <= 0)
@@ -782,9 +766,7 @@ void *value;
* If something pending in a finally clause is resumed at the ":endtry", report
* it if required by the 'verbose' option or when debugging.
*/
-void report_resume_pending(pending, value)
-int pending;
-void *value;
+void report_resume_pending(int pending, void *value)
{
if (p_verbose >= 14 || debug_break_level > 0) {
if (debug_break_level <= 0)
@@ -799,9 +781,7 @@ void *value;
* If something pending in a finally clause is discarded, report it if required
* by the 'verbose' option or when debugging.
*/
-void report_discard_pending(pending, value)
-int pending;
-void *value;
+void report_discard_pending(int pending, void *value)
{
if (p_verbose >= 14 || debug_break_level > 0) {
if (debug_break_level <= 0)
@@ -816,8 +796,7 @@ void *value;
/*
* ":if".
*/
-void ex_if(eap)
-exarg_T *eap;
+void ex_if(exarg_T *eap)
{
int error;
int skip;
@@ -854,8 +833,7 @@ exarg_T *eap;
/*
* ":endif".
*/
-void ex_endif(eap)
-exarg_T *eap;
+void ex_endif(exarg_T *eap)
{
did_endif = TRUE;
if (eap->cstack->cs_idx < 0
@@ -883,8 +861,7 @@ exarg_T *eap;
/*
* ":else" and ":elseif".
*/
-void ex_else(eap)
-exarg_T *eap;
+void ex_else(exarg_T *eap)
{
int error;
int skip;
@@ -965,8 +942,7 @@ exarg_T *eap;
/*
* Handle ":while" and ":for".
*/
-void ex_while(eap)
-exarg_T *eap;
+void ex_while(exarg_T *eap)
{
int error;
int skip;
@@ -1055,8 +1031,7 @@ exarg_T *eap;
/*
* ":continue"
*/
-void ex_continue(eap)
-exarg_T *eap;
+void ex_continue(exarg_T *eap)
{
int idx;
struct condstack *cstack = eap->cstack;
@@ -1089,8 +1064,7 @@ exarg_T *eap;
/*
* ":break"
*/
-void ex_break(eap)
-exarg_T *eap;
+void ex_break(exarg_T *eap)
{
int idx;
struct condstack *cstack = eap->cstack;
@@ -1113,8 +1087,7 @@ exarg_T *eap;
/*
* ":endwhile" and ":endfor"
*/
-void ex_endwhile(eap)
-exarg_T *eap;
+void ex_endwhile(exarg_T *eap)
{
struct condstack *cstack = eap->cstack;
int idx;
@@ -1190,8 +1163,7 @@ exarg_T *eap;
/*
* ":throw expr"
*/
-void ex_throw(eap)
-exarg_T *eap;
+void ex_throw(exarg_T *eap)
{
char_u *arg = eap->arg;
char_u *value;
@@ -1218,8 +1190,7 @@ exarg_T *eap;
* for ":throw" (user exception) and error and interrupt exceptions. Also
* used for rethrowing an uncaught exception.
*/
-void do_throw(cstack)
-struct condstack *cstack;
+void do_throw(struct condstack *cstack)
{
int idx;
int inactivate_try = FALSE;
@@ -1279,8 +1250,7 @@ struct condstack *cstack;
/*
* ":try"
*/
-void ex_try(eap)
-exarg_T *eap;
+void ex_try(exarg_T *eap)
{
int skip;
struct condstack *cstack = eap->cstack;
@@ -1347,8 +1317,7 @@ exarg_T *eap;
/*
* ":catch /{pattern}/" and ":catch"
*/
-void ex_catch(eap)
-exarg_T *eap;
+void ex_catch(exarg_T *eap)
{
int idx = 0;
int give_up = FALSE;
@@ -1489,8 +1458,7 @@ exarg_T *eap;
/*
* ":finally"
*/
-void ex_finally(eap)
-exarg_T *eap;
+void ex_finally(exarg_T *eap)
{
int idx;
int skip = FALSE;
@@ -1608,8 +1576,7 @@ exarg_T *eap;
/*
* ":endtry"
*/
-void ex_endtry(eap)
-exarg_T *eap;
+void ex_endtry(exarg_T *eap)
{
int idx;
int skip;
@@ -1797,8 +1764,7 @@ exarg_T *eap;
* do_cmdline() that is going to be made for the cleanup autocommand
* execution.
*/
-void enter_cleanup(csp)
-cleanup_T *csp;
+void enter_cleanup(cleanup_T *csp)
{
int pending = CSTP_NONE;
@@ -1854,8 +1820,7 @@ cleanup_T *csp;
* cleanup autocommands. In the latter case, the saved error/interrupt/
* exception state is discarded.
*/
-void leave_cleanup(csp)
-cleanup_T *csp;
+void leave_cleanup(cleanup_T *csp)
{
int pending = csp->pending;
@@ -1935,10 +1900,7 @@ cleanup_T *csp;
* entered, is restored (used by ex_endtry()). This is normally done only
* when such a try conditional is left.
*/
-int cleanup_conditionals(cstack, searched_cond, inclusive)
-struct condstack *cstack;
-int searched_cond;
-int inclusive;
+int cleanup_conditionals(struct condstack *cstack, int searched_cond, int inclusive)
{
int idx;
int stop = FALSE;
@@ -2046,8 +2008,7 @@ int inclusive;
/*
* Return an appropriate error message for a missing endwhile/endfor/endif.
*/
-static char_u * get_end_emsg(cstack)
-struct condstack *cstack;
+static char_u *get_end_emsg(struct condstack *cstack)
{
if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE)
return e_endwhile;
@@ -2064,11 +2025,7 @@ struct condstack *cstack;
* type.
* Also free "for info" structures where needed.
*/
-void rewind_conditionals(cstack, idx, cond_type, cond_level)
-struct condstack *cstack;
-int idx;
-int cond_type;
-int *cond_level;
+void rewind_conditionals(struct condstack *cstack, int idx, int cond_type, int *cond_level)
{
while (cstack->cs_idx > idx) {
if (cstack->cs_flags[cstack->cs_idx] & cond_type)
@@ -2082,8 +2039,7 @@ int *cond_level;
/*
* ":endfunction" when not after a ":function"
*/
-void ex_endfunction(eap)
-exarg_T *eap UNUSED;
+void ex_endfunction(exarg_T *eap)
{
EMSG(_("E193: :endfunction not inside a function"));
}
@@ -2091,8 +2047,7 @@ exarg_T *eap UNUSED;
/*
* Return TRUE if the string "p" looks like a ":while" or ":for" command.
*/
-int has_loop_cmd(p)
-char_u *p;
+int has_loop_cmd(char_u *p)
{
int len;