Commit bde413ac authored by Albert Astals Cid's avatar Albert Astals Cid

okular needs libspectre >= 0.2 as of now

Packagers start your engines!

svn path=/trunk/KDE/kdegraphics/okular/; revision=768911
parent 87fe7f27
# - Try to find the libspectre PS library
# Once done this will define
#
# LIBSPECTRE_FOUND - system has libspectre
# LIBSPECTRE_INCLUDE_DIR - the libspectre include directory
# LIBSPECTRE_LIBRARY - Link this to use libspectre
#
# Copyright (c) 2006-2007, Pino Toscano, <pino@kde.org>
# Copyright (c) 2008, Albert Astals Cid, <aacid@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
# in cache already
set(LIBSPECTRE_FOUND TRUE)
else(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
PKGCONFIG(libspectre _SpectreIncDir _SpectreLinkDir _SpectreLinkFlags _SpectreCflags)
if(_SpectreLinkFlags)
# find again pkg-config, to query it about libspectre version
FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/bin/ /usr/local/bin )
# query pkg-config asking for a libspectre >= LIBSPECTRE_MINIMUM_VERSION
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${LIBSPECTRE_MINIMUM_VERSION} libspectre RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
if(_return_VALUE STREQUAL "0")
set(LIBSPECTRE_FOUND TRUE)
endif(_return_VALUE STREQUAL "0")
endif(_SpectreLinkFlags)
if (LIBSPECTRE_FOUND)
set(LIBSPECTRE_LIBRARY ${_SpectreLinkFlags})
# the cflags for libspectre can contain more than one include path
separate_arguments(_SpectreCflags)
foreach(_includedir ${_SpectreCflags})
string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}")
set(LIBSPECTRE_INCLUDE_DIR ${LIBSPECTRE_INCLUDE_DIR} ${_includedir})
endforeach(_includedir)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
else (LIBSPECTRE_FOUND)
if (LIBSPECTRE_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find libspectre")
endif (LIBSPECTRE_FIND_REQUIRED)
message(STATUS "Could not find OPTIONAL package libspectre")
endif (LIBSPECTRE_FOUND)
# ensure that they are cached
set(LIBSPECTRE_INCLUDE_DIR ${LIBSPECTRE_INCLUDE_DIR} CACHE INTERNAL "The libspectre include path")
set(LIBSPECTRE_LIBRARY ${LIBSPECTRE_LIBRARY} CACHE INTERNAL "The libspectre library")
endif(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
include (MacroLogFeature)
set(LIBGS_MINIMUM_VERSION "8.56")
set(LIBSPECTRE_MINIMUM_VERSION "0.2")
macro_optional_find_package(Poppler)
macro_log_feature(POPPLER_FOUND "Poppler-Qt4" "A PDF rendering library" "http://poppler.freedesktop.org" FALSE "0.5.4" "Support for PDF files in okular.")
macro_optional_find_package(LIBGS)
macro_log_feature(LIBGS_FOUND "libgs, Ghostscript libraries" "A PostScript renderining library" "http://www.cs.wisc.edu/~ghost" FALSE "${LIBGS_MINIMUM_VERSION}" "Support for PS files in okular.")
macro_optional_find_package(LibSpectre)
macro_log_feature(LIBSPECTRE_FOUND "libspectre" "A PostScript rendering library" "http://libspectre.freedesktop.org/wiki/" FALSE "${LIBSPECTRE_MINIMUM_VERSION}" "Support for PS files in okular.")
macro_optional_find_package(CHM)
macro_log_feature(CHM_FOUND "CHM" "A library for dealing with Microsoft ITSS/CHM format files" "http://www.jedrea.com/chmlib" FALSE "" "Support CHM files in okular.")
......@@ -30,9 +30,9 @@ if(POPPLER_FOUND)
add_subdirectory(poppler)
endif(POPPLER_FOUND)
if(LIBGS_FOUND)
if(LIBSPECTRE_FOUND)
add_subdirectory(spectre)
endif(LIBGS_FOUND)
endif(LIBSPECTRE_FOUND)
add_subdirectory( kimgio )
......
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
)
set(spectreOkular_SRCS
ps.c
spectre-device.c
spectre-document.c
spectre-exporter.c
spectre-exporter-pdf.c
spectre-exporter-ps.c
spectre-gs.c
spectre-page.c
spectre-render-context.c
spectre-status.c
spectre-utils.c
)
kde4_add_library(spectreOkular SHARED ${spectreOkular_SRCS})
target_link_libraries(spectreOkular ${LIBGS_LIBRARY} )
set_target_properties(spectreOkular PROPERTIES VERSION 1.0.0 SOVERSION 1 )
install(TARGETS spectreOkular DESTINATION ${LIB_INSTALL_DIR})
The files in the src, lib, toolbin, examples, doc and man
directories (folders) and any subdirectories (sub-folders)
thereof are part of GPL Ghostscript.
The files in the Resource directory and any subdirectories thereof
are also part of GPL Ghostscript, with the explicit exception of
the files in the CMap subdirectory. The CMap files are copyright
Adobe Systems Incorporated and covered by a separate license
which permits only verbatim distribution.
GPL Ghostscript is free software; you can redistribute it and/or
modify it under the terms of version 2 of the GNU General Public
License as published by the Free Software Foundation.
GPL Ghostscript is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program so you can know your rights and responsibilities.
It should be in a file named doc/COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place Fifth Floor, Boston, MA
02110-1301, USA.
---
GPL Ghostscript contains an implementation of techniques covered
by US Patents 5,055,942 and 5,917,614, and corresponding
international patents. These patents are licensed for use with
GPL Ghostscript under the following grant:
Whereas, Raph Levien (hereinafter "Inventor") has obtained patent
protection for related technology (hereinafter "Patented
Technology"), Inventor wishes to aid the the GNU free software
project in achieving its goals, and Inventor also wishes to
increase public awareness of Patented Technology, Inventor hereby
grants a fully paid up, nonexclusive, royalty free license to
practice the patents listed below ("the Patents") if and only if
practiced in conjunction with software distributed under the
terms of any version of the GNU General Public License as
published by the Free Software Foundation, 51 Franklin Street, Suite
330, Boston, MA 02111. Inventor reserves all other rights,
including without limitation, licensing for software not
distributed under the GNU General Public License.
5055942 Photographic image reproduction device using digital
halftoning to screen images allowing adjustable coarseness
5917614 Method and apparatus for error diffusion screening of
images with improved smoothness in highlight and shadow
regions
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied, modified
or distributed except as expressly authorized under the terms of that
license. Refer to licensing information at http://www.artifex.com/
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
/* $Id$ */
/* gdevdsp.h - callback structure for DLL based display device */
#ifndef gdevdsp_INCLUDED
# define gdevdsp_INCLUDED
/*
* The callback structure must be provided by calling the
* Ghostscript APIs in the following order:
* gsapi_new_instance(&minst);
* gsapi_set_display_callback(minst, callback);
* gsapi_init_with_args(minst, argc, argv);
*
* Supported parameters and default values are:
* -sDisplayHandle=16#04d2 or 1234 string
* Caller supplied handle as a decimal or hexadecimal number
* in a string. On 32-bit platforms, it may be set
* using -dDisplayHandle=1234 for backward compatibility.
* Included as first parameter of all callback functions.
*
* -dDisplayFormat=0 long
* Color format specified using bitfields below.
* Included as argument of display_size() and display_presize()
* These can only be changed when the device is closed.
*
* The second parameter of all callback functions "void *device"
* is the address of the Ghostscript display device instance.
* The arguments "void *handle" and "void *device" together
* uniquely identify an instance of the display device.
*
* A typical sequence of callbacks would be
* open, presize, memalloc, size, sync, page
* presize, memfree, memalloc, size, sync, page
* preclose, memfree, close
* The caller should not access the image buffer:
* - before the first sync
* - between presize and size
* - after preclose
* If opening the device fails, you might see the following:
* open, presize, memalloc, memfree, close
*
*/
#define DISPLAY_VERSION_MAJOR 2
#define DISPLAY_VERSION_MINOR 0
#define DISPLAY_VERSION_MAJOR_V1 1 /* before separation format was added */
#define DISPLAY_VERSION_MINOR_V1 0
/* The display format is set by a combination of the following bitfields */
/* Define the color space alternatives */
typedef enum {
DISPLAY_COLORS_NATIVE = (1<<0),
DISPLAY_COLORS_GRAY = (1<<1),
DISPLAY_COLORS_RGB = (1<<2),
DISPLAY_COLORS_CMYK = (1<<3),
DISPLAY_COLORS_SEPARATION = (1<<19)
} DISPLAY_FORMAT_COLOR;
#define DISPLAY_COLORS_MASK 0x8000fL
/* Define whether alpha information, or an extra unused bytes is included */
/* DISPLAY_ALPHA_FIRST and DISPLAY_ALPHA_LAST are not implemented */
typedef enum {
DISPLAY_ALPHA_NONE = (0<<4),
DISPLAY_ALPHA_FIRST = (1<<4),
DISPLAY_ALPHA_LAST = (1<<5),
DISPLAY_UNUSED_FIRST = (1<<6), /* e.g. Mac xRGB */
DISPLAY_UNUSED_LAST = (1<<7) /* e.g. Windows BGRx */
} DISPLAY_FORMAT_ALPHA;
#define DISPLAY_ALPHA_MASK 0x00f0L
/* Define the depth per component for DISPLAY_COLORS_GRAY,
* DISPLAY_COLORS_RGB and DISPLAY_COLORS_CMYK,
* or the depth per pixel for DISPLAY_COLORS_NATIVE
* DISPLAY_DEPTH_2 and DISPLAY_DEPTH_12 have not been tested.
*/
typedef enum {
DISPLAY_DEPTH_1 = (1<<8),
DISPLAY_DEPTH_2 = (1<<9),
DISPLAY_DEPTH_4 = (1<<10),
DISPLAY_DEPTH_8 = (1<<11),
DISPLAY_DEPTH_12 = (1<<12),
DISPLAY_DEPTH_16 = (1<<13)
/* unused (1<<14) */
/* unused (1<<15) */
} DISPLAY_FORMAT_DEPTH;
#define DISPLAY_DEPTH_MASK 0xff00L
/* Define whether Red/Cyan should come first,
* or whether Blue/Black should come first
*/
typedef enum {
DISPLAY_BIGENDIAN = (0<<16), /* Red/Cyan first */
DISPLAY_LITTLEENDIAN = (1<<16) /* Blue/Black first */
} DISPLAY_FORMAT_ENDIAN;
#define DISPLAY_ENDIAN_MASK 0x00010000L
/* Define whether the raster starts at the top or bottom of the bitmap */
typedef enum {
DISPLAY_TOPFIRST = (0<<17), /* Unix, Mac */
DISPLAY_BOTTOMFIRST = (1<<17) /* Windows */
} DISPLAY_FORMAT_FIRSTROW;
#define DISPLAY_FIRSTROW_MASK 0x00020000L
/* Define whether packing RGB in 16-bits should use 555
* or 565 (extra bit for green)
*/
typedef enum {
DISPLAY_NATIVE_555 = (0<<18),
DISPLAY_NATIVE_565 = (1<<18)
} DISPLAY_FORMAT_555;
#define DISPLAY_555_MASK 0x00040000L
/* Define the row alignment, which must be equal to or greater than
* the size of a pointer.
* The default (DISPLAY_ROW_ALIGN_DEFAULT) is the size of a pointer,
* 4 bytes (DISPLAY_ROW_ALIGN_4) on 32-bit systems or 8 bytes
* (DISPLAY_ROW_ALIGN_8) on 64-bit systems.
*/
typedef enum {
DISPLAY_ROW_ALIGN_DEFAULT = (0<<20),
/* DISPLAY_ROW_ALIGN_1 = (1<<20), */ /* not currently possible */
/* DISPLAY_ROW_ALIGN_2 = (2<<20), */ /* not currently possible */
DISPLAY_ROW_ALIGN_4 = (3<<20),
DISPLAY_ROW_ALIGN_8 = (4<<20),
DISPLAY_ROW_ALIGN_16 = (5<<20),
DISPLAY_ROW_ALIGN_32 = (6<<20),
DISPLAY_ROW_ALIGN_64 = (7<<20)
} DISPLAY_FORMAT_ROW_ALIGN;
#define DISPLAY_ROW_ALIGN_MASK 0x00700000L
#ifndef display_callback_DEFINED
#define display_callback_DEFINED
typedef struct display_callback_s display_callback;
#endif
/*
* Note that for Windows, the display callback functions are
* cdecl, not stdcall. This differs from those in iapi.h.
*/
struct display_callback_s {
/* Size of this structure */
/* Used for checking if we have been handed a valid structure */
int size;
/* Major version of this structure */
/* The major version number will change if this structure changes. */
int version_major;
/* Minor version of this structure */
/* The minor version number will change if new features are added
* without changes to this structure. For example, a new color
* format.
*/
int version_minor;
/* New device has been opened */
/* This is the first event from this device. */
int (*display_open)(void *handle, void *device);
/* Device is about to be closed. */
/* Device will not be closed until this function returns. */
int (*display_preclose)(void *handle, void *device);
/* Device has been closed. */
/* This is the last event from this device. */
int (*display_close)(void *handle, void *device);
/* Device is about to be resized. */
/* Resize will only occur if this function returns 0. */
/* raster is byte count of a row. */
int (*display_presize)(void *handle, void *device,
int width, int height, int raster, unsigned int format);
/* Device has been resized. */
/* New pointer to raster returned in pimage */
int (*display_size)(void *handle, void *device, int width, int height,
int raster, unsigned int format, unsigned char *pimage);
/* flushpage */
int (*display_sync)(void *handle, void *device);
/* showpage */
/* If you want to pause on showpage, then don't return immediately */
int (*display_page)(void *handle, void *device, int copies, int flush);
/* Notify the caller whenever a portion of the raster is updated. */
/* This can be used for cooperative multitasking or for
* progressive update of the display.
* This function pointer may be set to NULL if not required.
*/
int (*display_update)(void *handle, void *device, int x, int y,
int w, int h);
/* Allocate memory for bitmap */
/* This is provided in case you need to create memory in a special
* way, e.g. shared. If this is NULL, the Ghostscript memory device
* allocates the bitmap. This will only called to allocate the
* image buffer. The first row will be placed at the address
* returned by display_memalloc.
*/
void *(*display_memalloc)(void *handle, void *device, unsigned long size);
/* Free memory for bitmap */
/* If this is NULL, the Ghostscript memory device will free the bitmap */
int (*display_memfree)(void *handle, void *device, void *mem);
/* Added in V2 */
/* When using separation color space (DISPLAY_COLORS_SEPARATION),
* give a mapping for one separation component.
* This is called for each new component found.
* It may be called multiple times for each component.
* It may be called at any time between display_size
* and display_close.
* The client uses this to map from the separations to CMYK
* and hence to RGB for display.
* GS must only use this callback if version_major >= 2.
* The unsigned short c,m,y,k values are 65535 = 1.0.
* This function pointer may be set to NULL if not required.
*/
int (*display_separation)(void *handle, void *device,
int component, const char *component_name,
unsigned short c, unsigned short m,
unsigned short y, unsigned short k);
};
/* This is the V1 structure, before separation format was added */
struct display_callback_v1_s {
int size;
int version_major;
int version_minor;
int (*display_open)(void *handle, void *device);
int (*display_preclose)(void *handle, void *device);
int (*display_close)(void *handle, void *device);
int (*display_presize)(void *handle, void *device,
int width, int height, int raster, unsigned int format);
int (*display_size)(void *handle, void *device, int width, int height,
int raster, unsigned int format, unsigned char *pimage);
int (*display_sync)(void *handle, void *device);
int (*display_page)(void *handle, void *device, int copies, int flush);
int (*display_update)(void *handle, void *device, int x, int y,
int w, int h);
void *(*display_memalloc)(void *handle, void *device, unsigned long size);
int (*display_memfree)(void *handle, void *device, void *mem);
};
#define DISPLAY_CALLBACK_V1_SIZEOF sizeof(struct display_callback_v1_s)
#endif /* gdevdsp_INCLUDED */
This diff is collapsed.
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied, modified
or distributed except as expressly authorized under the terms of that
license. Refer to licensing information at http://www.artifex.com/
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
/* $Id$ */
/* Definition of error codes */
#ifndef ierrors_INCLUDED
# define ierrors_INCLUDED
/*
* DO NOT USE THIS FILE IN THE GRAPHICS LIBRARY.
* THIS FILE IS PART OF THE POSTSCRIPT INTERPRETER.
* USE gserrors.h IN THE LIBRARY.
*/
/*
* A procedure that may return an error always returns
* a non-negative value (zero, unless otherwise noted) for success,
* or negative for failure.
* We use ints rather than an enum to avoid a lot of casting.
*/
/* Define the error name table */
extern const char *const gs_error_names[];
/* ------ PostScript Level 1 errors ------ */
#define e_unknownerror (-1) /* unknown error */
#define e_dictfull (-2)
#define e_dictstackoverflow (-3)
#define e_dictstackunderflow (-4)
#define e_execstackoverflow (-5)
#define e_interrupt (-6)
#define e_invalidaccess (-7)
#define e_invalidexit (-8)
#define e_invalidfileaccess (-9)
#define e_invalidfont (-10)
#define e_invalidrestore (-11)
#define e_ioerror (-12)
#define e_limitcheck (-13)
#define e_nocurrentpoint (-14)
#define e_rangecheck (-15)
#define e_stackoverflow (-16)
#define e_stackunderflow (-17)
#define e_syntaxerror (-18)
#define e_timeout (-19)
#define e_typecheck (-20)
#define e_undefined (-21)
#define e_undefinedfilename (-22)
#define e_undefinedresult (-23)
#define e_unmatchedmark (-24)
#define e_VMerror (-25) /* must be the last Level 1 error */
#define LEVEL1_ERROR_NAMES\
"unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\
"execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\
"invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\
"limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\
"stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\
"undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror"
/* ------ Additional Level 2 errors (also in DPS) ------ */
#define e_configurationerror (-26)
#define e_undefinedresource (-27)
#define e_unregistered (-28)
#define LEVEL2_ERROR_NAMES\
"configurationerror", "undefinedresource", "unregistered"
/* ------ Additional DPS errors ------ */
#define e_invalidcontext (-29)
/* invalidid is for the NeXT DPS extension. */
#define e_invalidid (-30)
#define DPS_ERROR_NAMES\
"invalidcontext", "invalidid"
#define ERROR_NAMES\
LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES, DPS_ERROR_NAMES
/* ------ Pseudo-errors used internally ------ */
/*
* Internal code for a fatal error.
* gs_interpret also returns this for a .quit with a positive exit code.
*/
#define e_Fatal (-100)
/*
* Internal code for the .quit operator.
* The real quit code is an integer on the operand stack.
* gs_interpret returns this only for a .quit with a zero exit code.
*/
#define e_Quit (-101)
/*
* Internal code for a normal exit from the interpreter.
* Do not use outside of interp.c.
*/
#define e_InterpreterExit (-102)
/*
* Internal code that indicates that a procedure has been stored in the
* remap_proc of the graphics state, and should be called before retrying
* the current token. This is used for color remapping involving a call
* back into the interpreter -- inelegant, but effective.
*/
#define e_RemapColor (-103)
/*
* Internal code to indicate we have underflowed the top block
* of the e-stack.
*/
#define e_ExecStackUnderflow (-104)
/*
* Internal code for the vmreclaim operator with a positive operand.
* We need to handle this as an error because otherwise the interpreter
* won't reload enough of its state when the operator returns.
*/
#define e_VMreclaim (-105)
/*
* Internal code for requesting more input from run_string.
*/
#define e_NeedInput (-106)
/*
* Internal code for a normal exit when usage info is displayed.
* This allows Window versions of Ghostscript to pause until
* the message can be read.
*/
#define e_Info (-110)
/*
* Define which error codes require re-executing the current object.
*/
#define ERROR_IS_INTERRUPT(ecode)\
((ecode) == e_interrupt || (ecode) == e_timeout)
#endif /* ierrors_INCLUDED */
This diff is collapsed.
/*
* ps.h -- Include file for PostScript routines.
* Copyright (C) 1992 Timothy O. Theisen
* Copyright (C) 2004 Jose E. Marchesi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU gv; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
* Author: Tim Theisen Systems Programmer
* Internet: tim@cs.wisc.edu Department of Computer Sciences
* UUCP: uwvax!tim University of Wisconsin-Madison
* Phone: (608)262-0438 1210 West Dayton Street
* FAX: (608)262-9777 Madison, WI 53706
*/
#ifndef PS_H
#define PS_H
#include <libspectre/spectre-macros.h>
#include <stdio.h>
SPECTRE_BEGIN_DECLS
#ifndef NeedFunctionPrototypes
#if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#define NeedFunctionPrototypes 1
#else
#define NeedFunctionPrototypes 0
#endif /* __STDC__ */
#endif /* NeedFunctionPrototypes */
/* Constants used to index into the bounding box array. */
#define LLX 0
#define LLY 1
#define URX 2
#define URY 3
/* Constants used to store keywords that are scanned. */
/* NONE is not a keyword, it tells when a field was not set */
/*
enum {ATEND = -1, NONE = 0, PORTRAIT, LANDSCAPE, ASCEND, DESCEND, SPECIAL};
*/
#define ATEND (-1)
#define NONE 0
#define PORTRAIT 1
#define LANDSCAPE 2
#define SEASCAPE 3
#define UPSIDEDOWN 4
#define ASCEND 5
#define DESCEND 6
#define SPECIAL 7
#define AUTOMATIC 8
#define PSLINELENGTH 257 /* 255 characters + 1 newline + 1 NULL */
/*##############################################
media
##############################################*/
typedef struct documentmedia {
char *name;
int width;
int height;
} MediaStruct, *Media;
typedef struct document {
unsigned int ref_count;
#ifdef GV_CODE
int structured; /* toc will be useful */
int labels_useful; /* page labels are distinguishable, hence useful */
#endif
char *format; /* Postscript format */
char *filename; /* Document filename */
int epsf; /* Encapsulated PostScript flag. */
char *title; /* Title of document. */
char *date; /* Creation date. */
char *creator; /* Program that created the file */
char *fortext;
char *languagelevel;
int pageorder; /* ASCEND, DESCEND, SPECIAL */
long beginheader, endheader; /* offsets into file */
unsigned int lenheader;
long beginpreview, endpreview;
unsigned int lenpreview;
long begindefaults, enddefaults;
unsigned int lendefaults;
long beginprolog, endprolog;
unsigned int lenprolog;
long beginsetup, endsetup;
unsigned int lensetup;
long begintrailer, endtrailer;
unsigned int lentrailer;
int boundingbox[4];
int default_page_boundingbox[4];
int orientation; /* PORTRAIT, LANDSCAPE */
int default_page_orientation; /* PORTRAIT, LANDSCAPE */
unsigned int nummedia;
struct documentmedia *media;
Media default_page_media;
unsigned int numpages;
struct page *pages;
} *Document;
struct page {
char *label;
int boundingbox[4];
struct documentmedia *media;
int orientation; /* PORTRAIT, LANDSCAPE */
long begin, end; /* offsets into file */