summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch')
-rw-r--r--dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch b/dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch
new file mode 100644
index 000000000000..fafa97356cd8
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch
@@ -0,0 +1,53 @@
+--- include/NTL/tools.h.orig 2008-05-06 22:14:06.000000000 +1200
++++ include/NTL/tools.h 2008-05-06 22:14:23.000000000 +1200
+@@ -249,6 +249,12 @@
+ char IntValToChar(long a);
+
+
++/*
++ This function is not present in vanilla NTL
++ See tools.c for documentation.
++ */
++void SetErrorCallbackFunction(void (*func)(const char *s, void *context), void *context);
++
+
+ void Error(const char *s);
+
+--- src/tools.c.orig 2008-05-06 22:15:32.000000000 +1200
++++ src/tools.c 2008-05-06 22:15:45.000000000 +1200
+@@ -8,8 +8,35 @@
+ NTL_START_IMPL
+
+
++/*
++ The following code differs from vanilla NTL
++
++ We add a SetErrorCallbackFunction(). This sets a global callback function _function_,
++ which gets called with parameter _context_ and an error message string whenever Error()
++ gets called.
++
++ Note that if the custom error handler *returns*, then NTL will dump the error message
++ back to stderr and abort() as it habitually does.
++
++ -- David Harvey (2008-04-12)
++*/
++
++void (*ErrorCallbackFunction)(const char*, void*) = NULL;
++void *ErrorCallbackContext = NULL;
++
++
++void SetErrorCallbackFunction(void (*function)(const char*, void*), void *context)
++{
++ ErrorCallbackFunction = function;
++ ErrorCallbackContext = context;
++}
++
++
+ void Error(const char *s)
+ {
++ if (ErrorCallbackFunction != NULL)
++ ErrorCallbackFunction(s, ErrorCallbackContext);
++
+ cerr << s << "\n";
+ abort();
+ }