-#include <stddef.h>
-#include <unistd.h>
-
#include "debug.h"
#include "fprintf.h"
#include "code.h"
+/* constants */
+
+#define NB_LEAFS ((NB_BYTES + 1) * NB_BYTES / 2)
+
/* concatenate code */
int codcat (char *dst, int n, char *src)
n--;
dst++;
}
-
+
return (n > 0) ? codcpy (dst, n, src) : -1;
}
return i;
}
}
- VERBOSE (ERROR, fdprintf (STDOUT_FILENO, "Buffer too short\n"));
+ VERBOSE (ERROR, PRINTERR ("Buffer too short\n"));
return -1;
}
return i;
}
-/* vim: set ts=4 sw=4 et */
+/* get leaf(s) */
+
+leaf_t *getleaf (int n)
+{
+ static leaf_t leafs[NB_LEAFS] = {0};
+ static int pos = 0;
+ leaf_t *pt = (void *)0;
+
+ if (pos + n < NB_LEAFS) {
+ pt = leafs + pos;
+ pos += n;
+ } else {
+ VERBOSE (ERROR, PRINTERR ("No more leaf avaliable\n"));
+ }
+
+ return pt;
+}
+
+/* vim: set ts=4 sw=4 et: */