├── .git-hooks ├── README ├── commit-msg ├── post-merge └── pre-commit ├── .gitignore ├── .gitreview ├── AUTHORS ├── COPYING.MPL ├── HACKING ├── Makefile.am ├── NEWS ├── README ├── astyle.options ├── autogen.sh ├── build ├── .gitignore ├── Makefile.am └── win32 │ ├── .gitignore │ ├── Makefile.am │ ├── compile-resource │ └── lt-compile-resource ├── buildnumber.sh ├── configure.ac ├── createBuildNumber.pl ├── docs ├── Makefile.am └── doxygen │ ├── .gitignore │ ├── Makefile.am │ ├── doxygen.cfg │ ├── footer.html.in │ └── header.html.in ├── inc ├── Makefile.am └── libcdr │ ├── CDRDocument.h │ ├── CMXDocument.h │ ├── Makefile.am │ ├── libcdr.h │ └── libcdr_api.h ├── libcdr-zip.in ├── libcdr.pc.in ├── libcdr.spec.in ├── m4 ├── .gitignore ├── ax_cxx_compile_stdcxx.m4 ├── ax_cxx_compile_stdcxx_11.m4 ├── ax_cxx_compile_stdcxx_17.m4 ├── ax_gcc_func_attribute.m4 └── dlp_fallthrough.m4 └── src ├── .gitignore ├── Makefile.am ├── conv ├── .gitignore ├── Makefile.am ├── raw │ ├── .gitignore │ ├── Makefile.am │ ├── cdr2raw.cpp │ ├── cdr2raw.rc.in │ ├── cmx2raw.cpp │ └── cmx2raw.rc.in ├── svg │ ├── .gitignore │ ├── Makefile.am │ ├── cdr2xhtml.cpp │ ├── cdr2xhtml.rc.in │ ├── cmx2xhtml.cpp │ └── cmx2xhtml.rc.in └── text │ ├── .gitignore │ ├── Makefile.am │ ├── cdr2text.cpp │ ├── cdr2text.rc.in │ ├── cmx2text.cpp │ └── cmx2text.rc.in ├── fuzz ├── .gitignore ├── Makefile.am ├── cdrfuzzer.cpp └── cmxfuzzer.cpp ├── lib ├── .gitignore ├── CDRCollector.cpp ├── CDRCollector.h ├── CDRColorPalettes.h ├── CDRColorProfiles.h ├── CDRContentCollector.cpp ├── CDRContentCollector.h ├── CDRDocument.cpp ├── CDRDocumentStructure.h ├── CDRInternalStream.cpp ├── CDRInternalStream.h ├── CDROutputElementList.cpp ├── CDROutputElementList.h ├── CDRParser.cpp ├── CDRParser.h ├── CDRPath.cpp ├── CDRPath.h ├── CDRStylesCollector.cpp ├── CDRStylesCollector.h ├── CDRTransforms.cpp ├── CDRTransforms.h ├── CDRTypes.cpp ├── CDRTypes.h ├── CMXDocument.cpp ├── CMXDocumentStructure.h ├── CMXParser.cpp ├── CMXParser.h ├── CommonParser.cpp ├── CommonParser.h ├── Makefile.am ├── libcdr.rc.in ├── libcdr_utils.cpp └── libcdr_utils.h └── test ├── .gitignore ├── CDRInternalStreamTest.cpp ├── Makefile.am └── test.cpp /.git-hooks/README: -------------------------------------------------------------------------------- 1 | Git hooks are executable scripts you can place in $GIT_DIR/hooks directory to trigger action at certain points. 2 | 3 | There are two groups of these hooks: client side and server side. 4 | The client-side hooks: 5 | are for client operations such as committing and merging. 6 | The server-side hooks: 7 | are for Git server operations such as receiving pushed commits. 8 | 9 | See Also [ http://git-scm.com/book/en/Customizing-Git-Git-Hooks ] -------------------------------------------------------------------------------- /.git-hooks/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to check the commit log message. 4 | # Called by git-commit with one argument, the name of the file 5 | # that has the commit message. The hook should exit with non-zero 6 | # status after issuing an appropriate message if it wants to stop the 7 | # commit. The hook is allowed to edit the commit message file. 8 | # 9 | # To enable this hook, make this file executable. 10 | 11 | # Uncomment the below to add a Signed-off-by line to the message. 12 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 13 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 14 | 15 | # This example catches duplicate Signed-off-by lines. 16 | 17 | base_dir=$(dirname $0) 18 | MSG="$1" 19 | 20 | abort() { 21 | cp $1 $1.save 22 | cat >&2 <'`" ] ; then 56 | abort "$1" "The commit message looks like ChangeLog, please use the git form." 57 | fi 58 | 59 | # Check for whitespace in front of *'s 60 | 61 | if [ -n "`sed '/^#/,$d' $1 | grep '^[[:space:]]\+\*.*:'`" -a -z "`grep '^\*' $1`" ] ; then 62 | abort "$1" "Please don't use whitespace in front of '* file: Description.' entries." 63 | fi 64 | 65 | # Check that lines do not start with '#' (possibly accidental commit, 66 | # such as starting the message with '#ifdef', git commits start with '#'. 67 | 68 | if [ -n "`grep '^#[^[:blank:]]' $1`" ] ; then 69 | abort "$1" "Possible accidental comment in the commit message (leading # without space)." 70 | fi 71 | 72 | 73 | #------------------ copied gerrit commit-msg hook to handle ChangeId --> 74 | # From Gerrit Code Review 2.3 75 | # 76 | # Part of Gerrit Code Review (http://code.google.com/p/gerrit/) 77 | # 78 | # Copyright (C) 2009 The Android Open Source Project 79 | # 80 | # Licensed under the Apache License, Version 2.0 (the "License"); 81 | # you may not use this file except in compliance with the License. 82 | # You may obtain a copy of the License at 83 | # 84 | # http://www.apache.org/licenses/LICENSE-2.0 85 | # 86 | # Unless required by applicable law or agreed to in writing, software 87 | # distributed under the License is distributed on an "AS IS" BASIS, 88 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 89 | # See the License for the specific language governing permissions and 90 | # limitations under the License. 91 | # 92 | 93 | CHANGE_ID_AFTER="Bug|Issue" 94 | 95 | # Check for, and add if missing, a unique Change-Id 96 | # 97 | add_ChangeId() { 98 | clean_message=`sed -e ' 99 | /^diff --git a\/.*/{ 100 | s/// 101 | q 102 | } 103 | /^Signed-off-by:/d 104 | /^#/d 105 | ' "$MSG" | git stripspace` 106 | if test -z "$clean_message" 107 | then 108 | return 109 | fi 110 | 111 | id=`grep -i '^Change-Id:' "$MSG" | sed -e "s/.*: I//"` 112 | temp_msg=`grep -v -i '^Change-Id:' "$MSG"` 113 | echo "$temp_msg" > "$MSG" 114 | 115 | if test -z "$id" 116 | then 117 | id=`_gen_ChangeId` 118 | fi 119 | perl -e ' 120 | $MSG = shift; 121 | $id = shift; 122 | $CHANGE_ID_AFTER = shift; 123 | 124 | undef $/; 125 | open(I, $MSG); $_ = ; close I; 126 | s|^diff --git a/.*||ms; 127 | s|^#.*$||mg; 128 | exit unless $_; 129 | 130 | @message = split /\n/; 131 | $haveFooter = 0; 132 | $startFooter = @message; 133 | for($line = @message - 1; $line >= 0; $line--) { 134 | $_ = $message[$line]; 135 | 136 | if (/^[a-zA-Z0-9-]+: /) { 137 | $haveFooter++; 138 | next; 139 | } 140 | next if /^[ []/; 141 | $startFooter = $line if ($haveFooter && /^\r?$/); 142 | last; 143 | } 144 | 145 | @footer = @message[$startFooter+1..@message]; 146 | @message = @message[0..$startFooter]; 147 | push(@footer, "") unless @footer; 148 | 149 | for ($line = 0; $line < @footer; $line++) { 150 | $_ = $footer[$line]; 151 | next if /^($CHANGE_ID_AFTER):/i; 152 | last; 153 | } 154 | splice(@footer, $line, 0, "Change-Id: I$id"); 155 | 156 | $_ = join("\n", @message, @footer); 157 | open(O, ">$MSG"); print O; close O; 158 | ' "$MSG" "$id" "$CHANGE_ID_AFTER" 159 | } 160 | _gen_ChangeIdInput() { 161 | echo "tree `git write-tree`" 162 | if parent=`git rev-parse HEAD^0 2>/dev/null` 163 | then 164 | echo "parent $parent" 165 | fi 166 | echo "author `git var GIT_AUTHOR_IDENT`" 167 | echo "committer `git var GIT_COMMITTER_IDENT`" 168 | echo 169 | printf '%s' "$clean_message" 170 | } 171 | _gen_ChangeId() { 172 | _gen_ChangeIdInput | 173 | git hash-object -t commit --stdin 174 | } 175 | 176 | 177 | add_ChangeId 178 | #------------------ copied gerrit commit-msg hook to handle ChangeId <-- 179 | 180 | 181 | exit 0 182 | -------------------------------------------------------------------------------- /.git-hooks/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Do not warn if there were no real merge 4 | git rev-parse -q --verify HEAD^2 >/dev/null || exit 5 | 6 | echo 7 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 8 | echo "! You probably used 'git pull' instead of 'git pull -r' !" 9 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 10 | echo 11 | echo "You can still fix it - please do 'git pull -r' now." 12 | echo 13 | -------------------------------------------------------------------------------- /.git-hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | # A hook script to verify what is about to be committed. 4 | # Called by "git commit" with no arguments. The hook should 5 | # exit with non-zero status after issuing an appropriate message 6 | # if it wants to stop the commit. 7 | 8 | use strict; 9 | #use File::Copy; 10 | #use Cwd; 11 | 12 | $ENV{LC_ALL} = "C"; 13 | 14 | sub check_whitespaces($) 15 | { 16 | my ($h) = @_; 17 | my $src_limited = "c|cpp|cxx|h|hrc|hxx|idl|inl|java|map|MK|pmk|pl|pm|sdi|sh|src|tab|ui|xcu|xml"; 18 | my $src_full = "c|cpp|cxx|h|hrc|hxx|idl|inl|java|map|mk|MK|pmk|pl|pm|sdi|sh|src|tab|ui|xcu|xml"; 19 | 20 | my $found_bad = 0; 21 | my $filename; 22 | my $reported_filename = ""; 23 | my $lineno; 24 | sub bad_line 25 | { 26 | my ($why, $line, $file_filter) = @_; 27 | if (!defined $file_filter || $filename =~ /\.($file_filter)$/) 28 | { 29 | if (!$found_bad) 30 | { 31 | print STDERR "*\n"; 32 | print STDERR "* You have some suspicious patch lines:\n"; 33 | print STDERR "*\n"; 34 | $found_bad = 1; 35 | } 36 | if ($reported_filename ne $filename) 37 | { 38 | print STDERR "* In $filename\n"; 39 | $reported_filename = $filename; 40 | } 41 | print STDERR "* $why (line $lineno)\n"; 42 | print STDERR "$filename:$lineno:$line\n"; 43 | } 44 | } 45 | open( FILES, "git-diff-index -p -M --cached $h |" ) || die "Cannot run git diff-index."; 46 | while () 47 | { 48 | if (m|^diff --git a/(.*) b/\1$|) 49 | { 50 | $filename = $1; 51 | next; 52 | } 53 | if (/^@@ -\S+ \+(\d+)/) 54 | { 55 | $lineno = $1 - 1; 56 | next; 57 | } 58 | if (/^ /) 59 | { 60 | $lineno++; 61 | next; 62 | } 63 | if (s/^\+//) 64 | { 65 | $lineno++; 66 | chomp; 67 | if (/\s$/) 68 | { 69 | bad_line("trailing whitespace", $_ , $src_limited); 70 | } 71 | if (/\s* /) 72 | { 73 | bad_line("indent with Tab", $_, $src_limited); 74 | } 75 | if (/^(?:[<>=]){7}$/) 76 | { 77 | bad_line("unresolved merge conflict", $src_full); 78 | } 79 | if (/SAL_DEBUG/) 80 | { 81 | bad_line("temporary debug in commit", $_, $src_limited); 82 | } 83 | if (/True<\/property>/) 84 | { 85 | bad_line("use font attributes instead of use-markup", $_, $src_limited); 86 | } 87 | } 88 | } 89 | if ( $found_bad) 90 | { 91 | exit($found_bad); 92 | } 93 | } 94 | 95 | # Do the work :-) 96 | 97 | # Initial commit: diff against an empty tree object 98 | my $against="4b825dc642cb6eb9a060e54bf8d69288fbee4904"; 99 | if ( system( "git rev-parse --verify HEAD >/dev/null 2>&1" ) == 0 ) 100 | { 101 | $against="HEAD" 102 | } 103 | 104 | # If you want to allow non-ascii filenames set this variable to true. 105 | my $allownonascii=`git config hooks.allownonascii`; 106 | 107 | # Cross platform projects tend to avoid non-ascii filenames; prevent 108 | # them from being added to the repository. We exploit the fact that the 109 | # printable range starts at the space character and ends with tilde. 110 | if ( $allownonascii ne "true" && 111 | # Note that the use of brackets around a tr range is ok here, (it's 112 | # even required, for portability to Solaris 10's /usr/bin/tr), since 113 | # the square bracket bytes happen to fall in the designated range. 114 | `git diff --cached --name-only --diff-filter=A -z $against | \ 115 | LC_ALL=C tr -d '[ -~]\\0'` ne "" ) 116 | { 117 | print <$(distdir)/ChangeLog 32 | 33 | astyle: 34 | astyle --options=astyle.options \*.cpp \*.h 35 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | libcdr 0.1.8 2 | 3 | * Upgrade m4 macros. 4 | * Fix crash appear with format CDR 14 and Gradients (tdf#130914, tdf#158268) 5 | * Fixes parsing CDR7 files with no bbox surrounding text objects (tdf#98994) 6 | 7 | libcdr 0.1.5 8 | 9 | * Drop outdated MSVC project files. 10 | * Fix several issues found by oss-fuzz. 11 | * Switch from --enable-werror to --disable-werror as configure default. 12 | * Miscellaneous code cleanups. 13 | 14 | libcdr 0.1.4 15 | 16 | * Fix several issues found by oss-fuzz. 17 | * Require C++11 for build. 18 | * Fix issues found by coverity. 19 | * Various code cleanups. 20 | 21 | libcdr 0.1.3 22 | 23 | * Improvements for CMX parsers 24 | - More robust parsing using the pointers from CMX header 25 | - Implement almost all fills 26 | - Implement outline properties 27 | - Implement embedded raster images 28 | - Implement transparency lens for fills 29 | * Some fixes for CDR parsers 30 | - Consider fill/outline styles 31 | * Tools 32 | - Make cmx2* and cdr2* tools handle both CDR and CMX 33 | 34 | libcdr 0.1.2 35 | 36 | * Fix various crashes and hangs when reading broken files found with the 37 | help of american-fuzzy-lop. 38 | * Fix build with boost 1.59. (rhbz#1258127) 39 | * Fix various problems detected by Coverity. 40 | * Do not drop empty text lines. (tdf#67873) 41 | * Make --help output of all command line tools more help2man-friendly. 42 | * Several other small improvements. 43 | 44 | libcdr 0.1.1 45 | 46 | * Fix several problems found by Coverity. 47 | * Fix crash when NULL is passed as input stream. 48 | * Fix various crashes and hangs when reading broken files found with the 49 | help of american-fuzzy-lop. 50 | * Only export public symbols on Linux. 51 | 52 | libcdr 0.1.0 53 | 54 | * switch to librevenge 55 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libcdr is a library and a set of tools for reading and converting binary files 2 | produced by Corel DRAW. 3 | 4 | Most up to date code is available from Git repository at libreoffice.org 5 | (https://gerrit.libreoffice.org/gitweb?p=libcdr.git), which is mirrored at 6 | freedesktop.org (http://cgit.freedesktop.org/libreoffice/libcdr/). See 7 | https://wiki.documentfoundation.org/DLP/Libraries/libcdr for more information. 8 | 9 | libcdr requires boost, icu, lcms2, librevenge and zlib to build. 10 | 11 | The library is available under MPL 2.0. 12 | 13 | Corel DRAW is a trademark by Corel. The developers of libcdr are in no way 14 | affiliated with the company. 15 | -------------------------------------------------------------------------------- /astyle.options: -------------------------------------------------------------------------------- 1 | # formatting options 2 | style=allman 3 | indent=spaces=2 4 | align-pointer=name 5 | break-closing-brackets 6 | pad-header 7 | unpad-paren 8 | max-instatement-indent=120 9 | 10 | # processing options 11 | recursive 12 | suffix=none 13 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set_git_hooks() 4 | { 5 | # assume that the current directory is the source tree 6 | if [ -d ".git" ] ; then 7 | for hook in $(ls -1 .git-hooks) ; do 8 | cd .git/hooks 9 | if [ ! -e "${hook?}" -o -L "${hook?}" ] ; then 10 | rm -f "${hook?}" 11 | ln -sf "../../.git-hooks/${hook?}" "${hook?}" 12 | fi 13 | cd - > /dev/null 14 | done 15 | fi 16 | } 17 | 18 | TESTLIBTOOLIZE="glibtoolize libtoolize" 19 | 20 | LIBTOOLIZEFOUND="0" 21 | 22 | srcdir=`dirname $0` 23 | test -z "$srcdir" && srcdir=. 24 | 25 | olddir=`pwd` 26 | cd $srcdir 27 | 28 | set_git_hooks 29 | 30 | aclocal --version > /dev/null 2> /dev/null || { 31 | echo "error: aclocal not found" 32 | exit 1 33 | } 34 | automake --version > /dev/null 2> /dev/null || { 35 | echo "error: automake not found" 36 | exit 1 37 | } 38 | 39 | for i in $TESTLIBTOOLIZE; do 40 | if which $i > /dev/null 2>&1; then 41 | LIBTOOLIZE=$i 42 | LIBTOOLIZEFOUND="1" 43 | break 44 | fi 45 | done 46 | 47 | if [ "$LIBTOOLIZEFOUND" = "0" ]; then 48 | echo "$0: need libtoolize tool to build libcdr" >&2 49 | exit 1 50 | fi 51 | 52 | amcheck=`automake --version | grep 'automake (GNU automake) 1.5'` 53 | if test "x$amcheck" = "xautomake (GNU automake) 1.5"; then 54 | echo "warning: you appear to be using automake 1.5" 55 | echo " this version has a bug - GNUmakefile.am dependencies are not generated" 56 | fi 57 | 58 | rm -rf autom4te*.cache 59 | 60 | $LIBTOOLIZE --force --copy || { 61 | echo "error: libtoolize failed" 62 | exit 1 63 | } 64 | aclocal $ACLOCAL_FLAGS || { 65 | echo "error: aclocal $ACLOCAL_FLAGS failed" 66 | exit 1 67 | } 68 | autoheader || { 69 | echo "error: autoheader failed" 70 | exit 1 71 | } 72 | automake -a -c --foreign || { 73 | echo "warning: automake failed" 74 | } 75 | autoconf || { 76 | echo "error: autoconf failed" 77 | exit 1 78 | } 79 | -------------------------------------------------------------------------------- /build/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in -------------------------------------------------------------------------------- /build/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = win32 2 | -------------------------------------------------------------------------------- /build/win32/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | Debug 4 | Release 5 | *.dep 6 | *.mak 7 | *.ncb 8 | *.opt 9 | *.plg 10 | *.suo 11 | -------------------------------------------------------------------------------- /build/win32/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = \ 2 | compile-resource \ 3 | lt-compile-resource 4 | -------------------------------------------------------------------------------- /build/win32/compile-resource: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script to compile a resource file for a DLL if there is a .rc file 4 | # for it. The resource source file is supposed to contain a version 5 | # info section, that uses the string BUILDNUMBER as the least 6 | # significant part of the version numbers. This script replaces that 7 | # string with a "build number" before compiling the binary resource 8 | # file. The build number is kept between builds in a "stamp" file, and 9 | # incremented each time. (If there is no stamp file, build number 0 is 10 | # used.) The intention is that only the "official" maintainer of a DLL 11 | # keeps such a stamp file, and thus the DLLs he releases have 12 | # increasing version number resources, which can be used by an 13 | # installer program to decide whether to replace an existing DLL with 14 | # the same name. 15 | 16 | # This is just my (tml@iki.fi) idea, if somebody comes up with a 17 | # better way to generate version number resources, don't hesitate to 18 | # suggest. 19 | 20 | # The command line arguments are: 21 | # $1: the name of the .rc file to check 22 | # $2: the name of the resource object file to produce, if the rc file exists 23 | 24 | # Check if we have a resource file for this DLL. 25 | rcfile=$1 26 | resfile=$2 27 | if [ -f $rcfile ]; then 28 | # Check if we have a build number stamp file. 29 | basename=`basename $rcfile .rc` 30 | if [ -f $basename-build.stamp ]; then 31 | read number <$basename-build.stamp 32 | buildnumber=$[number] 33 | echo Build number $buildnumber 34 | rm -rf $basename-build.stamp 35 | else 36 | echo Using zero as build number 37 | buildnumber=0 38 | fi 39 | 40 | m4 -DBUILDNUMBER=$buildnumber <$rcfile >$$.rc && 41 | ${WINDRES-windres} $$.rc $resfile && 42 | rm $$.rc 43 | else 44 | # Return failure 45 | exit 1 46 | fi 47 | -------------------------------------------------------------------------------- /build/win32/lt-compile-resource: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script to compile a resource file for a DLL in the same way that 4 | # libtool would, if it knew about .rc files. 5 | 6 | # This kinda sucks, but the alternative would be to teach autoconf, 7 | # automake, and libtool about compiling .rc files. That would be 8 | # doable, but waiting for those changes to propagate to official 9 | # versions of those tools would take some time. 10 | 11 | # The command line arguments are: 12 | # $1: the name of the .rc file to compile if it exists 13 | # $2: the name of the resource libtool object file to produce 14 | 15 | rcfile=$1 16 | lo=$2 17 | case "$lo" in 18 | *.lo) 19 | resfile=.libs/`basename $lo .lo`.o 20 | ;; 21 | *) 22 | echo libtool object name should end with .lo 23 | exit 1 24 | ;; 25 | esac 26 | d=`dirname $0` 27 | 28 | # Create .libs if not there already 29 | [ ! -d .libs ] && mkdir .libs 30 | 31 | # Super-ugly hack: libtool can work in two ways on Win32: Either it 32 | # uses .lo files which are the real object files in "this" directory, 33 | # or it creates .o files in the .libs subdirectory, and the .lo file 34 | # is a small text file. We try to deduce which case this is by 35 | # checking if there are any .o files in .libs. This requires that the 36 | # resource file gets built last in the Makefile. 37 | 38 | o_files_in_dotlibs=`echo .libs/*.o` 39 | case "$o_files_in_dotlibs" in 40 | .libs/\*.o) 41 | use_script=false 42 | ;; 43 | *) use_script=true 44 | ;; 45 | esac 46 | 47 | # Another way of working of libtool: When compiling with --enable-static and 48 | # --disable-shared options, the .lo file can be still a small text file, and 49 | # the .o files are created in the same directory as the .lo files. 50 | 51 | o_files_in_dot=`echo ./*.o` 52 | case "$o_files_in_dot" in 53 | ./\*.o) 54 | use_script=$use_script 55 | ;; 56 | *) use_script=true 57 | ;; 58 | esac 59 | 60 | # Try to compile resource file 61 | $d/compile-resource $rcfile $resfile && { 62 | if [ $use_script = true ]; then 63 | # Handcraft a libtool object 64 | # libtool checks for a second line matching "Generated by .* libtool"! 65 | (echo "# $lo" 66 | echo "# Generated by lt-compile-resource, compatible with libtool" 67 | echo "pic_object=$resfile" 68 | echo "non_pic_object=none") >$lo 69 | else 70 | mv $resfile $lo 71 | fi 72 | # Success 73 | exit 0 74 | } 75 | 76 | # If unsuccessful (no .rc file, or some error in it) return failure 77 | 78 | exit 1 79 | -------------------------------------------------------------------------------- /buildnumber.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script to create the BUILDNUMBER used by compile-resource. This script 4 | # needs the script createBuildNumber.pl to be in the same directory. 5 | 6 | { perl ./createBuildNumber.pl \ 7 | src/lib/libcdr-build.stamp \ 8 | src/conv/raw/cdr2raw-build.stamp \ 9 | src/conv/svg/cdr2xhtml-build.stamp 10 | #Success 11 | exit 0 12 | } 13 | #unsucessful 14 | exit 1 15 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # Process this file with autoconf to create configure. 2 | 3 | AC_PREREQ([2.65]) 4 | 5 | # ==================== 6 | # Version informations 7 | # ==================== 8 | m4_define([libcdr_version_major],[0]) 9 | m4_define([libcdr_version_minor],[1]) 10 | m4_define([libcdr_version_micro],[9]) 11 | m4_define([libcdr_version],[libcdr_version_major.libcdr_version_minor.libcdr_version_micro]) 12 | 13 | # ============= 14 | # Automake init 15 | # ============= 16 | AC_INIT([libcdr],[libcdr_version]) 17 | AC_CONFIG_MACRO_DIR([m4]) 18 | AC_CONFIG_HEADER([config.h]) 19 | AM_INIT_AUTOMAKE([1.11 foreign dist-xz dist-bzip2]) 20 | AM_SILENT_RULES([yes]) 21 | AC_LANG([C++]) 22 | 23 | # =========================== 24 | # Find required base packages 25 | # =========================== 26 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 27 | AC_PROG_CC 28 | AC_PROG_CPP 29 | AC_PROG_CXX 30 | AC_PROG_INSTALL 31 | AC_PROG_LN_S 32 | AC_PROG_MAKE_SET 33 | LT_INIT([win32-dll disable-static pic-only]) 34 | AC_CANONICAL_HOST 35 | 36 | AX_CXX_COMPILE_STDCXX_11 37 | AX_GCC_FUNC_ATTRIBUTE([format]) 38 | DLP_FALLTHROUGH 39 | 40 | PKG_PROG_PKG_CONFIG([0.20]) 41 | 42 | # =============== 43 | # Find librevenge 44 | # =============== 45 | PKG_CHECK_MODULES([REVENGE],[librevenge-0.0 >= 0.0.1]) 46 | AC_SUBST([REVENGE_CFLAGS]) 47 | AC_SUBST([REVENGE_LIBS]) 48 | 49 | 50 | # ===== 51 | # Tools 52 | # ===== 53 | AC_ARG_ENABLE([tools], 54 | [AS_HELP_STRING([--disable-tools], [Build conversion tools])], 55 | [enable_tools="$enableval"], 56 | [enable_tools=yes] 57 | ) 58 | AM_CONDITIONAL(BUILD_TOOLS, [test "x$enable_tools" = "xyes"]) 59 | AS_IF([test "x$enable_tools" = "xyes"], [need_stream=yes; need_generators=yes]) 60 | 61 | # ======= 62 | # Fuzzers 63 | # ======= 64 | AC_ARG_ENABLE([fuzzers], 65 | [AS_HELP_STRING([--enable-fuzzers], [Build fuzzer(s)])], 66 | [enable_fuzzers="$enableval"], 67 | [enable_fuzzers=no] 68 | ) 69 | AM_CONDITIONAL(BUILD_FUZZERS, [test "x$enable_fuzzers" = "xyes"]) 70 | AS_IF([test "x$enable_fuzzers" = "xyes"], [need_stream=yes; need_generators=yes]) 71 | 72 | AS_IF([test "x$need_stream" = "xyes"], [ 73 | PKG_CHECK_MODULES([REVENGE_STREAM],[librevenge-stream-0.0]) 74 | ]) 75 | AC_SUBST([REVENGE_STREAM_CFLAGS]) 76 | AC_SUBST([REVENGE_STREAM_LIBS]) 77 | 78 | AS_IF([test "x$need_generators" = "xyes"], [ 79 | PKG_CHECK_MODULES([REVENGE_GENERATORS],[librevenge-generators-0.0]) 80 | ]) 81 | AC_SUBST([REVENGE_GENERATORS_CFLAGS]) 82 | AC_SUBST([REVENGE_GENERATORS_LIBS]) 83 | 84 | # ========== 85 | # Find lcms2 86 | # ========== 87 | PKG_CHECK_MODULES([LCMS2],[lcms2]) 88 | AC_SUBST([LCMS2_CFLAGS]) 89 | AC_SUBST([LCMS_LIBS]) 90 | 91 | # ========= 92 | # Find zlib 93 | # ========= 94 | PKG_CHECK_MODULES([ZLIB],[zlib]) 95 | AC_SUBST(ZLIB_CFLAGS) 96 | AC_SUBST(ZLIB_LIBS) 97 | 98 | # ======== 99 | # Find icu 100 | # ======== 101 | PKG_CHECK_MODULES([ICU], [icu-i18n >= 75 icu-uc >= 75], 102 | [AX_CXX_COMPILE_STDCXX_17], 103 | [PKG_CHECK_MODULES([ICU], [icu-i18n])] 104 | ) 105 | AC_SUBST(ICU_CFLAGS) 106 | AC_SUBST(ICU_LIBS) 107 | 108 | 109 | # =========================== 110 | # Find required boost headers 111 | # =========================== 112 | 113 | AC_CHECK_HEADERS( 114 | boost/algorithm/string.hpp \ 115 | boost/cstdint.hpp \ 116 | boost/optional.hpp \ 117 | boost/property_tree/json_parser.hpp \ 118 | boost/property_tree/ptree.hpp \ 119 | boost/spirit/include/qi.hpp \ 120 | , 121 | [], 122 | [AC_MSG_ERROR(Required boost headers not found. Install boost >= 1.41.0)], 123 | [] 124 | ) 125 | 126 | # ================================= 127 | # Libtool/Version Makefile settings 128 | # ================================= 129 | AC_SUBST(CDR_MAJOR_VERSION, [libcdr_version_major]) 130 | AC_SUBST(CDR_MINOR_VERSION, [libcdr_version_minor]) 131 | AC_SUBST(CDR_MICRO_VERSION, [libcdr_version_micro]) 132 | AC_SUBST(CDR_VERSION, [libcdr_version]) 133 | # AC_SUBST(LT_RELEASE, [libcdr_version_major.libcdr_version_minor]) 134 | LT_CURRENT=`expr 100 '*' libcdr_version_major + libcdr_version_minor` 135 | # For 1.0.0 comment the first line and uncomment the second 136 | LT_AGE=0 137 | # LT_AGE=libcdr_version_minor 138 | AC_SUBST(LT_CURRENT) 139 | AC_SUBST(LT_REVISION, [libcdr_version_micro]) 140 | AC_SUBST(LT_AGE) 141 | 142 | # ========================== 143 | # Platform check for windows 144 | # ========================== 145 | AC_MSG_CHECKING([for native Win32]) 146 | AS_CASE([$host], 147 | [*-*-mingw*], [ 148 | native_win32=yes 149 | LIBCDR_WIN32_RESOURCE=libcdr-win32res.lo 150 | CDR2RAW_WIN32_RESOURCE=cdr2raw-win32res.lo 151 | CDR2TEXT_WIN32_RESOURCE=cdr2raw-win32res.lo 152 | CDR2XHTML_WIN32_RESOURCE=cdr2xhtml-win32res.lo 153 | CMX2RAW_WIN32_RESOURCE=cmx2raw-win32res.lo 154 | CMX2TEXT_WIN32_RESOURCE=cmx2raw-win32res.lo 155 | CMX2XHTML_WIN32_RESOURCE=cmx2xhtml-win32res.lo 156 | ], [ 157 | native_win32=no 158 | LIBCDR_WIN32_RESOURCE= 159 | CDR2RAW_WIN32_RESOURCE= 160 | CDR2TEXT_WIN32_RESOURCE= 161 | CDR2XHTML_WIN32_RESOURCE= 162 | CMX2RAW_WIN32_RESOURCE= 163 | CMX2TEXT_WIN32_RESOURCE= 164 | CMX2XHTML_WIN32_RESOURCE= 165 | ] 166 | ) 167 | AC_MSG_RESULT([$native_win32]) 168 | AM_CONDITIONAL(OS_WIN32, [test "x$native_win32" = "xyes"]) 169 | AC_SUBST(LIBCDR_WIN32_RESOURCE) 170 | AC_SUBST(CDR2RAW_WIN32_RESOURCE) 171 | AC_SUBST(CDR2TEXT_WIN32_RESOURCE) 172 | AC_SUBST(CDR2XHTML_WIN32_RESOURCE) 173 | AC_SUBST(CMX2RAW_WIN32_RESOURCE) 174 | AC_SUBST(CMX2TEXT_WIN32_RESOURCE) 175 | AC_SUBST(CMX2XHTML_WIN32_RESOURCE) 176 | 177 | AC_MSG_CHECKING([for Win32 platform in general]) 178 | AS_CASE([$host], 179 | [*-*-mingw*|*-*-cygwin*], [platform_win32=yes], 180 | [platform_win32=no] 181 | ) 182 | AC_MSG_RESULT([$platform_win32]) 183 | AM_CONDITIONAL([PLATFORM_WIN32], [test "x$platform_win32" = "xyes"]) 184 | 185 | AS_IF([test $platform_win32 = yes], 186 | [], 187 | [ 188 | AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) 189 | saved_CXXFLAGS="$CXXFLAGS" 190 | CXXFLAGS="$CXXFLAGS -fvisibility=hidden" 191 | AC_TRY_COMPILE([], [], [have_visibility=yes], [have_visibility=no]) 192 | AC_MSG_RESULT([$have_visibility]) 193 | CXXFLAGS="$saved_CXXFLAGS" 194 | AX_GCC_FUNC_ATTRIBUTE([visibility]) 195 | ] 196 | ) 197 | AM_CONDITIONAL([HAVE_VISIBILITY], [ 198 | test x"$have_visibility" = xyes && test x"$ax_cv_have_func_attribute_visibility" = xyes]) 199 | 200 | # ================ 201 | # Check for cflags 202 | # ================ 203 | AC_ARG_ENABLE([werror], 204 | [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development])], 205 | [enable_werror="$enableval"], 206 | [enable_werror=no] 207 | ) 208 | AS_IF([test x"$enable_werror" != "xno"], [ 209 | CFLAGS="$CFLAGS -Werror" 210 | CXXFLAGS="$CXXFLAGS -Werror" 211 | ]) 212 | AC_ARG_ENABLE([weffc], 213 | [AS_HELP_STRING([--disable-weffc], [ Disable -Weffc++ warnings, useful when using an old version of gcc or of boost])], 214 | [enable_weffc="$enableval"], 215 | [enable_weffc=yes] 216 | ) 217 | AC_ARG_ENABLE([wparanoic], 218 | [AS_HELP_STRING([--enable-wparanoic], [Enable a lot of warnings...])], 219 | [enable_wparanoic="$enableval"], 220 | [enable_wparanoic=no] 221 | ) 222 | # Courtesy of Glib: Ensure MSVC-compatible struct packing convention 223 | # is used when compiling for Win32 with gcc. 224 | AS_IF([test "x$native_win32" = "xyes"], [ 225 | AC_CHECK_TOOL(WINDRES, windres) 226 | AS_IF([test x"$GCC" = xyes], [ 227 | AC_MSG_CHECKING([how to get MSVC-compatible struct packing]) 228 | AS_IF([test -z "$ac_cv_prog_CC"], [ 229 | our_gcc="$CC" 230 | ], [ 231 | our_gcc="$ac_cv_prog_CC" 232 | ]) 233 | AS_IF([$our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null], [ 234 | msnative_struct="-mms-bitfields" 235 | CFLAGS="$CFLAGS $msnative_struct" 236 | CXXFLAGS="$CXXFLAGS $msnative_struct" 237 | AC_MSG_RESULT([${msnative_struct}]) 238 | ], [ 239 | AC_MSG_RESULT([no way]) 240 | AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code]) 241 | ]) 242 | ]) 243 | CFLAGS="$CFLAGS -Wall -Wextra -pedantic" 244 | CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wshadow -pedantic" 245 | ], [ 246 | AS_IF([test x"$GCC" = xyes], [ 247 | # Be tough with warnings and produce less careless code 248 | CFLAGS="$CFLAGS -Wall -Wextra -pedantic" 249 | CXXFLAGS="$CXXFLAGS -Wall -Wextra -pedantic -Wshadow -Wunused-variable" 250 | AS_IF([test x"$enable_weffc" != "xno"], [ 251 | CXXFLAGS="$CXXFLAGS -Weffc++" 252 | ]) 253 | AS_IF([test x"$enable_wparanoic" != "xno"], [ 254 | CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wchar-subscripts" 255 | CXXFLAGS="$CXXFLAGS -Wcomment -Wconversion -Wdisabled-optimization" 256 | CXXFLAGS="$CXXFLAGS -Wfloat-equal -Wformat -Wformat=2" 257 | CXXFLAGS="$CXXFLAGS -Wformat-nonliteral -Wformat-security" 258 | CXXFLAGS="$CXXFLAGS -Wformat-y2k -Wimport -Winit-self -Winvalid-pch" 259 | CXXFLAGS="$CXXFLAGS -Wmissing-braces -Wmissing-field-initializers" 260 | CXXFLAGS="$CXXFLAGS -Wmissing-format-attribute -Wmissing-include-dirs" 261 | CXXFLAGS="$CXXFLAGS -Wmissing-noreturn -Wpacked -Wparentheses" 262 | CXXFLAGS="$CXXFLAGS -Wpointer-arith -Wredundant-decls -Wreturn-type" 263 | CXXFLAGS="$CXXFLAGS -Wsequence-point -Wsign-compare -Wstrict-aliasing" 264 | CXXFLAGS="$CXXFLAGS -Wstrict-aliasing=2 -Wswitch -Wswitch-default" 265 | CXXFLAGS="$CXXFLAGS -Wtrigraphs -Wunknown-pragmas -Wunused" 266 | CXXFLAGS="$CXXFLAGS -Wunused-function -Wunused-label -Wunused-parameter" 267 | CXXFLAGS="$CXXFLAGS -Wunused-value -Wvariadic-macros" 268 | CXXFLAGS="$CXXFLAGS -Wvolatile-register-var -Wwrite-strings" 269 | ]) 270 | ]) 271 | ]) 272 | AC_SUBST(DEBUG_CXXFLAGS) 273 | 274 | # ============ 275 | # Debug switch 276 | # ============ 277 | AC_ARG_ENABLE([debug], 278 | [AS_HELP_STRING([--enable-debug], [Turn on debugging])], 279 | [enable_debug="$enableval"], 280 | [enable_debug=no] 281 | ) 282 | AS_IF([test "x$enable_debug" = "xyes"], [ 283 | DEBUG_CXXFLAGS="-DDEBUG -g" 284 | CXXFLAGS="$CXXFLAGS -O0" 285 | CFLAGS="$CFLAGS -O0" 286 | ], [ 287 | DEBUG_CXXFLAGS="-DNDEBUG" 288 | ]) 289 | AC_SUBST(DEBUG_CXXFLAGS) 290 | 291 | # ========== 292 | # Unit tests 293 | # ========== 294 | AC_ARG_ENABLE([tests], 295 | [AS_HELP_STRING([--enable-tests], [Build and run unit tests])], 296 | [enable_tests="$enableval"], 297 | [enable_tests=yes] 298 | ) 299 | AS_IF([test "x$enable_tests" = "xyes"], [ 300 | PKG_CHECK_MODULES([CPPUNIT], [cppunit]) 301 | ], []) 302 | AC_SUBST([CPPUNIT_CFLAGS]) 303 | AC_SUBST([CPPUNIT_LIBS]) 304 | AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" = "xyes"]) 305 | AS_IF([test "x$enable_tests" = "xyes"], [need_stream=yes]) 306 | 307 | # ============= 308 | # Documentation 309 | # ============= 310 | AC_ARG_WITH(docs, 311 | [AS_HELP_STRING([--without-docs], [Do not build documentation])], 312 | [with_docs="$withval"], 313 | [AS_IF([test "x$native_win32" = "xyes"], [with_docs=no], [with_docs=yes])] 314 | ) 315 | AS_IF([test "x$with_docs" != "xno"], [ 316 | AC_PATH_PROG(DOXYGEN, [doxygen]) 317 | AS_IF([test -z "$DOXYGEN"], [ 318 | AC_MSG_WARN([*** Could not find doxygen in your PATH.]) 319 | AC_MSG_WARN([*** The documentation will not be built.]) 320 | build_docs=no 321 | ], [build_docs=yes]) 322 | ], [build_docs=no]) 323 | AM_CONDITIONAL([WITH_LIBCDR_DOCS], [test "x$build_docs" != "xno"]) 324 | 325 | # ===================== 326 | # Prepare all .in files 327 | # ===================== 328 | AC_CONFIG_FILES([ 329 | Makefile 330 | inc/Makefile 331 | inc/libcdr/Makefile 332 | src/Makefile 333 | src/conv/Makefile 334 | src/conv/raw/Makefile 335 | src/conv/raw/cdr2raw.rc 336 | src/conv/raw/cmx2raw.rc 337 | src/conv/svg/Makefile 338 | src/conv/svg/cdr2xhtml.rc 339 | src/conv/svg/cmx2xhtml.rc 340 | src/conv/text/Makefile 341 | src/conv/text/cdr2text.rc 342 | src/conv/text/cmx2text.rc 343 | src/fuzz/Makefile 344 | src/lib/Makefile 345 | src/lib/libcdr.rc 346 | src/test/Makefile 347 | build/Makefile 348 | build/win32/Makefile 349 | docs/Makefile 350 | docs/doxygen/Makefile 351 | libcdr-$CDR_MAJOR_VERSION.$CDR_MINOR_VERSION.pc:libcdr.pc.in 352 | libcdr.spec 353 | libcdr-zip 354 | ]) 355 | AC_OUTPUT 356 | 357 | # ============================================== 358 | # Display final informations about configuration 359 | # ============================================== 360 | AC_MSG_NOTICE([ 361 | ============================================================================== 362 | Build configuration: 363 | debug: ${enable_debug} 364 | docs: ${build_docs} 365 | fuzzers: ${enable_fuzzers} 366 | tests: ${enable_tests} 367 | tools: ${enable_tools} 368 | werror: ${enable_werror} 369 | ============================================================================== 370 | ]) 371 | -------------------------------------------------------------------------------- /createBuildNumber.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # ***** BEGIN LICENSE BLOCK ***** 3 | # Version: LGPL 2.1 4 | # 5 | # The Original Code is Mozilla Calendar Code. 6 | # 7 | # Copyright (C) 2002 Christopher S. Charabaruk (ccharabaruk@meldstar.com). 8 | # Copyright (C) 2004 Fridrich Strba (fridrich.strba@bluewin.ch). 9 | # All Rights Reserved. 10 | # 11 | # This program is free software; you can redistribute it and/or 12 | # modify it under the terms of the GNU Lesser General Public 13 | # License as published by the Free Software Foundation; either 14 | # version 2 of the License, or (at your option) any later version. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | # Library General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU Library General Public 22 | # License along with this library; if not, write to the Free Software 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | # 25 | # For further information visit http://librevenge.sourceforge.net 26 | # 27 | # 28 | # "This product is not manufactured, approved, or supported by 29 | # Corel Corporation or Corel Corporation Limited." 30 | # 31 | # ***** END LICENSE BLOCK ***** 32 | 33 | # create a build id to be used by build/win32/compile-resource 34 | @timevars = localtime(time); 35 | $buildid = sprintf("%1.1d%.2d%.2d", ($timevars[5] - 100) , ($timevars[4] + 1) , $timevars[3]); 36 | 37 | #print our build id 38 | print $buildid . "\n"; 39 | 40 | foreach $file (@ARGV) 41 | { 42 | # print filename 43 | print "Working on " . $file . "\n"; 44 | 45 | open(OUT,">" . $file) or die "cannot open " . $file . "-temp for write\n"; 46 | print OUT $buildid . "\n"; 47 | close (OUT); 48 | } 49 | 50 | print "All done!\n"; 51 | -------------------------------------------------------------------------------- /docs/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = doxygen 2 | -------------------------------------------------------------------------------- /docs/doxygen/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | html 4 | -------------------------------------------------------------------------------- /docs/doxygen/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = doxygen.cfg \ 2 | footer.html.in \ 3 | header.html.in 4 | 5 | if WITH_LIBCDR_DOCS 6 | 7 | install-data-am: 8 | mkdir -p $(DESTDIR)$(docdir)/html 9 | $(INSTALL_DATA) html/*.html $(DESTDIR)$(docdir)/html/ 10 | $(INSTALL_DATA) html/*.png $(DESTDIR)$(docdir)/html/ 11 | $(INSTALL_DATA) html/*.css $(DESTDIR)$(docdir)/html/ 12 | 13 | uninstall-am: 14 | -rm -rf $(DESTDIR)$(docdir)/html 15 | 16 | all: 17 | test -f header.html.in || $(LN_S) $(srcdir)/header.html.in ./ 18 | test -f footer.html.in || $(LN_S) $(srcdir)/footer.html.in ./ 19 | doxygen $(srcdir)/doxygen.cfg 20 | 21 | else 22 | 23 | all: 24 | 25 | endif 26 | 27 | distclean-local: clean-local 28 | 29 | clean-local: 30 | rm -rf html 31 | -------------------------------------------------------------------------------- /docs/doxygen/footer.html.in: -------------------------------------------------------------------------------- 1 |
2 | Generated for $projectname by 3 | doxygen $doxygenversion
4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/doxygen/header.html.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | $title documentation 4 | 5 | 6 | -------------------------------------------------------------------------------- /inc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = libcdr 2 | -------------------------------------------------------------------------------- /inc/libcdr/CDRDocument.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * This file is part of the libcdr project. 4 | * 5 | * This Source Code Form is subject to the terms of the Mozilla Public 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | */ 9 | 10 | #ifndef __CDRDOCUMENT_H__ 11 | #define __CDRDOCUMENT_H__ 12 | 13 | #include 14 | #include "libcdr_api.h" 15 | 16 | namespace libcdr 17 | { 18 | class CDRDocument 19 | { 20 | public: 21 | 22 | static CDRAPI bool isSupported(librevenge::RVNGInputStream *input); 23 | 24 | static CDRAPI bool parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter); 25 | }; 26 | 27 | } // namespace libcdr 28 | 29 | #endif // __CDRDOCUMENT_H__ 30 | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ 31 | -------------------------------------------------------------------------------- /inc/libcdr/CMXDocument.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * This file is part of the libcdr project. 4 | * 5 | * This Source Code Form is subject to the terms of the Mozilla Public 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | */ 9 | 10 | #ifndef __CMXDOCUMENT_H__ 11 | #define __CMXDOCUMENT_H__ 12 | 13 | #include 14 | #include "libcdr_api.h" 15 | 16 | namespace libcdr 17 | { 18 | class CMXDocument 19 | { 20 | public: 21 | 22 | static CDRAPI bool isSupported(librevenge::RVNGInputStream *input); 23 | 24 | static CDRAPI bool parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter); 25 | }; 26 | 27 | } // namespace libcdr 28 | 29 | #endif // __CMXDOCUMENT_H__ 30 | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ 31 | -------------------------------------------------------------------------------- /inc/libcdr/Makefile.am: -------------------------------------------------------------------------------- 1 | libcdrdir = $(includedir)/libcdr-$(CDR_MAJOR_VERSION).$(CDR_MINOR_VERSION)/libcdr 2 | 3 | dist_libcdr_HEADERS = \ 4 | libcdr.h \ 5 | libcdr_api.h \ 6 | CDRDocument.h \ 7 | CMXDocument.h 8 | -------------------------------------------------------------------------------- /inc/libcdr/libcdr.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * This file is part of the libcdr project. 4 | * 5 | * This Source Code Form is subject to the terms of the Mozilla Public 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | */ 9 | 10 | #ifndef __LIBCDR_H__ 11 | #define __LIBCDR_H__ 12 | 13 | #include "CDRDocument.h" 14 | #include "CMXDocument.h" 15 | 16 | #endif 17 | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ 18 | -------------------------------------------------------------------------------- /inc/libcdr/libcdr_api.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * This file is part of the libcdr project. 4 | * 5 | * This Source Code Form is subject to the terms of the Mozilla Public 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | */ 9 | 10 | #ifndef __LIBCDR_API_H__ 11 | #define __LIBCDR_API_H__ 12 | 13 | #ifdef DLL_EXPORT 14 | #ifdef LIBCDR_BUILD 15 | #define CDRAPI __declspec(dllexport) 16 | #else 17 | #define CDRAPI __declspec(dllimport) 18 | #endif 19 | #else // !DLL_EXPORT 20 | #ifdef LIBCDR_VISIBILITY 21 | #define CDRAPI __attribute__((visibility("default"))) 22 | #else 23 | #define CDRAPI 24 | #endif 25 | #endif 26 | 27 | #endif 28 | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ 29 | -------------------------------------------------------------------------------- /libcdr-zip.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Build runtime and developer zipfiles for libcdr on Win32. 4 | 5 | ZIP=libcdr-@CDR_VERSION@-MinGW.zip 6 | DEVZIP=libcdr-devel-@CDR_VERSION@-MinGW.zip 7 | TOOLSZIP=libcdr-tools-@CDR_VERSION@.zip 8 | 9 | cd $DESTDIR@prefix@ 10 | 11 | DLLDIR=lib 12 | [ -f bin/libcdr-@CDR_MAJOR_VERSION@.@CDR_MINOR_VERSION@.dll ] && \ 13 | DLLDIR=bin 14 | 15 | @STRIP@ --strip-all \ 16 | $DLLDIR/libcdr-@CDR_MAJOR_VERSION@.@CDR_MINOR_VERSION@.dll \ 17 | bin/cdr2raw.exe \ 18 | bin/cdr2text.exe \ 19 | bin/cdr2xhtml.exe \ 20 | bin/cmx2raw.exe \ 21 | bin/cmx2text.exe \ 22 | bin/cmx2xhtml.exe 23 | 24 | upx -qqq --best \ 25 | $DLLDIR/libcdr-@CDR_MAJOR_VERSION@.@CDR_MINOR_VERSION@.dll \ 26 | bin/cdr2raw.exe \ 27 | bin/cdr2text.exe \ 28 | bin/cdr2xhtml.exe \ 29 | bin/cmx2raw.exe \ 30 | bin/cmx2text.exe \ 31 | bin/cmx2xhtml.exe 32 | 33 | rm -f $ZIP 34 | zip -q -r $ZIP -@ <= 0.9.0, gcc-c++, libstdc++-devel, pkgconfig >= 0.9.0 15 | License: MPL-2.0 16 | Prefix: %{prefix} 17 | 18 | %description 19 | libcdr is a library for reading and converting CDR images 20 | 21 | %package tools 22 | Requires: libcdr 23 | Summary: Tools to convert CDR images into other formats 24 | Group: Applications/Publishing 25 | 26 | %description tools 27 | Tools to convert CDR images into other formats. 28 | Currently supported: raw svg 29 | 30 | %package devel 31 | Requires: %{name} >= %{version} 32 | Requires: librevenge-devel >= 0.9.0 33 | Summary: Files for developing with libcdr. 34 | Group: Development/Libraries 35 | 36 | %description devel 37 | Includes and definitions for developing with libcdr. 38 | 39 | %if %{!?_without_docs:1}%{?_without_docs:0} 40 | %package docs 41 | Requires: %{name} >= %{version} 42 | BuildRequires: doxygen 43 | Summary: Documentation of libcdr API 44 | Group: Development/Documentation 45 | 46 | %description docs 47 | Documentation of libcdr API for developing with libcdr 48 | %endif 49 | 50 | %prep 51 | %__rm -rf $RPM_BUILD_ROOT 52 | 53 | %setup -q -n %{name}-%{version} 54 | 55 | %build 56 | %configure --prefix=%{_prefix} --libdir=%{_libdir} \ 57 | %{?_with_debug:--enable-debug} \ 58 | 59 | %__make 60 | 61 | %install 62 | umask 022 63 | 64 | %__make DESTDIR=$RPM_BUILD_ROOT install 65 | %__rm -rf $RPM_BUILD_ROOT/%{_libdir}/libcdr*.la 66 | 67 | %clean 68 | %__rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/file.list.%{name} 69 | 70 | %files 71 | %defattr(644,root,root,755) 72 | %{_libdir}/libcdr*.so.* 73 | %doc ChangeLog README COPYING AUTHORS 74 | 75 | %files tools 76 | %defattr(755,root,root,755) 77 | %{_bindir}/cdr2* 78 | %{_bindir}/cmx2* 79 | 80 | %files devel 81 | %defattr(644,root,root,755) 82 | %{_libdir}/libcdr*.so 83 | %{_libdir}/pkgconfig/libcdr*.pc 84 | %{_includedir}/libcdr-@CDR_MAJOR_VERSION@.@CDR_MINOR_VERSION@/libcdr 85 | 86 | %if %{!?_without_docs:1}%{?_without_docs:0} 87 | %files docs 88 | %{_datadir}/* 89 | %endif 90 | 91 | %changelog 92 | * Fri Apr 20 2007 Fridrich Strba 93 | - Add documentation packaging 94 | - Make doc and stream optional 95 | 96 | * Tue Jan 27 2004 Fridrich Strba 97 | - Create rpm spec according to the rpm spec of libwpD 98 | - of Rui M. Seabra 99 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | libtool.m4 2 | lt*.m4 3 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_11.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++11 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++11. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2008 Benjamin Kosnik 25 | # Copyright (c) 2012 Zack Weinberg 26 | # Copyright (c) 2013 Roy Stogner 27 | # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov 28 | # Copyright (c) 2015 Paul Norman 29 | # Copyright (c) 2015 Moritz Klammler 30 | # 31 | # Copying and distribution of this file, with or without modification, are 32 | # permitted in any medium without royalty provided the copyright notice 33 | # and this notice are preserved. This file is offered as-is, without any 34 | # warranty. 35 | 36 | #serial 18 37 | 38 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 39 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) 40 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_17.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_17.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_17([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++17 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++17. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2015 Moritz Klammler 25 | # Copyright (c) 2016 Krzesimir Nowak 26 | # 27 | # Copying and distribution of this file, with or without modification, are 28 | # permitted in any medium without royalty provided the copyright notice 29 | # and this notice are preserved. This file is offered as-is, without any 30 | # warranty. 31 | 32 | #serial 2 33 | 34 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 35 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_17], [AX_CXX_COMPILE_STDCXX([17], [$1], [$2])]) 36 | -------------------------------------------------------------------------------- /m4/ax_gcc_func_attribute.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) 8 | # 9 | # DESCRIPTION 10 | # 11 | # This macro checks if the compiler supports one of GCC's function 12 | # attributes; many other compilers also provide function attributes with 13 | # the same syntax. Compiler warnings are used to detect supported 14 | # attributes as unsupported ones are ignored by default so quieting 15 | # warnings when using this macro will yield false positives. 16 | # 17 | # The ATTRIBUTE parameter holds the name of the attribute to be checked. 18 | # 19 | # If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. 20 | # 21 | # The macro caches its result in the ax_cv_have_func_attribute_ 22 | # variable. 23 | # 24 | # The macro currently supports the following function attributes: 25 | # 26 | # alias 27 | # aligned 28 | # alloc_size 29 | # always_inline 30 | # artificial 31 | # cold 32 | # const 33 | # constructor 34 | # constructor_priority for constructor attribute with priority 35 | # deprecated 36 | # destructor 37 | # dllexport 38 | # dllimport 39 | # error 40 | # externally_visible 41 | # fallthrough 42 | # flatten 43 | # format 44 | # format_arg 45 | # gnu_format 46 | # gnu_inline 47 | # hot 48 | # ifunc 49 | # leaf 50 | # malloc 51 | # noclone 52 | # noinline 53 | # nonnull 54 | # noreturn 55 | # nothrow 56 | # optimize 57 | # pure 58 | # sentinel 59 | # sentinel_position 60 | # unused 61 | # used 62 | # visibility 63 | # warning 64 | # warn_unused_result 65 | # weak 66 | # weakref 67 | # 68 | # Unsupported function attributes will be tested with a prototype 69 | # returning an int and not accepting any arguments and the result of the 70 | # check might be wrong or meaningless so use with care. 71 | # 72 | # LICENSE 73 | # 74 | # Copyright (c) 2013 Gabriele Svelto 75 | # 76 | # Copying and distribution of this file, with or without modification, are 77 | # permitted in any medium without royalty provided the copyright notice 78 | # and this notice are preserved. This file is offered as-is, without any 79 | # warranty. 80 | 81 | #serial 13 82 | 83 | AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ 84 | AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) 85 | 86 | AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ 87 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ 88 | m4_case([$1], 89 | [alias], [ 90 | int foo( void ) { return 0; } 91 | int bar( void ) __attribute__(($1("foo"))); 92 | ], 93 | [aligned], [ 94 | int foo( void ) __attribute__(($1(32))); 95 | ], 96 | [alloc_size], [ 97 | void *foo(int a) __attribute__(($1(1))); 98 | ], 99 | [always_inline], [ 100 | inline __attribute__(($1)) int foo( void ) { return 0; } 101 | ], 102 | [artificial], [ 103 | inline __attribute__(($1)) int foo( void ) { return 0; } 104 | ], 105 | [cold], [ 106 | int foo( void ) __attribute__(($1)); 107 | ], 108 | [const], [ 109 | int foo( void ) __attribute__(($1)); 110 | ], 111 | [constructor_priority], [ 112 | int foo( void ) __attribute__((__constructor__(65535/2))); 113 | ], 114 | [constructor], [ 115 | int foo( void ) __attribute__(($1)); 116 | ], 117 | [deprecated], [ 118 | int foo( void ) __attribute__(($1(""))); 119 | ], 120 | [destructor], [ 121 | int foo( void ) __attribute__(($1)); 122 | ], 123 | [dllexport], [ 124 | __attribute__(($1)) int foo( void ) { return 0; } 125 | ], 126 | [dllimport], [ 127 | int foo( void ) __attribute__(($1)); 128 | ], 129 | [error], [ 130 | int foo( void ) __attribute__(($1(""))); 131 | ], 132 | [externally_visible], [ 133 | int foo( void ) __attribute__(($1)); 134 | ], 135 | [fallthrough], [ 136 | void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }}; 137 | ], 138 | [flatten], [ 139 | int foo( void ) __attribute__(($1)); 140 | ], 141 | [format], [ 142 | int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); 143 | ], 144 | [gnu_format], [ 145 | int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2))); 146 | ], 147 | [format_arg], [ 148 | char *foo(const char *p) __attribute__(($1(1))); 149 | ], 150 | [gnu_inline], [ 151 | inline __attribute__(($1)) int foo( void ) { return 0; } 152 | ], 153 | [hot], [ 154 | int foo( void ) __attribute__(($1)); 155 | ], 156 | [ifunc], [ 157 | int my_foo( void ) { return 0; } 158 | static int (*resolve_foo(void))(void) { return my_foo; } 159 | int foo( void ) __attribute__(($1("resolve_foo"))); 160 | ], 161 | [leaf], [ 162 | __attribute__(($1)) int foo( void ) { return 0; } 163 | ], 164 | [malloc], [ 165 | void *foo( void ) __attribute__(($1)); 166 | ], 167 | [noclone], [ 168 | int foo( void ) __attribute__(($1)); 169 | ], 170 | [noinline], [ 171 | __attribute__(($1)) int foo( void ) { return 0; } 172 | ], 173 | [nonnull], [ 174 | int foo(char *p) __attribute__(($1(1))); 175 | ], 176 | [noreturn], [ 177 | void foo( void ) __attribute__(($1)); 178 | ], 179 | [nothrow], [ 180 | int foo( void ) __attribute__(($1)); 181 | ], 182 | [optimize], [ 183 | __attribute__(($1(3))) int foo( void ) { return 0; } 184 | ], 185 | [pure], [ 186 | int foo( void ) __attribute__(($1)); 187 | ], 188 | [sentinel], [ 189 | int foo(void *p, ...) __attribute__(($1)); 190 | ], 191 | [sentinel_position], [ 192 | int foo(void *p, ...) __attribute__(($1(1))); 193 | ], 194 | [returns_nonnull], [ 195 | void *foo( void ) __attribute__(($1)); 196 | ], 197 | [unused], [ 198 | int foo( void ) __attribute__(($1)); 199 | ], 200 | [used], [ 201 | int foo( void ) __attribute__(($1)); 202 | ], 203 | [visibility], [ 204 | int foo_def( void ) __attribute__(($1("default"))); 205 | int foo_hid( void ) __attribute__(($1("hidden"))); 206 | int foo_int( void ) __attribute__(($1("internal"))); 207 | int foo_pro( void ) __attribute__(($1("protected"))); 208 | ], 209 | [warning], [ 210 | int foo( void ) __attribute__(($1(""))); 211 | ], 212 | [warn_unused_result], [ 213 | int foo( void ) __attribute__(($1)); 214 | ], 215 | [weak], [ 216 | int foo( void ) __attribute__(($1)); 217 | ], 218 | [weakref], [ 219 | static int foo( void ) { return 0; } 220 | static int bar( void ) __attribute__(($1("foo"))); 221 | ], 222 | [ 223 | m4_warn([syntax], [Unsupported attribute $1, the test may fail]) 224 | int foo( void ) __attribute__(($1)); 225 | ] 226 | )], []) 227 | ], 228 | dnl GCC doesn't exit with an error if an unknown attribute is 229 | dnl provided but only outputs a warning, so accept the attribute 230 | dnl only if no warning were issued. 231 | [AS_IF([grep -- -Wattributes conftest.err], 232 | [AS_VAR_SET([ac_var], [no])], 233 | [AS_VAR_SET([ac_var], [yes])])], 234 | [AS_VAR_SET([ac_var], [no])]) 235 | ]) 236 | 237 | AS_IF([test yes = AS_VAR_GET([ac_var])], 238 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, 239 | [Define to 1 if the system has the `$1' function attribute])], []) 240 | 241 | AS_VAR_POPDEF([ac_var]) 242 | ]) 243 | -------------------------------------------------------------------------------- /m4/dlp_fallthrough.m4: -------------------------------------------------------------------------------- 1 | # 2 | # SYNOPSIS 3 | # 4 | # DLP_FALLTHROUGH 5 | # 6 | # DESCRIPTION 7 | # 8 | # This macro checks if the compiler supports a fallthrough warning 9 | # suppression attribute in GCC or CLANG style. 10 | # 11 | # If a fallthrough warning suppression attribute is supported define 12 | # HAVE_