4 #include "dl-dvi-program.hh"
8 #include "dl-dvi-fontdefinition.hh"
9 #include "dl-loader.hh"
12 const uint N_PAGE_COUNTERS = 10; // \count0 ... \count9
14 class DviPageHeader : public RefCounted {
16 int count[N_PAGE_COUNTERS];
17 uint address; // address of this page, not the preceding
20 class DviPage : public AbstractDviProgram {
22 int count[N_PAGE_COUNTERS]; // \count0 ... \count9
24 DviPage (DviProgram& p, int c[N_PAGE_COUNTERS]) :
27 for (uint i=0; i<N_PAGE_COUNTERS; ++i)
30 DviPage (DviPageHeader& h, DviProgram& p) :
33 for (uint i=0; i<N_PAGE_COUNTERS; ++i)
34 count[i] = h.count[i];
36 virtual void execute (DviRuntime& runtime)
38 program.execute (runtime);
40 int get_page_count (int i) { return count[i]; }
44 NORMAL_DVI = 2, // FIXME: this should be 2
45 TEX_XET_DVI = 2 // FIXME: is this correct?
48 class DviFilePreamble : public RefCounted {
58 class DviFilePostamble : public RefCounted {
66 uint last_page_address;
70 map <uint, DviFontdefinition *> fontdefinitions;
73 class DviFile : public RefCounted {
74 AbstractLoader &loader;
76 DviFilePreamble *preamble;
77 DviFilePostamble *postamble;
80 map <uint, DviPageHeader *> page_headers;
81 map <uint, DviPage *> pages;
84 DviFile (AbstractLoader& l);
85 DviPage *get_page (uint n); /* unref it when done */
87 uint get_n_pages () { return n_pages; }
88 DviFontdefinition *get_fontdefinition (uint n)
90 return postamble->fontdefinitions[n];
92 uint get_numerator () { return postamble->numerator; }
93 uint get_denominator () { return postamble->denominator; }
94 uint get_magnification () { return postamble->magnification; }
98 #endif // DL_DVI_FILE_HH