diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/args.h | 2 | ||||
| -rw-r--r-- | include/bc.h | 21 | ||||
| -rw-r--r-- | include/bcl.h | 2 | ||||
| -rw-r--r-- | include/dc.h | 5 | ||||
| -rw-r--r-- | include/file.h | 26 | ||||
| -rw-r--r-- | include/history.h | 2 | ||||
| -rw-r--r-- | include/lang.h | 2 | ||||
| -rw-r--r-- | include/lex.h | 2 | ||||
| -rw-r--r-- | include/library.h | 2 | ||||
| -rw-r--r-- | include/num.h | 2 | ||||
| -rw-r--r-- | include/opt.h | 2 | ||||
| -rw-r--r-- | include/parse.h | 2 | ||||
| -rw-r--r-- | include/program.h | 2 | ||||
| -rw-r--r-- | include/rand.h | 7 | ||||
| -rw-r--r-- | include/read.h | 2 | ||||
| -rw-r--r-- | include/status.h | 6 | ||||
| -rw-r--r-- | include/vector.h | 2 | ||||
| -rw-r--r-- | include/version.h | 4 | ||||
| -rw-r--r-- | include/vm.h | 12 |
19 files changed, 55 insertions, 50 deletions
diff --git a/include/args.h b/include/args.h index 3174ba267590..f1e9f007bddf 100644 --- a/include/args.h +++ b/include/args.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/bc.h b/include/bc.h index 17fd0b9d171f..b25df09a174e 100644 --- a/include/bc.h +++ b/include/bc.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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,8 +48,9 @@ /** * The main function for bc. It just sets variables and passes its arguments * through to @a bc_vm_boot(). + * @return A status. */ -void +BcStatus bc_main(int argc, char* argv[]); // These are references to the help text, the library text, and the "filename" @@ -88,10 +89,8 @@ 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 @@ -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. @@ -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. diff --git a/include/bcl.h b/include/bcl.h index d3a9f42cdcf8..8e762b694f4d 100644 --- a/include/bcl.h +++ b/include/bcl.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/dc.h b/include/dc.h index 9a603c26d1a5..1328f1c63b38 100644 --- a/include/dc.h +++ b/include/dc.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: @@ -45,8 +45,9 @@ /** * The main function for dc. It just sets variables and passes its arguments * through to @a bc_vm_boot(). + * @return A status. */ -void +BcStatus dc_main(int argc, char* argv[]); // A reference to the dc help text. diff --git a/include/file.h b/include/file.h index 95cfa861a734..86f368db11c6 100644 --- a/include/file.h +++ b/include/file.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: @@ -54,6 +54,9 @@ typedef struct BcFile // with the existing code as possible. FILE* f; + // True if errors should be fatal, false otherwise. + bool errors_fatal; + } BcFile; #else // BC_ENABLE_LINE_LIB @@ -64,6 +67,9 @@ typedef struct BcFile // The actual file descriptor. int fd; + // True if errors should be fatal, false otherwise. + bool errors_fatal; + // The buffer for the file. char* buf; @@ -123,23 +129,25 @@ typedef enum BcFlushType /** * Initialize a file. - * @param f The file to initialize. - * @param file The stdio file. + * @param f The file to initialize. + * @param file The stdio file. + * @param errors_fatal True if errors should be fatal, false otherwise. */ void -bc_file_init(BcFile* f, FILE* file); +bc_file_init(BcFile* f, FILE* file, bool errors_fatal); #else // BC_ENABLE_LINE_LIB /** * Initialize a file. - * @param f The file to initialize. - * @param fd The file descriptor. - * @param buf The buffer for the file. - * @param cap The capacity of the buffer. + * @param f The file to initialize. + * @param fd The file descriptor. + * @param buf The buffer for the file. + * @param cap The capacity of the buffer. + * @param errors_fatal True if errors should be fatal, false otherwise. */ void -bc_file_init(BcFile* f, int fd, char* buf, size_t cap); +bc_file_init(BcFile* f, int fd, char* buf, size_t cap, bool errors_fatal); #endif // BC_ENABLE_LINE_LIB diff --git a/include/history.h b/include/history.h index 64402c4dffa1..460524bd7b87 100644 --- a/include/history.h +++ b/include/history.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/lang.h b/include/lang.h index 97aeeaa98da8..6c8245139719 100644 --- a/include/lang.h +++ b/include/lang.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/lex.h b/include/lex.h index ac9b7b6ea69c..d2be3c7526ef 100644 --- a/include/lex.h +++ b/include/lex.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/library.h b/include/library.h index 1edd3757444c..9942705a5f36 100644 --- a/include/library.h +++ b/include/library.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/num.h b/include/num.h index 6c9dee107f2f..6cead6eb3823 100644 --- a/include/num.h +++ b/include/num.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/opt.h b/include/opt.h index 28d9d99a7856..e60328994d8c 100644 --- a/include/opt.h +++ b/include/opt.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/parse.h b/include/parse.h index ece413e7bd74..7f0f8768b0db 100644 --- a/include/parse.h +++ b/include/parse.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/program.h b/include/program.h index 1df753afad22..e16e5c079d7d 100644 --- a/include/program.h +++ b/include/program.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/rand.h b/include/rand.h index e516295d7c5c..aee63b866cf6 100644 --- a/include/rand.h +++ b/include/rand.h @@ -13,7 +13,7 @@ * This code is under the following license: * * Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -241,10 +241,7 @@ typedef struct BcRandState * @param l The low 64 bits. * @return The constant built from @a h and @a l. */ -#define BC_RAND_CONSTANT(h, l) \ - { \ - .lo = (l), .hi = (h) \ - } +#define BC_RAND_CONSTANT(h, l) { .lo = (l), .hi = (h) } /** * Truncates a PCG state to the number of bits in a random integer. diff --git a/include/read.h b/include/read.h index 867dcd7433a3..62e6897635a2 100644 --- a/include/read.h +++ b/include/read.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/status.h b/include/status.h index 242514edb476..f579df8c649b 100644 --- a/include/status.h +++ b/include/status.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: @@ -60,10 +60,10 @@ #endif // __FreeBSD__ #endif // BC_TEST_FREEBSD -// This is used by configure.sh to test for Mac OSX. +// This is used by configure.sh to test for macOS. #ifdef BC_TEST_APPLE #ifdef __APPLE__ -#error On Mac OSX without _DARWIN_C_SOURCE +#error On macOS without _DARWIN_C_SOURCE #endif // __APPLE__ #endif // BC_TEST_APPLE diff --git a/include/vector.h b/include/vector.h index b86be1424537..cad5fc2aa7c3 100644 --- a/include/vector.h +++ b/include/vector.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: diff --git a/include/version.h b/include/version.h index e2576269345d..586691a6e7ef 100644 --- a/include/version.h +++ b/include/version.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: @@ -37,6 +37,6 @@ #define BC_VERSION_H /// The current version. -#define VERSION 6.7.5 +#define VERSION 6.7.6 #endif // BC_VERSION_H diff --git a/include/vm.h b/include/vm.h index c56cc8e7370a..052c1d14c237 100644 --- a/include/vm.h +++ b/include/vm.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 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: @@ -493,7 +493,7 @@ #define BC_VM_SAFE_RESULT(r) ((r)->t >= BC_RESULT_TEMP) /// The invalid locale catalog return value. -#define BC_VM_INVALID_CATALOG ((nl_catd) -1) +#define BC_VM_INVALID_CATALOG ((nl_catd) - 1) /** * Returns true if the *unsigned* multiplication overflows. @@ -791,8 +791,9 @@ bc_vm_info(const char* const help); * The entrance point for bc/dc together. * @param argc The count of arguments. * @param argv The argument array. + * @return A status. */ -void +BcStatus bc_vm_boot(int argc, char* argv[]); /** @@ -1045,8 +1046,9 @@ bc_vm_fatalError(BcErr e); * A function to call at exit. * @param status The exit status. */ -int -bc_vm_atexit(int status); +BcStatus +bc_vm_atexit(BcStatus status); + #endif // BC_ENABLE_LIBRARY /// A reference to the copyright header. |
