aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc/include
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bc/include')
-rw-r--r--contrib/bc/include/args.h2
-rw-r--r--contrib/bc/include/bc.h8
-rw-r--r--contrib/bc/include/bcl.h2
-rw-r--r--contrib/bc/include/dc.h2
-rw-r--r--contrib/bc/include/file.h2
-rw-r--r--contrib/bc/include/history.h26
-rw-r--r--contrib/bc/include/lang.h6
-rw-r--r--contrib/bc/include/lex.h2
-rw-r--r--contrib/bc/include/library.h2
-rw-r--r--contrib/bc/include/num.h2
-rw-r--r--contrib/bc/include/opt.h2
-rw-r--r--contrib/bc/include/ossfuzz.h2
-rw-r--r--contrib/bc/include/parse.h2
-rw-r--r--contrib/bc/include/program.h16
-rw-r--r--contrib/bc/include/rand.h2
-rw-r--r--contrib/bc/include/read.h2
-rw-r--r--contrib/bc/include/status.h7
-rw-r--r--contrib/bc/include/vector.h2
-rw-r--r--contrib/bc/include/version.h42
-rw-r--r--contrib/bc/include/vm.h3
20 files changed, 37 insertions, 97 deletions
diff --git a/contrib/bc/include/args.h b/contrib/bc/include/args.h
index 8f8f00be4630..fd9ca60c29c9 100644
--- a/contrib/bc/include/args.h
+++ b/contrib/bc/include/args.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/bc.h b/contrib/bc/include/bc.h
index 2213278be1da..19159c45e018 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-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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:
@@ -265,9 +265,9 @@ bc_lex_token(BcLex* l);
* @return An expression entry for bc_parse_exprs[].
*/
#define BC_PARSE_EXPR_ENTRY(e1, e2, e3, e4, e5, e6, e7, e8) \
- ((UINTMAX_C(e1) << 7) | (UINTMAX_C(e2) << 6) | (UINTMAX_C(e3) << 5) | \
- (UINTMAX_C(e4) << 4) | (UINTMAX_C(e5) << 3) | (UINTMAX_C(e6) << 2) | \
- (UINTMAX_C(e7) << 1) | (UINTMAX_C(e8) << 0))
+ ((UINT8_C(e1) << 7) | (UINT8_C(e2) << 6) | (UINT8_C(e3) << 5) | \
+ (UINT8_C(e4) << 4) | (UINT8_C(e5) << 3) | (UINT8_C(e6) << 2) | \
+ (UINT8_C(e7) << 1) | (UINT8_C(e8) << 0))
/**
* Returns true if token @a i is a token that belongs in an expression.
diff --git a/contrib/bc/include/bcl.h b/contrib/bc/include/bcl.h
index 8e762b694f4d..a46610de47f5 100644
--- a/contrib/bc/include/bcl.h
+++ b/contrib/bc/include/bcl.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/dc.h b/contrib/bc/include/dc.h
index 63f5ccbd10e3..edab5605c7e7 100644
--- a/contrib/bc/include/dc.h
+++ b/contrib/bc/include/dc.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/file.h b/contrib/bc/include/file.h
index 86f368db11c6..d152645b1209 100644
--- a/contrib/bc/include/file.h
+++ b/contrib/bc/include/file.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/history.h b/contrib/bc/include/history.h
index 13f6dc6e985c..03b729707556 100644
--- a/contrib/bc/include/history.h
+++ b/contrib/bc/include/history.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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:
@@ -120,30 +120,6 @@ typedef struct BcHistory
extern const char bc_history_editrc[];
extern const size_t bc_history_editrc_len;
-#ifdef __APPLE__
-
-/**
- * Returns true if the line is a valid line, false otherwise.
- * @param line The line.
- * @param len The length of the line.
- * @return True if the line is valid, false otherwise.
- */
-#define BC_HISTORY_INVALID_LINE(line, len) \
- ((line) == NULL && ((len) == -1 || errno == EINTR))
-
-#else // __APPLE__
-
-/**
- * Returns true if the line is a valid line, false otherwise.
- * @param line The line.
- * @param len The length of the line.
- * @return True if the line is valid, false otherwise.
- */
-#define BC_HISTORY_INVALID_LINE(line, len) \
- ((line) == NULL && (len) == -1 && errno == EINTR)
-
-#endif // __APPLE__
-
#else // BC_ENABLE_EDITLINE
#if BC_ENABLE_READLINE
diff --git a/contrib/bc/include/lang.h b/contrib/bc/include/lang.h
index 6c8245139719..d0582a7d2199 100644
--- a/contrib/bc/include/lang.h
+++ b/contrib/bc/include/lang.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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:
@@ -533,6 +533,10 @@ typedef enum BcType
} BcType;
#if BC_ENABLED
+
+/// Check if type array or array reference
+#define BC_IS_ARRAY(e) (e == BC_TYPE_ARRAY || e == BC_TYPE_REF)
+
/// An auto variable in bc.
typedef struct BcAuto
{
diff --git a/contrib/bc/include/lex.h b/contrib/bc/include/lex.h
index d2be3c7526ef..5f97a47341df 100644
--- a/contrib/bc/include/lex.h
+++ b/contrib/bc/include/lex.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/library.h b/contrib/bc/include/library.h
index 9942705a5f36..db7cb1302fe8 100644
--- a/contrib/bc/include/library.h
+++ b/contrib/bc/include/library.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/num.h b/contrib/bc/include/num.h
index 6cead6eb3823..970873c75589 100644
--- a/contrib/bc/include/num.h
+++ b/contrib/bc/include/num.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/opt.h b/contrib/bc/include/opt.h
index 41058cb4e29c..a5194b34cbb8 100644
--- a/contrib/bc/include/opt.h
+++ b/contrib/bc/include/opt.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/ossfuzz.h b/contrib/bc/include/ossfuzz.h
index 5c12a3c9c9fb..4e233df9ab95 100644
--- a/contrib/bc/include/ossfuzz.h
+++ b/contrib/bc/include/ossfuzz.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/parse.h b/contrib/bc/include/parse.h
index 7f0f8768b0db..e39ea09a8aad 100644
--- a/contrib/bc/include/parse.h
+++ b/contrib/bc/include/parse.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/program.h b/contrib/bc/include/program.h
index e16e5c079d7d..17454057cdba 100644
--- a/contrib/bc/include/program.h
+++ b/contrib/bc/include/program.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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:
@@ -145,6 +145,9 @@ typedef struct BcProgram
#endif // BC_ENABLED
+ /// The number of results that have not been retired.
+ size_t nresults;
+
// The BcDig array for strmb. This uses BC_NUM_LONG_LOG10 because it is used
// in bc_num_ulong2num(), which attempts to realloc, unless it is big
// enough. This is big enough.
@@ -207,11 +210,16 @@ typedef struct BcProgram
* operands while preserving the result (which we assumed was pushed before the
* actual operation).
* @param p The program.
- * @param nres The number of results returned by the instruction.
* @param nops The number of operands used by the instruction.
*/
-#define bc_program_retire(p, nres, nops) \
- (bc_vec_npopAt(&(p)->results, (nops), (p)->results.len - (nres + nops)))
+#define bc_program_retire(p, nops) \
+ do \
+ { \
+ bc_vec_npopAt(&(p)->results, (nops), \
+ (p)->results.len - ((p)->nresults + nops)); \
+ p->nresults = 0; \
+ } \
+ while (0)
#if DC_ENABLED
diff --git a/contrib/bc/include/rand.h b/contrib/bc/include/rand.h
index aee63b866cf6..f88de071b25d 100644
--- a/contrib/bc/include/rand.h
+++ b/contrib/bc/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-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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
diff --git a/contrib/bc/include/read.h b/contrib/bc/include/read.h
index 62e6897635a2..c43a9980327b 100644
--- a/contrib/bc/include/read.h
+++ b/contrib/bc/include/read.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/status.h b/contrib/bc/include/status.h
index 203f09af628b..8e3ab9ed218b 100644
--- a/contrib/bc/include/status.h
+++ b/contrib/bc/include/status.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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:
@@ -683,12 +683,7 @@ typedef enum BcMode
#define BC_NO_SIG_EXC(vm) \
BC_LIKELY((vm)->status == (sig_atomic_t) BC_STATUS_SUCCESS && !(vm)->sig)
-#ifndef _WIN32
-#define BC_SIG_INTERRUPT(vm) \
- BC_UNLIKELY((vm)->sig != 0 && (vm)->sig != SIGWINCH)
-#else // _WIN32
#define BC_SIG_INTERRUPT(vm) BC_UNLIKELY((vm)->sig != 0)
-#endif // _WIN32
#if BC_DEBUG
diff --git a/contrib/bc/include/vector.h b/contrib/bc/include/vector.h
index cad5fc2aa7c3..01b029961465 100644
--- a/contrib/bc/include/vector.h
+++ b/contrib/bc/include/vector.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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/contrib/bc/include/version.h b/contrib/bc/include/version.h
deleted file mode 100644
index a4fb8def5024..000000000000
--- a/contrib/bc/include/version.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * *****************************************************************************
- *
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * 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:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * *****************************************************************************
- *
- * The version of bc.
- *
- */
-
-#ifndef BC_VERSION_H
-#define BC_VERSION_H
-
-/// The current version.
-#define VERSION 7.0.2
-
-#endif // BC_VERSION_H
diff --git a/contrib/bc/include/vm.h b/contrib/bc/include/vm.h
index e81206b63871..86e0fe06edc1 100644
--- a/contrib/bc/include/vm.h
+++ b/contrib/bc/include/vm.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2025 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:
@@ -52,7 +52,6 @@
#endif // BC_ENABLE_NLS
-#include <version.h>
#include <status.h>
#include <num.h>
#include <lex.h>