+#define HF_CONTIGUOUS 0x01
+
+typedef struct Hook {
+ HookCallback callback;
+ long priority;
+ short flags;
+ struct Hook *next;
+} Hook;
+
+typedef struct HookHead {
+ int dirty;
+ Hook *head;
+} HookHead;
+
+static HookHead hooks[HOOKMAX];
+static int dirtyhooks[HOOKMAX];
+static int dirtyhookcount;
+
+unsigned int hookqueuelength = 0;
+
+static void collectgarbage(HookHead *h);
+static void markdirty(int hook);