///
///  @file    exec.h
///  @brief   Header file for parsing and executing TECO commands.
///
///  *** This file is automatically generated. DO NOT MODIFY. ***
///
///  @copyright 2019-2023 Franklin P. Johnston / Nowwith Treble Software
///
///  Permission is hereby granted, free of charge, to any person obtaining a
///  copy of this software and associated documentation files (the "Software"),
///  to deal in the Software without restriction, including without limitation
///  the rights to use, copy, modify, merge, publish, distribute, sublicense,
///  and/or sell copies of the Software, and to permit persons to whom the
///  Software is furnished to do so, subject to the following conditions:
///
///  The above copyright notice and this permission notice shall be included in
///  all copies or substantial portions of the Software.
///
///  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
///  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
///  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
///  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA-
///  BILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
///  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
///  THE SOFTWARE.
///
////////////////////////////////////////////////////////////////////////////////

#if     !defined(_EXEC_H)

#define _EXEC_H

enum
{
    END_LIST,                       ///< End of list
    NO_ATSIGN,                      ///< Don't allow atsign
    NO_COLON,                       ///< Don't allow colon
    NO_DCOLON,                      ///< Don't allow double colon
    NO_M,                           ///< Don't allow m argument
    NO_M_ONLY,                      ///< Don't allow m without n
    NO_N,                           ///< Don't allow n argument
    NO_NEG_M,                       ///< Don't allow negative m
    NO_NEG_N                        ///< Don't allow negative n
};

#if     defined(NSTRICT)        // Disable strict syntax checking

#define confirm(cmd, ...)

#else

/// @def    confirm
/// @brief  Tests restrictions on command syntax.

#define confirm(cmd, ...) if (f.e0.exec) confirm_cmd(cmd, ## __VA_ARGS__, END_LIST)

void confirm_cmd(struct cmd *cmd, ...);

#endif


// Global variables

extern char eg_command[];

extern tstring ez;

extern struct ctrl ctrl;

extern const struct cmd null_cmd;

// Functions that scan commands

extern bool scan_A(struct cmd *cmd);

extern bool scan_B(struct cmd *cmd);

extern bool scan_C(struct cmd *cmd);

extern bool scan_D(struct cmd *cmd);

extern bool scan_EI(struct cmd *cmd);

extern bool scan_EJ(struct cmd *cmd);

extern bool scan_EL(struct cmd *cmd);

extern bool scan_EM(struct cmd *cmd);

extern bool scan_EO(struct cmd *cmd);

extern bool scan_EQ(struct cmd *cmd);

extern bool scan_ER(struct cmd *cmd);

extern bool scan_E_under(struct cmd *cmd);

extern bool scan_F0(struct cmd *cmd);

extern bool scan_F1(struct cmd *cmd);

extern bool scan_FB(struct cmd *cmd);

extern bool scan_FC(struct cmd *cmd);

extern bool scan_FD(struct cmd *cmd);

extern bool scan_FF(struct cmd *cmd);

extern bool scan_FH(struct cmd *cmd);

extern bool scan_FK(struct cmd *cmd);

extern bool scan_FM(struct cmd *cmd);

extern bool scan_FN(struct cmd *cmd);

extern bool scan_FR(struct cmd *cmd);

extern bool scan_FS(struct cmd *cmd);

extern bool scan_FZ(struct cmd *cmd);

extern bool scan_F_under(struct cmd *cmd);

extern bool scan_G(struct cmd *cmd);

extern bool scan_H(struct cmd *cmd);

extern bool scan_I(struct cmd *cmd);

extern bool scan_J(struct cmd *cmd);

extern bool scan_K(struct cmd *cmd);

extern bool scan_M(struct cmd *cmd);

extern bool scan_N(struct cmd *cmd);

extern bool scan_O(struct cmd *cmd);

extern bool scan_P(struct cmd *cmd);

extern bool scan_Q(struct cmd *cmd);

extern bool scan_S(struct cmd *cmd);

extern bool scan_T(struct cmd *cmd);

extern bool scan_U(struct cmd *cmd);

extern bool scan_V(struct cmd *cmd);

extern bool scan_W(struct cmd *cmd);

extern bool scan_X(struct cmd *cmd);

extern bool scan_Y(struct cmd *cmd);

extern bool scan_Z(struct cmd *cmd);

