diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/image')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/epdf.h | 219 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/image.h | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/pdftoepdf.h | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/writeimg.h | 1 |
4 files changed, 106 insertions, 129 deletions
diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h index 57bb2e39ae9..9c32c06b795 100644 --- a/Build/source/texk/web2c/luatexdir/image/epdf.h +++ b/Build/source/texk/web2c/luatexdir/image/epdf.h @@ -18,15 +18,19 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -// this is the common header file for C++ sources pdftoepdf.cc and lepdflib.cc +/* this is the common header file for C++ sources pdftoepdf.c and lepdflib.c */ #ifndef EPDF_H # define EPDF_H -extern "C" { + +/*extern "C" {*/ + #ifdef HAVE_CONFIG_H #include <w2c/config.h> #endif -} + +/*}*/ + # include <stdlib.h> # include <math.h> # include <stddef.h> @@ -35,41 +39,22 @@ extern "C" { # include <kpathsea/c-ctype.h> # include <sys/stat.h> # include <dirent.h> -# include <poppler-config.h> -# include <goo/GooString.h> -# include <goo/gmem.h> -# include <goo/gfile.h> -# include <Object.h> -# include <Stream.h> -# include <Gfx.h> -# include <Annot.h> -# include <Array.h> -# include <Dict.h> -# include <XRef.h> -# include <Catalog.h> -# include <StructTreeRoot.h> -# include <Link.h> -# include <Page.h> -# include <GfxFont.h> -# include <PDFDoc.h> -# include <GlobalParams.h> -# include <Error.h> -# include <FileSpec.h> - -extern "C" { + +/*extern "C" { */ # include <kpathsea/c-auto.h> - extern char *xstrdup(const char *); +extern char *xstrdup(const char *); - typedef enum { FE_FAIL, FE_RETURN_NULL } file_error_mode; +typedef enum { FE_FAIL, FE_RETURN_NULL } file_error_mode; /* the following code is extremly ugly but needed for including web2c/config.h */ - typedef const char *const_string; /* including kpathsea/types.h doesn't work on some systems */ +typedef const char *const_string; /* including kpathsea/types.h doesn't work on some systems */ # define KPATHSEA_CONFIG_H /* avoid including other kpathsea header files */ - /* from web2c/config.h */ + +/* from web2c/config.h */ # ifdef CONFIG_H /* CONFIG_H has been defined by some xpdf */ # undef CONFIG_H /* header file */ @@ -84,117 +69,105 @@ extern "C" { # include "lua.h" # include "lauxlib.h" - /* pdfgen.w */ - extern int ten_pow[10]; - __attribute__ ((format(printf, 2, 3))) - extern void pdf_printf(PDF, const char *fmt, ...); - extern void pdf_begin_obj(PDF, int, int); - extern void pdf_end_obj(PDF); - extern void pdf_begin_dict(PDF); - extern void pdf_end_dict(PDF); - extern void pdf_begin_array(PDF); - extern void pdf_end_array(PDF); - extern void pdf_add_null(PDF); - extern void pdf_add_bool(PDF, int i); - extern void pdf_add_int(PDF, int i); - extern void pdf_add_ref(PDF, int num); - extern void pdf_add_name(PDF, const char *name); - extern void pdf_dict_add_streaminfo(PDF); - extern void pdf_begin_stream(PDF); - extern void pdf_end_stream(PDF); - extern void pdf_room(PDF, int); - extern void pdf_out_block(PDF pdf, const char *s, size_t n); - - extern void pdf_dict_add_int(PDF, const char *key, int i); - extern void pdf_dict_add_ref(PDF, const char *key, int num); - extern void pdf_dict_add_name(PDF, const char *key, const char *val); - extern void pdf_dict_add_streaminfo(PDF); - -# define pdf_out(pdf, A) do { pdf_room(pdf, 1); *(pdf->buf->p++) = A; } while (0) -# define pdf_quick_out(pdf,A) *(pdf->buf->p++)=(unsigned char)(A) +# include "luapplib/pplib.h" + +/* pdfgen.w */ + +extern int ten_pow[10]; +__attribute__ ((format(printf, 2, 3))) +extern void pdf_printf(PDF, const char *fmt, ...); +extern void pdf_begin_obj(PDF, int, int); +extern void pdf_end_obj(PDF); +extern void pdf_begin_dict(PDF); +extern void pdf_end_dict(PDF); +extern void pdf_begin_array(PDF); +extern void pdf_end_array(PDF); +extern void pdf_add_null(PDF); +extern void pdf_add_bool(PDF, int i); +extern void pdf_add_int(PDF, int i); +extern void pdf_add_real(PDF, double d); +extern void pdf_add_ref(PDF, int num); +extern void pdf_add_name(PDF, const char *name); +extern void pdf_dict_add_streaminfo(PDF); +extern void pdf_begin_stream(PDF); +extern void pdf_end_stream(PDF); +extern void pdf_room(PDF, int); +extern void pdf_out_block(PDF pdf, const char *s, size_t n); + +extern void pdf_dict_add_int(PDF, const char *key, int i); +extern void pdf_dict_add_ref(PDF, const char *key, int num); +extern void pdf_dict_add_name(PDF, const char *key, const char *val); +extern void pdf_dict_add_streaminfo(PDF); + +/* Conflict with pdfgen.h */ +/*# define pdf_out(pdf, A) do { pdf_room(pdf, 1); *(pdf->buf->p++) = A; } while (0)*/ +/*# define pdf_quick_out(pdf,A) *(pdf->buf->p++)=(unsigned char)(A) */ + # define pdf_puts(pdf, s) pdf_out_block((pdf), (s), strlen(s)) - /* pdfpage.w */ - extern void print_pdffloat(PDF pdf, pdffloat f); +/* pdfpage.w */ - /* pdftables.w */ - extern int pdf_create_obj(PDF pdf, int t, int i); +extern void print_pdffloat(PDF pdf, pdffloat f); - /* pdftoepdf.cc */ - extern void read_pdf_info(image_dict *); - extern void flush_pdf_info(image_dict *); - extern void write_epdf(PDF, image_dict *, int suppress_optional_info); - extern void unrefPdfDocument(char *); - extern void unrefMemStreamPdfDocument(char *); - extern void epdf_free(void); - extern void copyReal(PDF pdf, double d); +/* pdftables.w */ - /* writeimg.w */ - extern void pdf_dict_add_img_filename(PDF pdf, image_dict * idict); +extern int pdf_create_obj(PDF pdf, int t, int i); - /* utils.w */ - extern char *convertStringToPDFString(char *in, int len); +/* pdftoepdf.c */ - /* lepdflib.w */ - int luaopen_epdf(lua_State * L); +extern void read_pdf_info(image_dict *); +extern void flush_pdf_info(image_dict *); -# include "luatex-common.h" +extern void write_epdf(PDF, image_dict *, int suppress_optional_info); +extern int write_epdf_object(PDF, image_dict *, int n); -}; +extern void unrefPdfDocument(char *); +extern void unrefMemStreamPdfDocument(char *); -/**********************************************************************/ - -// PdfObject encapsulates the xpdf Object type, -// and properly frees its resources on destruction. -// Use obj-> to access members of the Object, -// and &obj to get a pointer to the object. -// It is no longer necessary to call Object::free explicitely. - -# if 0 -// PdfObject is replaced by xpdf's Object type, with manual obj.free() - -// *INDENT-OFF* -class PdfObject { - public: - PdfObject() { // nothing - } - ~PdfObject() { - iObject.free(); - } - Object *operator->() { - return &iObject; - } - Object *operator&() { - return &iObject; - } - private: // no copying or assigning - PdfObject(const PdfObject &); - void operator=(const PdfObject &); - public: - Object iObject; -}; -// *INDENT-ON* -# endif +extern void epdf_free(void); + +/* writeimg.w */ -/**********************************************************************/ +extern void pdf_dict_add_img_filename(PDF pdf, image_dict * idict); + +/* utils.w */ + +/*extern char *convertStringToPDFString(const char *in, int len);*/ + +/* lepdflib.w */ + +int luaopen_epdf(lua_State * L); + +# include "luatex-common.h" + +/*}*/ + +typedef struct InObj InObj; struct InObj { - Ref ref; // ref in original PDF - int num; // new object number in output PDF - InObj *next; // next entry in list of indirect objects -}; + ppref *ref; /* ref in original PDF */ + int num; /* new object number in output PDF */ + InObj *next; /* next entry in list of indirect objects */ +} ; + + +typedef struct avl_table avl_table; struct PdfDocument { - char *file_path; // full file name including path - char *checksum; // for reopening - PDFDoc *doc; - InObj *inObjList; // temporary linked list - avl_table *ObjMapTree; // permanent over luatex run - unsigned int occurences; // number of references to the PdfDocument; it can be deleted when occurences == 0 - unsigned int pc; // counter to track PDFDoc generation or deletion + char *file_path; /* full file name including path */ + char *checksum; /* for reopening */ + ppdoc *pdfe; + InObj *inObjList; /* temporary linked list */ + avl_table *ObjMapTree; /* permanent over luatex run */ + int is_mem; + char *memstream; + unsigned int occurences; /* number of references to the PdfDocument; it can be deleted when occurences == 0 */ + unsigned int pc; /* counter to track PDFDoc generation or deletion */ }; -PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe); +typedef struct PdfDocument PdfDocument; + +PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe, const char *userpassword, const char *ownerpassword); PdfDocument *refMemStreamPdfDocument(char *docstream, unsigned long long streamsize, const char *file_id); diff --git a/Build/source/texk/web2c/luatexdir/image/image.h b/Build/source/texk/web2c/luatexdir/image/image.h index 7c79723f1df..985f53d06eb 100644 --- a/Build/source/texk/web2c/luatexdir/image/image.h +++ b/Build/source/texk/web2c/luatexdir/image/image.h @@ -39,6 +39,7 @@ extern scaled one_hundred_bp; /* from pdfgen.w */ typedef struct { char *stream; + size_t size; } pdf_stream_struct; typedef struct { @@ -116,6 +117,8 @@ typedef struct { char *filepath; /* full file path after kpathsea */ char *attr; /* additional image dict entries */ FILE *file; + char *userpassword; + char *ownerpassword; imgtype_e image_type; int procset; /* /ProcSet flags */ int color_depth; /* color depth */ @@ -125,6 +128,7 @@ typedef struct { int flags; int luaref ; boolean keepopen; + boolean nolength; int errorlevel; int pdfmajorversion; int pdfminorversion; @@ -159,6 +163,8 @@ typedef struct { # define img_pagename(N) ((N)->pagename) # define img_filename(N) ((N)->filename) # define img_visiblefilename(N) ((N)->visiblefilename) +# define img_userpassword(N) ((N)->userpassword) +# define img_ownerpassword(N) ((N)->ownerpassword) # define img_filepath(N) ((N)->filepath) # define img_attr(N) ((N)->attr) # define img_file(N) ((N)->file) @@ -171,12 +177,14 @@ typedef struct { # define img_flags(N) ((N)->flags) # define img_luaref(N) ((N)->luaref) # define img_keepopen(N) ((N)->keepopen) +# define img_nolength(N) ((N)->nolength) # define img_errorlevel(N) ((N)->errorlevel) # define img_pdfmajorversion(N) ((N)->pdfmajorversion) # define img_pdfminorversion(N) ((N)->pdfminorversion) # define img_pdfstream_ptr(N) ((N)->img_struct.pdfstream) # define img_pdfstream_stream(N) ((N)->img_struct.pdfstream->stream) +# define img_pdfstream_size(N) ((N)->img_struct.pdfstream->size) # define img_png_ptr(N) ((N)->img_struct.png) # define img_png_png_ptr(N) ((N)->img_struct.png->png_ptr) diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h index 0a8ef942c0e..cc8f0e15041 100644 --- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h +++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h @@ -30,12 +30,7 @@ void flush_pdf_info(image_dict *); void unrefPdfDocument(char *); void unrefMemStreamPdfDocument(char *); void write_epdf(PDF, image_dict *, int suppress_optional_info); -void epdf_check_mem(void); -void copyReal(PDF pdf, double d); - -int poppler_version_major(void); -int poppler_version_minor(void); -int poppler_version_micro(void); +int write_epdf_object(PDF, image_dict *, int n); /* epdf.c --- this should go in an own header file */ diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.h b/Build/source/texk/web2c/luatexdir/image/writeimg.h index 46c42d2657e..dc86648e217 100644 --- a/Build/source/texk/web2c/luatexdir/image/writeimg.h +++ b/Build/source/texk/web2c/luatexdir/image/writeimg.h @@ -38,6 +38,7 @@ void scan_pdfrefximage(PDF pdf); scaled_whd tex_scale(scaled_whd nat, scaled_whd tex); scaled_whd scale_img(image_dict *, scaled_whd, int); void write_img(PDF, image_dict *); +int write_img_object(PDF, image_dict *, int n); void pdf_write_image(PDF pdf, int n); void check_pdfstream_dict(image_dict *); void write_pdfstream(PDF, image_dict *); |