Developers

alonso laurent

Developers

Getting the sources

libmwaw sources are stored in git. To get them, you can use:

git clone git://git.code.sf.net/p/libmwaw/libmwaw libmwaw

or you can browse the code ( https://sourceforge.net/p/libmwaw/libmwaw/ci/master/tree/ ).

Building it

Dependencies

You will need these applications in order to compile libmwaw:

Once the source has been checked out, libmwaw can be built in usual manner:

cd libmwaw
./autogen.sh
./configure
make
make install

Finally, if you want also to create ODF documents, you need:

Contributing

Once you have done a change that you are happy with, and that builds with libmwaw, contribute it back, we'll be happy to integrate it! All you need to do is to send us a patch. The followning commands will commit the changes to your local repository and create one or more patch files. You can send these as a ticket( https://sourceforge.net/p/libmwaw/tickets/ ).

git commit -a
git format-patch origin/master

Fuzzing

On OSX or on Linux, the simpler method is probably to install afl http://lcamtuf.coredump.cx/afl/ . Then you can recompile libmwaw using:

CXX=PATH_TO_AFL/afl-g++ ./configure [--with-sharedptr=boost|c++11|tr1]
make clean all install

or if you compile with clang:

CXX=PATH_TO_AFL/afl-clang++ ./configure [--with-sharedptr=boost|c++11|tr1]
make clean all install

the next step consists in regrouping a list of test files in some directory (for instance input) ; finally, you can launch the afl-fuzz:

afl-fuzz -i input -o output mwaw2raw @@

Emscripten

On OSX, the creation of the libraries seems to work while the creation of the executables is still not supported,
ie. after installing Emscripten from http://emscripten.org and creating a zlib's javascript version: https://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#using-libraries in /usr/local/em,
I am able to compile, librevenge, libmwaw, libodfgen by

  emconfigure ./configure PKG_CONFIG_LIBDIR=/usr/local/em/lib/pkgconfig/ [OPTIONS] --prefix=/usr/local/em/
  emmake make clean all
  sudo emmake make install

which creates a byte code version of the corresponding libraries and install them in /usr/local/em/.

Then I begin to compile writerperfect:

  emconfigure ./configure PKG_CONFIG_LIBDIR=/usr/local/em/lib/pkgconfig/ [OPTIONS] --prefix=/usr/local/em/
  emmake make clean all

To compile a final executable, I do that by hand, ie. I update mwaw2odf.cxx (see https://sourceforge.net/projects/libmwaw/files/testEmscriptenCompilation/) and I compile with:

  EMDIR=/usr/local/em/
  WRITERDIR=~/sources/libwpd-rw.git/writerperfect
  em++ -O2 -DSHAREDPTR_STD -DDEFINE_GETXATTR -I $WRITERDIR/lib -I $WRITERDIR/conv/odf -I$EMDIR/include/librevenge-0.0 -s DEMANGLE_SUPPORT=1 -L$EMDIR/lib -llibmwaw-0.3 -llibodfgen-0.1 -llibrevenge-0.0 -llibrevenge-stream-0.0 -llibz mwaw2odf.cxx -L$WRITERDIR/conv/odf/.libs -llibodfhelper -llibodfmwaw -L$WRITERDIR/lib/.libs -llibwriterperfect_internal -s EXPORTED_FUNCTIONS='["_main","_callConversion"]' -o mwaw2odf.js

Finally, I copy in the final repository:

Debug Tools (low level)

In general, I add --enable-full-debug to the configure's options. Then when parsing a file, libmwaw creates some *.ascii files(1) in the current directory which looked like:

...
00008c [Entries(Windows)[Footer]: sel=[1x0-1x0],pageNumberPos=-14x30,datePos=-14x236,timePos=-14x442,actFont=-1,f0=true,f1=true,flg=-1]000100000001000000000000fff2001efff200ecfff201baffffffffff00ffffffff
0000ae [Entries(Windows)[Header]: sel=[2x10-2x13],pageNumberPos=54x98,datePos=54x138,timePos=54x319,actFont=-1,f0=true,f1=true,flg=-1]0002000a0002000d00000000003600620036008a0036013fffffffffff00ffffffff
0000d0 [Entries(Windows): sel=[1x0-1x0],pageNumberPos=-14x30,datePos=-14x236,timePos=-14x442,actFont=12,flg=1]000100000001000000000000fff2001efff200ecfff201baffffffffff000c000001
0000f2 [Entries(Information)[1]:indent,Pos=(0x32)x(0x32)(pt),unkn1=2d36,unkn2=f0,]00000020002d36f0
0000fa [Entries(Information)[2]:text,Pos=(0x32)x(0x48)(pt),height=16,unkn1=2d36,unkn2=e8,]00100020002d36e8
000102 [_Entries(Information)[1]:indent,Pos=(0x0)x(0x0)(pt),unkn1=2d36,unkn2=c8,]00000000002d36c8
00010a [Entries(Information)[2]:text,Pos=(0x0)x(0x16)(pt),height=16,unkn1=2d36,unkn2=c0,]00100000002d36c0
000112 [Entries(Information)[3]:text,Pos=(0x16)x(0x32)(pt),height=16,unkn1=2d35,unkn2=74,]00100010002d3574
00011a [_Entries(Information)[1]:indent,Pos=(0x0)x(0x0)(pt),unkn1=2d36,unkn2=a0,]00000000002d36a0
000122 [Entries(Information)[2]:text,Pos=(0x0)x(0x16)(pt),height=16,unkn1=2d36,unkn2=98,]00100000002d3698
00012a [_Entries(Paragraph):leftMarg=0.125,rightMarg=1.13889,tabs=(5L,),]00000022000a01e000010000000a016819520000000000000040000000000156020000000018
000150 [Entries(Text):'',f0=[pos=0,font=[nam='',sz=12,]]]0001000e0000000600000c000001
00015e [Entries(LineHeight)[-1-1]:16]00011023
...

where each line begins with the file position's, then between [] the data which have been recognized and finally the hexadecimal code of the data.

(1) and some pct, ... files.

BEWARE: this can create a big list of files

Then I use a script which looks like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
test -d entriesGW || mkdir entriesGW
for i in 1WP 1DB 1Graph 1SP 2WP 2DB 2Graph 2SP ; do
    resDir=entriesGW/$i
    test -d "$resDir" || mkdir "$resDir"
    rm "$resDir"/*
    for j in ~/MyDocuments/GreatWorks/$i/* ; do
        rm *ascii
        echo "-----------$j----------"
        mwaw2odf "$j" tt.odt
        if grep Entries *ascii >& /dev/null ; then
            for k in  `cut -c-100 *ascii|sed -e'/Entries/!d;s/.*Entries(\([^)]*\)).*/\1/1'|sort -u`; do
                echo $j >> "$resDir/$k"
                if [ $k != "TEXT" ]; then
                    echo $j >> "$resDir/$k.data"
                    grep $k *ascii | grep -v TEXT >> "$resDir/$k.data"
                fi
            done
        fi
        if grep FileHeader *.ascii >& /dev/null ; then
            echo $j >> "$resDir/FileHeader"
            grep FileHeader *.ascii >> "$resDir/FileHeader"
        fi
    done
done

to parse some list of files and to regroup the data which shared the same type...

BEWARE: this code erases all *.ascii files in the current repository, so BE SURE to launch it in a empty repository or in a repository which does not contain any *.ascii files that you want to keep.

Contact

You can get in touch with us:

Project Admins:


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks