Skip to content

Instantly share code, notes, and snippets.

@nega0
Created November 19, 2013 22:10
Show Gist options
  • Save nega0/7553483 to your computer and use it in GitHub Desktop.
Save nega0/7553483 to your computer and use it in GitHub Desktop.
--- /dev/null 2011-01-28 15:18:26.820752001 +0100
+++ pythia6_rng_callback.c 2011-02-03 21:35:13.542831166 +0100
@@ -0,0 +1,24 @@
+/* forward decl, original Pythia impl */
+extern double old_pyr_(int* idummy);
+
+/* function pointer contating the current impl */
+double (*pyr_callback)(int*) = 0;
+
+/* setter for the pyr callback */
+void set_pyr_callback(double (*new_callback)(int*) )
+{
+ pyr_callback = new_callback;
+}
+
+/* call the current PYR implementation */
+double ext_pyr_(int* idummy)
+{
+ if (pyr_callback)
+ {
+ return (*pyr_callback)(idummy);
+ }
+ else
+ {
+ return old_pyr_(idummy);
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment