+ }
+}
+
+typedef enum {
+ pDefault = 0
+ ,pComment
+ ,pDescription
+ ,pEscaped
+ ,pNewline
+ ,pName
+ ,pNumber
+ ,pString
+} STATE;
+
+static void
+parse_description(const char *input_name)
+{
+ static char empty[1] =
+ {0};
+
+ FILE *fp;
+ struct stat sb;
+ size_t count_bools = 0;
+ size_t count_nums = 0;
+ size_t count_strs = 0;
+ size_t len;
+ size_t j, k;
+ STATE state;
+
+ if (stat(input_name, &sb) != 0
+ || (sb.st_mode & S_IFMT) != S_IFREG) {
+ failed("input is not a file");
+ }
+
+ if (sb.st_size == 0) {
+ failed("input is empty");
+ }
+
+ /*
+ * None of the arrays could be larger than the input-file, and since it
+ * is small, just allocate the maximum for simplicity.
+ */
+ if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0 ||
+ (my_boolcodes = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_numcodes = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_numvalues = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_strcodes = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_strvalues = typeCalloc(char *, sb.st_size)) == 0) {
+ failed("cannot allocate memory for input-file");
+ }
+
+ if ((fp = fopen(input_name, "r")) == 0) {
+ failed("cannot open input-file");
+ } else {
+ len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
+ my_blob[sb.st_size] = '\0';
+ fclose(fp);
+ }