extern bool scan_add(struct cmd *cmd);

extern bool scan_and(struct cmd *cmd);

extern bool scan_atsign(struct cmd *cmd);

extern bool scan_case(struct cmd *cmd);

extern bool scan_colon(struct cmd *cmd);

extern bool scan_comma(struct cmd *cmd);

extern bool scan_ctrl_A(struct cmd *cmd);

extern bool scan_ctrl_B(struct cmd *cmd);

extern bool scan_ctrl_H(struct cmd *cmd);

extern bool scan_ctrl_I(struct cmd *cmd);

extern bool scan_ctrl_P(struct cmd *cmd);

extern bool scan_ctrl_Q(struct cmd *cmd);

extern bool scan_ctrl_S(struct cmd *cmd);

extern bool scan_ctrl_T(struct cmd *cmd);

extern bool scan_ctrl_U(struct cmd *cmd);

extern bool scan_ctrl_Y(struct cmd *cmd);

extern bool scan_ctrl_Z(struct cmd *cmd);

extern bool scan_ctrl_under(struct cmd *cmd);

extern bool scan_ctrl_up(struct cmd *cmd);

extern bool scan_div(struct cmd *cmd);

extern bool scan_dot(struct cmd *cmd);

extern bool scan_equals(struct cmd *cmd);

extern bool scan_false(struct cmd *cmd);

extern bool scan_flag1(struct cmd *cmd);

extern bool scan_flag2(struct cmd *cmd);

extern bool scan_greater(struct cmd *cmd);

extern bool scan_if(struct cmd *cmd);

extern bool scan_left(struct cmd *cmd);

extern bool scan_less(struct cmd *cmd);

extern bool scan_mul(struct cmd *cmd);

extern bool scan_number(struct cmd *cmd);

extern bool scan_or(struct cmd *cmd);

extern bool scan_percent(struct cmd *cmd);

extern bool scan_popQ(struct cmd *cmd);

extern bool scan_pushQ(struct cmd *cmd);

extern bool scan_right(struct cmd *cmd);

extern bool scan_semi(struct cmd *cmd);

extern bool scan_sub(struct cmd *cmd);

extern bool scan_tag(struct cmd *cmd);

extern bool scan_under(struct cmd *cmd);

extern bool scan_white(struct cmd *cmd);

extern bool scan_xor(struct cmd *cmd);


// Functions that execute commands

extern void exec_A(struct cmd *cmd);

extern void exec_C(struct cmd *cmd);

extern void exec_D(struct cmd *cmd);

extern void exec_E1(struct cmd *cmd);

extern void exec_E2(struct cmd *cmd);

extern void exec_E3(struct cmd *cmd);

extern void exec_E4(struct cmd *cmd);

extern void exec_EA(struct cmd *cmd);

extern void exec_EB(struct cmd *cmd);

extern void exec_EC(struct cmd *cmd);

extern void exec_ED(struct cmd *cmd);

extern void exec_EE(struct cmd *cmd);

extern void exec_EF(struct cmd *cmd);

extern void exec_EG(struct cmd *cmd);

extern void exec_EH(struct cmd *cmd);

extern void exec_EI(struct cmd *cmd);

extern void exec_EK(struct cmd *cmd);

extern void exec_EL(struct cmd *cmd);

extern void exec_EM(struct cmd *cmd);

extern void exec_EN(struct cmd *cmd);

extern void exec_EO(struct cmd *cmd);

extern void exec_EP(struct cmd *cmd);

extern void exec_EQ(struct cmd *cmd);

extern void exec_ER(struct cmd *cmd);

extern void exec_ES(struct cmd *cmd);

extern void exec_ET(struct cmd *cmd);

extern void exec_EU(struct cmd *cmd);

extern void exec_EV(struct cmd *cmd);

extern void exec_EW(struct cmd *cmd);

extern void exec_EX(struct cmd *cmd);

extern void exec_EY(struct cmd *cmd);

extern void exec_EZ(struct cmd *cmd);

extern void exec_E_percent(struct cmd *cmd);

extern void exec_E_under(struct cmd *cmd);

extern void exec_F1(struct cmd *cmd);

extern void exec_F2(struct cmd *cmd);

extern void exec_F3(struct cmd *cmd);

extern void exec_F4(struct cmd *cmd);

