+static unsigned char directives_stack[32];
+static unsigned int directives_index;
+
+static int do_direct(void)
+{
+ return directives_stack[directives_index];
+}
+
+static void directive_onoff(int onoff)
+{
+ if (directives_index >= sizeof(directives_stack) - 1) {
+ fprintf(stderr, "mhbuild: #on/off overflow, continuing\n");
+ return;
+ }
+ directives_stack[++directives_index] = onoff;
+}
+
+static void directive_init(int onoff)
+{
+ directives_index = 0;
+ directives_stack[0] = onoff;
+}
+
+static void directive_pop(void)
+{
+ if (directives_index > 0)
+ directives_index--;
+ else
+ fprintf(stderr, "mhbuild: #pop underflow, continuing\n");
+}
+