/*1* *****************************************************************************2*3* SPDX-License-Identifier: BSD-2-Clause4*5* Copyright (c) 2018-2025 Gavin D. Howard and contributors.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions are met:9*10* * Redistributions of source code must retain the above copyright notice, this11* list of conditions and the following disclaimer.12*13* * Redistributions in binary form must reproduce the above copyright notice,14* this list of conditions and the following disclaimer in the documentation15* and/or other materials provided with the distribution.16*17* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"18* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE21* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR22* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF23* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS24* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN25* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)26* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE27* POSSIBILITY OF SUCH DAMAGE.28*29* *****************************************************************************30*31* Definitions for dc only.32*33*/3435#ifndef BC_DC_H36#define BC_DC_H3738#if DC_ENABLED3940#include <status.h>41#include <lex.h>42#include <parse.h>4344/**45* The main function for dc. It just sets variables and passes its arguments46* through to @a bc_vm_boot().47* @return A status.48*/49BcStatus50dc_main(int argc, const char* argv[]);5152// A reference to the dc help text.53extern const char dc_help[];5455/**56* The @a BcLexNext function for dc. (See include/lex.h for a definition of57* @a BcLexNext.)58* @param l The lexer.59*/60void61dc_lex_token(BcLex* l);6263/**64* Returns true if the negative char `_` should be treated as a command or not.65* dc considers negative a command if it does *not* immediately proceed a66* number. Otherwise, it's just considered a negative.67* @param l The lexer.68* @return True if a negative should be treated as a command, false if it69* should be treated as a negative sign on a number.70*/71bool72dc_lex_negCommand(BcLex* l);7374// References to the signal message and its length.75extern const char dc_sig_msg[];76extern const uchar dc_sig_msg_len;7778// References to an array and its length. This array is an array of lex tokens79// that, when encountered, should be treated as commands that take a register.80extern const uint8_t dc_lex_regs[];81extern const size_t dc_lex_regs_len;8283// References to an array of tokens and its length. This array corresponds to84// the ASCII table, starting at double quotes. This makes it easy to look up85// tokens for characters.86extern const uint8_t dc_lex_tokens[];87extern const uint8_t dc_parse_insts[];8889/**90* The @a BcParseParse function for dc. (See include/parse.h for a definition of91* @a BcParseParse.)92* @param p The parser.93*/94void95dc_parse_parse(BcParse* p);9697/**98* The @a BcParseExpr function for dc. (See include/parse.h for a definition of99* @a BcParseExpr.)100* @param p The parser.101* @param flags Flags that define the requirements that the parsed code must102* meet or an error will result. See @a BcParseExpr for more info.103*/104void105dc_parse_expr(BcParse* p, uint8_t flags);106107#endif // DC_ENABLED108109#endif // BC_DC_H110111112