]> mj.ucw.cz Git - paperjam.git/blobdiff - parse.cc
Measure bboxes by Ghostscripting
[paperjam.git] / parse.cc
index 2e38d3ad403204451ea2ace07e6a8d3079c78b57..1869b3a76ef04345ffd4d0ead54f7bbe2314eba6 100644 (file)
--- a/parse.cc
+++ b/parse.cc
@@ -71,7 +71,8 @@ static token_type get_next_token()
     {
       while (*in_pos >= 'A' && *in_pos <= 'Z' ||
             *in_pos >= 'a' && *in_pos <= 'z' ||
-            *in_pos >= '0' && *in_pos <= '9')
+            *in_pos >= '0' && *in_pos <= '9' ||
+            *in_pos == '_')
        token += *in_pos++;
       return TOK_IDENT;
     }
@@ -458,3 +459,29 @@ void parse(const char *in, list<cmd *> &cmds)
   debug_cmds(cmds);
   instantiate(cmds);
 }
+
+void help()
+{
+  for (int i=0; cmd_table[i].name; i++)
+    {
+      const cmd_def *def = &cmd_table[i];
+      printf("%s\n", def->name);
+
+      const arg_def *arg = def->arg_defs;
+      static const char * const type_names[] = {
+       "string", "int", "double", "dimen"
+      };
+      while (arg->name)
+       {
+         printf("\t%s (%s)%s%s\n",
+           arg->name,
+           type_names[arg->type & AT_TYPE_MASK],
+           (arg->type & AT_MANDATORY) ? " [mandatory]" : "",
+           (arg->type & AT_POSITIONAL) ? " [positional]" : "");
+         arg++;
+       }
+
+       if (def->has_pipeline)
+         printf("\t{ pipeline }\n");
+    }
+}