extern void exec_FB(struct cmd *cmd);

extern void exec_FC(struct cmd *cmd);

extern void exec_FD(struct cmd *cmd);

extern void exec_FF(struct cmd *cmd);

extern void exec_FK(struct cmd *cmd);

extern void exec_FL(struct cmd *cmd);

extern void exec_FM(struct cmd *cmd);

extern void exec_FN(struct cmd *cmd);

extern void exec_FQ(struct cmd *cmd);

extern void exec_FR(struct cmd *cmd);

extern void exec_FS(struct cmd *cmd);

extern void exec_FU(struct cmd *cmd);

extern void exec_F_else(struct cmd *cmd);

extern void exec_F_endif(struct cmd *cmd);

extern void exec_F_greater(struct cmd *cmd);

extern void exec_F_less(struct cmd *cmd);

extern void exec_F_under(struct cmd *cmd);

extern void exec_G(struct cmd *cmd);

extern void exec_I(struct cmd *cmd);

extern void exec_J(struct cmd *cmd);

extern void exec_K(struct cmd *cmd);

extern void exec_L(struct cmd *cmd);

extern void exec_M(struct cmd *cmd);

extern void exec_N(struct cmd *cmd);

extern void exec_O(struct cmd *cmd);

extern void exec_P(struct cmd *cmd);

extern void exec_R(struct cmd *cmd);

extern void exec_S(struct cmd *cmd);

extern void exec_T(struct cmd *cmd);

extern void exec_U(struct cmd *cmd);

extern void exec_V(struct cmd *cmd);

extern void exec_W(struct cmd *cmd);

extern void exec_X(struct cmd *cmd);

extern void exec_Y(struct cmd *cmd);

extern void exec_back(struct cmd *cmd);

extern void exec_bad(struct cmd *cmd);

extern void exec_ctrl_A(struct cmd *cmd);

extern void exec_ctrl_C(struct cmd *cmd);

extern void exec_ctrl_D(struct cmd *cmd);

extern void exec_ctrl_E(struct cmd *cmd);

extern void exec_ctrl_I(struct cmd *cmd);

extern void exec_ctrl_O(struct cmd *cmd);

extern void exec_ctrl_Q(struct cmd *cmd);

extern void exec_ctrl_R(struct cmd *cmd);

extern void exec_ctrl_T(struct cmd *cmd);

extern void exec_ctrl_U(struct cmd *cmd);

extern void exec_ctrl_V(struct cmd *cmd);

extern void exec_ctrl_W(struct cmd *cmd);

extern void exec_ctrl_X(struct cmd *cmd);

extern void exec_else(struct cmd *cmd);

extern void exec_endif(struct cmd *cmd);

extern void exec_equals(struct cmd *cmd);

extern void exec_escape(struct cmd *cmd);

extern void exec_greater(struct cmd *cmd);

extern void exec_if(struct cmd *cmd);

extern void exec_less(struct cmd *cmd);

extern void exec_percent(struct cmd *cmd);

extern void exec_popQ(struct cmd *cmd);

extern void exec_pushQ(struct cmd *cmd);

extern void exec_semi(struct cmd *cmd);

extern void exec_tag(struct cmd *cmd);

extern void exec_trace(struct cmd *cmd);

extern void exec_under(struct cmd *cmd);


// Helper functions for executing commands

extern bool append(bool n_set, int_t n_arg, bool colon_set);

extern bool check_semi(void);

extern void default_n(struct cmd *cmd, int_t n_default);

extern void close_files(void);

extern void exec_cmd(struct cmd *cmd);

extern void exec_ctrl_F(uint key);

extern void exec_macro(tbuffer *macro, struct cmd *cmd);

extern void exec_insert(const char *buf, uint_t len);

extern void exec_str(const char *string);

extern void exit_loop(struct cmd *cmd);

extern int find_eg(char *buf);

extern bool finish_cmd(struct cmd *cmd, int c);

extern bool next_page(int_t start, int_t end, bool ff, bool yank);

extern bool next_yank(void);

extern bool read_EI(void);

extern void reset_indirect(void);

extern void reset_search(void);

extern bool skip_cmd(struct cmd *cmd, const char *skip);

extern void scan_texts(struct cmd *cmd, int ntexts, int delim);

#endif  // !defined(_EXEC_H)
