]> mj.ucw.cz Git - paperjam.git/blob - jam.h
First attempts...
[paperjam.git] / jam.h
1 #include <vector>
2 #include <list>
3
4 #include "pdf-tools.h"
5
6 typedef unsigned int uint;
7
8 #define NONRET __attribute__((noreturn))
9
10 struct pipeline;
11
12 union arg_val {
13   string *s;
14   double d;
15   pipeline *p;
16 };
17
18 enum arg_type {
19   AT_STRING,
20   AT_DOUBLE,
21   AT_DIMEN,
22   AT_PIPELINE,                  // Pipeline has an empty name
23   AT_TYPE_MASK = 0xffff,
24   AT_MANDATORY = 0x10000,
25   AT_POSITIONAL = 0x20000,
26 };
27
28 struct arg_def {
29   const char *name;
30   uint type;
31 };
32
33 struct page_out {
34 };
35
36 struct page {
37   double width;
38   double height;
39   void render(page_out *out, pdf_matrix xform);
40 };
41
42 struct cmd {
43 };
44
45 struct cmd_args {
46   vector<arg_val> arg;
47   vector<bool> arg_given;
48 };
49
50 struct cmd_def {
51   const char *name;
52   const arg_def *arg_defs;
53   cmd (*constructor)(cmd_args *args);
54 };
55
56 struct pipeline_selector {
57   int from;
58   int to;
59 };
60
61 struct pipeline_branch {
62   vector<pipeline_selector> selectors;
63   list<cmd> commands;
64 };
65
66 struct pipeline {
67   vector<pipeline_branch *> branches;
68 };