summaryrefslogtreecommitdiffstats
path: root/debian/pyrex/pyrex-0.9.9/Demos/callback/cheesefinder.c
diff options
context:
space:
mode:
Diffstat (limited to 'debian/pyrex/pyrex-0.9.9/Demos/callback/cheesefinder.c')
-rw-r--r--debian/pyrex/pyrex-0.9.9/Demos/callback/cheesefinder.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/debian/pyrex/pyrex-0.9.9/Demos/callback/cheesefinder.c b/debian/pyrex/pyrex-0.9.9/Demos/callback/cheesefinder.c
new file mode 100644
index 00000000..ab41853b
--- /dev/null
+++ b/debian/pyrex/pyrex-0.9.9/Demos/callback/cheesefinder.c
@@ -0,0 +1,21 @@
+/*
+ * An example of a C API that provides a callback mechanism.
+ */
+
+#include "cheesefinder.h"
+
+static char *cheeses[] = {
+ "cheddar",
+ "camembert",
+ "that runny one",
+ 0
+};
+
+void find_cheeses(cheesefunc user_func, void *user_data) {
+ char **p = cheeses;
+ while (*p) {
+ user_func(*p, user_data);
+ ++p;
+ }
+}
+