diff options
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r-- | src/ex_eval.c | 364 |
1 files changed, 181 insertions, 183 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c index 097280a67..645b27d8c 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -52,12 +52,12 @@ static char *get_end_emsg(struct condstack *cstack); * for a variable that is allowed to be changed during execution of a script. */ #if 0 -/* Expressions used for testing during the development phase. */ +// Expressions used for testing during the development phase. # define THROW_ON_ERROR (!eval_to_number("$VIMNOERRTHROW")) # define THROW_ON_INTERRUPT (!eval_to_number("$VIMNOINTTHROW")) # define THROW_TEST #else -/* Values used for the Vim release. */ +// Values used for the Vim release. # define THROW_ON_ERROR TRUE # define THROW_ON_ERROR_TRUE # define THROW_ON_INTERRUPT TRUE @@ -127,8 +127,8 @@ should_abort(int retcode) 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. */ + // This function is only called after an error. In this case, "force_abort" + // determines whether searching for finally clauses is necessary. return force_abort; } @@ -215,9 +215,9 @@ cause_errthrow( */ if (did_throw) { - /* When discarding an interrupt exception, reset got_int to prevent the - * same interrupt being converted to an exception again and discarding - * the error exception we are about to throw here. */ + // When discarding an interrupt exception, reset got_int to prevent the + // same interrupt being converted to an exception again and discarding + // the error exception we are about to throw here. if (current_exception->type == ET_INTERRUPT) got_int = FALSE; discard_current_exception(); @@ -276,7 +276,7 @@ cause_errthrow( { char *tmsg; - /* Skip the extra "Vim " prefix for message "E458". */ + // Skip the extra "Vim " prefix for message "E458". tmsg = elem->msg; if (STRNCMP(tmsg, "Vim E", 5) == 0 && VIM_ISDIGIT(tmsg[5]) @@ -342,8 +342,8 @@ do_errthrow(struct condstack *cstack, char_u *cmdname) force_abort = TRUE; } - /* If no exception is to be thrown or the conversion should be done after - * returning to a previous invocation of do_one_cmd(), do nothing. */ + // If no exception is to be thrown or the conversion should be done after + // returning to a previous invocation of do_one_cmd(), do nothing. if (msg_list == NULL || *msg_list == NULL) return; @@ -374,7 +374,7 @@ do_intthrow(struct condstack *cstack) if (!got_int || (trylevel == 0 && !did_throw)) return FALSE; -#ifdef THROW_TEST /* avoid warning for condition always true */ +#ifdef THROW_TEST // avoid warning for condition always true if (!THROW_ON_INTERRUPT) { /* @@ -401,7 +401,7 @@ do_intthrow(struct condstack *cstack) if (current_exception->type == ET_INTERRUPT) return FALSE; - /* An interrupt exception replaces any user or error exception. */ + // An interrupt exception replaces any user or error exception. discard_current_exception(); } if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) != FAIL) @@ -449,9 +449,9 @@ get_exception_string( val = ret + 4; } - /* msg_add_fname may have been used to prefix the message with a file - * name in quotes. In the exception value, put the file name in - * parentheses and move it to the end. */ + // msg_add_fname may have been used to prefix the message with a file + // name in quotes. In the exception value, put the file name in + // parentheses and move it to the end. for (p = mesg; ; p++) { if (*p == NUL @@ -464,13 +464,13 @@ get_exception_string( && p[4] == ':')))))) { if (*p == NUL || p == mesg) - STRCAT(val, mesg); /* 'E123' missing or at beginning */ + STRCAT(val, mesg); // 'E123' missing or at beginning else { - /* '"filename" E123: message text' */ + // '"filename" E123: message text' if (mesg[0] != '"' || p-2 < &mesg[1] || p[-2] != '"' || p[-1] != ' ') - /* "E123:" is part of the file name. */ + // "E123:" is part of the file name. continue; STRCAT(val, p); @@ -525,8 +525,8 @@ throw_exception(void *value, except_type_T type, char_u *cmdname) goto nomem; if (type == ET_ERROR) - /* Store the original message and prefix the exception value with - * "Vim:" or, if a command name is given, "Vim(cmdname):". */ + // Store the original message and prefix the exception value with + // "Vim:" or, if a command name is given, "Vim(cmdname):". excp->messages = (struct msglist *)value; excp->value = get_exception_string(value, type, cmdname, &should_free); @@ -549,15 +549,15 @@ throw_exception(void *value, except_type_T type, char_u *cmdname) int save_msg_silent = msg_silent; if (debug_break_level > 0) - msg_silent = FALSE; /* display messages */ + msg_silent = FALSE; // display messages else verbose_enter(); ++no_wait_return; if (debug_break_level > 0 || *p_vfile == NUL) - msg_scroll = TRUE; /* always scroll up, don't overwrite */ + msg_scroll = TRUE; // always scroll up, don't overwrite smsg(_("Exception thrown: %s"), excp->value); - msg_puts("\n"); /* don't overwrite this either */ + msg_puts("\n"); // don't overwrite this either if (debug_break_level > 0 || *p_vfile == NUL) cmdline_row = msg_row; @@ -601,17 +601,17 @@ discard_exception(except_T *excp, int was_finished) saved_IObuff = vim_strsave(IObuff); if (debug_break_level > 0) - msg_silent = FALSE; /* display messages */ + msg_silent = FALSE; // display messages else verbose_enter(); ++no_wait_return; if (debug_break_level > 0 || *p_vfile == NUL) - msg_scroll = TRUE; /* always scroll up, don't overwrite */ + msg_scroll = TRUE; // always scroll up, don't overwrite smsg(was_finished ? _("Exception finished: %s") : _("Exception discarded: %s"), excp->value); - msg_puts("\n"); /* don't overwrite this either */ + msg_puts("\n"); // don't overwrite this either if (debug_break_level > 0 || *p_vfile == NUL) cmdline_row = msg_row; --no_wait_return; @@ -664,7 +664,7 @@ catch_exception(except_T *excp) set_vim_var_string(VV_THROWPOINT, IObuff, -1); } else - /* throw_name not set on an exception from a command that was typed. */ + // throw_name not set on an exception from a command that was typed. set_vim_var_string(VV_THROWPOINT, NULL, -1); if (p_verbose >= 13 || debug_break_level > 0) @@ -672,15 +672,15 @@ catch_exception(except_T *excp) int save_msg_silent = msg_silent; if (debug_break_level > 0) - msg_silent = FALSE; /* display messages */ + msg_silent = FALSE; // display messages else verbose_enter(); ++no_wait_return; if (debug_break_level > 0 || *p_vfile == NUL) - msg_scroll = TRUE; /* always scroll up, don't overwrite */ + msg_scroll = TRUE; // always scroll up, don't overwrite smsg(_("Exception caught: %s"), excp->value); - msg_puts("\n"); /* don't overwrite this either */ + msg_puts("\n"); // don't overwrite this either if (debug_break_level > 0 || *p_vfile == NUL) cmdline_row = msg_row; @@ -716,8 +716,8 @@ finish_exception(except_T *excp) set_vim_var_string(VV_THROWPOINT, IObuff, -1); } else - /* throw_name not set on an exception from a command that was - * typed. */ + // throw_name not set on an exception from a command that was + // typed. set_vim_var_string(VV_THROWPOINT, NULL, -1); } else @@ -726,7 +726,7 @@ finish_exception(except_T *excp) set_vim_var_string(VV_THROWPOINT, NULL, -1); } - /* Discard the exception, but use the finish message for 'verbose'. */ + // Discard the exception, but use the finish message for 'verbose'. discard_exception(excp, TRUE); } @@ -760,7 +760,7 @@ report_pending(int action, int pending, void *value) case RP_RESUME: mesg = _("%s resumed"); break; - /* case RP_DISCARD: */ + // case RP_DISCARD: default: mesg = _("%s discarded"); break; @@ -781,7 +781,7 @@ report_pending(int action, int pending, void *value) s = ":finish"; break; case CSTP_RETURN: - /* ":return" command producing value, allocated */ + // ":return" command producing value, allocated s = (char *)get_return_cmd(value); break; @@ -797,17 +797,17 @@ report_pending(int action, int pending, void *value) s = _("Error and interrupt"); else if (pending & CSTP_ERROR) s = _("Error"); - else /* if (pending & CSTP_INTERRUPT) */ + else // if (pending & CSTP_INTERRUPT) s = _("Interrupt"); } save_msg_silent = msg_silent; if (debug_break_level > 0) - msg_silent = FALSE; /* display messages */ + msg_silent = FALSE; // display messages ++no_wait_return; - msg_scroll = TRUE; /* always scroll up, don't overwrite */ + msg_scroll = TRUE; // always scroll up, don't overwrite smsg(mesg, s); - msg_puts("\n"); /* don't overwrite this either */ + msg_puts("\n"); // don't overwrite this either cmdline_row = msg_row; --no_wait_return; if (debug_break_level > 0) @@ -916,7 +916,7 @@ ex_if(exarg_T *eap) cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE; } else - /* set TRUE, so this conditional will never get active */ + // set TRUE, so this conditional will never get active cstack->cs_flags[cstack->cs_idx] = CSF_TRUE; } } @@ -992,12 +992,12 @@ ex_else(exarg_T *eap) skip = TRUE; } - /* if skipping or the ":if" was TRUE, reset ACTIVE, otherwise set it */ + // if skipping or the ":if" was TRUE, reset ACTIVE, otherwise set it if (skip || cstack->cs_flags[cstack->cs_idx] & CSF_TRUE) { if (eap->errmsg == NULL) cstack->cs_flags[cstack->cs_idx] = CSF_TRUE; - skip = TRUE; /* don't evaluate an ":elseif" */ + skip = TRUE; // don't evaluate an ":elseif" } else cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE; @@ -1021,11 +1021,11 @@ ex_else(exarg_T *eap) if (eap->cmdidx == CMD_elseif) { result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); - /* When throwing error exceptions, we want to throw always the first - * of several errors in a row. This is what actually happens when - * a conditional error was detected above and there is another failure - * when parsing the expression. Since the skip flag is set in this - * case, the parsing error will be ignored by emsg(). */ + // When throwing error exceptions, we want to throw always the first + // of several errors in a row. This is what actually happens when + // a conditional error was detected above and there is another failure + // when parsing the expression. Since the skip flag is set in this + // case, the parsing error will be ignored by emsg(). if (!skip && !error) { @@ -1035,7 +1035,7 @@ ex_else(exarg_T *eap) cstack->cs_flags[cstack->cs_idx] = 0; } else if (eap->errmsg == NULL) - /* set TRUE, so this conditional will never get active */ + // set TRUE, so this conditional will never get active cstack->cs_flags[cstack->cs_idx] = CSF_TRUE; } else @@ -1093,19 +1093,19 @@ ex_while(exarg_T *eap) */ if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0) { - /* Jumping here from a ":continue" or ":endfor": use the - * previously evaluated list. */ + // Jumping here from a ":continue" or ":endfor": use the + // previously evaluated list. fi = cstack->cs_forinfo[cstack->cs_idx]; error = FALSE; } else { - /* Evaluate the argument and get the info in a structure. */ + // Evaluate the argument and get the info in a structure. fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip); cstack->cs_forinfo[cstack->cs_idx] = fi; } - /* use the element at the start of the list and advance */ + // use the element at the start of the list and advance if (!error && fi != NULL && !skip) result = next_for_item(fi, eap->arg); else @@ -1131,10 +1131,10 @@ ex_while(exarg_T *eap) else { cstack->cs_lflags &= ~CSL_HAD_LOOP; - /* If the ":while" evaluates to FALSE or ":for" is past the end of - * the list, show the debug prompt at the ":endwhile"/":endfor" as - * if there was a ":break" in a ":while"/":for" evaluating to - * TRUE. */ + // If the ":while" evaluates to FALSE or ":for" is past the end of + // the list, show the debug prompt at the ":endwhile"/":endfor" as + // if there was a ":break" in a ":while"/":for" evaluating to + // TRUE. if (!skip && !error) cstack->cs_flags[cstack->cs_idx] |= CSF_TRUE; } @@ -1154,10 +1154,10 @@ ex_continue(exarg_T *eap) eap->errmsg = N_("E586: :continue without :while or :for"); else { - /* Try to find the matching ":while". This might stop at a try - * conditional not in its finally clause (which is then to be executed - * next). Therefor, inactivate all conditionals except the ":while" - * itself (if reached). */ + // Try to find the matching ":while". This might stop at a try + // conditional not in its finally clause (which is then to be executed + // next). Therefor, inactivate all conditionals except the ":while" + // itself (if reached). idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); if (idx >= 0 && (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { @@ -1167,12 +1167,12 @@ ex_continue(exarg_T *eap) * Set CSL_HAD_CONT, so do_cmdline() will jump back to the * matching ":while". */ - cstack->cs_lflags |= CSL_HAD_CONT; /* let do_cmdline() handle it */ + cstack->cs_lflags |= CSL_HAD_CONT; // let do_cmdline() handle it } else { - /* If a try conditional not in its finally clause is reached first, - * make the ":continue" pending for execution at the ":endtry". */ + // If a try conditional not in its finally clause is reached first, + // make the ":continue" pending for execution at the ":endtry". cstack->cs_pending[idx] = CSTP_CONTINUE; report_make_pending(CSTP_CONTINUE, NULL); } @@ -1192,10 +1192,10 @@ ex_break(exarg_T *eap) eap->errmsg = N_("E587: :break without :while or :for"); else { - /* Inactivate conditionals until the matching ":while" or a try - * conditional not in its finally clause (which is then to be - * executed next) is found. In the latter case, make the ":break" - * pending for execution at the ":endtry". */ + // Inactivate conditionals until the matching ":while" or a try + // conditional not in its finally clause (which is then to be + // executed next) is found. In the latter case, make the ":break" + // pending for execution at the ":endtry". idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE); if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { @@ -1235,8 +1235,8 @@ ex_endwhile(exarg_T *eap) fl = cstack->cs_flags[cstack->cs_idx]; if (!(fl & csf)) { - /* If we are in a ":while" or ":for" but used the wrong endloop - * command, do not rewind to the next enclosing ":for"/":while". */ + // If we are in a ":while" or ":for" but used the wrong endloop + // command, do not rewind to the next enclosing ":for"/":while". if (fl & CSF_WHILE) eap->errmsg = _("E732: Using :endfor with :while"); else if (fl & CSF_FOR) @@ -1248,21 +1248,21 @@ ex_endwhile(exarg_T *eap) eap->errmsg = e_endif; else if (fl & CSF_FINALLY) eap->errmsg = e_endtry; - /* Try to find the matching ":while" and report what's missing. */ + // Try to find the matching ":while" and report what's missing. for (idx = cstack->cs_idx; idx > 0; --idx) { fl = cstack->cs_flags[idx]; if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) { - /* Give up at a try conditional not in its finally clause. - * Ignore the ":endwhile"/":endfor". */ + // Give up at a try conditional not in its finally clause. + // Ignore the ":endwhile"/":endfor". eap->errmsg = err; return; } if (fl & csf) break; } - /* Cleanup and rewind all contained (and unclosed) conditionals. */ + // Cleanup and rewind all contained (and unclosed) conditionals. (void)cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel); } @@ -1308,8 +1308,8 @@ ex_throw(exarg_T *eap) value = NULL; } - /* On error or when an exception is thrown during argument evaluation, do - * not throw. */ + // On error or when an exception is thrown during argument evaluation, do + // not throw. if (!eap->skip && value != NULL) { if (throw_exception(value, ET_USER, NULL) == FAIL) @@ -1374,17 +1374,17 @@ do_throw(struct condstack *cstack) if (cstack->cs_flags[idx] & CSF_ACTIVE) cstack->cs_flags[idx] |= CSF_THROWN; else - /* THROWN may have already been set for a catchable exception - * that has been discarded. Ensure it is reset for the new - * exception. */ + // THROWN may have already been set for a catchable exception + // that has been discarded. Ensure it is reset for the new + // exception. cstack->cs_flags[idx] &= ~CSF_THROWN; } cstack->cs_flags[idx] &= ~CSF_ACTIVE; cstack->cs_exception[idx] = current_exception; } #if 0 - /* TODO: Add optimization below. Not yet done because of interface - * problems to eval.c and ex_cmds2.c. (Servatius) */ + // TODO: Add optimization below. Not yet done because of interface + // problems to eval.c and ex_cmds2.c. (Servatius) else { /* @@ -1429,9 +1429,9 @@ ex_try(exarg_T *eap) if (!skip) { - /* Set ACTIVE and TRUE. TRUE means that the corresponding ":catch" - * commands should check for a match if an exception is thrown and - * that the finally clause needs to be executed. */ + // Set ACTIVE and TRUE. TRUE means that the corresponding ":catch" + // commands should check for a match if an exception is thrown and + // that the finally clause needs to be executed. cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE; /* @@ -1498,8 +1498,8 @@ ex_catch(exarg_T *eap) { if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) { - /* Report what's missing if the matching ":try" is not in its - * finally clause. */ + // Report what's missing if the matching ":try" is not in its + // finally clause. eap->errmsg = get_end_emsg(cstack); skip = TRUE; } @@ -1508,8 +1508,8 @@ ex_catch(exarg_T *eap) break; if (cstack->cs_flags[idx] & CSF_FINALLY) { - /* Give up for a ":catch" after ":finally" and ignore it. - * Just parse. */ + // Give up for a ":catch" after ":finally" and ignore it. + // Just parse. eap->errmsg = N_("E604: :catch after :finally"); give_up = TRUE; } @@ -1518,7 +1518,7 @@ ex_catch(exarg_T *eap) &cstack->cs_looplevel); } - if (ends_excmd(*eap->arg)) /* no argument, catch all errors */ + if (ends_excmd(*eap->arg)) // no argument, catch all errors { pat = (char_u *)".*"; end = NULL; @@ -1554,17 +1554,17 @@ ex_catch(exarg_T *eap) return; } - /* When debugging or a breakpoint was encountered, display the - * debug prompt (if not already done) before checking for a match. - * This is a helpful hint for the user when the regular expression - * matching fails. Handle a ">quit" debug command as if an - * interrupt had occurred before the ":catch". That is, discard - * the original exception, replace it by an interrupt exception, - * and don't catch it in this try block. */ + // When debugging or a breakpoint was encountered, display the + // debug prompt (if not already done) before checking for a match. + // This is a helpful hint for the user when the regular expression + // matching fails. Handle a ">quit" debug command as if an + // interrupt had occurred before the ":catch". That is, discard + // the original exception, replace it by an interrupt exception, + // and don't catch it in this try block. if (!dbg_check_skipped(eap) || !do_intthrow(cstack)) { - /* Terminate the pattern and avoid the 'l' flag in 'cpoptions' - * while compiling it. */ + // Terminate the pattern and avoid the 'l' flag in 'cpoptions' + // while compiling it. if (end != NULL) { save_char = *end; @@ -1572,8 +1572,8 @@ ex_catch(exarg_T *eap) } save_cpo = p_cpo; p_cpo = (char_u *)""; - /* Disable error messages, it will make current_exception - * invalid. */ + // Disable error messages, it will make current_exception + // invalid. ++emsg_off; regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); --emsg_off; @@ -1602,16 +1602,16 @@ ex_catch(exarg_T *eap) if (caught) { - /* Make this ":catch" clause active and reset did_emsg, got_int, - * and did_throw. Put the exception on the caught stack. */ + // Make this ":catch" clause active and reset did_emsg, got_int, + // and did_throw. Put the exception on the caught stack. cstack->cs_flags[idx] |= CSF_ACTIVE | CSF_CAUGHT; did_emsg = got_int = did_throw = FALSE; catch_exception((except_T *)cstack->cs_exception[idx]); - /* It's mandatory that the current exception is stored in the cstack - * so that it can be discarded at the next ":catch", ":finally", or - * ":endtry" or when the catch clause is left by a ":continue", - * ":break", ":return", ":finish", error, interrupt, or another - * exception. */ + // It's mandatory that the current exception is stored in the cstack + // so that it can be discarded at the next ":catch", ":finally", or + // ":endtry" or when the catch clause is left by a ":continue", + // ":break", ":return", ":finish", error, interrupt, or another + // exception. if (cstack->cs_exception[cstack->cs_idx] != current_exception) internal_error("ex_catch()"); } @@ -1656,9 +1656,9 @@ ex_finally(exarg_T *eap) for (idx = cstack->cs_idx - 1; idx > 0; --idx) if (cstack->cs_flags[idx] & CSF_TRY) break; - /* Make this error pending, so that the commands in the following - * finally clause can be executed. This overrules also a pending - * ":continue", ":break", ":return", or ":finish". */ + // Make this error pending, so that the commands in the following + // finally clause can be executed. This overrules also a pending + // ":continue", ":break", ":return", or ":finish". pending = CSTP_ERROR; } else @@ -1666,7 +1666,7 @@ ex_finally(exarg_T *eap) if (cstack->cs_flags[idx] & CSF_FINALLY) { - /* Give up for a multiple ":finally" and ignore it. */ + // Give up for a multiple ":finally" and ignore it. eap->errmsg = N_("E607: multiple :finally"); return; } @@ -1685,15 +1685,15 @@ ex_finally(exarg_T *eap) if (!skip) { - /* When debugging or a breakpoint was encountered, display the - * debug prompt (if not already done). The user then knows that the - * finally clause is executed. */ + // When debugging or a breakpoint was encountered, display the + // debug prompt (if not already done). The user then knows that the + // finally clause is executed. if (dbg_check_skipped(eap)) { - /* Handle a ">quit" debug command as if an interrupt had - * occurred before the ":finally". That is, discard the - * original exception and replace it by an interrupt - * exception. */ + // Handle a ">quit" debug command as if an interrupt had + // occurred before the ":finally". That is, discard the + // original exception and replace it by an interrupt + // exception. (void)do_intthrow(cstack); } @@ -1738,13 +1738,13 @@ ex_finally(exarg_T *eap) pending |= got_int ? CSTP_INTERRUPT : 0; cstack->cs_pending[cstack->cs_idx] = pending; - /* It's mandatory that the current exception is stored in the - * cstack so that it can be rethrown at the ":endtry" or be - * discarded if the finally clause is left by a ":continue", - * ":break", ":return", ":finish", error, interrupt, or another - * exception. When emsg() is called for a missing ":endif" or - * a missing ":endwhile"/":endfor" detected here, the - * exception will be discarded. */ + // It's mandatory that the current exception is stored in the + // cstack so that it can be rethrown at the ":endtry" or be + // discarded if the finally clause is left by a ":continue", + // ":break", ":return", ":finish", error, interrupt, or another + // 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) internal_error("ex_finally()"); @@ -1796,7 +1796,7 @@ ex_endtry(exarg_T *eap) if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) { eap->errmsg = get_end_emsg(cstack); - /* Find the matching ":try" and report what's missing. */ + // Find the matching ":try" and report what's missing. idx = cstack->cs_idx; do --idx; @@ -1830,28 +1830,27 @@ ex_endtry(exarg_T *eap) rethrow = TRUE; } - /* If there was no finally clause, show the user when debugging or - * a breakpoint was encountered that the end of the try conditional has - * been reached: display the debug prompt (if not already done). Do - * this on normal control flow or when an exception was thrown, but not - * on an interrupt or error not converted to an exception or when - * a ":break", ":continue", ":return", or ":finish" is pending. These - * actions are carried out immediately. - */ + // If there was no finally clause, show the user when debugging or + // a breakpoint was encountered that the end of the try conditional has + // been reached: display the debug prompt (if not already done). Do + // this on normal control flow or when an exception was thrown, but not + // on an interrupt or error not converted to an exception or when + // a ":break", ":continue", ":return", or ":finish" is pending. These + // actions are carried out immediately. if ((rethrow || (!skip && !(cstack->cs_flags[idx] & CSF_FINALLY) && !cstack->cs_pending[idx])) && dbg_check_skipped(eap)) { - /* Handle a ">quit" debug command as if an interrupt had occurred - * before the ":endtry". That is, throw an interrupt exception and - * set "skip" and "rethrow". */ + // Handle a ">quit" debug command as if an interrupt had occurred + // before the ":endtry". That is, throw an interrupt exception and + // set "skip" and "rethrow". if (got_int) { skip = TRUE; (void)do_intthrow(cstack); - /* The do_intthrow() call may have reset did_throw or - * cstack->cs_pending[idx].*/ + // The do_intthrow() call may have reset did_throw or + // cstack->cs_pending[idx]. rethrow = FALSE; if (did_throw && !(cstack->cs_flags[idx] & CSF_FINALLY)) rethrow = TRUE; @@ -1899,13 +1898,13 @@ ex_endtry(exarg_T *eap) case CSTP_NONE: break; - /* Reactivate a pending ":continue", ":break", ":return", - * ":finish" from the try block or a catch clause of this try - * conditional. This is skipped, if there was an error in an - * (unskipped) conditional command or an interrupt afterwards - * or if the finally clause is present and executed a new error, - * interrupt, throw, ":continue", ":break", ":return", or - * ":finish". */ + // Reactivate a pending ":continue", ":break", ":return", + // ":finish" from the try block or a catch clause of this try + // conditional. This is skipped, if there was an error in an + // (unskipped) conditional command or an interrupt afterwards + // or if the finally clause is present and executed a new error, + // interrupt, throw, ":continue", ":break", ":return", or + // ":finish". case CSTP_CONTINUE: ex_continue(eap); break; @@ -1919,12 +1918,12 @@ ex_endtry(exarg_T *eap) do_finish(eap, FALSE); break; - /* When the finally clause was entered due to an error, - * interrupt or throw (as opposed to a ":continue", ":break", - * ":return", or ":finish"), restore the pending values of - * did_emsg, got_int, and did_throw. This is skipped, if there - * was a new error, interrupt, throw, ":continue", ":break", - * ":return", or ":finish". in the finally clause. */ + // When the finally clause was entered due to an error, + // interrupt or throw (as opposed to a ":continue", ":break", + // ":return", or ":finish"), restore the pending values of + // did_emsg, got_int, and did_throw. This is skipped, if there + // was a new error, interrupt, throw, ":continue", ":break", + // ":return", or ":finish". in the finally clause. default: if (pending & CSTP_ERROR) did_emsg = TRUE; @@ -1937,7 +1936,7 @@ ex_endtry(exarg_T *eap) } if (rethrow) - /* Rethrow the current exception (within this cstack). */ + // Rethrow the current exception (within this cstack). do_throw(cstack); } } @@ -1980,13 +1979,12 @@ enter_cleanup(cleanup_T *csp) | (did_throw ? CSTP_THROW : 0) | (need_rethrow ? CSTP_THROW : 0); - /* If we are currently throwing an exception (did_throw), save it as - * well. On an error not yet converted to an exception, update - * "force_abort" and reset "cause_abort" (as do_errthrow() would do). - * This is needed for the do_cmdline() call that is going to be made - * for autocommand execution. We need not save *msg_list because - * there is an extra instance for every call of do_cmdline(), anyway. - */ + // If we are currently throwing an exception (did_throw), save it as + // well. On an error not yet converted to an exception, update + // "force_abort" and reset "cause_abort" (as do_errthrow() would do). + // This is needed for the do_cmdline() call that is going to be made + // for autocommand execution. We need not save *msg_list because + // there is an extra instance for every call of do_cmdline(), anyway. if (did_throw || need_rethrow) { csp->exception = current_exception; @@ -2003,7 +2001,7 @@ enter_cleanup(cleanup_T *csp) } did_emsg = got_int = did_throw = need_rethrow = FALSE; - /* Report if required by the 'verbose' option or when debugging. */ + // Report if required by the 'verbose' option or when debugging. report_make_pending(pending, csp->exception); } else @@ -2033,23 +2031,23 @@ leave_cleanup(cleanup_T *csp) { int pending = csp->pending; - if (pending == CSTP_NONE) /* nothing to do */ + if (pending == CSTP_NONE) // nothing to do return; - /* If there was an aborting error, an interrupt, or an uncaught exception - * after the corresponding call to enter_cleanup(), discard what has been - * made pending by it. Report this to the user if required by the - * 'verbose' option or when debugging. */ + // If there was an aborting error, an interrupt, or an uncaught exception + // after the corresponding call to enter_cleanup(), discard what has been + // made pending by it. Report this to the user if required by the + // 'verbose' option or when debugging. if (aborting() || need_rethrow) { if (pending & CSTP_THROW) - /* Cancel the pending exception (includes report). */ + // Cancel the pending exception (includes report). discard_exception((except_T *)csp->exception, FALSE); else report_discard_pending(pending, NULL); - /* If an error was about to be converted to an exception when - * enter_cleanup() was called, free the message list. */ + // If an error was about to be converted to an exception when + // enter_cleanup() was called, free the message list. if (msg_list != NULL) free_global_msglist(); } @@ -2088,9 +2086,9 @@ leave_cleanup(cleanup_T *csp) if (pending & CSTP_INTERRUPT) got_int = TRUE; if (pending & CSTP_THROW) - need_rethrow = TRUE; /* did_throw will be set by do_one_cmd() */ + need_rethrow = TRUE; // did_throw will be set by do_one_cmd() - /* Report if required by the 'verbose' option or when debugging. */ + // Report if required by the 'verbose' option or when debugging. report_resume_pending(pending, (pending & CSTP_THROW) ? (void *)current_exception : NULL); } @@ -2158,9 +2156,9 @@ cleanup_conditionals( { if (cstack->cs_pending[idx] & CSTP_THROW) { - /* Cancel the pending exception. This is in the - * finally clause, so that the stack of the - * caught exceptions is not involved. */ + // Cancel the pending exception. This is in the + // finally clause, so that the stack of the + // caught exceptions is not involved. discard_exception((except_T *) cstack->cs_exception[idx], FALSE); @@ -2184,10 +2182,10 @@ cleanup_conditionals( if ((cstack->cs_flags[idx] & CSF_ACTIVE) && (cstack->cs_flags[idx] & CSF_CAUGHT)) finish_exception((except_T *)cstack->cs_exception[idx]); - /* Stop at this try conditional - except the try block never - * got active (because of an inactive surrounding conditional - * or when the ":try" appeared after an error or interrupt or - * throw). */ + // Stop at this try conditional - except the try block never + // got active (because of an inactive surrounding conditional + // or when the ":try" appeared after an error or interrupt or + // throw). if (cstack->cs_flags[idx] & CSF_TRUE) { if (searched_cond == 0 && !inclusive) @@ -2197,10 +2195,10 @@ cleanup_conditionals( } } - /* Stop on the searched conditional type (even when the surrounding - * conditional is not active or something has been made pending). - * If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT, - * check first whether "emsg_silent" needs to be restored. */ + // Stop on the searched conditional type (even when the surrounding + // conditional is not active or something has been made pending). + // If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT, + // check first whether "emsg_silent" needs to be restored. if (cstack->cs_flags[idx] & searched_cond) { if (!inclusive) @@ -2288,7 +2286,7 @@ has_loop_cmd(char_u *p) { int len; - /* skip modifiers, white space and ':' */ + // skip modifiers, white space and ':' for (;;) { while (*p == ' ' || *p == '\t' || *p == ':') @@ -2304,4 +2302,4 @@ has_loop_cmd(char_u *p) return FALSE; } -#endif /* FEAT_EVAL */ +#endif // FEAT_EVAL |