diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-05-21 13:19:17 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-05-21 13:19:17 +0000 |
commit | ebdcfba2fc6c9bf4db2008a00058f3422a9d1da8 (patch) | |
tree | 52772b6cbe81d9ca8b67d3990ea033a27d432916 /Build/source/texk/xdvipdfmx/src/spc_pdfm.c | |
parent | 246e3a9180a28cb419402687d2005bdfb5313774 (diff) |
update to xdvipdfmx 0.7, from xetex svn r.688
git-svn-id: svn://tug.org/texlive/trunk@8272 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvipdfmx/src/spc_pdfm.c')
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/spc_pdfm.c | 78 |
1 files changed, 32 insertions, 46 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/spc_pdfm.c b/Build/source/texk/xdvipdfmx/src/spc_pdfm.c index 6d914149d86..c9319a457a7 100644 --- a/Build/source/texk/xdvipdfmx/src/spc_pdfm.c +++ b/Build/source/texk/xdvipdfmx/src/spc_pdfm.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.30 2008/02/13 20:22:21 matthias Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/spc_pdfm.c,v 1.34 2008/05/18 12:05:22 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -36,6 +36,7 @@ #include "numbers.h" #include "fontmap.h" +#include "dpxfile.h" #include "dpxutil.h" #include "pdfobj.h" @@ -331,7 +332,7 @@ spc_handler_pdfm_put (struct spc_env *spe, struct spc_arg *ap) } skip_white(&ap->curptr, ap->endptr); - obj2 = parse_pdf_object(&ap->curptr, ap->endptr); + obj2 = parse_pdf_object(&ap->curptr, ap->endptr, NULL); if (!obj2) { spc_warn(spe, "Missing (an) object(s) to put into \"%s\"!", ident); RELEASE(ident); @@ -377,7 +378,7 @@ spc_handler_pdfm_put (struct spc_env *spe, struct spc_arg *ap) /* dvipdfm */ pdf_add_array(obj1, pdf_link_obj(obj2)); while (ap->curptr < ap->endptr) { - pdf_obj *obj3 = parse_pdf_object(&ap->curptr, ap->endptr); + pdf_obj *obj3 = parse_pdf_object(&ap->curptr, ap->endptr, NULL); if (!obj3) break; pdf_add_array(obj1, obj3); @@ -603,14 +604,14 @@ my_parse_pdf_dict (char **pp, char *endptr, struct tounicode *cd) #if 0 /* disable this test, as we do utf8 reencoding with no cmap */ if (cd->cmap_id < 0) - return parse_pdf_dict(pp, endptr); + return parse_pdf_dict(pp, endptr, NULL); #endif /* :( */ if (cd && cd->unescape_backslash) dict = parse_pdf_tainted_dict(pp, endptr); else { - dict = parse_pdf_dict(pp, endptr); + dict = parse_pdf_dict(pp, endptr, NULL); } if (dict) pdf_foreach_dict(dict, modstrings, cd); @@ -657,7 +658,7 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE annot_dict = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - annot_dict = parse_pdf_dict(&args->curptr, args->endptr); + annot_dict = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!annot_dict) { spc_warn(spe, "Could not find dictionary object."); @@ -718,7 +719,7 @@ spc_handler_pdfm_bann (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE sd->annot_dict = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - sd->annot_dict = parse_pdf_dict(&args->curptr, args->endptr); + sd->annot_dict = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!sd->annot_dict) { spc_warn(spe, "Ignoring annotation with invalid dictionary."); @@ -885,7 +886,7 @@ spc_handler_pdfm_outline (struct spc_env *spe, struct spc_arg *args) } skip_white(&args->curptr, args->endptr); - tmp = parse_pdf_object(&args->curptr, args->endptr); + tmp = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!tmp) { spc_warn(spe, "Missing number for outline item depth."); return -1; @@ -915,7 +916,7 @@ spc_handler_pdfm_outline (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE item_dict = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - item_dict = parse_pdf_dict(&args->curptr, args->endptr); + item_dict = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!item_dict) { spc_warn(spe, "Ignoring invalid dictionary."); @@ -955,7 +956,7 @@ spc_handler_pdfm_article (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE info_dict = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - info_dict = parse_pdf_dict(&args->curptr, args->endptr); + info_dict = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!info_dict) { spc_warn(spe, "Ignoring article with invalid info dictionary."); @@ -1032,7 +1033,7 @@ spc_handler_pdfm_bead (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE article_info = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - article_info = parse_pdf_dict(&args->curptr, args->endptr); + article_info = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!article_info) { spc_warn(spe, "Error in reading dictionary."); @@ -1087,7 +1088,7 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) } skip_white(&args->curptr, args->endptr); - fspec = parse_pdf_object(&args->curptr, args->endptr); + fspec = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!fspec) { spc_warn(spe, "Missing filename string for pdf:image."); if (ident) @@ -1131,7 +1132,7 @@ spc_handler_pdfm_dest (struct spc_env *spe, struct spc_arg *args) skip_white(&args->curptr, args->endptr); - name = parse_pdf_object(&args->curptr, args->endptr); + name = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!name) { spc_warn(spe, "PDF string expected for destination name but not found."); return -1; @@ -1141,7 +1142,7 @@ spc_handler_pdfm_dest (struct spc_env *spe, struct spc_arg *args) return -1; } - array = parse_pdf_object(&args->curptr, args->endptr); + array = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!array) { spc_warn(spe, "No destination not specified for pdf:dest."); pdf_release_obj(name); @@ -1171,7 +1172,7 @@ spc_handler_pdfm_names (struct spc_env *spe, struct spc_arg *args) pdf_obj *category, *key, *value, *tmp; int i, size; - category = parse_pdf_object(&args->curptr, args->endptr); + category = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!category) { spc_warn(spe, "PDF name expected but not found."); return -1; @@ -1181,7 +1182,7 @@ spc_handler_pdfm_names (struct spc_env *spe, struct spc_arg *args) return -1; } - tmp = parse_pdf_object(&args->curptr, args->endptr); + tmp = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!tmp) { spc_warn(spe, "PDF object expected but not found."); pdf_release_obj(category); @@ -1216,7 +1217,7 @@ spc_handler_pdfm_names (struct spc_env *spe, struct spc_arg *args) pdf_release_obj(tmp); } else if (PDF_OBJ_STRINGTYPE(tmp)) { key = tmp; - value = parse_pdf_object(&args->curptr, args->endptr); + value = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!value) { pdf_release_obj(category); pdf_release_obj(key); @@ -1255,7 +1256,7 @@ spc_handler_pdfm_docinfo (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE dict = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - dict = parse_pdf_dict(&args->curptr, args->endptr); + dict = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!dict) { spc_warn(spe, "Dictionary object expected but not found."); @@ -1281,7 +1282,7 @@ spc_handler_pdfm_docview (struct spc_env *spe, struct spc_arg *args) #ifdef ENABLE_TOUNICODE dict = my_parse_pdf_dict(&args->curptr, args->endptr, &sd->cd); #else - dict = parse_pdf_dict(&args->curptr, args->endptr); + dict = parse_pdf_dict(&args->curptr, args->endptr, NULL); #endif /* ENABLE_TOUNICODE */ if (!dict) { spc_warn(spe, "Dictionary object expected but not found."); @@ -1332,7 +1333,7 @@ spc_handler_pdfm_object (struct spc_env *spe, struct spc_arg *args) return -1; } - object = parse_pdf_object(&args->curptr, args->endptr); + object = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!object) { spc_warn(spe, "Could not find an object definition for \"%s\".", ident); RELEASE(ident); @@ -1426,7 +1427,7 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) { pdf_obj *fstream; long stream_len, nb_read; - char *ident, *filename, *fullname; + char *ident, *filename; pdf_obj *tmp; FILE *fp; @@ -1440,7 +1441,7 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) skip_white(&args->curptr, args->endptr); - tmp = parse_pdf_object(&args->curptr, args->endptr); + tmp = parse_pdf_object(&args->curptr, args->endptr, NULL); if (!tmp) { spc_warn(spe, "Missing filename string for pdf:fstream."); RELEASE(ident); @@ -1460,32 +1461,17 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) return -1; } - fstream = pdf_new_stream(STREAM_COMPRESS); + fstream = pdf_new_stream(STREAM_COMPRESS); -#ifdef MIKTEX - if (!miktex_find_app_input_file("dvipdfm", filename, work_buffer)) - fullname = NULL; - else { - fullname = work_buffer; - } -#else /* !MIKTEX */ - fullname = kpse_find_file(filename, kpse_program_binary_format, 0); -#endif - pdf_release_obj(tmp); - if (!fullname) { - spc_warn(spe, "Could not find file."); - pdf_release_obj(fstream); - RELEASE(ident); - return -1; - } - - fp = MFOPEN(fullname, FOPEN_RBIN_MODE); + fp = DPXFOPEN(filename, DPX_RES_TYPE_BINARY); if (!fp) { - spc_warn(spe, "Could not open file: %s", fullname); + spc_warn(spe, "Could not open file: %s", filename); pdf_release_obj(fstream); + pdf_release_obj(tmp); RELEASE(ident); return -1; } + pdf_release_obj(tmp); stream_len = 0; while ((nb_read = @@ -1508,7 +1494,7 @@ spc_handler_pdfm_fstream (struct spc_env *spe, struct spc_arg *args) stream_dict = pdf_stream_dict(fstream); - tmp = parse_pdf_dict(&args->curptr, args->endptr); + tmp = parse_pdf_dict(&args->curptr, args->endptr, NULL); if (!tmp) { spc_warn(spe, "Parsing dictionary failed."); pdf_release_obj(fstream); @@ -1624,7 +1610,7 @@ spc_handler_pdfm_eform (struct spc_env *spe, struct spc_arg *args) /* An extra dictionary after exobj must be merged to /Resources. * Please use pdf:put @resources (before pdf:exobj) instead. */ - garbage = parse_pdf_dict(&args->curptr, args->endptr); + garbage = parse_pdf_dict(&args->curptr, args->endptr, NULL); if (garbage) { resource = pdf_doc_current_page_resources(); pdf_merge_dict(resource, garbage); @@ -1778,7 +1764,7 @@ spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap) case '+': mrec = NEW(1, fontmap_rec); pdf_init_fontmap_record(mrec); - error = pdf_read_fontmap_line(mrec, ap->curptr, (long) (ap->endptr - ap->curptr)); + error = pdf_read_fontmap_line(mrec, ap->curptr, (long) (ap->endptr - ap->curptr), is_pdfm_mapline(ap->curptr)); if (error) spc_warn(spe, "Invalid fontmap line."); else { @@ -1790,7 +1776,7 @@ spc_handler_pdfm_mapline (struct spc_env *spe, struct spc_arg *ap) default: mrec = NEW(1, fontmap_rec); pdf_init_fontmap_record(mrec); - error = pdf_read_fontmap_line(mrec, ap->curptr, (long) (ap->endptr - ap->curptr)); + error = pdf_read_fontmap_line(mrec, ap->curptr, (long) (ap->endptr - ap->curptr), is_pdfm_mapline(ap->curptr)); if (error) spc_warn(spe, "Invalid fontmap line."); else { |