diff options
author | Søren Sandmann <sandmann@redhat.com> | 2004-12-21 23:57:26 (GMT) |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2004-12-21 23:57:26 (GMT) |
commit | 4296951e94a43c723e9522b588cab178eb66d144 (patch) | |
tree | 63ba229741d10df67fe87f24b6241903e16e9764 /dvi/dvilib/dl-dvi-file.hh | |
parent | 3e73e947a3a8c03da8f35f52e2a42ba066e2be2a (diff) |
New directory with the beginning of a .dvi backend.
Tue Dec 21 18:55:06 2004 Søren Sandmann <sandmann@redhat.com>
* dvi/*: New directory with the beginning of a .dvi backend.
Diffstat (limited to 'dvi/dvilib/dl-dvi-file.hh')
-rwxr-xr-x | dvi/dvilib/dl-dvi-file.hh | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/dvi/dvilib/dl-dvi-file.hh b/dvi/dvilib/dl-dvi-file.hh new file mode 100755 index 0000000..d6c0201 --- /dev/null +++ b/dvi/dvilib/dl-dvi-file.hh @@ -0,0 +1,99 @@ +#ifndef DL_DVI_FILE_HH +#define DL_DVI_FILE_HH + +#include "dl-dvi-program.hh" +#include <map> +#include <list> +#include <algorithm> +#include "dl-dvi-fontdefinition.hh" +#include "dl-loader.hh" + +namespace DviLib { + const uint N_PAGE_COUNTERS = 10; // \count0 ... \count9 + + class DviPageHeader : public RefCounted { + public: + int count[N_PAGE_COUNTERS]; + uint address; // address of this page, not the preceding + }; + + class DviPage : public AbstractDviProgram { + DviProgram& program; + int count[N_PAGE_COUNTERS]; // \count0 ... \count9 + public: + DviPage (DviProgram& p, int c[N_PAGE_COUNTERS]) : + program (p) + { + for (uint i=0; i<N_PAGE_COUNTERS; ++i) + count[i] = c[i]; + } + DviPage (DviPageHeader& h, DviProgram& p) : + program (p) + { + for (uint i=0; i<N_PAGE_COUNTERS; ++i) + count[i] = h.count[i]; + } + virtual void execute (DviRuntime& runtime) + { + program.execute (runtime); + } + int get_page_count (int i) { return count[i]; } + }; + + enum DviType { + NORMAL_DVI = 2, // FIXME: this should be 2 + TEX_XET_DVI = 2 // FIXME: is this correct? + }; + + class DviFilePreamble : public RefCounted { + public: + // preamble + DviType type; + uint magnification; + uint numerator; + uint denominator; + string comment; + }; + + class DviFilePostamble : public RefCounted { + public: + // postamble + DviType type; + uint magnification; + uint numerator; + uint denominator; + + uint last_page_address; + uint max_height; + uint max_width; + uint stack_height; + map <uint, DviFontdefinition *> fontdefinitions; + }; + + class DviFile : public RefCounted { + AbstractLoader &loader; + + DviFilePreamble *preamble; + DviFilePostamble *postamble; + + uint n_pages; + map <uint, DviPageHeader *> page_headers; + map <uint, DviPage *> pages; + + public: + DviFile (AbstractLoader& l); + DviPage *get_page (uint n); /* unref it when done */ + ~DviFile (void) {} + uint get_n_pages () { return n_pages; } + DviFontdefinition *get_fontdefinition (uint n) + { + return postamble->fontdefinitions[n]; + } + uint get_numerator () { return postamble->numerator; } + uint get_denominator () { return postamble->denominator; } + uint get_magnification () { return postamble->magnification; } + }; + +} +#endif // DL_DVI_FILE_HH + |