diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/extractpdfmark/src |
Initial commit
Diffstat (limited to 'support/extractpdfmark/src')
31 files changed, 5350 insertions, 0 deletions
diff --git a/support/extractpdfmark/src/Makefile.am b/support/extractpdfmark/src/Makefile.am new file mode 100644 index 0000000000..1e37f09a8b --- /dev/null +++ b/support/extractpdfmark/src/Makefile.am @@ -0,0 +1,38 @@ +SUBDIRS = + +bin_PROGRAMS = extractpdfmark +extractpdfmark_SOURCES = main.cc cmdlineparse.hh \ + output-pdfmark.cc output-pdfmark.hh \ + encodename.cc \ + utf16.cc utf16.hh \ + utf8.cc utf8.hh + +extractpdfmark_LDADD = +extractpdfmark_LDFLAGS = +extractpdfmark_DEPENDENCIES = + +if USE_POPPLER_CORE +SUBDIRS += poppler-core +extractpdfmark_LDADD += -lextractpdfmark-poppler-core $(POPPLER_LIBS) +extractpdfmark_LDFLAGS += -L./poppler-core +extractpdfmark_DEPENDENCIES += ./poppler-core/libextractpdfmark-poppler-core.a +endif + +if USE_POPPLER_GLIB +SUBDIRS += poppler-glib +extractpdfmark_LDADD += -lextractpdfmark-poppler-glib $(POPPLER_GLIB_LIBS) +extractpdfmark_LDFLAGS += -L./poppler-glib +extractpdfmark_DEPENDENCIES += ./poppler-glib/libextractpdfmark-poppler-glib.a +endif + +if USE_POPPLER_CPP +SUBDIRS += poppler-cpp +extractpdfmark_LDADD += -lextractpdfmark-poppler-cpp $(POPPLER_CPP_LIBS) +extractpdfmark_LDFLAGS += -L./poppler-cpp +extractpdfmark_DEPENDENCIES += ./poppler-cpp/libextractpdfmark-poppler-cpp.a +endif + +if USE_ICONV +extractpdfmark_SOURCES += iconv_wrapper.hh +extractpdfmark_LDADD += $(LIBICONV) +endif diff --git a/support/extractpdfmark/src/Makefile.in b/support/extractpdfmark/src/Makefile.in new file mode 100644 index 0000000000..76730d24e3 --- /dev/null +++ b/support/extractpdfmark/src/Makefile.in @@ -0,0 +1,764 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = extractpdfmark$(EXEEXT) +@USE_POPPLER_CORE_TRUE@am__append_1 = poppler-core +@USE_POPPLER_CORE_TRUE@am__append_2 = -lextractpdfmark-poppler-core $(POPPLER_LIBS) +@USE_POPPLER_CORE_TRUE@am__append_3 = -L./poppler-core +@USE_POPPLER_CORE_TRUE@am__append_4 = ./poppler-core/libextractpdfmark-poppler-core.a +@USE_POPPLER_GLIB_TRUE@am__append_5 = poppler-glib +@USE_POPPLER_GLIB_TRUE@am__append_6 = -lextractpdfmark-poppler-glib $(POPPLER_GLIB_LIBS) +@USE_POPPLER_GLIB_TRUE@am__append_7 = -L./poppler-glib +@USE_POPPLER_GLIB_TRUE@am__append_8 = ./poppler-glib/libextractpdfmark-poppler-glib.a +@USE_POPPLER_CPP_TRUE@am__append_9 = poppler-cpp +@USE_POPPLER_CPP_TRUE@am__append_10 = -lextractpdfmark-poppler-cpp $(POPPLER_CPP_LIBS) +@USE_POPPLER_CPP_TRUE@am__append_11 = -L./poppler-cpp +@USE_POPPLER_CPP_TRUE@am__append_12 = ./poppler-cpp/libextractpdfmark-poppler-cpp.a +@USE_ICONV_TRUE@am__append_13 = iconv_wrapper.hh +@USE_ICONV_TRUE@am__append_14 = $(LIBICONV) +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am__extractpdfmark_SOURCES_DIST = main.cc cmdlineparse.hh \ + output-pdfmark.cc output-pdfmark.hh encodename.cc utf16.cc \ + utf16.hh utf8.cc utf8.hh iconv_wrapper.hh +am__objects_1 = +am_extractpdfmark_OBJECTS = main.$(OBJEXT) output-pdfmark.$(OBJEXT) \ + encodename.$(OBJEXT) utf16.$(OBJEXT) utf8.$(OBJEXT) \ + $(am__objects_1) +extractpdfmark_OBJECTS = $(am_extractpdfmark_OBJECTS) +am__DEPENDENCIES_1 = +@USE_POPPLER_CORE_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +@USE_POPPLER_GLIB_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) +@USE_POPPLER_CPP_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) +@USE_ICONV_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1) +extractpdfmark_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(extractpdfmark_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(extractpdfmark_SOURCES) +DIST_SOURCES = $(am__extractpdfmark_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = poppler-core poppler-glib poppler-cpp +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIFF = @DIFF@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GHOSTSCRIPT = @GHOSTSCRIPT@ +GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT = @PACKAGE_COPYRIGHT@ +PACKAGE_LICENSE = @PACKAGE_LICENSE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFTEX = @PDFTEX@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_CPP_CFLAGS = @POPPLER_CPP_CFLAGS@ +POPPLER_CPP_LIBS = @POPPLER_CPP_LIBS@ +POPPLER_GLIB_CFLAGS = @POPPLER_GLIB_CFLAGS@ +POPPLER_GLIB_LIBS = @POPPLER_GLIB_LIBS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = $(am__append_1) $(am__append_5) $(am__append_9) +extractpdfmark_SOURCES = main.cc cmdlineparse.hh output-pdfmark.cc \ + output-pdfmark.hh encodename.cc utf16.cc utf16.hh utf8.cc \ + utf8.hh $(am__append_13) +extractpdfmark_LDADD = $(am__append_2) $(am__append_6) \ + $(am__append_10) $(am__append_14) +extractpdfmark_LDFLAGS = $(am__append_3) $(am__append_7) \ + $(am__append_11) +extractpdfmark_DEPENDENCIES = $(am__append_4) $(am__append_8) \ + $(am__append_12) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +extractpdfmark$(EXEEXT): $(extractpdfmark_OBJECTS) $(extractpdfmark_DEPENDENCIES) $(EXTRA_extractpdfmark_DEPENDENCIES) + @rm -f extractpdfmark$(EXEEXT) + $(AM_V_CXXLD)$(extractpdfmark_LINK) $(extractpdfmark_OBJECTS) $(extractpdfmark_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encodename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output-pdfmark.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-binPROGRAMS clean-generic cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/support/extractpdfmark/src/cmdlineparse.hh b/support/extractpdfmark/src/cmdlineparse.hh new file mode 100644 index 0000000000..88641ea889 --- /dev/null +++ b/support/extractpdfmark/src/cmdlineparse.hh @@ -0,0 +1,832 @@ +// +// One header file Commandline Parse for C++11 2017-01-29.01 GPL +// https://github.com/trueroad/cmdlineparse/ +// +// Copyright (C) 2016, 2017 Masamichi Hosoda +// +// One header file Commandline Parse for C++11 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 3 of the License, or +// (at your option) any later version. +// +// One header file Commandline Parse for C++11 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 One header file Commandline Parse for C++11. +// If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDE_GUARD_CMDLINEPARSE_HH +#define INCLUDE_GUARD_CMDLINEPARSE_HH + +#include <vector> +#include <map> +#include <string> +#include <iostream> +#include <sstream> +#include <functional> + +// gettext macros +#ifndef _ + +#define _(DUMMY) DUMMY +#define CMDLINEPARSE_HH_DEFINE_DUMMY_GETTEXT + +#endif + +namespace cmdlineparse +{ + + enum class arg_mode + { + no_argument = 0, + required_argument = 1, + optional_argument = 2 + }; + + enum class abort_reason + { + option_handler = -1, + no_abort = 0, + error_extra_arg, + error_no_arg, + error_ambiguous_option, + error_unknown_option, + error_no_arg_short, + error_unknown_option_short, + }; + + class parser + { + public: + // Add an option handler + bool add_handler (char short_name, const std::string &long_name, + arg_mode has_arg, + std::function<bool(const std::string&)> option_handler, + const std::string &description = "", + const std::string &typestr = "", + const std::string &header = "", + const std::string &group = ""); + + // Add a flag option + bool add_flag (char short_name, const std::string &long_name, + bool *flag, + const std::string &description = "", + const std::string &group = ""); + + // Add a string option + bool add_string (char short_name, const std::string &long_name, + std::string *var, const std::string &defval, + const std::string &description = "", + const std::string &typestr = "STRING", + const std::string &group = ""); + + // Add help description + void add_description (char short_name, const std::string &long_name, + arg_mode has_arg, + const std::string &description, + const std::string &typestr = "", + const std::string &header = "", + const std::string &group = ""); + + // Add default handler + bool add_default_help (void); + bool add_default_version (void); + bool add_default (void) + { + if (!add_default_help ()) + return false; + return add_default_version (); + } + + // Parse options + bool parse (int argc, char const* const* argv, int optind = 1); + + // Build default strings + std::string build_usage (void) const; + std::string build_help (void) const; + + // Get version_string + const std::string &get_version_string () const noexcept + { + return version_string; + } + + // Set version_string + void set_version_string (const std::string &s) + { + version_string = s; + } + + // Get unamed_args + const std::vector<std::string> &get_unamed_args () const noexcept + { + return unamed_args; + } + + // Set usage_unamed_opts + void set_usage_unamed_opts (const std::string &s) + { + usage_unamed_opts = s; + } + + // Get abort reason + abort_reason get_abort_reason () const noexcept + { + return abort; + } + + // Get abort option + const std::string &get_abort_option () const noexcept + { + return abort_option; + } + + // Set opterr + void set_opterr (bool flag) noexcept + { + opterr = flag; + } + + // Set long_only + void set_long_only (bool flag) noexcept + { + long_only = flag; + } + + // Set continue_on_error + void set_continue_on_error (bool flag) noexcept + { + continue_on_error = flag; + } + + // Set abbreviated_long_name + void set_abbreviated_long_name (bool flag) noexcept + { + abbreviated_long_name = flag; + } + + // Constructor + parser (); + + // Const + const std::string h_indent {" "}; + const std::string h_space {" "}; + const std::string d_indent {" "}; + + private: + // Internal functions + void add_short (char short_name, arg_mode has_arg, + std::function<bool(const std::string&)> option_handler); + void add_long (const std::string &long_name, arg_mode has_arg, + std::function<bool(const std::string&)> option_handler); + bool find_unique_long_name (const std::string &long_name, + std::pair<arg_mode, + std::function<bool(const std::string&)>> + *target, + bool *ambiguous); + bool parse_long_name (std::vector<std::string>::const_iterator *it); + bool parse_short_name (std::vector<std::string>::const_iterator *it); + + // Error handlers + std::function<bool(const std::string&, + const std::string&)> error_extra_arg + { + [this](const std::string &long_name, const std::string &)->bool + { + if (opterr) + std::cerr << argvs[0] + << _(": option doesn't take an argument -- ") + << long_name << std::endl; + return continue_on_error; + } + }; + std::function<bool(const std::string&)> error_no_arg + { + [this](const std::string &long_name)->bool + { + if (opterr) + std::cerr << argvs[0] + << _(": option requires an argument -- ") + << long_name << std::endl; + return continue_on_error; + } + }; + std::function<bool(const std::string&)> error_ambiguous_option + { + [this](const std::string &optchars)->bool + { + if (opterr) + std::cerr << argvs[0] + << _(": ambiguous option -- ") + << optchars << std::endl; + return continue_on_error; + } + }; + std::function<bool(const std::string&)> error_unknown_option + { + [this](const std::string &optchars)->bool + { + if (opterr) + std::cerr << argvs[0] + << _(": unknown option -- ") + << optchars << std::endl; + return continue_on_error; + } + }; + std::function<bool(char)> error_no_arg_short + { + [this](char optchar)->bool + { + if (opterr) + std::cerr << argvs[0] + << _(": option requires an argument -- ") + << optchar << std::endl; + return continue_on_error; + } + }; + std::function<bool(char)> error_unknown_option_short + { + [this](char optchar)->bool + { + if (opterr) + std::cerr << argvs[0] + << _(": unknown option -- ") + << optchar << std::endl; + return continue_on_error; + } + }; + + // Help strings + std::string version_string; + std::string usage_unamed_opts; + + // Flags + bool opterr {true}; + bool continue_on_error {false}; + bool long_only {false}; + bool abbreviated_long_name {true}; + + // Abort reason + abort_reason abort {abort_reason::no_abort}; + std::string abort_option; + + // Arguments + std::vector<std::string> argvs; + std::vector<std::string> unamed_args; + + // Maps + std::map<char, + std::pair<arg_mode, + std::function <bool(const std::string&)>>> short_map; + std::map<std::string, + std::pair<arg_mode, + std::function <bool(const std::string&)>>> long_map; + std::map<std::string, std::vector<std::string>> help_map; + }; + + inline + parser::parser () + { +#ifdef PACKAGE_STRING + // Build version_string + std::stringstream ss; + ss << PACKAGE_STRING << std::endl; + +#ifdef PACKAGE_COPYRIGHT + ss << PACKAGE_COPYRIGHT << std::endl; +#ifdef PACKAGE_LICENSE + ss << PACKAGE_LICENSE << std::endl; +#endif // PACKAGE_LICENSE +#endif // PACKAGE_COPYRIGHT + +#ifdef PACKAGE_URL + ss << std::endl << PACKAGE_URL << std::endl; +#endif // PACKAGE_URL + + version_string = ss.str (); +#endif // PACKAGE_STRING + } + + inline void + parser::add_short (char short_name, arg_mode has_arg, + std::function<bool(const std::string&)> option_handler) + { + if (short_name) + { + short_map[short_name] = + std::pair<arg_mode, std::function <bool(const std::string&)>> + (has_arg, option_handler); + } + } + + inline void + parser::add_long (const std::string &long_name, arg_mode has_arg, + std::function<bool(const std::string&)> option_handler) + { + if (!long_name.empty ()) + { + long_map[long_name] = + std::pair<arg_mode, std::function <bool(const std::string&)>> + (has_arg, option_handler); + } + } + + inline void + parser::add_description (char short_name, const std::string &long_name, + arg_mode has_arg, + const std::string &description, + const std::string &typestr, + const std::string &header, + const std::string &group) + { + std::stringstream ss; + + if (short_name || !long_name.empty () || !header.empty ()) + { + ss << h_indent; + if (short_name) + { + ss << "-" << short_name; + if (long_name.empty () && !typestr.empty ()) + ss << typestr; + } + if (!long_name.empty ()) + { + if (short_name) + ss << ", "; + ss << "--" << long_name; + if (!typestr.empty ()) + { + switch (has_arg) + { + case arg_mode::no_argument: + // Nothing to do + break; + case arg_mode::required_argument: + ss << "=" << typestr; + break; + case arg_mode::optional_argument: + ss << "[=" << typestr << "]"; + break; + } + } + } + if (!header.empty ()) + ss << header; + ss << std::endl; + } + + if (!description.empty ()) + ss << description << std::endl; + + help_map[group].push_back (ss.str ()); + } + + inline bool + parser::add_handler (char short_name, const std::string &long_name, + arg_mode has_arg, + std::function<bool(const std::string&)> option_handler, + const std::string &description, + const std::string &typestr, + const std::string &header, + const std::string &group) + { + if (short_name && short_map.find (short_name) != short_map.end ()) + { + // The short name is already registerd. + return false; + } + if (!long_name.empty() && long_map.find (long_name) != long_map.end ()) + { + // The long name is already registerd. + return false; + } + + add_short (short_name, has_arg, option_handler); + add_long (long_name, has_arg, option_handler); + + if (!description.empty () || !typestr.empty ()) + add_description (short_name, long_name, has_arg, + description, typestr, header, group); + + return true; + } + + inline bool + parser::add_flag (char short_name, const std::string &long_name, + bool *flag, + const std::string &description, + const std::string &group) + { + *flag = false; + return add_handler (short_name, long_name, arg_mode::no_argument, + [flag](const std::string &)->bool + { + *flag = true; + return true; + }, + description, "", "", group); + } + + inline bool + parser::add_string (char short_name, const std::string &long_name, + std::string *var, const std::string &defval, + const std::string &description, + const std::string &typestr, + const std::string &group) + { + *var = defval; + std::string header; + + if(!defval.empty ()) + { + // Three spaces for separator (same as h_space) + header = _(" (default=") + defval + ")"; + } + return add_handler (short_name, long_name, arg_mode::required_argument, + [var](const std::string &optarg)->bool + { + *var = optarg; + return true; + }, + description, typestr, header, group); + } + + inline bool + parser::add_default_help (void) + { + return add_handler ('h', "help", arg_mode::no_argument, + [this](const std::string &)->bool + { + std::cout << build_help (); + return false; + }, + // Four spaces for indent (same as d_indent) + _(" Print help and exit")); + } + + inline bool + parser::add_default_version (void) + { + return add_handler ('V', "version", arg_mode::no_argument, + [this](const std::string &)->bool + { + std::cout << version_string; + return false; + }, + // Four spaces for indent (same as d_indent) + _(" Print version and exit")); + } + + inline bool + parser::find_unique_long_name (const std::string &long_name, + std::pair<arg_mode, + std::function<bool(const std::string&)>> + *target, + bool *ambiguous) + { + if (long_map.find (long_name) != long_map.end ()) + { + // Long option name found + *target = long_map[long_name]; + return true; + } + if (abbreviated_long_name) + { + // Search abbreviated long option name + for (decltype (long_map.cbegin()) it = + long_map.upper_bound (long_name); + it != long_map.cend (); + ++it) + { + if (it->first.substr (0, long_name.size ()) == long_name) + { + auto next_it = it; + ++next_it; + if (next_it != long_map.cend () && + next_it->first.substr (0, long_name.size ()) == long_name) + { + // Failed: ambiguous option + *ambiguous = true; + return false; + } + // Unique abbreviated long option name fount + *target = it->second; + return true; + } + } + } + // Failed: unknown long option name + *ambiguous = false; + return false; + } + + inline bool + parser::parse_long_name (std::vector<std::string>::const_iterator *it) + { + size_t optchars_pos = (*it)->at(1) == '-' ? + 2: // Double hyphen (--long_name) style + 1; // Single hyphen (-long_name) style + auto delimiter_pos = (*it)->find ('='); + std::string long_name = (*it)->substr (optchars_pos, + delimiter_pos - optchars_pos); + std::string optarg; + + if (delimiter_pos != std::string::npos) + { + // Option characters have an option argument + // (something like --long_name=optarg) + optarg = (*it)->substr (delimiter_pos + 1, std::string::npos); + } + + std::pair<arg_mode, std::function<bool(const std::string&)>> target; + bool ambiguous; + if (find_unique_long_name (long_name, &target, &ambiguous)) + { + // Long option name found + switch (target.first) + { + case arg_mode::no_argument: + if (delimiter_pos != std::string::npos) + { + if (!error_extra_arg (long_name, optarg)) + { + abort = abort_reason::error_extra_arg; + abort_option = long_name; + return false; + } + return true; + } + break; + case arg_mode::required_argument: + if (delimiter_pos == std::string::npos) + { + if ((*it + 1) != argvs.cend ()) + { + // Next argv-element is an option argument + // (something like --long_name optarg) + optarg = *(++(*it)); + } + else + { + if (!error_no_arg (long_name)) + { + abort = abort_reason::error_no_arg; + abort_option = long_name; + return false; + } + return true; + } + } + break; + case arg_mode::optional_argument: + // Nothing to do + break; + } + // Call option handler + if (!target.second (optarg)) + { + abort = abort_reason::option_handler; + abort_option = long_name; + return false; + } + return true; + } + + // Long option name did not find + if (optchars_pos == 1) + { + // Fallback to short option name + return parse_short_name (it); + } + if (ambiguous) + { + if (!error_ambiguous_option ((*it)->substr (optchars_pos, + std::string::npos))) + { + abort = abort_reason::error_ambiguous_option; + abort_option = long_name; + return false; + } + return true; + } + if (!error_unknown_option ((*it)->substr (optchars_pos, + std::string::npos))) + { + abort = abort_reason::error_unknown_option; + abort_option = long_name; + return false; + } + return true; + } + + inline bool + parser::parse_short_name (std::vector<std::string>::const_iterator *it) + { + for (auto name_it = (*it)->cbegin () + 1; + name_it != (*it)->cend (); + ++name_it) + { + if (short_map.find (*name_it) != short_map.end()) + { + // Short option name found + auto target = short_map[*name_it]; + switch (target.first) + { + case arg_mode::no_argument: + // Option characters doesn't have an option argument + // (something like -o) + if (!target.second ("")) // Call option handler + { + abort = abort_reason::option_handler; + abort_option = *name_it; + return false; + } + break; + case arg_mode::required_argument: + if ((name_it + 1) != (*it)->cend ()) + { + // Option characters have an option argument + // (something like -ooptarg) + std::string optarg (name_it + 1, (*it)->cend ()); + if (!target.second (optarg)) // Call option handler + { + abort = abort_reason::option_handler; + abort_option = *name_it; + return false; + } + return true; + } + else if ((*it + 1) != argvs.cend ()) + { + // Next argv-element is an option argument + // (something like -o optarg) + std::string optarg = *(++(*it)); + if (!target.second (optarg)) // Call option handler + { + abort = abort_reason::option_handler; + abort_option = *name_it; + return false; + } + return true; + } + else + { + if (!error_no_arg_short (*name_it)) + { + abort = abort_reason::error_no_arg_short; + abort_option = *name_it; + return false; + } + } + break; + case arg_mode::optional_argument: + if ((name_it + 1) != (*it)->cend ()) + { + // Option characters have an option argument + // (something like -ooptarg) + std::string optarg (name_it + 1, (*it)->cend ()); + if (!target.second (optarg)) // Call option handler + { + abort = abort_reason::option_handler; + abort_option = *name_it; + return false; + } + return true; + } + // Option characters doesn't have an option argument + // (something like -o) + if (!target.second ("")) // Call option handler + { + abort = abort_reason::option_handler; + abort_option = *name_it; + return false; + } + break; + } + } + else + { + if (!error_unknown_option_short (*name_it)) + { + abort = abort_reason::error_unknown_option_short; + abort_option = *name_it; + return false; + } + } + } + return true; + } + + inline bool + parser::parse (int argc, char const* const* argv, int optind) + { + argvs.assign (argv, argv + argc); + + if (version_string.empty ()) + version_string = argvs[0] + "\n"; + + bool all_skip = false; + + for (auto argv_it = argvs.cbegin () + optind; + argv_it != argvs.cend (); + ++argv_it) + { + // Check skip + if (all_skip) + { + unamed_args.push_back (*argv_it); + continue; + } + + // Check "--" and "-" + // They are not option element. + if (*argv_it == "--") + { + all_skip = true; + continue; + } + else if (*argv_it == "-") + { + unamed_args.push_back (*argv_it); + continue; + } + + // Check option element + if (argv_it->substr (0, 2) == "--") + { + // Long option + if (!parse_long_name (&argv_it)) + return false; + } + else if (argv_it->substr (0, 1) == "-") + { + if (long_only) + { + // Long option + if (!parse_long_name (&argv_it)) + return false; + } + else + { + // Short option + if (!parse_short_name (&argv_it)) + return false; + } + } + else + { + // It is not an option element. + unamed_args.push_back (*argv_it); + } + } + return true; + } + + inline std::string + parser::build_usage (void) const + { + std::stringstream ss; + + ss << _("Usage: ") << argvs[0] << _(" [options] "); + if (!usage_unamed_opts.empty ()) + ss << "[" << usage_unamed_opts << "] "; + ss << "..." << std::endl; + + return ss.str (); + } + + inline std::string + parser::build_help (void) const + { + std::stringstream ss; + + ss << version_string << std::endl << build_usage () << std::endl; + + for (const auto &group: help_map) + { + if (!group.first.empty ()) + ss << std::endl << group.first << ":" << std::endl; + for (const auto &description: group.second) + { + ss << description; + } + } + + return ss.str (); + } + +} + +#if defined (_) && defined (CMDLINEPARSE_HH_DEFINE_DUMMY_GETTEXT) +#undef _ +#undef CMDLINEPARSE_HH_DEFINE_DUMMY_GETTEXT +#endif + +#endif diff --git a/support/extractpdfmark/src/encodename.cc b/support/extractpdfmark/src/encodename.cc new file mode 100644 index 0000000000..d29afd6e32 --- /dev/null +++ b/support/extractpdfmark/src/encodename.cc @@ -0,0 +1,99 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "output-pdfmark.hh" + +#include <iomanip> +#include <sstream> +#include <string> + +#include "utf16.hh" +#include "utf8.hh" + +std::string output_pdfmark::encode_literal (const std::string &name) const +{ + bool bflag = escape || is_utf16 (name) || !is_utf8 (name); + std::stringstream encoded; + + for (auto c: name) + { + if (bflag || static_cast<unsigned char>(c) < 0x20 || + c == '(' || c == ')' || c == '\\' || c == 0x7f) + { + encoded + << '\\' + << std::oct << std::setw (3) << std::setfill ('0') + << static_cast<int>(static_cast<unsigned char>(c)); + } + else + { + encoded << c; + } + } + return encoded.str (); +} + +std::string output_pdfmark::encode_hexadecimal (const std::string &name) const +{ + std::stringstream encoded; + + encoded << std::hex << std::setw (2) << std::setfill ('0'); + for (auto c: name) + { + encoded << static_cast<int>(static_cast<unsigned char>(c)); + } + + return encoded.str (); +} + +std::string output_pdfmark::encode_nameobject (const std::string &name) const +{ + std::stringstream encoded; + + for (auto c: name) + { + if (escape || + static_cast<unsigned char>(c) < 0x21 || + static_cast<unsigned char>(c) > 0x7e || + c == '(' || c == ')' || c == '<' || c == '>' || + c == '[' || c == ']' || c == '{' || c == '}' || + c == '/' || c == '%' || c == '#') + { + encoded + << '#' + << std::hex << std::uppercase + << std::setw (2) << std::setfill ('0') + << static_cast<int>(static_cast<unsigned char>(c)); + } + else + { + encoded << c; + } + } + return encoded.str (); +} + +std::string output_pdfmark::encode_name (const std::string &name) const +{ + if (hexadecimal) + return "<" + encode_hexadecimal (name) + ">"; + if (nameobject) + return "/" + encode_nameobject (name); + return "(" + encode_literal (name) + ")"; +} diff --git a/support/extractpdfmark/src/iconv_wrapper.hh b/support/extractpdfmark/src/iconv_wrapper.hh new file mode 100644 index 0000000000..6517a4e1d3 --- /dev/null +++ b/support/extractpdfmark/src/iconv_wrapper.hh @@ -0,0 +1,212 @@ +// +// One header file iconv wrapper for C++11 2016-10-19.22 GPL +// https://github.com/trueroad/iconv_wrapper/ +// +// Copyright (C) 2016 Masamichi Hosoda. All rights reserved. +// +// One header file iconv wrapper for C++11 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 3 of the License, or +// (at your option) any later version. +// +// One header file iconv wrapper for C++11 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 One header file Commandline Parse for C++11. +// If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDE_GUARD_ICONV_WRAPPER_H +#define INCLUDE_GUARD_ICONV_WRAPPER_H + +#include <iconv.h> +#include <string> +#include <system_error> + +namespace iconv_wrapper +{ + class iconv + { + public: + // Open + void open (const std::string &fromcode, const std::string &tocode); + + // Close + void close () noexcept; + + // Convert + std::string convert (const std::string &in); + + // Convert (with getting the incomplete input / output + // when an exception occurs) + std::string &convert (const std::string &in, + std::string::size_type *pinpos, + std::string *pout); + + // Get initial sequence + std::string get_initial_sequence (void); + + // Get initial sequence + std::string &get_initial_sequence (std::string *pout); + + // Reset conversion state + void reset (void) const noexcept; + + // Constructor / destructor + iconv () = default; + + iconv (const std::string &fromcode, const std::string &tocode) + { + open (fromcode, tocode); + } + + ~iconv () noexcept + { + close (); + } + + // Enable move + iconv (iconv &&) = default; + iconv& operator = (iconv &&) = default; + + private: + // Internal class + // There is two different implements for the second argument of iconv (). + // `const char**' and `char **' + // This class is for automatic type cast switching. + class iconv_const_cast + { + public: + iconv_const_cast (const char **in) noexcept: + t (in) + { + } + operator char** () const noexcept + { + return const_cast<char**>(t); + } + operator const char ** () const noexcept + { + return t; + } + private: + const char ** t; + }; + + // Internal function + void do_iconv (std::string *pout, const char *inbuf, size_t *pinleft, + std::string::size_type *pinpos = nullptr); + + // Disable copy + // Since iconv_t cannot duplicate. + iconv (iconv const &) = delete; + iconv& operator = (iconv const &) = delete; + + // Const + // Here is C cast instead of C++ cast. + // C++ reinterpret_cast (pointer) and static_cast (integer) cannot be used. + // Since it depends on the implementation of iconv_t. + const iconv_t invalid_cd = (iconv_t)-1; + + // Conversion descriptor + iconv_t convdesc = invalid_cd; + }; + + inline void iconv::open (const std::string &fromcode, + const std::string &tocode) + { + if (convdesc == invalid_cd) + { + close (); + } + convdesc = iconv_open (tocode.c_str (), fromcode.c_str ()); + if (convdesc == invalid_cd) + { + throw std::system_error (errno, std::system_category ()); + } + } + + inline void iconv::close () noexcept + { + if (convdesc != invalid_cd) + { + iconv_close (convdesc); + convdesc = invalid_cd; + } + } + + inline std::string iconv::convert (const std::string &in) + { + std::string out (in.size (), '\0'); + convert (in, nullptr, &out); + return out; + } + + inline std::string &iconv::convert (const std::string &in, + std::string::size_type *pinpos, + std::string *pout) + { + size_t inleft {in.size ()}; + do_iconv (pout, &in.at (0), &inleft, pinpos); + return *pout; + } + + inline std::string iconv::get_initial_sequence (void) + { + std::string out (1, '\0'); + get_initial_sequence (&out); + return out; + } + + inline std::string &iconv::get_initial_sequence (std::string *pout) + { + do_iconv (pout, nullptr, nullptr); + return *pout; + } + + inline void iconv::reset (void) const noexcept + { + ::iconv (convdesc, nullptr, nullptr, nullptr, nullptr); + } + + inline void iconv::do_iconv (std::string *pout, + const char *inbuf, size_t *pinleft, + std::string::size_type *pinpos) + { + if (pout->empty ()) + { + pout->resize (1); + } + const char *inbuf_tmp {inbuf}; + char *outbuf {&pout->at (0)}; + size_t outleft {pout->size ()}; + size_t s; + + while ((s = ::iconv (convdesc, + iconv_const_cast(&inbuf_tmp), pinleft, + &outbuf, &outleft)) == static_cast<size_t>(-1)) + { + if (errno != E2BIG) + { + if (pinpos && inbuf) + { + *pinpos = (inbuf_tmp - inbuf); + } + pout->resize (outbuf - &pout->at (0)); + throw std::system_error (errno, std::system_category ()); + } + std::string::size_type pos = (outbuf - &pout->at (0)); + pout->resize (pout->size () * 2); + outbuf = &pout->at (pos); + outleft = pout->size () - pos; + } + pout->resize (outbuf - &pout->at (0)); + } +} + +#endif // INCLUDE_GUARD_ICONV_WRAPPER_H diff --git a/support/extractpdfmark/src/main.cc b/support/extractpdfmark/src/main.cc new file mode 100644 index 0000000000..97f1eaec60 --- /dev/null +++ b/support/extractpdfmark/src/main.cc @@ -0,0 +1,86 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include <fstream> +#include <iostream> +#include <memory> +#include <string> + +#include "cmdlineparse.hh" +#include "output-pdfmark.hh" + +int main (int argc, char *argv[]) +{ + cmdlineparse::parser cmd; + std::unique_ptr<output_pdfmark> opdfmark {create_output_pdfmark ()}; + std::string output_filename; + + cmd.add_default_help (); + cmd.add_handler ('V', "version", + cmdlineparse::arg_mode::no_argument, + [&cmd, &opdfmark](const std::string &)->bool + { + std::cout << cmd.get_version_string () + << std::endl + << opdfmark->version (); + return false; + }, + " Print version and exit"); + cmd.add_string ('o', "output", &output_filename, "", + " Output filename\n" + " (Default: standard output)", + "OUTPUT.ps"); + opdfmark->add_options (&cmd); + + cmd.set_usage_unamed_opts ("INPUT.pdf"); + + if (!cmd.parse (argc, argv)) + return 0; + + if (cmd.get_unamed_args ().empty ()) + { + std::cerr << cmd.get_version_string () << std::endl + << cmd.build_usage () << std::endl; + return 1; + } + + std::ostream *pout; + std::ofstream ofs; + if (output_filename.empty () || output_filename == "-") + { + pout = &std::cout; + } + else + { + ofs.open (output_filename); + pout = &ofs; + } + + *pout << "% " << PACKAGE_STRING << std::endl + << "% " << PACKAGE_URL << std::endl << std::endl; + + if (!opdfmark->open (cmd.get_unamed_args ().at (0))) + return 1; + + opdfmark->parse_options (); + + *pout << opdfmark->pagemode (); + *pout << opdfmark->destname (); + return 0; +} diff --git a/support/extractpdfmark/src/output-pdfmark.cc b/support/extractpdfmark/src/output-pdfmark.cc new file mode 100644 index 0000000000..cc5bd5aaab --- /dev/null +++ b/support/extractpdfmark/src/output-pdfmark.cc @@ -0,0 +1,67 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016-2018 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "output-pdfmark.hh" + +#include <iostream> +#include <string> + +#include "cmdlineparse.hh" + +void output_pdfmark::add_options (cmdlineparse::parser *cmd) +{ + cmd->add_string (0, "style", &style, "literal", + " Name style\n" + " literal: literal strings" +#ifdef USE_CODECVT + " (UTF-8 validation by codecvt)\n" +#else +#ifdef USE_ICONV + " (UTF-8 validation by iconv)\n" +#else // USE_ICONV + " (no UTF-8 validation)\n" +#endif // USE_ICONV +#endif // USE_CODECVT + " hex: hexadecimal strings\n" + " name: name object", + "STYLE"); + cmd->add_flag (0, "escape", &escape, + " Escape all characters"); +} + +void output_pdfmark::parse_options (void) +{ + if (style == "literal") + { + hexadecimal = false; + nameobject = false; + } + else if (style == "hex") + { + hexadecimal = true; + nameobject = false; + } + else if (style == "name") + { + hexadecimal = false; + nameobject = true; + } + else + std::cerr << "unknown --style argument: " << style << std::endl; +} diff --git a/support/extractpdfmark/src/output-pdfmark.hh b/support/extractpdfmark/src/output-pdfmark.hh new file mode 100644 index 0000000000..2194eb9373 --- /dev/null +++ b/support/extractpdfmark/src/output-pdfmark.hh @@ -0,0 +1,62 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_OUTPUT_PDFMARK_HH +#define INCLUDE_GUARD_OUTPUT_PDFMARK_HH + +#include <memory> +#include <string> + +namespace cmdlineparse +{ + class parser; +} + +class output_pdfmark +{ +public: + virtual bool open (const std::string &pdf_filename) = 0; + virtual std::string pagemode (void) = 0; + virtual std::string destname (void) = 0; + virtual std::string version (void) = 0; + + void add_options (cmdlineparse::parser *cmd); + void parse_options (void); + + std::string encode_literal (const std::string &name) const; + std::string encode_hexadecimal (const std::string &name) const; + std::string encode_nameobject (const std::string &name) const; + std::string encode_name (const std::string &name) const; + + output_pdfmark () = default; + virtual ~output_pdfmark () = default; + +private: + output_pdfmark (output_pdfmark const&) = delete; + output_pdfmark (output_pdfmark&&) = delete; + output_pdfmark& operator = (output_pdfmark const&) = delete; + output_pdfmark& operator = (output_pdfmark&&) = delete; + + std::string style; + bool escape = false; + bool hexadecimal = false; + bool nameobject = false; +}; + +std::unique_ptr<output_pdfmark> create_output_pdfmark (void); + +#endif // INCLUDE_GUARD_OUTPUT_PDFMARK_HH diff --git a/support/extractpdfmark/src/poppler-core/Makefile.am b/support/extractpdfmark/src/poppler-core/Makefile.am new file mode 100644 index 0000000000..2f0eec1ebc --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/Makefile.am @@ -0,0 +1,5 @@ +noinst_LIBRARIES = libextractpdfmark-poppler-core.a +libextractpdfmark_poppler_core_a_SOURCES = poppler-core.cc poppler-core.hh \ + pagemode.cc destname.cc destname-private.hh +libextractpdfmark_poppler_core_a_CPPFLAGS = -I$(srcdir)/.. \ + $(POPPLER_CFLAGS) diff --git a/support/extractpdfmark/src/poppler-core/Makefile.in b/support/extractpdfmark/src/poppler-core/Makefile.in new file mode 100644 index 0000000000..8136ebafe0 --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/Makefile.in @@ -0,0 +1,631 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/poppler-core +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libextractpdfmark_poppler_core_a_AR = $(AR) $(ARFLAGS) +libextractpdfmark_poppler_core_a_LIBADD = +am_libextractpdfmark_poppler_core_a_OBJECTS = \ + libextractpdfmark_poppler_core_a-poppler-core.$(OBJEXT) \ + libextractpdfmark_poppler_core_a-pagemode.$(OBJEXT) \ + libextractpdfmark_poppler_core_a-destname.$(OBJEXT) +libextractpdfmark_poppler_core_a_OBJECTS = \ + $(am_libextractpdfmark_poppler_core_a_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libextractpdfmark_poppler_core_a_SOURCES) +DIST_SOURCES = $(libextractpdfmark_poppler_core_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIFF = @DIFF@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GHOSTSCRIPT = @GHOSTSCRIPT@ +GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT = @PACKAGE_COPYRIGHT@ +PACKAGE_LICENSE = @PACKAGE_LICENSE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFTEX = @PDFTEX@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_CPP_CFLAGS = @POPPLER_CPP_CFLAGS@ +POPPLER_CPP_LIBS = @POPPLER_CPP_LIBS@ +POPPLER_GLIB_CFLAGS = @POPPLER_GLIB_CFLAGS@ +POPPLER_GLIB_LIBS = @POPPLER_GLIB_LIBS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libextractpdfmark-poppler-core.a +libextractpdfmark_poppler_core_a_SOURCES = poppler-core.cc poppler-core.hh \ + pagemode.cc destname.cc destname-private.hh + +libextractpdfmark_poppler_core_a_CPPFLAGS = -I$(srcdir)/.. \ + $(POPPLER_CFLAGS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/poppler-core/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/poppler-core/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libextractpdfmark-poppler-core.a: $(libextractpdfmark_poppler_core_a_OBJECTS) $(libextractpdfmark_poppler_core_a_DEPENDENCIES) $(EXTRA_libextractpdfmark_poppler_core_a_DEPENDENCIES) + $(AM_V_at)-rm -f libextractpdfmark-poppler-core.a + $(AM_V_AR)$(libextractpdfmark_poppler_core_a_AR) libextractpdfmark-poppler-core.a $(libextractpdfmark_poppler_core_a_OBJECTS) $(libextractpdfmark_poppler_core_a_LIBADD) + $(AM_V_at)$(RANLIB) libextractpdfmark-poppler-core.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +libextractpdfmark_poppler_core_a-poppler-core.o: poppler-core.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_core_a-poppler-core.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Tpo -c -o libextractpdfmark_poppler_core_a-poppler-core.o `test -f 'poppler-core.cc' || echo '$(srcdir)/'`poppler-core.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Tpo $(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='poppler-core.cc' object='libextractpdfmark_poppler_core_a-poppler-core.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_core_a-poppler-core.o `test -f 'poppler-core.cc' || echo '$(srcdir)/'`poppler-core.cc + +libextractpdfmark_poppler_core_a-poppler-core.obj: poppler-core.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_core_a-poppler-core.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Tpo -c -o libextractpdfmark_poppler_core_a-poppler-core.obj `if test -f 'poppler-core.cc'; then $(CYGPATH_W) 'poppler-core.cc'; else $(CYGPATH_W) '$(srcdir)/poppler-core.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Tpo $(DEPDIR)/libextractpdfmark_poppler_core_a-poppler-core.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='poppler-core.cc' object='libextractpdfmark_poppler_core_a-poppler-core.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_core_a-poppler-core.obj `if test -f 'poppler-core.cc'; then $(CYGPATH_W) 'poppler-core.cc'; else $(CYGPATH_W) '$(srcdir)/poppler-core.cc'; fi` + +libextractpdfmark_poppler_core_a-pagemode.o: pagemode.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_core_a-pagemode.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Tpo -c -o libextractpdfmark_poppler_core_a-pagemode.o `test -f 'pagemode.cc' || echo '$(srcdir)/'`pagemode.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Tpo $(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pagemode.cc' object='libextractpdfmark_poppler_core_a-pagemode.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_core_a-pagemode.o `test -f 'pagemode.cc' || echo '$(srcdir)/'`pagemode.cc + +libextractpdfmark_poppler_core_a-pagemode.obj: pagemode.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_core_a-pagemode.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Tpo -c -o libextractpdfmark_poppler_core_a-pagemode.obj `if test -f 'pagemode.cc'; then $(CYGPATH_W) 'pagemode.cc'; else $(CYGPATH_W) '$(srcdir)/pagemode.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Tpo $(DEPDIR)/libextractpdfmark_poppler_core_a-pagemode.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pagemode.cc' object='libextractpdfmark_poppler_core_a-pagemode.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_core_a-pagemode.obj `if test -f 'pagemode.cc'; then $(CYGPATH_W) 'pagemode.cc'; else $(CYGPATH_W) '$(srcdir)/pagemode.cc'; fi` + +libextractpdfmark_poppler_core_a-destname.o: destname.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_core_a-destname.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Tpo -c -o libextractpdfmark_poppler_core_a-destname.o `test -f 'destname.cc' || echo '$(srcdir)/'`destname.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Tpo $(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='destname.cc' object='libextractpdfmark_poppler_core_a-destname.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_core_a-destname.o `test -f 'destname.cc' || echo '$(srcdir)/'`destname.cc + +libextractpdfmark_poppler_core_a-destname.obj: destname.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_core_a-destname.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Tpo -c -o libextractpdfmark_poppler_core_a-destname.obj `if test -f 'destname.cc'; then $(CYGPATH_W) 'destname.cc'; else $(CYGPATH_W) '$(srcdir)/destname.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Tpo $(DEPDIR)/libextractpdfmark_poppler_core_a-destname.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='destname.cc' object='libextractpdfmark_poppler_core_a-destname.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_core_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_core_a-destname.obj `if test -f 'destname.cc'; then $(CYGPATH_W) 'destname.cc'; else $(CYGPATH_W) '$(srcdir)/destname.cc'; fi` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/support/extractpdfmark/src/poppler-core/destname-private.hh b/support/extractpdfmark/src/poppler-core/destname-private.hh new file mode 100644 index 0000000000..cec376a52a --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/destname-private.hh @@ -0,0 +1,69 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_DESTNAME_PRIVATE_HH +#define INCLUDE_GUARD_DESTNAME_PRIVATE_HH + +#include <Catalog.h> + +// +// *** FIX ME, UGLY *** +// +// poppler does not have destination name enumeration. +// So forced to use a private member function. +// +// http://bloglitb.blogspot.jp/2010/07/access-to-private-members-thats-easy.html +// https://gist.github.com/dabrahams/1528856 +// + +template <class Tag> +struct Accessor +{ + static typename Tag::type value; +}; + +template <class Tag> +typename Tag::type Accessor<Tag>::value; + +template <class Tag, typename Tag::type p> +struct Initializer +{ + Initializer() + { + Accessor<Tag>::value = p; + } + static Initializer instance; +}; + +template <class Tag, typename Tag::type p> +Initializer<Tag, p> Initializer<Tag, p>::instance; + +struct Catalog_getDestNameTree { typedef NameTree* (Catalog::* type)(); }; + +template struct Initializer<Catalog_getDestNameTree, + &Catalog::getDestNameTree>; + +inline NameTree *get_destnametree (Catalog *catalog) +{ + return (catalog->*Accessor<Catalog_getDestNameTree>::value)(); +} + +// +// *** FIXME, UGLY *** +// + +#endif // INCLUDE_GUARD_DESTNAME_PRIVATE_HH diff --git a/support/extractpdfmark/src/poppler-core/destname.cc b/support/extractpdfmark/src/poppler-core/destname.cc new file mode 100644 index 0000000000..33e05e2af0 --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/destname.cc @@ -0,0 +1,244 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2018 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-core.hh" + +#include <iostream> +#include <map> +#include <sstream> +#include <string> +#include <Link.h> +#include <PDFDoc.h> + +#ifndef HAVE_POPPLER_CORE_IF +#include "destname-private.hh" +#endif + +inline std::string goo_to_string (GooString *goo) +{ + return std::string { +#ifdef HAS_GOOSTRING_C_STR + goo->c_str (), +#else + goo->getCString (), +#endif + static_cast<std::string::size_type>(goo->getLength ())}; +} + +inline void poppler_core::add_destname (GooString *name, + LinkDest *link_dest) +{ + std::string str = goo_to_string (name); + add_destname (str, link_dest); +} + +inline void poppler_core::add_destname (GooString *name) +{ + std::string str = goo_to_string (name); + std::unique_ptr<LinkDest> link_dest {doc->findDest (name)}; + add_destname (str, link_dest.get ()); +} + +inline void poppler_core::add_destname (const char *name) +{ + GooString goo {name}; + std::unique_ptr<LinkDest> link_dest {doc->findDest (&goo)}; + add_destname (name, link_dest.get ()); +} + +inline void poppler_core::add_destname (const std::string &name, + LinkDest *link_dest) +{ + if (link_dest) + { + name_map.insert (std::make_pair (name, *link_dest)); + } +} + +std::string poppler_core::build_destname (const std::string &name, + LinkDest *link_dest) +{ + std::stringstream ss; + + if (link_dest) + { + int pagenum; + if (link_dest->isPageRef ()) + { + Ref page_ref = link_dest->getPageRef (); + pagenum = doc->findPage (page_ref.num, page_ref.gen); + } + else + { + pagenum = link_dest->getPageNum (); + } + + switch (link_dest->getKind ()) + { + case destXYZ: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/XYZ " << link_dest->getLeft () + << " " << link_dest->getTop () + << " " << link_dest->getZoom () + << "] /DEST pdfmark" << std::endl; + break; + case destFit: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/Fit] /DEST pdfmark" << std::endl; + break; + case destFitH: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/FitH " << link_dest->getTop () + << "] /DEST pdfmark" << std::endl; + break; + case destFitV: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/FitV " << link_dest->getLeft () + << "] /DEST pdfmark" << std::endl; + break; + case destFitR: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/FitR " << link_dest->getLeft () + << " " << link_dest->getBottom () + << " " << link_dest->getRight () + << " " << link_dest->getTop () + << "] /DEST pdfmark" << std::endl; + break; + case destFitB: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/FitB] /DEST pdfmark" << std::endl; + break; + case destFitBH: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/FitBH " << link_dest->getTop () + << "] /DEST pdfmark" << std::endl; + break; + case destFitBV: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << pagenum + << " /View [/FitBV " << link_dest->getLeft () + << "] /DEST pdfmark" << std::endl; + break; + default: + ss << "% link_dest kind is unknown." << std::endl; + break; + } + } + else + { + ss << "% link_dest is null." << std::endl; + } + + return ss.str (); +} + +std::string poppler_core::build_destnames (void) +{ + std::string str; + + for (auto &elm: name_map) + { + str += build_destname (elm.first, &elm.second); + } + + return str; +} + +#ifdef HAVE_POPPLER_CORE_IF + +// Use poppler-core interface +std::string poppler_core::destname (void) +{ + Catalog *catalog = doc->getCatalog (); + name_map.clear (); + + if (catalog && catalog->isOk ()) + { + int len = catalog->numDestNameTree (); + for (int i=0; i<len; ++i) + { + add_destname (catalog->getDestNameTreeName (i), + catalog->getDestNameTreeDest (i)); + } + + len = catalog->numDests (); + for (int i=0; i<len; ++i) + { + add_destname (catalog->getDestsName (i), + catalog->getDestsDest (i)); + } + } + else + std::cerr << "Catalog is not OK" << std::endl; + + return build_destnames (); +} + +#else // HAVE_POPPLER_CORE_IF + +// Use poppler-core private access +std::string poppler_core::destname (void) +{ + Catalog *catalog = doc->getCatalog (); + name_map.clear (); + + if (catalog && catalog->isOk ()) + { + NameTree *destnametree = get_destnametree (catalog); + if (destnametree) + { + int len = destnametree->numEntries (); + for (int i=0; i<len; ++i) + { + add_destname (destnametree->getName (i)); + } + } + + Object *obj = catalog->getDests (); + if (obj && obj->isDict ()) + { + int len = obj->dictGetLength (); + for (int i=0; i<len; ++i) + { + add_destname (obj->dictGetKey (i)); + } + } + } + else + std::cerr << "Catalog is not OK" << std::endl; + + return build_destnames (); +} + +#endif // HAVE_POPPLER_CORE_IF diff --git a/support/extractpdfmark/src/poppler-core/pagemode.cc b/support/extractpdfmark/src/poppler-core/pagemode.cc new file mode 100644 index 0000000000..d835487839 --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/pagemode.cc @@ -0,0 +1,59 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-core.hh" + +#include <sstream> +#include <PDFDoc.h> + +std::string poppler_core::pagemode (void) +{ + std::stringstream ss; + Catalog *catalog = doc->getCatalog (); + + if (catalog && catalog->isOk ()) + { + switch (catalog->getPageMode ()) + { + case Catalog::pageModeOutlines: + ss << "[ /PageMode /UseOutlines /DOCVIEW pdfmark" << std::endl; + break; + case Catalog::pageModeThumbs: + ss << "[ /PageMode /UseThumbs /DOCVIEW pdfmark" << std::endl; + break; + case Catalog::pageModeFullScreen: + ss << "[ /PageMode /FullScreen /DOCVIEW pdfmark" << std::endl; + break; + case Catalog::pageModeOC: + ss << "% pageModeOC" << std::endl; + break; + case Catalog::pageModeAttach: + ss << "% pageModeAttach" << std::endl; + break; + case Catalog::pageModeNone: + default: + ss << "[ /PageMode /UseNone /DOCVIEW pdfmark" << std::endl; + break; + } + } + else + ss << "% PageMode unset" << std::endl; + + return ss.str (); +} diff --git a/support/extractpdfmark/src/poppler-core/poppler-core.cc b/support/extractpdfmark/src/poppler-core/poppler-core.cc new file mode 100644 index 0000000000..8e77aac17b --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/poppler-core.cc @@ -0,0 +1,74 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-core.hh" + +#include <iostream> +#include <memory> +#include <PDFDoc.h> +#include <PDFDocFactory.h> + +std::unique_ptr<output_pdfmark> create_output_pdfmark (void) +{ + return std::unique_ptr<output_pdfmark> (new poppler_core ()); +} + +bool poppler_core::open (const std::string &pdf_filename) +{ + std::unique_ptr<GooString> fileName + {new GooString {pdf_filename.c_str (), + static_cast<int> (pdf_filename.length ())}}; + doc = std::unique_ptr<PDFDoc> + {PDFDocFactory ().createPDFDoc (*fileName, NULL, NULL)}; + + if (!doc) + { + std::cerr << "open failed." << std::endl; + return false; + } + if (!doc->isOk ()) + { + std::cerr << "file is not OK." << std::endl; + return false; + } + + return true; +} + +std::string poppler_core::version (void) +{ + std::string retval; + + retval = "Compiled with poppler-core"; +#ifndef HAVE_POPPLER_CORE_IF + retval += " private"; +#endif +#ifdef POPPLER_CORE_IF_VERSION + retval += " "; + retval += POPPLER_CORE_IF_VERSION; +#else +#ifdef POPPLER_VERSION + retval += " "; + retval += POPPLER_VERSION; +#endif +#endif + retval += ".\n"; + + return retval; +} diff --git a/support/extractpdfmark/src/poppler-core/poppler-core.hh b/support/extractpdfmark/src/poppler-core/poppler-core.hh new file mode 100644 index 0000000000..303210cf28 --- /dev/null +++ b/support/extractpdfmark/src/poppler-core/poppler-core.hh @@ -0,0 +1,50 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_POPPLER_CORE_HH +#define INCLUDE_GUARD_POPPLER_CORE_HH + +#include <map> +#include <memory> +#include <string> +#include <Link.h> + +#include "output-pdfmark.hh" + +class PDFDoc; + +class poppler_core : public output_pdfmark +{ +public: + bool open (const std::string &pdf_filename); + std::string pagemode (void); + std::string destname (void); + std::string version (void); + +private: + std::string build_destname (const std::string &name, LinkDest *link_dest); + std::string build_destnames (void); + void add_destname (const std::string &name, LinkDest *link_dest); + void add_destname (GooString *name, LinkDest *link_dest); + void add_destname (GooString *name); + void add_destname (const char *name); + + std::unique_ptr<PDFDoc> doc; + std::map<std::string, LinkDest> name_map; +}; + +#endif // INCLUDE_GUARD_POPPLER_CORE_HH diff --git a/support/extractpdfmark/src/poppler-cpp/Makefile.am b/support/extractpdfmark/src/poppler-cpp/Makefile.am new file mode 100644 index 0000000000..2dab7bbaef --- /dev/null +++ b/support/extractpdfmark/src/poppler-cpp/Makefile.am @@ -0,0 +1,5 @@ +noinst_LIBRARIES = libextractpdfmark-poppler-cpp.a +libextractpdfmark_poppler_cpp_a_SOURCES = poppler-cpp.cc poppler-cpp.hh \ + pagemode-cpp.cc destname-cpp.cc +libextractpdfmark_poppler_cpp_a_CPPFLAGS = -I$(srcdir)/.. \ + $(POPPLER_CPP_CFLAGS) diff --git a/support/extractpdfmark/src/poppler-cpp/Makefile.in b/support/extractpdfmark/src/poppler-cpp/Makefile.in new file mode 100644 index 0000000000..dfac0a6555 --- /dev/null +++ b/support/extractpdfmark/src/poppler-cpp/Makefile.in @@ -0,0 +1,631 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/poppler-cpp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libextractpdfmark_poppler_cpp_a_AR = $(AR) $(ARFLAGS) +libextractpdfmark_poppler_cpp_a_LIBADD = +am_libextractpdfmark_poppler_cpp_a_OBJECTS = \ + libextractpdfmark_poppler_cpp_a-poppler-cpp.$(OBJEXT) \ + libextractpdfmark_poppler_cpp_a-pagemode-cpp.$(OBJEXT) \ + libextractpdfmark_poppler_cpp_a-destname-cpp.$(OBJEXT) +libextractpdfmark_poppler_cpp_a_OBJECTS = \ + $(am_libextractpdfmark_poppler_cpp_a_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libextractpdfmark_poppler_cpp_a_SOURCES) +DIST_SOURCES = $(libextractpdfmark_poppler_cpp_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIFF = @DIFF@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GHOSTSCRIPT = @GHOSTSCRIPT@ +GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT = @PACKAGE_COPYRIGHT@ +PACKAGE_LICENSE = @PACKAGE_LICENSE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFTEX = @PDFTEX@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_CPP_CFLAGS = @POPPLER_CPP_CFLAGS@ +POPPLER_CPP_LIBS = @POPPLER_CPP_LIBS@ +POPPLER_GLIB_CFLAGS = @POPPLER_GLIB_CFLAGS@ +POPPLER_GLIB_LIBS = @POPPLER_GLIB_LIBS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libextractpdfmark-poppler-cpp.a +libextractpdfmark_poppler_cpp_a_SOURCES = poppler-cpp.cc poppler-cpp.hh \ + pagemode-cpp.cc destname-cpp.cc + +libextractpdfmark_poppler_cpp_a_CPPFLAGS = -I$(srcdir)/.. \ + $(POPPLER_CPP_CFLAGS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/poppler-cpp/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/poppler-cpp/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libextractpdfmark-poppler-cpp.a: $(libextractpdfmark_poppler_cpp_a_OBJECTS) $(libextractpdfmark_poppler_cpp_a_DEPENDENCIES) $(EXTRA_libextractpdfmark_poppler_cpp_a_DEPENDENCIES) + $(AM_V_at)-rm -f libextractpdfmark-poppler-cpp.a + $(AM_V_AR)$(libextractpdfmark_poppler_cpp_a_AR) libextractpdfmark-poppler-cpp.a $(libextractpdfmark_poppler_cpp_a_OBJECTS) $(libextractpdfmark_poppler_cpp_a_LIBADD) + $(AM_V_at)$(RANLIB) libextractpdfmark-poppler-cpp.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +libextractpdfmark_poppler_cpp_a-poppler-cpp.o: poppler-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_cpp_a-poppler-cpp.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Tpo -c -o libextractpdfmark_poppler_cpp_a-poppler-cpp.o `test -f 'poppler-cpp.cc' || echo '$(srcdir)/'`poppler-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Tpo $(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='poppler-cpp.cc' object='libextractpdfmark_poppler_cpp_a-poppler-cpp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_cpp_a-poppler-cpp.o `test -f 'poppler-cpp.cc' || echo '$(srcdir)/'`poppler-cpp.cc + +libextractpdfmark_poppler_cpp_a-poppler-cpp.obj: poppler-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_cpp_a-poppler-cpp.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Tpo -c -o libextractpdfmark_poppler_cpp_a-poppler-cpp.obj `if test -f 'poppler-cpp.cc'; then $(CYGPATH_W) 'poppler-cpp.cc'; else $(CYGPATH_W) '$(srcdir)/poppler-cpp.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Tpo $(DEPDIR)/libextractpdfmark_poppler_cpp_a-poppler-cpp.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='poppler-cpp.cc' object='libextractpdfmark_poppler_cpp_a-poppler-cpp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_cpp_a-poppler-cpp.obj `if test -f 'poppler-cpp.cc'; then $(CYGPATH_W) 'poppler-cpp.cc'; else $(CYGPATH_W) '$(srcdir)/poppler-cpp.cc'; fi` + +libextractpdfmark_poppler_cpp_a-pagemode-cpp.o: pagemode-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_cpp_a-pagemode-cpp.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Tpo -c -o libextractpdfmark_poppler_cpp_a-pagemode-cpp.o `test -f 'pagemode-cpp.cc' || echo '$(srcdir)/'`pagemode-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Tpo $(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pagemode-cpp.cc' object='libextractpdfmark_poppler_cpp_a-pagemode-cpp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_cpp_a-pagemode-cpp.o `test -f 'pagemode-cpp.cc' || echo '$(srcdir)/'`pagemode-cpp.cc + +libextractpdfmark_poppler_cpp_a-pagemode-cpp.obj: pagemode-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_cpp_a-pagemode-cpp.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Tpo -c -o libextractpdfmark_poppler_cpp_a-pagemode-cpp.obj `if test -f 'pagemode-cpp.cc'; then $(CYGPATH_W) 'pagemode-cpp.cc'; else $(CYGPATH_W) '$(srcdir)/pagemode-cpp.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Tpo $(DEPDIR)/libextractpdfmark_poppler_cpp_a-pagemode-cpp.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pagemode-cpp.cc' object='libextractpdfmark_poppler_cpp_a-pagemode-cpp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_cpp_a-pagemode-cpp.obj `if test -f 'pagemode-cpp.cc'; then $(CYGPATH_W) 'pagemode-cpp.cc'; else $(CYGPATH_W) '$(srcdir)/pagemode-cpp.cc'; fi` + +libextractpdfmark_poppler_cpp_a-destname-cpp.o: destname-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_cpp_a-destname-cpp.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Tpo -c -o libextractpdfmark_poppler_cpp_a-destname-cpp.o `test -f 'destname-cpp.cc' || echo '$(srcdir)/'`destname-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Tpo $(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='destname-cpp.cc' object='libextractpdfmark_poppler_cpp_a-destname-cpp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_cpp_a-destname-cpp.o `test -f 'destname-cpp.cc' || echo '$(srcdir)/'`destname-cpp.cc + +libextractpdfmark_poppler_cpp_a-destname-cpp.obj: destname-cpp.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_cpp_a-destname-cpp.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Tpo -c -o libextractpdfmark_poppler_cpp_a-destname-cpp.obj `if test -f 'destname-cpp.cc'; then $(CYGPATH_W) 'destname-cpp.cc'; else $(CYGPATH_W) '$(srcdir)/destname-cpp.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Tpo $(DEPDIR)/libextractpdfmark_poppler_cpp_a-destname-cpp.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='destname-cpp.cc' object='libextractpdfmark_poppler_cpp_a-destname-cpp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_cpp_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_cpp_a-destname-cpp.obj `if test -f 'destname-cpp.cc'; then $(CYGPATH_W) 'destname-cpp.cc'; else $(CYGPATH_W) '$(srcdir)/destname-cpp.cc'; fi` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/support/extractpdfmark/src/poppler-cpp/destname-cpp.cc b/support/extractpdfmark/src/poppler-cpp/destname-cpp.cc new file mode 100644 index 0000000000..f3892fe933 --- /dev/null +++ b/support/extractpdfmark/src/poppler-cpp/destname-cpp.cc @@ -0,0 +1,112 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-cpp.hh" + +#include <sstream> +#include <string> +#include <poppler-destination.h> + +std::string poppler_cpp::walk (const std::string &name, + const poppler::destination &dest) +{ + std::stringstream ss; + + switch (dest.type ()) + { + case poppler::destination::type_enum::xyz: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/XYZ " << dest.left () + << " " << dest.top () + << " " << dest.zoom () + << "] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/Fit] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit_h: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/FitH " << dest.top () + << "] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit_v: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/FitV " << dest.left () + << "] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit_r: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/FitR " << dest.left () + << " " << dest.bottom () + << " " << dest.right () + << " " << dest.top () + << "] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit_b: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/FitB] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit_b_h: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest. page_number () + << " /View [/FitBH " << dest.top () + << "] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::fit_b_v: + ss + << "[ /Dest " << encode_name (name) + << " /Page " << dest.page_number () + << " /View [/FitBV " << dest.left () + << "] /DEST pdfmark" << std::endl; + break; + case poppler::destination::type_enum::unknown: + ss << "% dest type is unknown." << std::endl; + break; + default: + ss << "% dest type error." << std::endl; + break; + } + + return ss.str (); +} + +std::string poppler_cpp::destname (void) +{ + auto map {doc->create_destination_map ()}; + std::string retval; + + for (const auto& pair: map) + retval += walk (pair.first, pair.second); + + return retval; +} diff --git a/support/extractpdfmark/src/poppler-cpp/pagemode-cpp.cc b/support/extractpdfmark/src/poppler-cpp/pagemode-cpp.cc new file mode 100644 index 0000000000..9ebe5cc3b7 --- /dev/null +++ b/support/extractpdfmark/src/poppler-cpp/pagemode-cpp.cc @@ -0,0 +1,63 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-cpp.hh" + +#include <iostream> +#include <sstream> +#include <string> +#include <poppler-document.h> + +std::string poppler_cpp::pagemode (void) +{ + std::stringstream ss; + + if (!doc) + { + std::cerr << "% document is null" << std::endl; + return ""; + } + + switch (doc->page_mode ()) + { + case poppler::document::page_mode_enum::use_none: + ss << "[ /PageMode /UseNone /DOCVIEW pdfmark" << std::endl; + break; + case poppler::document::page_mode_enum::use_outlines: + ss << "[ /PageMode /UseOutlines /DOCVIEW pdfmark" << std::endl; + break; + case poppler::document::page_mode_enum::use_thumbs: + ss << "[ /PageMode /UseThumbs /DOCVIEW pdfmark" << std::endl; + break; + case poppler::document::page_mode_enum::fullscreen: + ss << "[ /PageMode /FullScreen /DOCVIEW pdfmark" << std::endl; + break; + case poppler::document::page_mode_enum::use_oc: + ss << "% PageMode use_oc" << std::endl; + break; + case poppler::document::page_mode_enum::use_attach: + ss << "% PageMode use_attach" << std::endl; + break; + default: + ss << "% PageMode unknown" << std::endl; + break; + } + + return ss.str (); +} diff --git a/support/extractpdfmark/src/poppler-cpp/poppler-cpp.cc b/support/extractpdfmark/src/poppler-cpp/poppler-cpp.cc new file mode 100644 index 0000000000..60acdcc319 --- /dev/null +++ b/support/extractpdfmark/src/poppler-cpp/poppler-cpp.cc @@ -0,0 +1,56 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-cpp.hh" + +#include <iostream> +#include <string> +#include <poppler-document.h> +#include <poppler-version.h> + +std::unique_ptr<output_pdfmark> create_output_pdfmark (void) +{ + return std::unique_ptr<output_pdfmark> (new poppler_cpp ()); +} + +bool poppler_cpp::open (const std::string &pdf_filename) +{ + doc = poppler::document::load_from_file (pdf_filename); + + if (!doc) + { + std::cerr << "poppler::document::load_from_file failed: " + << pdf_filename; + return false; + } + return true; +} + +std::string poppler_cpp::version (void) +{ + std::string retval; + + retval = "Compiled with poppler-cpp "; + retval += POPPLER_VERSION; + retval += ".\nRunning with poppler-cpp "; + retval += poppler::version_string (); + retval += ".\n"; + + return retval; +} diff --git a/support/extractpdfmark/src/poppler-cpp/poppler-cpp.hh b/support/extractpdfmark/src/poppler-cpp/poppler-cpp.hh new file mode 100644 index 0000000000..3f9e0f9f0a --- /dev/null +++ b/support/extractpdfmark/src/poppler-cpp/poppler-cpp.hh @@ -0,0 +1,42 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_POPPLER_CPP_HH +#define INCLUDE_GUARD_POPPLER_CPP_HH + +#include <string> +#include <poppler-destination.h> +#include <poppler-document.h> + +#include "output-pdfmark.hh" + +class poppler_cpp : public output_pdfmark +{ +public: + bool open (const std::string &pdf_filename); + std::string pagemode (void); + std::string destname (void); + std::string version (void); + +private: + std::string walk (const std::string &name, + const poppler::destination &dest); + + poppler::document *doc = nullptr; +}; + +#endif // INCLUDE_GUARD_POPPLER_CPP_HH diff --git a/support/extractpdfmark/src/poppler-glib/Makefile.am b/support/extractpdfmark/src/poppler-glib/Makefile.am new file mode 100644 index 0000000000..5c150e7a14 --- /dev/null +++ b/support/extractpdfmark/src/poppler-glib/Makefile.am @@ -0,0 +1,5 @@ +noinst_LIBRARIES = libextractpdfmark-poppler-glib.a +libextractpdfmark_poppler_glib_a_SOURCES = poppler-glib.cc poppler-glib.hh \ + pagemode-glib.cc destname-glib.cc +libextractpdfmark_poppler_glib_a_CPPFLAGS = -I$(srcdir)/.. \ + $(POPPLER_GLIB_CFLAGS) diff --git a/support/extractpdfmark/src/poppler-glib/Makefile.in b/support/extractpdfmark/src/poppler-glib/Makefile.in new file mode 100644 index 0000000000..be62899ef0 --- /dev/null +++ b/support/extractpdfmark/src/poppler-glib/Makefile.in @@ -0,0 +1,631 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/poppler-glib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libextractpdfmark_poppler_glib_a_AR = $(AR) $(ARFLAGS) +libextractpdfmark_poppler_glib_a_LIBADD = +am_libextractpdfmark_poppler_glib_a_OBJECTS = \ + libextractpdfmark_poppler_glib_a-poppler-glib.$(OBJEXT) \ + libextractpdfmark_poppler_glib_a-pagemode-glib.$(OBJEXT) \ + libextractpdfmark_poppler_glib_a-destname-glib.$(OBJEXT) +libextractpdfmark_poppler_glib_a_OBJECTS = \ + $(am_libextractpdfmark_poppler_glib_a_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libextractpdfmark_poppler_glib_a_SOURCES) +DIST_SOURCES = $(libextractpdfmark_poppler_glib_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIFF = @DIFF@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GHOSTSCRIPT = @GHOSTSCRIPT@ +GREP = @GREP@ +HAVE_CXX11 = @HAVE_CXX11@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_COPYRIGHT = @PACKAGE_COPYRIGHT@ +PACKAGE_LICENSE = @PACKAGE_LICENSE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFTEX = @PDFTEX@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_CPP_CFLAGS = @POPPLER_CPP_CFLAGS@ +POPPLER_CPP_LIBS = @POPPLER_CPP_LIBS@ +POPPLER_GLIB_CFLAGS = @POPPLER_GLIB_CFLAGS@ +POPPLER_GLIB_LIBS = @POPPLER_GLIB_LIBS@ +POPPLER_LIBS = @POPPLER_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libextractpdfmark-poppler-glib.a +libextractpdfmark_poppler_glib_a_SOURCES = poppler-glib.cc poppler-glib.hh \ + pagemode-glib.cc destname-glib.cc + +libextractpdfmark_poppler_glib_a_CPPFLAGS = -I$(srcdir)/.. \ + $(POPPLER_GLIB_CFLAGS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/poppler-glib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/poppler-glib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libextractpdfmark-poppler-glib.a: $(libextractpdfmark_poppler_glib_a_OBJECTS) $(libextractpdfmark_poppler_glib_a_DEPENDENCIES) $(EXTRA_libextractpdfmark_poppler_glib_a_DEPENDENCIES) + $(AM_V_at)-rm -f libextractpdfmark-poppler-glib.a + $(AM_V_AR)$(libextractpdfmark_poppler_glib_a_AR) libextractpdfmark-poppler-glib.a $(libextractpdfmark_poppler_glib_a_OBJECTS) $(libextractpdfmark_poppler_glib_a_LIBADD) + $(AM_V_at)$(RANLIB) libextractpdfmark-poppler-glib.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +libextractpdfmark_poppler_glib_a-poppler-glib.o: poppler-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_glib_a-poppler-glib.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Tpo -c -o libextractpdfmark_poppler_glib_a-poppler-glib.o `test -f 'poppler-glib.cc' || echo '$(srcdir)/'`poppler-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Tpo $(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='poppler-glib.cc' object='libextractpdfmark_poppler_glib_a-poppler-glib.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_glib_a-poppler-glib.o `test -f 'poppler-glib.cc' || echo '$(srcdir)/'`poppler-glib.cc + +libextractpdfmark_poppler_glib_a-poppler-glib.obj: poppler-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_glib_a-poppler-glib.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Tpo -c -o libextractpdfmark_poppler_glib_a-poppler-glib.obj `if test -f 'poppler-glib.cc'; then $(CYGPATH_W) 'poppler-glib.cc'; else $(CYGPATH_W) '$(srcdir)/poppler-glib.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Tpo $(DEPDIR)/libextractpdfmark_poppler_glib_a-poppler-glib.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='poppler-glib.cc' object='libextractpdfmark_poppler_glib_a-poppler-glib.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_glib_a-poppler-glib.obj `if test -f 'poppler-glib.cc'; then $(CYGPATH_W) 'poppler-glib.cc'; else $(CYGPATH_W) '$(srcdir)/poppler-glib.cc'; fi` + +libextractpdfmark_poppler_glib_a-pagemode-glib.o: pagemode-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_glib_a-pagemode-glib.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Tpo -c -o libextractpdfmark_poppler_glib_a-pagemode-glib.o `test -f 'pagemode-glib.cc' || echo '$(srcdir)/'`pagemode-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Tpo $(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pagemode-glib.cc' object='libextractpdfmark_poppler_glib_a-pagemode-glib.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_glib_a-pagemode-glib.o `test -f 'pagemode-glib.cc' || echo '$(srcdir)/'`pagemode-glib.cc + +libextractpdfmark_poppler_glib_a-pagemode-glib.obj: pagemode-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_glib_a-pagemode-glib.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Tpo -c -o libextractpdfmark_poppler_glib_a-pagemode-glib.obj `if test -f 'pagemode-glib.cc'; then $(CYGPATH_W) 'pagemode-glib.cc'; else $(CYGPATH_W) '$(srcdir)/pagemode-glib.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Tpo $(DEPDIR)/libextractpdfmark_poppler_glib_a-pagemode-glib.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='pagemode-glib.cc' object='libextractpdfmark_poppler_glib_a-pagemode-glib.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_glib_a-pagemode-glib.obj `if test -f 'pagemode-glib.cc'; then $(CYGPATH_W) 'pagemode-glib.cc'; else $(CYGPATH_W) '$(srcdir)/pagemode-glib.cc'; fi` + +libextractpdfmark_poppler_glib_a-destname-glib.o: destname-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_glib_a-destname-glib.o -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Tpo -c -o libextractpdfmark_poppler_glib_a-destname-glib.o `test -f 'destname-glib.cc' || echo '$(srcdir)/'`destname-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Tpo $(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='destname-glib.cc' object='libextractpdfmark_poppler_glib_a-destname-glib.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_glib_a-destname-glib.o `test -f 'destname-glib.cc' || echo '$(srcdir)/'`destname-glib.cc + +libextractpdfmark_poppler_glib_a-destname-glib.obj: destname-glib.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libextractpdfmark_poppler_glib_a-destname-glib.obj -MD -MP -MF $(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Tpo -c -o libextractpdfmark_poppler_glib_a-destname-glib.obj `if test -f 'destname-glib.cc'; then $(CYGPATH_W) 'destname-glib.cc'; else $(CYGPATH_W) '$(srcdir)/destname-glib.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Tpo $(DEPDIR)/libextractpdfmark_poppler_glib_a-destname-glib.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='destname-glib.cc' object='libextractpdfmark_poppler_glib_a-destname-glib.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextractpdfmark_poppler_glib_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libextractpdfmark_poppler_glib_a-destname-glib.obj `if test -f 'destname-glib.cc'; then $(CYGPATH_W) 'destname-glib.cc'; else $(CYGPATH_W) '$(srcdir)/destname-glib.cc'; fi` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/support/extractpdfmark/src/poppler-glib/destname-glib.cc b/support/extractpdfmark/src/poppler-glib/destname-glib.cc new file mode 100644 index 0000000000..1f72eaad38 --- /dev/null +++ b/support/extractpdfmark/src/poppler-glib/destname-glib.cc @@ -0,0 +1,136 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-glib.hh" + +#include <sstream> +#include <string> +#include <utility> +#include <poppler.h> + +gboolean poppler_glib::walk_entry (gpointer key, + gpointer value, + gpointer user_data) +{ + gchar *name = static_cast<char*> (key); + PopplerDest *dest = static_cast<PopplerDest*> (value); + poppler_glib *pg = static_cast<poppler_glib*> (user_data); + + return pg->walk (name, dest); +} + +bool poppler_glib::walk (gchar *name, PopplerDest *dest) +{ + gsize len; + void *data {poppler_named_dest_to_bytestring (name, &len)}; + std::string n {static_cast<char*> (data), + static_cast<std::string::size_type> (len)}; + std::stringstream ss; + if (dest) + { + switch (dest->type) + { + case POPPLER_DEST_XYZ: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/XYZ " << dest->left + << " " << dest->top + << " " << dest->zoom + << "] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FIT: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/Fit] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FITH: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/FitH " << dest->top + << "] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FITV: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/FitV " << dest->left + << "] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FITR: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/FitR " << dest->left + << " " << dest->bottom + << " " << dest->right + << " " << dest->top + << "] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FITB: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/FitB] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FITBH: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/FitBH " << dest->top + << "] /DEST pdfmark" << std::endl; + break; + case POPPLER_DEST_FITBV: + ss + << "[ /Dest " << encode_name (n) + << " /Page " << dest->page_num + << " /View [/FitBV " << dest->left + << "] /DEST pdfmark" << std::endl; + break; + default: + ss << "% dest type is unknown." << std::endl; + break; + } + } + else + { + ss << "% dest is null." << std::endl; + } + + dests += ss.str (); + + // return value is used for GTraverseFunc ()'s return value. + // false means to continue the travarsal (true means to stop) + return false; +} + +std::string poppler_glib::destname (void) +{ + std::unique_ptr<GTree, decltype (&g_tree_destroy)> + tree {poppler_document_create_dests_tree (document), g_tree_destroy}; + dests.clear (); + + g_tree_foreach (tree.get (), walk_entry, this); + + std::string tmp {std::move(dests)}; + dests.clear (); + return tmp; +} diff --git a/support/extractpdfmark/src/poppler-glib/pagemode-glib.cc b/support/extractpdfmark/src/poppler-glib/pagemode-glib.cc new file mode 100644 index 0000000000..c8632e1fd0 --- /dev/null +++ b/support/extractpdfmark/src/poppler-glib/pagemode-glib.cc @@ -0,0 +1,64 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-glib.hh" + +#include <iostream> +#include <sstream> +#include <string> +#include <poppler.h> + +std::string poppler_glib::pagemode (void) +{ + std::stringstream ss; + + if (!document) + { + std::cerr << "% document is null" << std::endl; + return ""; + } + + switch (poppler_document_get_page_mode (document)) + { + case POPPLER_PAGE_MODE_UNSET: + case POPPLER_PAGE_MODE_NONE: + ss << "[ /PageMode /UseNone /DOCVIEW pdfmark" << std::endl; + break; + case POPPLER_PAGE_MODE_USE_OUTLINES: + ss << "[ /PageMode /UseOutlines /DOCVIEW pdfmark" << std::endl; + break; + case POPPLER_PAGE_MODE_USE_THUMBS: + ss << "[ /PageMode /UseThumbs /DOCVIEW pdfmark" << std::endl; + break; + case POPPLER_PAGE_MODE_FULL_SCREEN: + ss << "[ /PageMode /FullScreen /DOCVIEW pdfmark" << std::endl; + break; + case POPPLER_PAGE_MODE_USE_OC: + ss << "% PageMode POPPLER_MODE_USE_OC" << std::endl; + break; + case POPPLER_PAGE_MODE_USE_ATTACHMENTS: + ss << "% PageMode POPPLER_MODE_USE_ATTACHMENTS" << std::endl; + break; + default: + ss << "% PageMode unknown" << std::endl; + break; + } + + return ss.str (); +} diff --git a/support/extractpdfmark/src/poppler-glib/poppler-glib.cc b/support/extractpdfmark/src/poppler-glib/poppler-glib.cc new file mode 100644 index 0000000000..6ee06e8b8d --- /dev/null +++ b/support/extractpdfmark/src/poppler-glib/poppler-glib.cc @@ -0,0 +1,114 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "poppler-glib.hh" + +#include <iostream> +#include <memory> +#include <sstream> +#include <string> +#include <poppler.h> + +std::unique_ptr<output_pdfmark> create_output_pdfmark (void) +{ + return std::unique_ptr<output_pdfmark> (new poppler_glib ()); +} + +namespace +{ + std::string get_uri (const std::string &filename) + { + std::string abs_filename; + + if (g_path_is_absolute (filename.c_str ())) + abs_filename = filename; + else + { + std::unique_ptr<gchar, decltype (&g_free)> dir + {g_get_current_dir (), g_free}; + std::unique_ptr<gchar, decltype (&g_free)> abs + {g_build_filename (dir.get (), filename.c_str (), nullptr), g_free}; + abs_filename = abs.get (); + } + + GError *error {nullptr}; + std::unique_ptr<gchar, decltype (&g_free)> uri + {g_filename_to_uri (abs_filename.c_str (), nullptr, &error), g_free}; + if (!uri) + { + std::cerr << "g_filename_to_uri failed: " << abs_filename; + if (error) + { + std::cerr << ": " << error->message << std::endl; + g_error_free (error); + } + else + { + std::cerr << std::endl; + } + return ""; + } + return uri.get (); + } +} + +bool poppler_glib::open (const std::string &pdf_filename) +{ + GError *error {nullptr}; + document = poppler_document_new_from_file (get_uri (pdf_filename).c_str (), + nullptr, &error); + if (!document) + { + std::cerr << "poppler_document_new_from_file failed: " << pdf_filename; + if (error) + { + std::cerr << ": " << error->message << std::endl; + g_error_free (error); + } + else + { + std::cerr << std::endl; + } + return false; + } + return true; +} + +std::string poppler_glib::version (void) +{ + std::stringstream ss; + + ss << "Compiled with poppler-glib " + << POPPLER_MAJOR_VERSION << "." + << POPPLER_MINOR_VERSION << "." + << POPPLER_MICRO_VERSION + << ", glib " + << GLIB_MAJOR_VERSION << "." + << GLIB_MINOR_VERSION << "." + << GLIB_MICRO_VERSION + << ".\nRunning with poppler-glib " + << poppler_get_version () + << ", glib " + << glib_major_version << "." + << glib_minor_version << "." + << glib_micro_version + << ".\n"; + + return ss.str (); +} diff --git a/support/extractpdfmark/src/poppler-glib/poppler-glib.hh b/support/extractpdfmark/src/poppler-glib/poppler-glib.hh new file mode 100644 index 0000000000..db9a625748 --- /dev/null +++ b/support/extractpdfmark/src/poppler-glib/poppler-glib.hh @@ -0,0 +1,49 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016, 2019 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_POPPLER_GLIB_HH +#define INCLUDE_GUARD_POPPLER_GLIB_HH + +#include <string> +#include <poppler.h> + +#include "output-pdfmark.hh" + +class poppler_glib : public output_pdfmark +{ +public: + bool open (const std::string &pdf_filename); + std::string pagemode (void); + std::string destname (void); + std::string version (void); + + ~poppler_glib () + { + g_clear_object (&document); + } + +private: + static gboolean walk_entry (gpointer key, + gpointer value, + gpointer user_data); + bool walk (gchar *name, PopplerDest *dest); + + PopplerDocument *document = nullptr; + std::string dests; +}; + +#endif // INCLUDE_GUARD_POPPLER_GLIB_HH diff --git a/support/extractpdfmark/src/utf16.cc b/support/extractpdfmark/src/utf16.cc new file mode 100644 index 0000000000..e1f6661d68 --- /dev/null +++ b/support/extractpdfmark/src/utf16.cc @@ -0,0 +1,27 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "utf16.hh" + +#include <string> + +bool is_utf16 (const std::string &str) +{ + return (str.length () >= 2) && str[0] == '\xfe' && str[1] == '\xff'; +} diff --git a/support/extractpdfmark/src/utf16.hh b/support/extractpdfmark/src/utf16.hh new file mode 100644 index 0000000000..fae4329caa --- /dev/null +++ b/support/extractpdfmark/src/utf16.hh @@ -0,0 +1,25 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_UTF16_HH +#define INCLUDE_GUARD_UTF16_HH + +#include <string> + +bool is_utf16 (const std::string &str); + +#endif // INCLUDE_GUARD_UTF16_HH diff --git a/support/extractpdfmark/src/utf8.cc b/support/extractpdfmark/src/utf8.cc new file mode 100644 index 0000000000..b58f1c0fe5 --- /dev/null +++ b/support/extractpdfmark/src/utf8.cc @@ -0,0 +1,73 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#include "config.h" + +#include "utf8.hh" + +#ifdef USE_CODECVT +#include <cwchar> +#include <codecvt> +#endif + +#include <string> + +#ifdef USE_ICONV +#include "iconv_wrapper.hh" +#endif + +#ifdef USE_CODECVT + +bool is_utf8 (const std::string &str) +{ + std::codecvt_utf8<char32_t> cvt; + auto mb {std::mbstate_t ()}; + return (cvt.length (mb, &str.front (), &str.front () + str.length (), + std::string::npos) + == str.length ()); +} + +#else // USE_CODECVT + +#ifdef USE_ICONV + +bool is_utf8 (const std::string &str) +{ + try + { + iconv_wrapper::iconv cvt8to16 {"UTF-8", "UTF-16"}; + std::string utf16 {cvt8to16.convert (str)}; + iconv_wrapper::iconv cvt16to8 {"UTF-16", "UTF-8"}; + std::string utf8 {cvt16to8.convert (utf16)}; + return (str == utf8); + } + catch (std::system_error &error) + { + return false; + } + return false; +} + +#else // USE_ICONV + +bool is_utf8 (const std::string &str) +{ + return false; +} + +#endif // USE_ICONV +#endif // USE_CODECVT diff --git a/support/extractpdfmark/src/utf8.hh b/support/extractpdfmark/src/utf8.hh new file mode 100644 index 0000000000..3ba039b819 --- /dev/null +++ b/support/extractpdfmark/src/utf8.hh @@ -0,0 +1,25 @@ +// This file is part of Extract PDFmark. +// +// Copyright (C) 2016 Masamichi Hosoda +// +// Extract PDFmark 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 3 of the License, or +// (at your option) any later version. +// +// Extract PDFmark 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 Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. + +#ifndef INCLUDE_GUARD_UTF8_HH +#define INCLUDE_GUARD_UTF8_HH + +#include <string> + +bool is_utf8 (const std::string &str); + +#endif // INCLUDE_GUARD_UTF8_HH |