aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc/include/bc.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bc/include/bc.h')
-rw-r--r--contrib/bc/include/bc.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/contrib/bc/include/bc.h b/contrib/bc/include/bc.h
index 06b2131c967b..2213278be1da 100644
--- a/contrib/bc/include/bc.h
+++ b/contrib/bc/include/bc.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2021 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -48,9 +48,10 @@
/**
* The main function for bc. It just sets variables and passes its arguments
* through to @a bc_vm_boot().
+ * @return A status.
*/
-void
-bc_main(int argc, char* argv[]);
+BcStatus
+bc_main(int argc, const char* argv[]);
// These are references to the help text, the library text, and the "filename"
// for the library.
@@ -88,22 +89,20 @@ typedef struct BcLexKeyword
#define BC_LEX_KW_LEN(kw) ((size_t) ((kw)->data & ~(BC_LEX_CHAR_MSB(1))))
/// A macro to easily build a keyword entry. See bc_lex_kws in src/data.c.
-#define BC_LEX_KW_ENTRY(a, b, c) \
- { \
- .data = ((b) & ~(BC_LEX_CHAR_MSB(1))) | BC_LEX_CHAR_MSB(c), .name = a \
- }
+#define BC_LEX_KW_ENTRY(a, b, c) \
+ { .data = ((b) & ~(BC_LEX_CHAR_MSB(1))) | BC_LEX_CHAR_MSB(c), .name = a }
#if BC_ENABLE_EXTRA_MATH
/// A macro for the number of keywords bc has. This has to be updated if any are
/// added. This is for the redefined_kws field of the BcVm struct.
-#define BC_LEX_NKWS (35)
+#define BC_LEX_NKWS (37)
#else // BC_ENABLE_EXTRA_MATH
/// A macro for the number of keywords bc has. This has to be updated if any are
/// added. This is for the redefined_kws field of the BcVm struct.
-#define BC_LEX_NKWS (31)
+#define BC_LEX_NKWS (33)
#endif // BC_ENABLE_EXTRA_MATH
@@ -234,7 +233,7 @@ bc_lex_token(BcLex* l);
* @param t The token to return operator data for.
* @return The operator data for @a t.
*/
-#define BC_PARSE_OP_DATA(t) bc_parse_ops[((t) -BC_LEX_OP_INC)]
+#define BC_PARSE_OP_DATA(t) bc_parse_ops[((t) - BC_LEX_OP_INC)]
/**
* Returns non-zero if operator @a op is left associative, zero otherwise.
@@ -276,7 +275,7 @@ bc_lex_token(BcLex* l);
* @return True if i is an expression token, false otherwise.
*/
#define BC_PARSE_EXPR(i) \
- (bc_parse_exprs[(((i) & (uchar) ~(0x07)) >> 3)] & (1 << (7 - ((i) &0x07))))
+ (bc_parse_exprs[(((i) & (uchar) ~(0x07)) >> 3)] & (1 << (7 - ((i) & 0x07))))
/**
* Returns the operator (by lex token) that is at the top of the operator
@@ -341,7 +340,7 @@ bc_lex_token(BcLex* l);
* @param t The token to turn into an instruction.
* @return The token as an instruction.
*/
-#define BC_PARSE_TOKEN_INST(t) ((uchar) ((t) -BC_LEX_NEG + BC_INST_NEG))
+#define BC_PARSE_TOKEN_INST(t) ((uchar) ((t) - BC_LEX_NEG + BC_INST_NEG))
/**
* Returns true if the token is a bc keyword.
@@ -372,10 +371,8 @@ typedef struct BcParseNext
/// A macro to generate a BcParseNext literal from BcParseNext data. See
/// src/data.c for examples.
-#define BC_PARSE_NEXT(a, ...) \
- { \
- .len = (uchar) (a), BC_PARSE_NEXT_TOKENS(__VA_ARGS__) \
- }
+#define BC_PARSE_NEXT(a, ...) \
+ { .len = (uchar) (a), BC_PARSE_NEXT_TOKENS(__VA_ARGS__) }
/// A status returned by @a bc_parse_expr_err(). It can either return success or
/// an error indicating an empty expression.