gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ./ChangeLog libbase/Makefile.am libbase/t...


From: Rob Savoye
Subject: [Gnash-commit] gnash ./ChangeLog libbase/Makefile.am libbase/t...
Date: Sat, 11 Mar 2006 19:24:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         
Changes by:     Rob Savoye <address@hidden>     06/03/11 19:24:27

Modified files:
        .              : ChangeLog 
        libbase        : Makefile.am tu_file.cpp tu_file.h 
        server         : Makefile.am impl.cpp xml.cpp 
        utilities      : Makefile.am parser.cpp processor.cpp 
Added files:
        libbase        : log.cpp log.h 
Removed files:
        server         : log.cpp log.h 

Log message:
        * utilities/Makefile.am: Add libxml flags and libs.
        * utilities/parser.cpp: Use getopt for processing command line
        arguments. Reindent to project coding standards. Add GNU standard
        options. Use new logging system, delete the old one.
        * utilities/processor.cpp: Use getopt for processing command line
        arguments. Reindent to project coding standards. Add GNU standard
        options. Use new logging system, delete the old one.
        * backend/gnash.cpp: Use getopt for processing command line
        arguments. Add GNU standard options. Use new logging system,
        delete the old one.
        * libbase/tu_file.h: Reformat to be more readable.
        * libbase/tu_file.cpp: Reformat to be more readable.
        * server/log.h: Moved to libbase.
        * server/log.cpp: Moved to libbase.
        * libbase/log.h: Add support for an STL streams based interface to
        the C based API for debugging messsages.
        * libbase/log.cpp: Add support for an STL streams based interface to
        the C based API for debugging messsages.
        * backend/gnash.cpp: Add support for new logging system, delete
        old callback system.
        * backend/render_handler_ogl.cpp: Cleanup some formating.
        * libbase/Makefile.am: Add log.h and log.cpp.
        * server/Makefile.am: Remove log.cpp and log.h.
        * server/xml.cpp: Use the new debugging macros.
        * utilities/Makefile.am: Add XML flags and libs.
        * utilities/parser.cpp: Add support for new logging system, delete
        old callback system.
        * utilities/processor.cpp: Add support for new logging system,
        delete old callback system.
        * configure.ac: Make using XML the default.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.184&tr2=1.185&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/Makefile.am.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/log.cpp?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/log.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/tu_file.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/libbase/tu_file.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Makefile.am.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/impl.cpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xml.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/utilities/Makefile.am.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/utilities/parser.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/utilities/processor.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.184 gnash/ChangeLog:1.185
--- gnash/ChangeLog:1.184       Fri Mar 10 15:15:13 2006
+++ gnash/ChangeLog     Sat Mar 11 19:24:27 2006
@@ -1,3 +1,42 @@
+2006-03-11  Rob Savoye  <address@hidden>
+
+       * utilities/Makefile.am: Add libxml flags and libs.
+       * utilities/parser.cpp: Use getopt for processing command line
+       arguments. Reindent to project coding standards. Add GNU standard
+       options. Use new logging system, delete the old one.
+       * utilities/processor.cpp: Use getopt for processing command line
+       arguments. Reindent to project coding standards. Add GNU standard
+       options. Use new logging system, delete the old one.
+       * backend/gnash.cpp: Use getopt for processing command line
+       arguments. Add GNU standard options. Use new logging system,
+       delete the old one.
+       * libbase/tu_file.h: Reformat to be more readable.
+       * libbase/tu_file.cpp: Reformat to be more readable.
+
+2006-03-11 Rob Savoye  <address@hidden>
+
+       * server/log.h: Moved to libbase.
+       * server/log.cpp: Moved to libbase.
+       * libbase/log.h: Add support for an STL streams based interface to
+       the C based API for debugging messsages. 
+       * libbase/log.cpp: Add support for an STL streams based interface to
+       the C based API for debugging messsages. 
+       * backend/gnash.cpp: Add support for new logging system, delete
+       old callback system.
+       * backend/render_handler_ogl.cpp: Cleanup some formating.
+       * libbase/Makefile.am: Add log.h and log.cpp.
+       * server/Makefile.am: Remove log.cpp and log.h.
+       * server/xml.cpp: Use the new debugging macros.
+       * utilities/Makefile.am: Add XML flags and libs.
+       * utilities/parser.cpp: Add support for new logging system, delete 
+       old callback system.
+       * utilities/processor.cpp: Add support for new logging system,
+       delete old callback system.
+
+2006-03-08  Rob Savoye  <address@hidden>
+
+       * configure.ac: Make using XML the default.
+
 2006-03-10  Rob Savoye  <address@hidden>
 
        * plugin/Makefile.am: Use DESTDIR when making directory.
@@ -54,6 +93,13 @@
        * doc/C/internals.xml: Include new plugin section.
        * doc/C/Makefile.in: Add plugin.xml to the list of doc chapters.
 
+2006-03-07  Rob Savoye  <address@hidden>
+
+       * doc/C/plugin.xml: New file for internals on writing Mozilla
+       plugins.
+       * doc/C/internals.xml: Include new plugin section.
+       * doc/C/Makefile.in: Add plugin.xml to the list of doc chapters.
+
 2006-03-06  Rob Savoye  <address@hidden>
 
        * server/shm.cpp: Clear up ifdef mess... Both shm_open() and
Index: gnash/libbase/Makefile.am
diff -u gnash/libbase/Makefile.am:1.16 gnash/libbase/Makefile.am:1.17
--- gnash/libbase/Makefile.am:1.16      Thu Mar  9 19:29:06 2006
+++ gnash/libbase/Makefile.am   Sat Mar 11 19:24:27 2006
@@ -73,6 +73,7 @@
        image.cpp               \
        image_filters.cpp       \
        jpeg.cpp                \
+       log.cpp                 \
        membuf.cpp              \
        ogl.cpp                 \
        postscript.cpp          \
@@ -96,6 +97,7 @@
        jpeg.h                  \
        membuf.h                \
        ogl.h                   \
+       log.h                   \
        postscript.h            \
        smart_ptr.h             \
        triangulate.h           \
Index: gnash/libbase/tu_file.cpp
diff -u gnash/libbase/tu_file.cpp:1.2 gnash/libbase/tu_file.cpp:1.3
--- gnash/libbase/tu_file.cpp:1.2       Sun Feb 26 15:49:30 2006
+++ gnash/libbase/tu_file.cpp   Sat Mar 11 19:24:27 2006
@@ -10,89 +10,93 @@
 #include "utility.h"
 #include "container.h"
 #include "membuf.h"
-
+#include "log.h"
 
 //
 // tu_file functions using FILE
 //
 
+using namespace gnash;
 
-static int std_read_func(void* dst, int bytes, void* appdata) 
+static int
+std_read_func(void* dst, int bytes, void* appdata) 
 // Return the number of bytes actually read.  EOF or an error would
 // cause that to not be equal to "bytes".
 {
-       assert(appdata);
-       assert(dst);
-       return fread( dst, 1, bytes, (FILE *)appdata );
+    GNASH_REPORT_FUNCTION;
+    
+    assert(appdata);
+    assert(dst);
+    return fread( dst, 1, bytes, (FILE *)appdata );
 }
 
-static int std_write_func(const void* src, int bytes, void* appdata)
+static int
+std_write_func(const void* src, int bytes, void* appdata)
 // Return the number of bytes actually written.
 {
-       assert(appdata);
-       assert(src);
-       return fwrite( src, 1, bytes, (FILE *)appdata );
+    assert(appdata);
+    assert(src);
+    return fwrite( src, 1, bytes, (FILE *)appdata );
 }
 
-static int std_seek_func(int pos, void *appdata)
+static int
+std_seek_func(int pos, void *appdata)
 // Return 0 on success, or TU_FILE_SEEK_ERROR on failure.
 {
-       assert(appdata);
-       clearerr((FILE*) appdata);      // make sure EOF flag is cleared.
-       int     result = fseek((FILE*)appdata, pos, SEEK_SET);
-       if (result == EOF)
-       {
-               // @@ TODO should set m_error to something relevant based on 
errno.
-               return TU_FILE_SEEK_ERROR;
-       }
-       return 0;
+    assert(appdata);
+    clearerr((FILE*) appdata); // make sure EOF flag is cleared.
+    int        result = fseek((FILE*)appdata, pos, SEEK_SET);
+    if (result == EOF) {
+       // @@ TODO should set m_error to something relevant based on errno.
+       return TU_FILE_SEEK_ERROR;
+    }
+    return 0;
 }
 
-static int std_seek_to_end_func(void *appdata)
+static int
+std_seek_to_end_func(void *appdata)
 // Return 0 on success, TU_FILE_SEEK_ERROR on failure.
 {
-       assert(appdata);
-       int     result = fseek((FILE*)appdata, 0, SEEK_END);
-       if (result == EOF)
-       {
-               // @@ TODO should set m_error to something relevant based on 
errno.
-               return TU_FILE_SEEK_ERROR;
-       }
-       return 0;
+    assert(appdata);
+    int        result = fseek((FILE*)appdata, 0, SEEK_END);
+    if (result == EOF) {
+       // @@ TODO should set m_error to something relevant based on errno.
+       return TU_FILE_SEEK_ERROR;
+    }
+    return 0;
 }
 
-static int std_tell_func(const void *appdata)
+static int
+std_tell_func(const void *appdata)
 // Return the file position, or -1 on failure.
 {
-       assert(appdata);
-       return ftell((FILE*)appdata);
+    assert(appdata);
+    return ftell((FILE*)appdata);
 }
 
-static bool std_get_eof_func(void *appdata)
+static bool
+std_get_eof_func(void *appdata)
 // Return true if we're at EOF.
 {
-       assert(appdata);
-       if (feof((FILE*) appdata))
-       {
-               return true;
-       }
-       else
-       {
-               return false;
-       }
+    assert(appdata);
+    if (feof((FILE*) appdata)) {
+       return true;
+    } else {
+       return false;
+    }
 }
 
-static int std_close_func(void *appdata)
+static int
+std_close_func(void *appdata)
 // Return 0 on success, or TU_FILE_CLOSE_ERROR on failure.
 {
-       assert(appdata);
-       int     result = fclose((FILE*)appdata);
-       if (result == EOF)
-       {
-               // @@ TODO should set m_error to something relevant based on 
errno.
-               return TU_FILE_CLOSE_ERROR;
-       }
-       return 0;
+    assert(appdata);
+    int        result = fclose((FILE*)appdata);
+    if (result == EOF) {
+       // @@ TODO should set m_error to something relevant based on errno.
+       return TU_FILE_CLOSE_ERROR;
+    }
+    return 0;
 }
 
 
@@ -100,177 +104,180 @@
 // tu_file functions using a readable/writable memory buffer
 //
 
-
 struct filebuf
 {
-       membuf m_;
-       int     m_position;
-       bool    m_read_only;
-
-       filebuf()
-               :
-               m_position(0),
-               m_read_only(false)
-       {
-       }
-
-       filebuf(int size, void* data)
-               :
-               m_(membuf::READ_ONLY, data, size),
-               m_position(0),
-               m_read_only(true)
+    membuf m_;
+    int        m_position;
+    bool       m_read_only;
+    
+    filebuf()
+       :
+       m_position(0),
+       m_read_only(false)
+       {
+       }
+    
+    filebuf(int size, void* data)
+       :
+       m_(membuf::READ_ONLY, data, size),
+       m_position(0),
+       m_read_only(true)
        {
        }
-
-       ~filebuf()
+    
+    ~filebuf()
        {
        }
-
-       bool    resize(int new_size)
+    
+    bool       resize(int new_size)
        // Return false if we couldn't resize.
        {
-               if (m_read_only) return false;
-
-               m_.resize(new_size);
-
-               // Hm, does this make sense?  We're truncating the file, so 
clamping the cursor.
-               // Alternative would be to disallow resize, but that doesn't 
seem good either.
-               if (m_position > m_.size())
-               {
-                       m_position = m_.size();
-               }
-
-               return true;
+           if (m_read_only) {
+               return false;
+           }
+           
+           m_.resize(new_size);
+           
+           // Hm, does this make sense?  We're truncating the file, so 
clamping the cursor.
+           // Alternative would be to disallow resize, but that doesn't seem 
good either.
+           if (m_position > m_.size()) {
+               m_position = m_.size();
+           }
+           
+           return true;
+       }
+    
+    bool       is_valid()
+       {
+           return
+               m_position >= 0
+               && m_position <= m_.size();
        }
-
-       bool    is_valid()
+    
+    unsigned char*     get_cursor()
        {
-               return
-                       m_position >= 0
-                       && m_position <= m_.size();
+           return ((unsigned char*) m_.data()) + m_position;
        }
-
-       unsigned char*  get_cursor() { return ((unsigned char*) m_.data()) + 
m_position; }
 };
 
 
-static int mem_read_func(void* dst, int bytes, void* appdata) 
+static int
+mem_read_func(void* dst, int bytes, void* appdata) 
 // Return the number of bytes actually read.  EOF or an error would
 // cause that to not be equal to "bytes".
 {
-       assert(appdata);
-       assert(dst);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       int     bytes_to_read = imin(bytes, buf->m_.size() - buf->m_position);
-       if (bytes_to_read)
-       {
-               memcpy(dst, buf->get_cursor(), bytes_to_read);
-       }
-       buf->m_position += bytes_to_read;
-
-       return bytes_to_read;
+    assert(appdata);
+    assert(dst);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    int        bytes_to_read = imin(bytes, buf->m_.size() - buf->m_position);
+    if (bytes_to_read) {
+       memcpy(dst, buf->get_cursor(), bytes_to_read);
+    }
+    buf->m_position += bytes_to_read;
+    
+    return bytes_to_read;
 }
 
 
 static int mem_write_func(const void* src, int bytes, void* appdata)
 // Return the number of bytes actually written.
 {
-       assert(appdata);
-       assert(src);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       // Expand buffer if necessary.
-       int     bytes_to_expand = imax(0, buf->m_position + bytes - 
buf->m_.size());
-       if (bytes_to_expand)
-       {
-               if (buf->resize(buf->m_.size() + bytes_to_expand) == false)
-               {
-                       // Couldn't expand!
-                       return 0;
-               }
-       }
-
-       memcpy(buf->get_cursor(), src, bytes);
-       buf->m_position += bytes;
-
-       return bytes;
+    assert(appdata);
+    assert(src);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    // Expand buffer if necessary.
+    int        bytes_to_expand = imax(0, buf->m_position + bytes - 
buf->m_.size());
+    if (bytes_to_expand) {
+       if (buf->resize(buf->m_.size() + bytes_to_expand) == false) {
+           // Couldn't expand!
+           return 0;
+       }
+    }
+    
+    memcpy(buf->get_cursor(), src, bytes);
+    buf->m_position += bytes;
+    
+    return bytes;
 }
 
-static int mem_seek_func(int pos, void *appdata)
+static int
+mem_seek_func(int pos, void *appdata)
 // Return 0 on success, or TU_FILE_SEEK_ERROR on failure.
 {
-       assert(appdata);
-       assert(pos >= 0);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       if (pos < 0)
-       {
-               buf->m_position = 0;
-               return TU_FILE_SEEK_ERROR;
-       }
-
-       if (pos > buf->m_.size())
-       {
-               buf->m_position = buf->m_.size();
-               return TU_FILE_SEEK_ERROR;
-       }
-
-       buf->m_position = pos;
-       return 0;
+    assert(appdata);
+    assert(pos >= 0);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    if (pos < 0) {
+       buf->m_position = 0;
+       return TU_FILE_SEEK_ERROR;
+    }
+    
+    if (pos > buf->m_.size()) {
+       buf->m_position = buf->m_.size();
+       return TU_FILE_SEEK_ERROR;
+    }
+    
+    buf->m_position = pos;
+    return 0;
 }
 
-static int mem_seek_to_end_func(void* appdata)
+static int
+mem_seek_to_end_func(void* appdata)
 // Return 0 on success, TU_FILE_SEEK_ERROR on failure.
 {
-       assert(appdata);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       buf->m_position = buf->m_.size();
-       return 0;
+    assert(appdata);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    buf->m_position = buf->m_.size();
+    return 0;
 }
 
-static int mem_tell_func(const void* appdata)
+static int
+mem_tell_func(const void* appdata)
 // Return the file position, or -1 on failure.
 {
-       assert(appdata);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       return buf->m_position;
+    assert(appdata);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    return buf->m_position;
 }
 
-static bool    mem_get_eof_func(void* appdata)
+static bool
+mem_get_eof_func(void* appdata)
 // Return true if we're positioned at the end of the buffer.
 {
-       assert(appdata);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       return buf->m_position >= buf->m_.size();
+    assert(appdata);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    return buf->m_position >= buf->m_.size();
 }
 
 static int mem_close_func(void* appdata)
 // Return 0 on success, or TU_FILE_CLOSE_ERROR on failure.
 {
-       assert(appdata);
-
-       filebuf* buf = (filebuf*) appdata;
-       assert(buf->is_valid());
-
-       delete buf;
-
-       return 0;
+    assert(appdata);
+    
+    filebuf* buf = (filebuf*) appdata;
+    assert(buf->is_valid());
+    
+    delete buf;
+    
+    return 0;
 }
 
 
@@ -278,232 +285,215 @@
 // generic functionality
 //
 
-
-tu_file::tu_file(
-       void * appdata,
-       read_func rf,
-       write_func wf,
-       seek_func sf,
-       seek_to_end_func ef,
-       tell_func tf,
-       get_eof_func gef,
-       close_func cf)
 // Create a file using the custom callbacks.
-{
-       m_data = appdata;
-       m_read = rf;
-       m_write = wf;
-       m_seek = sf;
-       m_seek_to_end = ef;
-       m_tell = tf;
-       m_get_eof = gef;
-       m_close = cf;
-       m_error = TU_FILE_NO_ERROR;
+tu_file::tu_file(void * appdata, read_func rf, write_func wf,
+                seek_func sf, seek_to_end_func ef, tell_func tf,
+                get_eof_func gef, close_func cf)
+{
+    m_data = appdata;
+    m_read = rf;
+    m_write = wf;
+    m_seek = sf;
+    m_seek_to_end = ef;
+    m_tell = tf;
+    m_get_eof = gef;
+    m_close = cf;
+    m_error = TU_FILE_NO_ERROR;
 }
 
-
-tu_file::tu_file(FILE* fp, bool autoclose=false)
 // Create a file from a standard file pointer.
+tu_file::tu_file(FILE* fp, bool autoclose=false)
 {
-       m_data = (void *)fp;
+    GNASH_REPORT_FUNCTION;
+
+    m_data = (void *)fp;
+    m_read = std_read_func;
+    m_write = std_write_func;
+    m_seek = std_seek_func;
+    m_seek_to_end = std_seek_to_end_func;
+    m_tell = std_tell_func;
+    m_get_eof = std_get_eof_func;
+    m_close = autoclose ? std_close_func : NULL;
+    m_error = TU_FILE_NO_ERROR;
+}
+
+// Create a file from the given name and the given mode.
+tu_file::tu_file(const char * name, const char * mode)
+{
+    GNASH_REPORT_RETURN;
+
+    m_data = fopen(name, mode);
+    
+    if (m_data) {
        m_read = std_read_func;
        m_write = std_write_func;
        m_seek = std_seek_func;
        m_seek_to_end = std_seek_to_end_func;
        m_tell = std_tell_func;
        m_get_eof = std_get_eof_func;
-       m_close = autoclose ? std_close_func : NULL;
+       m_close = std_close_func;
        m_error = TU_FILE_NO_ERROR;
+    } else {
+       m_read = NULL;
+       m_write = NULL;
+       m_seek = NULL;
+       m_seek_to_end = NULL;
+       m_tell = NULL;
+       m_get_eof = NULL;
+       m_close = NULL;
+       m_error = TU_FILE_OPEN_ERROR;
+    }
 }
 
-
-tu_file::tu_file(const char * name, const char * mode)
-// Create a file from the given name and the given mode.
-{
-       m_data = fopen(name, mode);
-       if (m_data)
-       {
-               m_read = std_read_func;
-               m_write = std_write_func;
-               m_seek = std_seek_func;
-               m_seek_to_end = std_seek_to_end_func;
-               m_tell = std_tell_func;
-               m_get_eof = std_get_eof_func;
-               m_close = std_close_func;
-               m_error = TU_FILE_NO_ERROR;
-       }
-       else 
-       {
-               m_read = NULL;
-               m_write = NULL;
-               m_seek = NULL;
-               m_seek_to_end = NULL;
-               m_tell = NULL;
-               m_get_eof = NULL;
-               m_close = NULL;
-               m_error = TU_FILE_OPEN_ERROR;
-       }
-}
-
-
 tu_file::tu_file(memory_buffer_enum m)
 // Create a read/write memory buffer.
 {
-       m_data = new membuf;
-
-       m_read = mem_read_func;
-       m_write = mem_write_func;
-       m_seek = mem_seek_func;
-       m_seek_to_end = mem_seek_to_end_func;
-       m_tell = mem_tell_func;
-       m_get_eof = mem_get_eof_func;
-       m_close = mem_close_func;
-       m_error = TU_FILE_NO_ERROR;
+    m_data = new membuf;
+    
+    m_read = mem_read_func;
+    m_write = mem_write_func;
+    m_seek = mem_seek_func;
+    m_seek_to_end = mem_seek_to_end_func;
+    m_tell = mem_tell_func;
+    m_get_eof = mem_get_eof_func;
+    m_close = mem_close_func;
+    m_error = TU_FILE_NO_ERROR;
 }
 
 
 tu_file::tu_file(memory_buffer_enum m, int size, void* data)
 // Create a read-only memory buffer, using the given data.
 {
-       m_data = new membuf(data, size);
-
-       m_read = mem_read_func;
-       m_write = mem_write_func;
-       m_seek = mem_seek_func;
-       m_seek_to_end = mem_seek_to_end_func;
-       m_tell = mem_tell_func;
-       m_get_eof = mem_get_eof_func;
-       m_close = mem_close_func;
-       m_error = TU_FILE_NO_ERROR;
+    m_data = new membuf(data, size);
+    
+    m_read = mem_read_func;
+    m_write = mem_write_func;
+    m_seek = mem_seek_func;
+    m_seek_to_end = mem_seek_to_end_func;
+    m_tell = mem_tell_func;
+    m_get_eof = mem_get_eof_func;
+    m_close = mem_close_func;
+    m_error = TU_FILE_NO_ERROR;
 }
 
-
 tu_file::~tu_file()
 // Close this file when destroyed.
 {
-       close();
+    close();
 }
 
-
-void tu_file::close() 
+void
+tu_file::close() 
 // Close this file.
 { 
-       if (m_close)
-       {
-               m_close(m_data);
-       }
-       m_data = NULL; 
-       m_read = NULL; 
-       m_write = NULL; 
-       m_seek = NULL; 
-       m_tell = NULL; 
-       m_close = NULL; 
+    if (m_close) {
+       m_close(m_data);
+    }
+    m_data = NULL; 
+    m_read = NULL; 
+    m_write = NULL; 
+    m_seek = NULL; 
+    m_tell = NULL; 
+    m_close = NULL; 
 }
 
 
-void   tu_file::copy_from(tu_file* src)
+void
+tu_file::copy_from(tu_file* src)
 // Copy remaining contents of *src into *this.
 {
-       // @@ bah, should buffer this!
-       while (src->get_eof() == false)
-       {
-               Uint8   b = src->read8();
-               if (src->get_error())
-               {
-                       break;
-               }
-
-               write8(b);
+    // @@ bah, should buffer this!
+    while (src->get_eof() == false) {
+       Uint8   b = src->read8();
+       if (src->get_error()) {
+           break;
        }
+       
+       write8(b);
+    }
 }
 
 
-void   tu_file::copy_to(membuf* dst)
+void
+tu_file::copy_to(membuf* dst)
 // Copy remaining contents of *this into *dst.
 {
-       static const int BUFSIZE = 4096;
+    static const int BUFSIZE = 4096;
+    
+    while (get_eof() == false) {
+       // Make room at the end of dst.
+       dst->resize(dst->size() + BUFSIZE);
+       int bytes_read = read_bytes(((char*) dst->data()) + dst->size() - 
BUFSIZE, BUFSIZE);
+       if (bytes_read < BUFSIZE) {
+           // Didn't use everything we allocated; trim the unused bytes.
+           dst->resize(dst->size() - (BUFSIZE - bytes_read));
+       }
        
-       while (get_eof() == false)
-       {
-               // Make room at the end of dst.
-               dst->resize(dst->size() + BUFSIZE);
-               int bytes_read = read_bytes(((char*) dst->data()) + dst->size() 
- BUFSIZE, BUFSIZE);
-               if (bytes_read < BUFSIZE) {
-                       // Didn't use everything we allocated; trim the unused 
bytes.
-                       dst->resize(dst->size() - (BUFSIZE - bytes_read));
-               }
-
-               if (get_error())
-               {
-                       break;
-               }
+       if (get_error()) {
+           break;
        }
+    }
 }
 
 
-int    tu_file::copy_bytes(tu_file* src, int byte_count)
+int
+tu_file::copy_bytes(tu_file* src, int byte_count)
 // Copy a fixed number of bytes from *src into *this.  Return the
 // number of bytes copied.
 {
-       static const int        BUFSIZE = 4096;
-       char    buffer[BUFSIZE];
-
-       int     bytes_left = byte_count;
-       while (bytes_left)
-       {
-               int     to_copy = imin(bytes_left, BUFSIZE);
-
-               int     read_count = src->read_bytes(buffer, to_copy);
-               int     write_count = write_bytes(buffer, read_count);
-
-               assert(write_count <= read_count);
-               assert(read_count <= to_copy);
-               assert(to_copy <= bytes_left);
-
-               bytes_left -= write_count;
-               if (write_count < to_copy)
-               {
-                       // Some kind of error; abort.
-                       return byte_count - bytes_left;
-               }
-       }
-
-       assert(bytes_left == 0);
-
-       return byte_count;
-}
-
-
-void tu_file::write_string(const char* src)
-{
-       for (;;)
-       {
-               write8(*src);
-               if (*src == 0)
-               {
-                       break;
-               }
-               src++;
-       }
-}
-
-
-int tu_file::read_string(char* dst, int max_length) 
-{
-       int i=0;
-       while (i<max_length)
-       {
-               dst[i] = read8();
-               if (dst[i]=='\0')
-               {
-                       return i;
-               }
-               i++;
-       }
-
-       dst[max_length - 1] = 0;        // force termination.
-
-       return -1;
+    static const int   BUFSIZE = 4096;
+    char       buffer[BUFSIZE];
+    
+    int        bytes_left = byte_count;
+    while (bytes_left) {
+       int     to_copy = imin(bytes_left, BUFSIZE);
+       
+       int     read_count = src->read_bytes(buffer, to_copy);
+       int     write_count = write_bytes(buffer, read_count);
+       
+       assert(write_count <= read_count);
+       assert(read_count <= to_copy);
+       assert(to_copy <= bytes_left);
+       
+       bytes_left -= write_count;
+       if (write_count < to_copy) {
+           // Some kind of error; abort.
+           return byte_count - bytes_left;
+       }
+    }
+    
+    assert(bytes_left == 0);
+    
+    return byte_count;
+}
+
+void
+tu_file::write_string(const char* src)
+{
+    for (;;) {
+       write8(*src);
+       if (*src == 0) {
+           break;
+       }
+       src++;
+    }
+}
+
+int
+tu_file::read_string(char* dst, int max_length) 
+{
+    int i=0;
+    while (i<max_length) {
+       dst[i] = read8();
+       if (dst[i]=='\0') {
+           return i;
+       }
+       i++;
+    }
+    
+    dst[max_length - 1] = 0;   // force termination.
+    
+    return -1;
 }
 
 
@@ -515,26 +505,23 @@
 #define vsnprintf      _vsnprintf
 #endif // _WIN32
 
-
 int    tu_file::printf(const char* fmt, ...)
 // Use printf-like semantics to send output to this stream.
 {
-       // Workspace for vsnprintf formatting.
-       static const int        BUFFER_SIZE = 1000;
-       char    buffer[BUFFER_SIZE];
-
-       va_list ap;
-       va_start(ap, fmt);
-       vsnprintf(buffer, BUFFER_SIZE, fmt, ap);
-       va_end(ap);
-
-       return write_bytes(buffer, strlen(buffer));
+    // Workspace for vsnprintf formatting.
+    static const int   BUFFER_SIZE = 1000;
+    char       buffer[BUFFER_SIZE];
+    
+    va_list ap;
+    va_start(ap, fmt);
+    vsnprintf(buffer, BUFFER_SIZE, fmt, ap);
+    va_end(ap);
+    
+    return write_bytes(buffer, strlen(buffer));
 }
 
 
 // Local Variables:
 // mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
 // indent-tabs-mode: t
 // End:
Index: gnash/libbase/tu_file.h
diff -u gnash/libbase/tu_file.h:1.2 gnash/libbase/tu_file.h:1.3
--- gnash/libbase/tu_file.h:1.2 Sat Jan 28 01:14:33 2006
+++ gnash/libbase/tu_file.h     Sat Mar 11 19:24:27 2006
@@ -19,15 +19,14 @@
 struct membuf;
 struct SDL_RWops;
 
-
 enum
 {
-       TU_FILE_NO_ERROR = 0,
-       TU_FILE_OPEN_ERROR,
-       TU_FILE_READ_ERROR,
-       TU_FILE_WRITE_ERROR,
-       TU_FILE_SEEK_ERROR,
-       TU_FILE_CLOSE_ERROR
+    TU_FILE_NO_ERROR = 0,
+    TU_FILE_OPEN_ERROR,
+    TU_FILE_READ_ERROR,
+    TU_FILE_WRITE_ERROR,
+    TU_FILE_SEEK_ERROR,
+    TU_FILE_CLOSE_ERROR
 };
 
 
@@ -38,130 +37,154 @@
 class tu_file
 {
 public:
-       typedef int (* read_func)(void* dst, int bytes, void* appdata);
-       typedef int (* write_func)(const void* src, int bytes, void* appdata);
-       typedef int (* seek_func)(int pos, void* appdata);
-       typedef int (* seek_to_end_func)(void* appdata);
-       typedef int (* tell_func)(const void* appdata);
-       typedef bool (* get_eof_func)(void* appdata);
-       typedef int (* close_func)(void* appdata);
-
-       // The generic constructor; supply functions for the implementation.
-       tu_file(
-               void * appdata,
-               read_func rf,
-               write_func wf,
-               seek_func sf,
-               seek_to_end_func ef,
-               tell_func tf,
-               get_eof_func gef,
-               close_func cf=NULL);
-
-       // Make a file from an ordinary FILE*.
-       tu_file(FILE* fp, bool autoclose);
-
-       // Optional: if you're using SDL, this is a constructor to create
-       // a tu_file from an SDL_RWops* stream.
-       tu_file(SDL_RWops* sdl_stream, bool autoclose);
-
-       // Open a file using ordinary fopen().  Automatically closes the
-       // file when we are destroyed.
-       tu_file(const char* name, const char* mode);
-
-       // Make a memory-buffer file for read/write.
-       enum memory_buffer_enum { memory_buffer };
-       tu_file(memory_buffer_enum m);
-
-       // A read-only memory-buffer with predefined data.
-       tu_file(memory_buffer_enum m, int size, void* data);
-
-       ~tu_file();
-
-       // Copy remaining contents of *in into *this.
-       void copy_from(tu_file* in);
-       // Copy remaining contents of *this into *out.
-       void copy_to(membuf* out);
-
-       // Copy a fixed number of bytes from *in to *this.
-       // Returns number of bytes copied.
-       int     copy_bytes(tu_file* in, int bytes);
-
-       Uint64  read_le64();
-       Uint32  read_le32();
-       Uint16  read_le16();
-       Uint64  read_be64();
-       Uint32  read_be32();
-       Uint16  read_be16();
-       void    write_le64(Uint64 u);
-       void    write_le32(Uint32 u);
-       void    write_le16(Uint16 u);
-       void    write_be64(Uint64 u);
-       void    write_be32(Uint32 u);
-       void    write_be16(Uint16 u);
-
-       // read/write a single byte
-       Uint8   read_byte() { return read8(); }
-       void    write_byte(Uint8 u) { write8(u); }
-       
-       // Read/write a byte buffer.
-       // Returns number of bytes read/written.
-       int     read_bytes(void* dst, int num) { return m_read(dst, num, 
m_data); }
-       int     write_bytes(const void* src, int num) { return m_write(src, 
num, m_data); }
-       
-       // write a 0-terminated string.
+    typedef int (* read_func)(void* dst, int bytes, void* appdata);
+    typedef int (* write_func)(const void* src, int bytes, void* appdata);
+    typedef int (* seek_func)(int pos, void* appdata);
+    typedef int (* seek_to_end_func)(void* appdata);
+    typedef int (* tell_func)(const void* appdata);
+    typedef bool (* get_eof_func)(void* appdata);
+    typedef int (* close_func)(void* appdata);
+    
+    // The generic constructor; supply functions for the implementation.
+    tu_file(
+       void * appdata,
+       read_func rf,
+       write_func wf,
+       seek_func sf,
+       seek_to_end_func ef,
+       tell_func tf,
+       get_eof_func gef,
+       close_func cf=NULL);
+    
+    // Make a file from an ordinary FILE*.
+    tu_file(FILE* fp, bool autoclose);
+    
+    // Optional: if you're using SDL, this is a constructor to create
+    // a tu_file from an SDL_RWops* stream.
+    tu_file(SDL_RWops* sdl_stream, bool autoclose);
+    
+    // Open a file using ordinary fopen().  Automatically closes the
+    // file when we are destroyed.
+    tu_file(const char* name, const char* mode);
+    
+    // Make a memory-buffer file for read/write.
+    enum memory_buffer_enum { memory_buffer };
+    tu_file(memory_buffer_enum m);
+    
+    // A read-only memory-buffer with predefined data.
+    tu_file(memory_buffer_enum m, int size, void* data);
+    
+    ~tu_file();
+    
+    // Copy remaining contents of *in into *this.
+    void copy_from(tu_file* in);
+    // Copy remaining contents of *this into *out.
+    void copy_to(membuf* out);
+    
+    // Copy a fixed number of bytes from *in to *this.
+    // Returns number of bytes copied.
+    int        copy_bytes(tu_file* in, int bytes);
+    
+    Uint64     read_le64();
+    Uint32     read_le32();
+    Uint16     read_le16();
+    Uint64     read_be64();
+    Uint32     read_be32();
+    Uint16     read_be16();
+    void       write_le64(Uint64 u);
+    void       write_le32(Uint32 u);
+    void       write_le16(Uint16 u);
+    void       write_be64(Uint64 u);
+    void       write_be32(Uint32 u);
+    void       write_be16(Uint16 u);
+    
+    // read/write a single byte
+    Uint8      read_byte() { return read8(); }
+    void       write_byte(Uint8 u) { write8(u); }
+    
+    // Read/write a byte buffer.
+    // Returns number of bytes read/written.
+    int        read_bytes(void* dst, int num) { return m_read(dst, num, 
m_data); }
+    int        write_bytes(const void* src, int num) { return m_write(src, 
num, m_data); }
+    
+    // write a 0-terminated string.
        void    write_string(const char* src);
-       
-       // Read up to max_length characters, returns the number of characters 
-       // read, or -1 if the string length is longer than max_length.
-       //
-       // Stops at the first \0 character if it comes before max_length.
-       //
-       // Guarantees termination of the string.
-       int     read_string(char* dst, int max_length);
-
-       // float/double IO
-       void    write_float32(float value);
-       void    write_double64(double value);
-       float   read_float32();
-       double  read_double64();
-
-       // get/set pos
-       int     get_position() const { return m_tell(m_data); }
-       void    set_position(int p) { m_seek(p, m_data); }
-       void    go_to_end() { m_seek_to_end(m_data); }
-       bool    get_eof() { return m_get_eof(m_data); }
-
-       int     get_error() { return m_error; }
-
-       // printf-style convenience function.
-       int     printf(const char* fmt, ...);
-
-       // UNSAFE back door, for testing only.
-       void*   get_app_data_DEBUG() { return m_data; }
-
-
+    
+    // Read up to max_length characters, returns the number of characters 
+    // read, or -1 if the string length is longer than max_length.
+    //
+    // Stops at the first \0 character if it comes before max_length.
+    //
+    // Guarantees termination of the string.
+    int        read_string(char* dst, int max_length);
+    
+    // float/double IO
+    void       write_float32(float value);
+    void       write_double64(double value);
+    float      read_float32();
+    double     read_double64();
+    
+    // get/set pos
+    int        get_position() const { return m_tell(m_data); }
+    void       set_position(int p) { m_seek(p, m_data); }
+    void       go_to_end() { m_seek_to_end(m_data); }
+    bool       get_eof() { return m_get_eof(m_data); }
+    
+    int        get_error() { return m_error; }
+    
+    // printf-style convenience function.
+    int        printf(const char* fmt, ...);
+    
+    // UNSAFE back door, for testing only.
+    void*      get_app_data_DEBUG() { return m_data; }
+    
+    
 private:
-       Uint64  read64() { Uint64 u; m_read(&u, 8, m_data); return u; }
-       Uint32  read32() { Uint32 u; m_read(&u, 4, m_data); return u; }
-       Uint16  read16() { Uint16 u; m_read(&u, 2, m_data); return u; }
-       Uint8   read8() { Uint8 u; m_read(&u, 1, m_data); return u; }
-
-       void    write64(Uint64 u) { m_write(&u, 8, m_data); }
-       void    write32(Uint32 u) { m_write(&u, 4, m_data); }
-       void    write16(Uint16 u) { m_write(&u, 2, m_data); }
-       void    write8(Uint8 u) { m_write(&u, 1, m_data); }
-
-       void    close();
-
-       void *  m_data;
-       read_func       m_read;
-       write_func      m_write;
-       seek_func       m_seek;
-       seek_to_end_func        m_seek_to_end;
-       tell_func       m_tell;
-       get_eof_func    m_get_eof;
-       close_func      m_close;
-       int     m_error;
+    Uint64     read64() {
+       Uint64 u;
+       m_read(&u, 8, m_data);
+       return u;
+    }
+    Uint32     read32() {
+       Uint32 u;
+       m_read(&u, 4, m_data);
+       return u;
+    }
+    Uint16     read16() {
+       Uint16 u;
+       m_read(&u, 2, m_data);
+       return u;
+    }
+    Uint8      read8() {
+       Uint8 u;
+       m_read(&u, 1, m_data);
+       return u;
+    }
+    
+    void       write64(Uint64 u) {
+       m_write(&u, 8, m_data);
+    }
+    void       write32(Uint32 u) {
+       m_write(&u, 4, m_data);
+    }
+    void       write16(Uint16 u) {
+       m_write(&u, 2, m_data);
+    }
+    void       write8(Uint8 u) {
+       m_write(&u, 1, m_data);
+    }
+    
+    void       close();
+    
+    void *     m_data;
+    read_func  m_read;
+    write_func         m_write;
+    seek_func  m_seek;
+    seek_to_end_func   m_seek_to_end;
+    tell_func  m_tell;
+    get_eof_func       m_get_eof;
+    close_func         m_close;
+    int        m_error;
 };
 
 
@@ -171,87 +194,87 @@
 
 
 #if _TU_LITTLE_ENDIAN_
-       inline Uint64   tu_file::read_le64() { return read64(); }
-       inline Uint32   tu_file::read_le32() { return read32(); }
-       inline Uint16   tu_file::read_le16() { return read16(); }
-       inline Uint64   tu_file::read_be64() { return swap64(read64()); }
-       inline Uint32   tu_file::read_be32() { return swap32(read32()); }
-       inline Uint16   tu_file::read_be16() { return swap16(read16()); }
-       inline void     tu_file::write_le64(Uint64 u) { write64(u); }
-       inline void     tu_file::write_le32(Uint32 u) { write32(u); }
-       inline void     tu_file::write_le16(Uint16 u) { write16(u); }
-       inline void     tu_file::write_be64(Uint64 u) { write64(swap64(u)); }
-       inline void     tu_file::write_be32(Uint32 u) { write32(swap32(u)); }
-       inline void     tu_file::write_be16(Uint16 u) { write16(swap16(u)); }
+inline Uint64  tu_file::read_le64() { return read64(); }
+inline Uint32  tu_file::read_le32() { return read32(); }
+inline Uint16  tu_file::read_le16() { return read16(); }
+inline Uint64  tu_file::read_be64() { return swap64(read64()); }
+inline Uint32  tu_file::read_be32() { return swap32(read32()); }
+inline Uint16  tu_file::read_be16() { return swap16(read16()); }
+inline void    tu_file::write_le64(Uint64 u) { write64(u); }
+inline void    tu_file::write_le32(Uint32 u) { write32(u); }
+inline void    tu_file::write_le16(Uint16 u) { write16(u); }
+inline void    tu_file::write_be64(Uint64 u) { write64(swap64(u)); }
+inline void    tu_file::write_be32(Uint32 u) { write32(swap32(u)); }
+inline void    tu_file::write_be16(Uint16 u) { write16(swap16(u)); }
 #else // not _TU_LITTLE_ENDIAN_
-       inline Uint64   tu_file::read_le64() { return swap64(read64()); }
-       inline Uint32   tu_file::read_le32() { return swap32(read32()); }
-       inline Uint16   tu_file::read_le16() { return swap16(read16()); }
-       inline Uint64   tu_file::read_be64() { return read64(); }
-       inline Uint32   tu_file::read_be32() { return read32(); }
-       inline Uint16   tu_file::read_be16() { return read16(); }
-       inline void     tu_file::write_le64(Uint64 u) { write64(swap64(u)); }
-       inline void     tu_file::write_le32(Uint32 u) { write32(swap32(u)); }
-       inline void     tu_file::write_le16(Uint16 u) { write16(swap16(u)); }
-       inline void     tu_file::write_be64(Uint64 u) { write64(u); }
-       inline void     tu_file::write_be32(Uint32 u) { write32(u); }
-       inline void     tu_file::write_be16(Uint16 u) { write16(u); }
+inline Uint64  tu_file::read_le64() { return swap64(read64()); }
+inline Uint32  tu_file::read_le32() { return swap32(read32()); }
+inline Uint16  tu_file::read_le16() { return swap16(read16()); }
+inline Uint64  tu_file::read_be64() { return read64(); }
+inline Uint32  tu_file::read_be32() { return read32(); }
+inline Uint16  tu_file::read_be16() { return read16(); }
+inline void    tu_file::write_le64(Uint64 u) { write64(swap64(u)); }
+inline void    tu_file::write_le32(Uint32 u) { write32(swap32(u)); }
+inline void    tu_file::write_le16(Uint16 u) { write16(swap16(u)); }
+inline void    tu_file::write_be64(Uint64 u) { write64(u); }
+inline void    tu_file::write_be32(Uint32 u) { write32(u); }
+inline void    tu_file::write_be16(Uint16 u) { write16(u); }
 #endif // not _TU_LITTLE_ENDIAN_
 
 
 inline void    tu_file::write_float32(float value)
 // Write a 32-bit little-endian float to this file.
 {
-       union alias {
-               float   f;
-               Uint32  i;
-       } u;
-       compiler_assert(sizeof(alias) == sizeof(Uint32));
-
-       u.f = value;
-       write_le32(u.i);
+    union alias {
+       float   f;
+       Uint32  i;
+    } u;
+    compiler_assert(sizeof(alias) == sizeof(Uint32));
+    
+    u.f = value;
+    write_le32(u.i);
 }
 
 
 inline float   tu_file::read_float32()
 // Read a 32-bit little-endian float from this file.
 {
-       union {
-               float   f;
-               Uint32  i;
-       } u;
-       compiler_assert(sizeof(u) == sizeof(u.i));
-
-       u.i = read_le32();
-       return u.f;
+    union {
+       float   f;
+       Uint32  i;
+    } u;
+    compiler_assert(sizeof(u) == sizeof(u.i));
+    
+    u.i = read_le32();
+    return u.f;
 }
 
 #if 0
 inline void            tu_file::write_double64(double value)
 // Write a 64-bit little-endian double to this file.
 {
-       union {
-               double  d;
-               Uint64  l;
-       } u;
-       compiler_assert(sizeof(u) == sizeof(u.l));
-
-       u.d = value;
-       write_le64(u.l);
+    union {
+       double  d;
+       Uint64  l;
+    } u;
+    compiler_assert(sizeof(u) == sizeof(u.l));
+    
+    u.d = value;
+    write_le64(u.l);
 }
 
 
 inline double  tu_file::read_double64()
 // Read a little-endian 64-bit double from this file.
 {
-       union {
-               double  d;
-               Uint64  l;
-       } u;
-       compiler_assert(sizeof(u) == sizeof(u.l));
-
-       u.l = read_le64();
-       return u.d;
+    union {
+       double  d;
+       Uint64  l;
+    } u;
+    compiler_assert(sizeof(u) == sizeof(u.l));
+    
+    u.l = read_le64();
+    return u.d;
 }
 #endif
 
@@ -260,7 +283,5 @@
 
 // Local Variables:
 // mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
 // indent-tabs-mode: t
 // End:
Index: gnash/server/Makefile.am
diff -u gnash/server/Makefile.am:1.23 gnash/server/Makefile.am:1.24
--- gnash/server/Makefile.am:1.23       Thu Mar  9 19:29:06 2006
+++ gnash/server/Makefile.am    Sat Mar 11 19:24:27 2006
@@ -127,7 +127,6 @@
         font.cpp         \
         fontlib.cpp      \
         impl.cpp         \
-        log.cpp          \
         morph2.cpp       \
        network.cpp      \
        Movie.cpp        \
@@ -152,7 +151,6 @@
        fontlib.h       \
        gnash.h         \
        impl.h          \
-       log.h           \
        morph2.h        \
        morph.h         \
        network.h       \
Index: gnash/server/impl.cpp
diff -u gnash/server/impl.cpp:1.22 gnash/server/impl.cpp:1.23
--- gnash/server/impl.cpp:1.22  Thu Mar  9 19:29:06 2006
+++ gnash/server/impl.cpp       Sat Mar 11 19:24:27 2006
@@ -347,39 +347,36 @@
 {
     //printf("%s: filename is %s\n",  __PRETTY_FUNCTION__, filename);
 
-    if (s_opener_function == NULL)
-       {
-           log_error("error: get_movie_info(): no file opener function 
registered\n");
-           if (version) *version = 0;
-           return;
-       }
-
+    if (s_opener_function == NULL) {
+       log_error("error: get_movie_info(): no file opener function 
registered\n");
+       if (version) *version = 0;
+       return;
+    }
+    
     tu_file*   in = s_opener_function(filename);
-    if (in == NULL || in->get_error() != TU_FILE_NO_ERROR)
-       {
-           log_error("error: get_movie_info(): can't open '%s'\n", filename);
-           if (version) *version = 0;
-           delete in;
-           return;
-       }
-
+    if (in == NULL || in->get_error() != TU_FILE_NO_ERROR) {
+       log_error("error: get_movie_info(): can't open '%s'\n", filename);
+       if (version) *version = 0;
+       delete in;
+       return;
+    }
+    
     Uint32     file_start_pos = in->get_position();
     Uint32     header = in->read_le32();
     Uint32     file_length = in->read_le32();
     Uint32     file_end_pos = file_start_pos + file_length;
-
+    
     int        local_version = (header >> 24) & 255;
     if ((header & 0x0FFFFFF) != 0x00535746
-       && (header & 0x0FFFFFF) != 0x00535743)
-       {
-           // ERROR
-           log_error("error: get_movie_info(): file '%s' does not start with a 
SWF header!\n", filename);
-           if (version) *version = 0;
-           delete in;
-           return;
-       }
+       && (header & 0x0FFFFFF) != 0x00535743) {
+       // ERROR
+       log_error("error: get_movie_info(): file '%s' does not start with a SWF 
header!\n", filename);
+       if (version) *version = 0;
+       delete in;
+       return;
+    }
     bool       compressed = (header & 255) == 'C';
-
+    
     tu_file*   original_in = NULL;
     if (compressed) {
 #if TU_CONFIG_LINK_TO_ZLIB == 0
Index: gnash/server/xml.cpp
diff -u gnash/server/xml.cpp:1.15 gnash/server/xml.cpp:1.16
--- gnash/server/xml.cpp:1.15   Thu Mar  9 19:29:06 2006
+++ gnash/server/xml.cpp        Sat Mar 11 19:24:27 2006
@@ -75,6 +75,7 @@
 XML::XML() 
     :_loaded(false),  _nodename(0), _nodes(0), _bytes_loaded(0), 
_bytes_total(0)
 {
+    GNASH_REPORT_FUNCTION;
 #ifdef DEBUG_MEMORY_ALLOCATION
     log_msg("Creating XML data at %p \n", this);
 #endif
@@ -85,6 +86,7 @@
 // Parse the ASCII XML string into memory
 XML::XML(tu_string xml_in)
 {
+    GNASH_REPORT_FUNCTION;
 #ifdef DEBUG_MEMORY_ALLOCATION
     log_msg("Creating XML data at %p \n", this);
 #endif
@@ -95,6 +97,7 @@
 
 XML::XML(struct node *childNode)
 {
+    GNASH_REPORT_FUNCTION;
 #ifdef DEBUG_MEMORY_ALLOCATION
     log_msg("\tCreating XML data at %p \n", this);
 #endif
@@ -104,6 +107,8 @@
 
 XML::~XML()
 {
+    GNASH_REPORT_FUNCTION;
+    
 #ifdef DEBUG_MEMORY_ALLOCATION
     if (this->_nodes) {
         log_msg("\tDeleting XML top level node %s at %p \n", 
this->_nodes->_name, this);
@@ -314,7 +319,8 @@
 bool
 XML::parseXML(tu_string xml_in)
 {
-    log_msg("%s:\n", __PRETTY_FUNCTION__);
+    GNASH_REPORT_FUNCTION;
+
     bool        ret = true;
 
     log_msg("Parse XML from memory: %s\n", xml_in.c_str());
@@ -593,6 +599,7 @@
 void
 XML::cleanupStackFrames(XMLNode *xml)
 {
+    GNASH_REPORT_FUNCTION;
 }
 
 as_object *
Index: gnash/utilities/Makefile.am
diff -u gnash/utilities/Makefile.am:1.12 gnash/utilities/Makefile.am:1.13
--- gnash/utilities/Makefile.am:1.12    Fri Mar 10 15:15:13 2006
+++ gnash/utilities/Makefile.am Sat Mar 11 19:24:27 2006
@@ -31,7 +31,8 @@
        ../server/libgnashserver.la \
        ../server/libgnashasobjs.la \
        ../libgeometry/libgnashgeo.la \
-       ../libbase/libgnashbase.la
+       ../libbase/libgnashbase.la \
+       $(LIBXML_LIBS)          \
        $(ZLIB_LIBS)
 
 INCLUDES = -I.. \
@@ -39,6 +40,7 @@
         -I$(top_srcdir)/libbase \
         -I$(top_srcdir)/server  \
         -I$(top_srcdir)/libgeometry \
+        $(LIBXML_CFLAGS)       \
         $(SDL_CFLAGS)
 #      $(PTHREAD_CFLAGS)        \
 #      $(LIBXML_CFLAGS)        \
Index: gnash/utilities/parser.cpp
diff -u gnash/utilities/parser.cpp:1.4 gnash/utilities/parser.cpp:1.5
--- gnash/utilities/parser.cpp:1.4      Wed Feb  1 23:58:32 2006
+++ gnash/utilities/parser.cpp  Sat Mar 11 19:24:27 2006
@@ -1,14 +1,48 @@
-// parser.cpp  -- Willem Kokke 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// A program to parse SWF files into text output.
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program 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 2 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+// Linking Gnash statically or dynamically with other modules is making
+// a combined work based on Gnash. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+// 
+// In addition, as a special exception, the copyright holders of Gnash give
+// you permission to combine Gnash with free software programs or
+// libraries that are released under the GNU LGPL and/or with Mozilla, 
+// so long as the linking with Mozilla, or any variant of Mozilla, is
+// through its standard plug-in interface. You may copy and distribute
+// such a system following the terms of the GNU GPL for Gnash and the
+// licenses of the other code concerned, provided that you include the
+// source code of that other code when and as the GNU GPL requires
+// distribution of source code. 
+// 
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is
+// their choice whether to do so.  The GNU General Public License gives
+// permission to release a modified version without this exception; this
+// exception also makes it possible to release a modified version which
+// carries forward this exception.
+//
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include <iostream>
+#include <cstdio>
+
 #include "tu_file.h"
 #include "zlib_adapter.h"
 #include "image.h"
@@ -21,6 +55,8 @@
 #define TWIPS_TO_PIXELS(x) ((x) / 20.f)
 #define PIXELS_TO_TWIPS(x) ((x) * 20.f)
 
+const char *GPARSE_VERSION = "1.0";
+
 bool gofast = false;           // FIXME: this flag gets set based on
                                // an XML message written using
                                // SendCommand(""). This way a movie
@@ -42,595 +78,614 @@
 
 using gnash::stream;
 using gnash::log_msg;
+using namespace std;
+using namespace gnash;
+
+static void usage (const char *);
 
 namespace parser
 {
-       static int ident = 0;
-       static int current_frame = 0;
-       tu_file* out;
-
-       typedef void (*loader_function)(stream* input, int tag_type);
-       static hash<int, loader_function> tag_loaders;
-
-       void register_tag_loader(int tag_type, loader_function lf)
-       {
-               assert(tag_loaders.get(tag_type, NULL) == false);
-               assert(lf != NULL);
-               tag_loaders.add(tag_type, lf);
-       }
-
-       void log_callback(bool error, const char* message)
-       {
-               static char buf[512];
-
-               strcpy(buf,"");
-
-               for (int i=0; i<ident; i++)
-               {
-                       strcat(buf,"    ");
-               }
-               strcat(buf,message);
-               //out->write_string(buf);
-               fputs(buf,stdout);
-       }
-
-       // parse a matrix
-       struct matrix
-       {
-               static float m_[2][3];
-               static bool has_scale, has_rotate;
-               static void parse(stream* in)
-               {
-                       in->align();
-
-                       memset(&m_[0], 0, sizeof(m_));
-                       m_[0][0] = 1;
-                       m_[1][1] = 1;
-
-                       int     has_scale = in->read_uint(1);
-                       if (has_scale)
-                       {
-                               int     scale_nbits = in->read_uint(5);
-                               m_[0][0] = in->read_sint(scale_nbits) / 
65536.0f;
-                               m_[1][1] = in->read_sint(scale_nbits) / 
65536.0f;
-                       }
-                       int     has_rotate = in->read_uint(1);
-                       if (has_rotate)
-                       {
-                               int     rotate_nbits = in->read_uint(5);
-                               m_[1][0] = in->read_sint(rotate_nbits) / 
65536.0f;
-                               m_[0][1] = in->read_sint(rotate_nbits) / 
65536.0f;
-                       }
-
-                       int     translate_nbits = in->read_uint(5);
-                       if (translate_nbits > 0)
-                       {
-                               m_[0][2] = (float) 
in->read_sint(translate_nbits);
-                               m_[1][2] = (float) 
in->read_sint(translate_nbits);
-                       }
-               }
-               static void write()
-               {
-                       ident++;
-                       log_msg("has_scale = %d, has_rotate = %d\n", has_scale, 
has_rotate);
-                       log_msg("| %4.4f %4.4f %4.4f |\n", m_[0][0], m_[0][1], 
TWIPS_TO_PIXELS(m_[0][2]));
-                       log_msg("| %4.4f %4.4f %4.4f |\n", m_[1][0], m_[1][1], 
TWIPS_TO_PIXELS(m_[1][2]));
-                       ident--;
-               }
-
-       };
-       float matrix::m_[2][3];
-       bool matrix::has_scale, matrix::has_rotate;
-
-       struct rect
-       {
-               static Uint32 x_min,x_max,y_min,y_max;
-               static void parse(stream* in)
-               {
-                       in->align();
-                       int     nbits = in->read_uint(5);
-                       x_min = in->read_sint(nbits);
-                       x_max = in->read_sint(nbits);
-                       y_min = in->read_sint(nbits);
-                       y_max = in->read_sint(nbits);
-               }
-               static void write()
-               {
-                       ident++;
-                       log_msg("x_min: %i, x_max: %i,  width: %i twips, %4.0f 
pixels\n", x_min, x_max, x_max - x_min, TWIPS_TO_PIXELS(x_max - x_min));
-                       log_msg("y_min: %i, y_max: %i, height: %i twips, %4.0f 
pixels\n", y_min, y_max, y_max - y_min, TWIPS_TO_PIXELS(y_max - y_min));
-                       ident--;
-               }
-       };
-       Uint32 rect::x_min;
-       Uint32 rect::y_min;
-       Uint32 rect::x_max;
-       Uint32 rect::y_max;
-
-       struct rgb
-       {
-               static Uint8 m_r, m_g, m_b;
-               static void parse(stream* in)
-               {
-                       m_r = in->read_u8();
-                       m_g = in->read_u8();
-                       m_b = in->read_u8();
-               }
-               static void write()
-               {
-                       ident++;
-                       log_msg("rgb: %d %d %d \n", m_r, m_g, m_b);
-                       ident--;
-               }
-       };
-       Uint8 rgb::m_r;
-       Uint8 rgb::m_g;
-       Uint8 rgb::m_b;
-
-       struct rgba
-       {
-               static Uint8 m_r, m_g, m_b, m_a;
-               static void parse(stream* in)
-               {
-                       m_r = in->read_u8();
-                       m_g = in->read_u8();
-                       m_b = in->read_u8();
-                       m_a = in->read_u8();
-               }
-               static void write()
-               {
-                       ident++;
-                       log_msg("rgba: %d %d %d %d\n", m_r, m_g, m_b, m_a);
-                       ident--;
-               }
-       };
-       Uint8 rgba::m_r;
-       Uint8 rgba::m_g;
-       Uint8 rgba::m_b;
-       Uint8 rgba::m_a;
-
-       struct cxform
-       {
-               static float m_[4][2];
-               static bool has_add, has_mult;
-
-               static void parse_rgb(stream* in)
-               {
-                       in->align();
-
-                       int     has_add = in->read_uint(1);
-                       int     has_mult = in->read_uint(1);
-                       int     nbits = in->read_uint(4);
-
-                       if (has_mult) {
-                               m_[0][0] = in->read_sint(nbits) / 255.0f;
-                               m_[1][0] = in->read_sint(nbits) / 255.0f;
-                               m_[2][0] = in->read_sint(nbits) / 255.0f;
-                               m_[3][0] = 1;
-                       }
-                       else {
-                               for (int i = 0; i < 4; i++) { m_[i][0] = 1; }
-                       }
-                       if (has_add) {
-                               m_[0][1] = (float) in->read_sint(nbits);
-                               m_[1][1] = (float) in->read_sint(nbits);
-                               m_[2][1] = (float) in->read_sint(nbits);
-                               m_[3][1] = 1;
-                       }
-                       else {
-                               for (int i = 0; i < 4; i++) { m_[i][1] = 0; }
-                       }
-               }
-               static void parse_rgba(stream* in)
-               {
-                       in->align();
-
-                       int     has_add = in->read_uint(1);
-                       int     has_mult = in->read_uint(1);
-                       int     nbits = in->read_uint(4);
-
-                       if (has_mult) {
-                               m_[0][0] = in->read_sint(nbits) / 255.0f;
-                               m_[1][0] = in->read_sint(nbits) / 255.0f;
-                               m_[2][0] = in->read_sint(nbits) / 255.0f;
-                               m_[3][0] = in->read_sint(nbits) / 255.0f;
-                       }
-                       else {
-                               for (int i = 0; i < 4; i++) { m_[i][0] = 1; }
-                       }
-                       if (has_add) {
-                               m_[0][1] = (float) in->read_sint(nbits);
-                               m_[1][1] = (float) in->read_sint(nbits);
-                               m_[2][1] = (float) in->read_sint(nbits);
-                               m_[3][1] = (float) in->read_sint(nbits);
-                       }
-                       else {
-                               for (int i = 0; i < 4; i++) { m_[i][1] = 0; }
-                       }
-               }
-               static void write()
-               {
-                       ident++;
-                       log_msg("cxform:\n");
-                       log_msg("has_add = %d, has_mult = %d\n", has_add, 
has_mult);
-                       log_msg("| %4.4f %4.4f |\n", m_[0][0], m_[0][1]);
-                       log_msg("| %4.4f %4.4f |\n", m_[1][0], m_[1][1]);
-                       log_msg("| %4.4f %4.4f |\n", m_[2][0], m_[2][1]);
-                       log_msg("| %4.4f %4.4f |\n", m_[3][0], m_[3][1]);
-                       ident--;
-               }
-       };
-       float cxform::m_[4][2];
-       bool cxform::has_add;
-       bool cxform::has_mult;
-
-       // tag 0
-       void parse_end_movie(stream* input, int tag_type)
-       {
-               assert(tag_type == 0);
-               ident--;
-               log_msg("\n");
-               log_msg("Movie ended\n\n");
-       }
-
-       // tag 1
-       void parse_show_frame(stream* input, int tag_type)
-       {
-               assert(tag_type == 1);
-               ident--;
-               current_frame++;
-               log_msg("\n");
-               log_msg("show frame %i\n\n", current_frame);
-               ident++;
-       }
-
-       // tag 2, 22, 32
-       void parse_define_shape123(stream* input, int tag_type)
-       {
-               assert(tag_type == 2 || tag_type == 22 || tag_type == 32);
-               if(tag_type == 2)
-                       log_msg("define_shape:\n");
-               if(tag_type == 22)
-                       log_msg("define_shape2:\n");
-               if(tag_type == 32)
-                       log_msg("define_shape3:\n");
-               ident++;
-               log_msg("character ID: %i\n", input->read_u16());
-               ident--;
-       }
-
-       // tag 4, 26
-       void parse_place_object12(stream* input, int tag_type)
-       {
-               assert(tag_type == 4 || tag_type == 26);
-               
-               if (tag_type == 4)
-               {
-                       log_msg("place_object:\n");
-                       ident++;
-                       log_msg("character ID: %i\n",input->read_u16());
-                       log_msg("depth: %i\n",input->read_u16());
-                       log_msg("matrix:\n");
-                       matrix::parse(input);
-                       matrix::write();
-                       
-                       if (input->get_position() < 
input->get_tag_end_position())
-                       {
-                               log_msg("color transform:\n");
-                               cxform::parse_rgb(input);
-                               cxform::write();
-                       }
-                       ident--;
-               }
-               else if (tag_type == 26)
-               {
-                       input->align();
-                       
-                       log_msg("place_object2:\n");
-                       ident++;
-                       
-                       bool    has_actions = input->read_uint(1) ? true : 
false;
-                       bool    has_clip_depth = input->read_uint(1) ? true : 
false;
-                       bool    has_name = input->read_uint(1) ? true : false;
-                       bool    has_ratio = input->read_uint(1) ? true : false;
-                       bool    has_cxform = input->read_uint(1) ? true : false;
-                       bool    has_matrix = input->read_uint(1) ? true : false;
-                       bool    has_char = input->read_uint(1) ? true : false;
-                       bool    flag_move = input->read_uint(1) ? true : false;
-
-                       UNUSED(has_actions);
-
-                       log_msg("depth: %i\n",input->read_u16());
-                       
-                       if (has_char) {
-                               log_msg("character ID: %i\n",input->read_u16());
-                       }
-                       if (has_matrix) {
-                               log_msg("matrix:\n");
-                               matrix::parse(input);
-                               matrix::write();
-                       }
-                       if (has_cxform) {
-                               log_msg("color transform:");
-                               cxform::parse_rgba(input);
-                               cxform::write();
-                       }                       
-                       if (has_ratio) {
-                               log_msg("ratio: %i\n",input->read_u16());
-                       }                       
-                       if (has_name) {
-                               log_msg("name: %s\n",input->read_string());
-                       }
-                       if (has_clip_depth) {
-                               log_msg("clipdepth: %i\n",input->read_u16());
-                       }                       
-                       if (has_clip_depth) {
-                               log_msg("has_actions: to be implemented\n");
-                       }
-                       
-                       if (has_char == true && flag_move == true)
-                       {
-                               log_msg("replacing a character previously at 
this depth\n");
-                       }
-                       else if (has_char == false && flag_move == true)
-                       {
-                               log_msg("moving a character previously at this 
depth\n");
-                       }
-                       else if (has_char == true && flag_move == false)
-                       {
-                               log_msg("placing a character first time at this 
depth\n");
-                       }
-                       
-                       ident--;
-               }
-       }
-
-       // tag 5, 28
-       void parse_remove_object12(stream* input, int tag_type)
-       {
-               assert(tag_type == 5 || tag_type == 28);
-               if (tag_type==5)
-               {
-                       log_msg("remove_object\n");
-                       ident++;
-                       log_msg("character ID: %i\n", input->read_u16());
-                       log_msg("depth: %i\n", input->read_u16());
-                       ident--;
-               }
-               if (tag_type==28)
-               {
-                       log_msg("remove_object_2\n");
-                       ident++;
-                       log_msg("depth: %i\n", input->read_u16());
-                       ident--;
-               }
-       }
-
-       // tag 46
-       void parse_define_shape_morph(stream *input, int tag_type)
-       {
-               assert(tag_type == 46);
-               log_msg("define_shape_morph\n");
-               ident++;
-               log_msg("character ID: %i\n", input->read_u16());
-               ident--;
+  static int ident = 0;
+  static int current_frame = 0;
+  tu_file* out;
+
+  typedef void (*loader_function)(stream* input, int tag_type);
+  static hash<int, loader_function> tag_loaders;
+  
+  void
+    register_tag_loader(int tag_type, loader_function lf)
+    {
+      assert(tag_loaders.get(tag_type, NULL) == false);
+      assert(lf != NULL);
+      tag_loaders.add(tag_type, lf);
+    }
+  
+  // parse a matrix
+  struct matrix
+  {
+    static float m_[2][3];
+    static bool has_scale, has_rotate;
+    static void parse(stream* in)
+    {
+      in->align();
+      
+      memset(&m_[0], 0, sizeof(m_));
+      m_[0][0] = 1;
+      m_[1][1] = 1;
+      
+      int      has_scale = in->read_uint(1);
+      if (has_scale) {
+        int    scale_nbits = in->read_uint(5);
+        m_[0][0] = in->read_sint(scale_nbits) / 65536.0f;
+        m_[1][1] = in->read_sint(scale_nbits) / 65536.0f;
+      }
+      int      has_rotate = in->read_uint(1);
+      if (has_rotate) {
+        int    rotate_nbits = in->read_uint(5);
+        m_[1][0] = in->read_sint(rotate_nbits) / 65536.0f;
+        m_[0][1] = in->read_sint(rotate_nbits) / 65536.0f;
+      }
+           
+      int      translate_nbits = in->read_uint(5);
+      if (translate_nbits > 0) {
+        m_[0][2] = (float) in->read_sint(translate_nbits);
+        m_[1][2] = (float) in->read_sint(translate_nbits);
+      }
+    }
+    static void write()
+    {
+      ident++;
+      log_msg("has_scale = %d, has_rotate = %d\n", has_scale, has_rotate);
+      log_msg("| %4.4f %4.4f %4.4f |\n", m_[0][0], m_[0][1], 
TWIPS_TO_PIXELS(m_[0][2]));
+      log_msg("| %4.4f %4.4f %4.4f |\n", m_[1][0], m_[1][1], 
TWIPS_TO_PIXELS(m_[1][2]));
+      ident--;
+    }
+    
+  };
+  float matrix::m_[2][3];
+  bool matrix::has_scale, matrix::has_rotate;
+
+  struct rect
+  {
+    static Uint32 x_min,x_max,y_min,y_max;
+    static void parse(stream* in)
+    {
+      in->align();
+      int      nbits = in->read_uint(5);
+      x_min = in->read_sint(nbits);
+      x_max = in->read_sint(nbits);
+      y_min = in->read_sint(nbits);
+      y_max = in->read_sint(nbits);
+    }
+    static void write()
+    {
+      ident++;
+      log_msg("x_min: %i, x_max: %i,   width: %i twips, %4.0f pixels\n", 
x_min, x_max, x_max - x_min, TWIPS_TO_PIXELS(x_max - x_min));
+      log_msg("y_min: %i, y_max: %i, height: %i twips, %4.0f pixels\n", y_min, 
y_max, y_max - y_min, TWIPS_TO_PIXELS(y_max - y_min));
+      ident--;
+    }
+  };
+  Uint32 rect::x_min;
+  Uint32 rect::y_min;
+  Uint32 rect::x_max;
+  Uint32 rect::y_max;
+
+  struct rgb
+  {
+    static Uint8 m_r, m_g, m_b;
+    static void parse(stream* in)
+    {
+      m_r = in->read_u8();
+      m_g = in->read_u8();
+      m_b = in->read_u8();
+    }
+    static void write()
+    {
+      ident++;
+      log_msg("rgb: %d %d %d \n", m_r, m_g, m_b);
+      ident--;
+    }
+  };
+  Uint8 rgb::m_r;
+  Uint8 rgb::m_g;
+  Uint8 rgb::m_b;
+
+  struct rgba
+  {
+    static Uint8 m_r, m_g, m_b, m_a;
+    static void parse(stream* in)
+    {
+      m_r = in->read_u8();
+      m_g = in->read_u8();
+      m_b = in->read_u8();
+      m_a = in->read_u8();
+    }
+    static void write()
+    {
+      ident++;
+      log_msg("rgba: %d %d %d %d\n", m_r, m_g, m_b, m_a);
+      ident--;
+    }
+  };
+  Uint8 rgba::m_r;
+  Uint8 rgba::m_g;
+  Uint8 rgba::m_b;
+  Uint8 rgba::m_a;
+
+  struct cxform
+  {
+    static float m_[4][2];
+    static bool has_add, has_mult;
+    
+    static void parse_rgb(stream* in)
+    {
+      in->align();
+           
+      int      has_add = in->read_uint(1);
+      int      has_mult = in->read_uint(1);
+      int      nbits = in->read_uint(4);
+           
+      if (has_mult) {
+        m_[0][0] = in->read_sint(nbits) / 255.0f;
+        m_[1][0] = in->read_sint(nbits) / 255.0f;
+        m_[2][0] = in->read_sint(nbits) / 255.0f;
+        m_[3][0] = 1;
+      } else {
+        for (int i = 0; i < 4; i++) { m_[i][0] = 1; }
+      }
+      if (has_add) {
+        m_[0][1] = (float) in->read_sint(nbits);
+        m_[1][1] = (float) in->read_sint(nbits);
+        m_[2][1] = (float) in->read_sint(nbits);
+        m_[3][1] = 1;
+      } else {
+        for (int i = 0; i < 4; i++) {
+          m_[i][1] = 0;
+        }
+      }
+    }
+    static void parse_rgba(stream* in)
+    {
+      in->align();
+           
+      int      has_add = in->read_uint(1);
+      int      has_mult = in->read_uint(1);
+      int      nbits = in->read_uint(4);
+           
+      if (has_mult) {
+        m_[0][0] = in->read_sint(nbits) / 255.0f;
+        m_[1][0] = in->read_sint(nbits) / 255.0f;
+        m_[2][0] = in->read_sint(nbits) / 255.0f;
+        m_[3][0] = in->read_sint(nbits) / 255.0f;
+      } else {
+        for (int i = 0; i < 4; i++) {
+          m_[i][0] = 1;
+        }
+      }
+      if (has_add) {
+        m_[0][1] = (float) in->read_sint(nbits);
+        m_[1][1] = (float) in->read_sint(nbits);
+        m_[2][1] = (float) in->read_sint(nbits);
+        m_[3][1] = (float) in->read_sint(nbits);
+      } else {
+        for (int i = 0; i < 4; i++) {
+          m_[i][1] = 0;
+        }
+      }
+    }
+    static void write()
+    {
+      ident++;
+      log_msg("cxform:\n");
+      log_msg("has_add = %d, has_mult = %d\n", has_add, has_mult);
+      log_msg("| %4.4f %4.4f |\n", m_[0][0], m_[0][1]);
+      log_msg("| %4.4f %4.4f |\n", m_[1][0], m_[1][1]);
+      log_msg("| %4.4f %4.4f |\n", m_[2][0], m_[2][1]);
+      log_msg("| %4.4f %4.4f |\n", m_[3][0], m_[3][1]);
+      ident--;
+    }
+  };
+  float cxform::m_[4][2];
+  bool cxform::has_add;
+  bool cxform::has_mult;
+
+  // tag 0
+  void parse_end_movie(stream* input, int tag_type)
+    {
+      assert(tag_type == 0);
+      ident--;
+      log_msg("\n");
+      log_msg("Movie ended\n\n");
+    }
+
+  // tag 1
+  void parse_show_frame(stream* input, int tag_type)
+    {
+      assert(tag_type == 1);
+      ident--;
+      current_frame++;
+      log_msg("\n");
+      log_msg("show frame %i\n\n", current_frame);
+      ident++;
+    }
+
+  // tag 2, 22, 32
+  void parse_define_shape123(stream* input, int tag_type)
+    {
+      assert(tag_type == 2 || tag_type == 22 || tag_type == 32);
+      if(tag_type == 2) {
+       log_msg("define_shape:\n");
+      }
+      if(tag_type == 22) {
+       log_msg("define_shape2:\n");
+      }
+      if(tag_type == 32) {
+       log_msg("define_shape3:\n");
+      }
+    
+      ident++;
+      log_msg("character ID: %i\n", input->read_u16());
+      ident--;
+    }
+
+  // tag 4, 26
+  void parse_place_object12(stream* input, int tag_type)
+    {
+      assert(tag_type == 4 || tag_type == 26);
+    
+      if (tag_type == 4) {
+       log_msg("place_object:\n");
+       ident++;
+       log_msg("character ID: %i\n",input->read_u16());
+       log_msg("depth: %i\n",input->read_u16());
+       log_msg("matrix:\n");
+       matrix::parse(input);
+       matrix::write();
+       
+       if (input->get_position() < input->get_tag_end_position()) {
+          log_msg("color transform:\n");
+          cxform::parse_rgb(input);
+          cxform::write();
+       }
+       ident--;
+      } else if (tag_type == 26) {
+       input->align();
+       
+       log_msg("place_object2:\n");
+       ident++;
+       
+       bool    has_actions = input->read_uint(1) ? true : false;
+       bool    has_clip_depth = input->read_uint(1) ? true : false;
+       bool    has_name = input->read_uint(1) ? true : false;
+       bool    has_ratio = input->read_uint(1) ? true : false;
+       bool    has_cxform = input->read_uint(1) ? true : false;
+       bool    has_matrix = input->read_uint(1) ? true : false;
+       bool    has_char = input->read_uint(1) ? true : false;
+       bool    flag_move = input->read_uint(1) ? true : false;
+       
+       UNUSED(has_actions);
+       
+       log_msg("depth: %i\n",input->read_u16());
+       
+       if (has_char) {
+          log_msg("character ID: %i\n",input->read_u16());
        }
-
-       // tag 6
-       void parse_define_bits(stream* input, int tag_type)
-       {
-               assert(tag_type==6);
-               log_msg("define jpeg bits\n");
-               ident++;
-               log_msg("character ID: %i\n", input->read_u16());
-               ident--;
+       if (has_matrix) {
+          log_msg("matrix:\n");
+          matrix::parse(input);
+          matrix::write();
+       }
+       if (has_cxform) {
+          log_msg("color transform:");
+          cxform::parse_rgba(input);
+          cxform::write();
+       }                       
+       if (has_ratio) {
+          log_msg("ratio: %i\n",input->read_u16());
+       }                       
+       if (has_name) {
+          log_msg("name: %s\n",input->read_string());
+       }
+       if (has_clip_depth) {
+          log_msg("clipdepth: %i\n",input->read_u16());
+       }                       
+       if (has_clip_depth) {
+          log_msg("has_actions: to be implemented\n");
        }
-
-       void parse_jpeg_tables(stream* input, int tag_type)
-       {
-               assert(tag_type==8);
-               log_msg("define jpeg table\n\n");
-       }       
-       
-       void parse_set_background_color(stream* input, int tag_type)
-       {
-               assert(tag_type==9);
-               rgb::parse(input);
-               log_msg("set background color to:\n");
-               rgb::write();           
+       
+       if (has_char == true && flag_move == true) {
+          log_msg("replacing a character previously at this depth\n");
+       } else if (has_char == false && flag_move == true) {
+          log_msg("moving a character previously at this depth\n");
+       } else if (has_char == true && flag_move == false) {
+          log_msg("placing a character first time at this depth\n");
        }
-
-       void parse_do_action(stream* input, int tag_type)
-       {
-               assert(tag_type==12);
-               log_msg("do action:\n");
-               ident++;
-               log_msg("to be implemented\n");
-               ident--;
-       }               
-
-       void parse_define_sprite(stream* input, int tag_type)
-       {
-               assert(tag_type==39);
-               log_msg("define a new sprite:\n");
-               ident++;
-               int     tag_end = input->get_tag_end_position();
-               Uint32 char_id = input->read_u16();
-               Uint32 sprite_frame_count = input->read_u16();
-               log_msg("character ID: %i\n", char_id);
-               log_msg("frame count of sprite: %i\n", sprite_frame_count);
-               Uint32 old_current_frame = current_frame;
-               current_frame = 0;
-
-               ident++;
-               log_msg("\n");          
-               log_msg("starting frame 0\n\n");
-               ident++;
-
-               while ((Uint32) input->get_position() < (Uint32) tag_end)
-               {
-                       int     tag_type = input->open_tag();
-                       loader_function lf = NULL;
-
-                       if (tag_type == 0)
-                       {
-                               ident--;
-                               ident--;
-                               ident--;
-                               log_msg("end of sprite definition\n\n");
-                       }
-                       else if (tag_loaders.get(tag_type, &lf))
-                       {
-                               (*lf)(input, tag_type);
-                       }
-                       else
-                       {
-                               log_msg("warning: no tag loader for tag_type 
%d\n", tag_type);
-                       }
-                       input->close_tag();
-               }
-               current_frame = old_current_frame;
-       }       
-       
-       void parse_set_framelabel(stream* input, int tag_type)
-       {
-               assert(tag_type==43);
-               log_msg("current framelabel:\n");
-               ident++;
-               char* str = input->read_string();
-               log_msg("%s\n",str);
-               delete str;
-
-               if (input->get_position() < input->get_tag_end_position())
-               {
-                       //TODOm_color_transform.read_rgb(in);
-               }
-               ident--;
-       }       
-       
-       void parse_swf(tu_file* file)
-       {
-               register_tag_loader(0,parse_end_movie);         
-               register_tag_loader(1,parse_show_frame);
-               register_tag_loader(2,parse_define_shape123);
-               register_tag_loader(4,parse_place_object12);
-               register_tag_loader(5,parse_remove_object12);
-               register_tag_loader(6,parse_define_bits);                       
-               register_tag_loader(8,parse_jpeg_tables);                       
        
-               register_tag_loader(9,parse_set_background_color);
-               register_tag_loader(12,parse_do_action);        
-               register_tag_loader(22,parse_define_shape123);
-               register_tag_loader(26,parse_place_object12);
-               register_tag_loader(28,parse_remove_object12);
-               register_tag_loader(32,parse_define_shape123);
-               register_tag_loader(39,parse_define_sprite);    
-               register_tag_loader(43,parse_set_framelabel);           
-                register_tag_loader(46,parse_define_shape_morph);
-
-               ident = 1;
-
-               Uint32 header = file->read_le32();
-               Uint32 file_length = file->read_le32();
-
-               Uint32 version = (header >> 24) & 255;
-               if ((header & 0x0FFFFFF) != 0x00535746 && (header & 0x0FFFFFF) 
!= 0x00535743)
-               {
-                       log_msg("\nNo valid SWF file, header is incorrect!\n");
-                       return;
-               }
-
-               bool compressed = (header & 255) == 'C';
-
-               tu_file* original_file = NULL;
-
-               log_msg("\nSWF version %i, file length = %i bytes\n", version, 
file_length);
-
-               if (compressed)
-               {
-                       log_msg("file is compressed.\n");
-                       original_file = file;
-                       file = zlib_adapter::make_inflater(original_file);
-                       file_length -= 8;
-               }
-
-               stream str(file);
-
-               rect::parse(&str);
-               float frame_rate = str.read_u16() / 256.0f;
-               int frame_count = str.read_u16();
-
-               log_msg("viewport:\n");
-               rect::write();
-               log_msg("frame rate = %f, number of frames = %d\n", frame_rate, 
frame_count);
-
-               log_msg("\n");
-               log_msg("starting frame 0\n\n");
-               ident++;
-
-               while ((Uint32) str.get_position() < file_length)
-               {
-                       int     tag_type = str.open_tag();
-
-                       loader_function lf = NULL;
-
-                       if (tag_loaders.get(tag_type, &lf))
-                       {
-                               (*lf)(&str, tag_type);
-
-                       } else
-                       {
-                               log_msg("warning: no tag loader for tag_type 
%d\n", tag_type);
-                       }
-
-                       str.close_tag();
-
-                       if (tag_type == 0)
-                       {
-                               if ((unsigned int)str.get_position() != 
file_length)
-                               {
-                                       log_msg("warning: end of file tag 
found, while not at the end of the file, aborting\n");
-                                       break;
-                               }
-                       }
-               }
-
-               if (out)
-               {
-                       delete out;
-               }
-               if (original_file)
-               {
-                       delete file;
-               }
-               exit(0);
+       
+       ident--;
+      }
+    }
+
+  // tag 5, 28
+  void parse_remove_object12(stream* input, int tag_type)
+    {
+      assert(tag_type == 5 || tag_type == 28);
+      if (tag_type==5) {
+       log_msg("remove_object\n");
+       ident++;
+       log_msg("character ID: %i\n", input->read_u16());
+       log_msg("depth: %i\n", input->read_u16());
+       ident--;
+      }
+      if (tag_type==28) {
+       log_msg("remove_object_2\n");
+       ident++;
+       log_msg("depth: %i\n", input->read_u16());
+       ident--;
+      }
+    }
+
+  // tag 46
+  void parse_define_shape_morph(stream *input, int tag_type)
+    {
+      assert(tag_type == 46);
+      log_msg("define_shape_morph\n");
+      ident++;
+      log_msg("character ID: %i\n", input->read_u16());
+      ident--;
+    }
+
+  // tag 6
+  void parse_define_bits(stream* input, int tag_type)
+    {
+      assert(tag_type==6);
+      log_msg("define jpeg bits\n");
+      ident++;
+      log_msg("character ID: %i\n", input->read_u16());
+      ident--;
+    }
+
+  void parse_jpeg_tables(stream* input, int tag_type)
+    {
+      assert(tag_type==8);
+      log_msg("define jpeg table\n\n");
+    }  
+
+  void parse_set_background_color(stream* input, int tag_type)
+    {
+      assert(tag_type==9);
+      rgb::parse(input);
+      log_msg("set background color to:\n");
+      rgb::write();            
+    }
+
+  void parse_do_action(stream* input, int tag_type)
+    {
+      assert(tag_type==12);
+      log_msg("do action:\n");
+      ident++;
+      log_msg("to be implemented\n");
+      ident--;
+    }          
+
+  void parse_define_sprite(stream* input, int tag_type)
+    {
+      assert(tag_type==39);
+      log_msg("define a new sprite:\n");
+      ident++;
+      int      tag_end = input->get_tag_end_position();
+      Uint32 char_id = input->read_u16();
+      Uint32 sprite_frame_count = input->read_u16();
+      log_msg("character ID: %i\n", char_id);
+      log_msg("frame count of sprite: %i\n", sprite_frame_count);
+      Uint32 old_current_frame = current_frame;
+      current_frame = 0;
+    
+      ident++;
+      log_msg("\n");           
+      log_msg("starting frame 0\n\n");
+      ident++;
+    
+      while ((Uint32) input->get_position() < (Uint32) tag_end) {
+       int     tag_type = input->open_tag();
+       loader_function lf = NULL;
+       
+       if (tag_type == 0) {
+          ident--;
+          ident--;
+          ident--;
+          log_msg("end of sprite definition\n\n");
+       } else if (tag_loaders.get(tag_type, &lf)) {
+          (*lf)(input, tag_type);
+       } else {
+          log_msg("warning: no tag loader for tag_type %d\n", tag_type);
+       }
+       input->close_tag();
+      }
+      current_frame = old_current_frame;
+    }  
+
+  void parse_set_framelabel(stream* input, int tag_type)
+    {
+      assert(tag_type==43);
+      log_msg("current framelabel:\n");
+      ident++;
+      char* str = input->read_string();
+      log_msg("%s\n",str);
+      delete str;
+    
+      if (input->get_position() < input->get_tag_end_position()) {
+       //TODOm_color_transform.read_rgb(in);
+      }
+      ident--;
+    }  
+
+    void register_all_loaders(void)
+      {
+      register_tag_loader(0,parse_end_movie);          
+      register_tag_loader(1,parse_show_frame);
+      register_tag_loader(2,parse_define_shape123);
+      register_tag_loader(4,parse_place_object12);
+      register_tag_loader(5,parse_remove_object12);
+      register_tag_loader(6,parse_define_bits);                        
+      register_tag_loader(8,parse_jpeg_tables);                                
+      register_tag_loader(9,parse_set_background_color);
+      register_tag_loader(12,parse_do_action); 
+      register_tag_loader(22,parse_define_shape123);
+      register_tag_loader(26,parse_place_object12);
+      register_tag_loader(28,parse_remove_object12);
+      register_tag_loader(32,parse_define_shape123);
+      register_tag_loader(39,parse_define_sprite);     
+      register_tag_loader(43,parse_set_framelabel);            
+      register_tag_loader(46,parse_define_shape_morph);  
+    }
+    
+  void parse_swf(tu_file* file)
+    {
+      ident = 1;
+    
+      Uint32 header = file->read_le32();
+      Uint32 file_length = file->read_le32();
+    
+      Uint32 version = (header >> 24) & 255;
+      if ((header & 0x0FFFFFF) != 0x00535746 && (header & 0x0FFFFFF) != 
0x00535743) {
+       log_msg("\nNo valid SWF file, header is incorrect!\n");
+       return;
+      }
+    
+      bool compressed = (header & 255) == 'C';
+    
+      tu_file* original_file = NULL;
+    
+      log_msg("\nSWF version %i, file length = %i bytes\n", version, 
file_length);
+    
+      if (compressed) {
+       log_msg("file is compressed.\n");
+       original_file = file;
+       file = zlib_adapter::make_inflater(original_file);
+       file_length -= 8;
+      }
+    
+      stream str(file);
+    
+      rect::parse(&str);
+      float frame_rate = str.read_u16() / 256.0f;
+      int frame_count = str.read_u16();
+    
+      log_msg("viewport:\n");
+      rect::write();
+      log_msg("frame rate = %f, number of frames = %d\n", frame_rate, 
frame_count);
+    
+      log_msg("\n");
+      log_msg("starting frame 0\n\n");
+      ident++;
+    
+      while ((Uint32) str.get_position() < file_length) {
+       int     tag_type = str.open_tag();
+       
+       loader_function lf = NULL;
+       
+       if (tag_loaders.get(tag_type, &lf)) {
+          (*lf)(&str, tag_type);           
+       } else {
+          log_msg("warning: no tag loader for tag_type %d\n", tag_type);
        }
+       
+       str.close_tag();
+       
+       if (tag_type == 0) {
+          if ((unsigned int)str.get_position() != file_length) {
+            log_msg("warning: end of file tag found, while not at the end of 
the file, aborting\n");
+            break;
+          }
+       }
+      }
+    
+      if (out) {
+       delete out;
+      }
+      if (original_file) {
+       delete file;
+      }
+    }
 }
 
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
 {
-       const char* infile = argv[1];
-       gnash::register_log_callback(parser::log_callback);
+  int c;
+  unsigned int i;
+  std::vector<const char*> infiles;
+  
+  // scan for the two main standard GNU options
+  for (c=0; c<argc; c++) {
+    if (strcmp("--help", argv[c]) == 0) {
+      usage(argv[0]);
+      exit(0);
+    }
+    if (strcmp("--version", argv[c]) == 0) {
+      cerr << "Gnash gprocessor version: " << GPARSE_VERSION;
+      cerr << ", Gnash version: " << VERSION << endl;
+      exit(0);
+    }
+  }
+  
+  while ((c = getopt (argc, argv, "h")) != -1) {
+    switch (c) {
+    case 'h':
+      usage (argv[0]);
+      break;
+    default:
+      break;
+    }
+  }
+  
+  // get the file name from the command line
+  while (optind < argc) {
+    infiles.push_back(argv[optind]);
+    optind++;
+  }
+  
+  // No file names were supplied
+  if (infiles.size() == 0) {
+    printf("no input files\n");
+    usage(argv[0]);
+    exit(1);
+  }
+  
+  // We always want output from this program
+  dbglogfile.setVerbosity(1);
+
+  parser::register_all_loaders();
+  for (i=0; i<infiles.size(); i++) {
+    tu_file*   in = new tu_file(infiles[i], "rb");
+    cerr << "Processing file: " << infiles[i] << endl;
+    if (in->get_error()) {
+      log_msg("can't open '%s' for input\n", infiles[i]);
+      delete in;
+      exit(1);
+    }
+    
+    parser::parse_swf(in);
+    delete in;
+  }
+  
+  exit(0);
+}
 
-       if (infile == NULL)
-       {
-               log_msg("pass a filename as a parameter\n");
-               exit(1);
-       }
 
-       tu_file*        in = new tu_file(infile, "rb");
-       if (in->get_error())
-       {
-               log_msg("can't open '%s' for input\n", infile);
-               delete in;
-               exit(1);
-       }
-       parser::parse_swf(in);
-       return(0);
+static void
+usage (const char *)
+{
+    printf(
+       "gparser -- an SWF parser for Gnash.\n"
+       "\n"
+       "usage: gparser [swf files to process...]\n"
+       "  --help(-h)  Print this info.\n"
+       "  --version   Print the version numbers.\n"
+       );
 }
 
 // Local Variables:
 // mode: C++
-// c-basic-offset: 8
-// tab-width: 8
 // indent-tabs-mode: t
 // End:
Index: gnash/utilities/processor.cpp
diff -u gnash/utilities/processor.cpp:1.5 gnash/utilities/processor.cpp:1.6
--- gnash/utilities/processor.cpp:1.5   Sun Feb 26 21:44:53 2006
+++ gnash/utilities/processor.cpp       Sat Mar 11 19:24:27 2006
@@ -1,13 +1,41 @@
-// processor.cpp       -- Thatcher Ulrich <address@hidden> 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// A SWF preprocessor for the library.  Loads a set of SWF
-// files and generates precomputed data such as font bitmaps and shape
-// tesselation meshes.  The precomputed data can be appended to the
-// original SWF files, so that we can more rapidly load those SWF
-// files later.
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program 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 2 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+// Linking Gnash statically or dynamically with other modules is making
+// a combined work based on Gnash. Thus, the terms and conditions of
+// the GNU General Public License cover the whole combination.
+// 
+// In addition, as a special exception, the copyright holders of Gnash give
+// you permission to combine Gnash with free software programs or
+// libraries that are released under the GNU LGPL and/or with Mozilla, 
+// so long as the linking with Mozilla, or any variant of Mozilla, is
+// through its standard plug-in interface. You may copy and distribute
+// such a system following the terms of the GNU GPL for Gnash and the
+// licenses of the other code concerned, provided that you include the
+// source code of that other code when and as the GNU GPL requires
+// distribution of source code. 
+// 
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is
+// their choice whether to do so.  The GNU General Public License gives
+// permission to release a modified version without this exception; this
+// exception also makes it possible to release a modified version which
+// carries forward this exception.
+//
+//
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -17,6 +45,9 @@
 #include "container.h"
 #include "gnash.h"
 #include "Movie.h"
+#include "log.h"
+
+#include <iostream>
 
 bool gofast = false;           // FIXME: this flag gets set based on
                                // an XML message written using
@@ -37,186 +68,128 @@
                                // want to make sure it all works.
 #endif // HAVE_LIBXML
 
+const char *GPROC_VERSION = "1.0";
 
-static bool    s_verbose = false;
-
-static void    message_log(const char* message)
-// Process a log message.
-{
-       if (s_verbose)
-       {
-               fputs(message, stdout);
-                //flush(stdout); // needed on osx for some reason
-       }
-}
-
-
-static void    log_callback(bool error, const char* message)
-// Error callback for handling messages.
-{
-       if (error)
-       {
-               // Log, and also print to stderr.
-               message_log(message);
-               fputs(message, stderr);
-       }
-       else
-       {
-               message_log(message);
-       }
-}
+using namespace std;
+using namespace gnash;
 
+static void usage (const char *);
 
-static tu_file*        file_opener(const char* url)
 // Callback function.  This opens files for the library.
+static tu_file*        file_opener(const char* url)
 {
-       return new tu_file(url, "rb");
-}
-
-
-static void    print_usage()
-{
-       printf(
-               "gprocessor -- a SWF preprocessor for gnash.\n"
-               "\n"
-               "This program has been donated to the Public Domain.\n"
-               "See http://tulrich.com/geekstuff/gameswf.html for more info.\n"
-               "\n"
-               "usage: processor [options] [swf files to process...]\n"
-               "\n"
-               "Preprocesses the given SWF movie files.  Optionally write 
preprocessed shape\n"
-               "and font data to cache files, so the associated SWF files can 
be loaded\n"
-               "faster by gameswf.\n"
-               "\n"
-               "options:\n"
-               "\n"
-               "  -h          Print this info.\n"
-               "  -w          Write a .gsc file with preprocessed info, for 
each input file.\n"
-               "  -v          Be verbose; i.e. print log messages to stdout\n"
-               "  -vp         Be verbose about movie parsing\n"
-               "  -va         Be verbose about ActionScript\n"
-               );
+    return new tu_file(url, "rb");
 }
 
 
 struct movie_data
 {
-       gnash::movie_definition*        m_movie;
-       tu_string       m_filename;
+    gnash::movie_definition*   m_movie;
+    tu_string  m_filename;
 };
 
-
 static gnash::movie_definition*        play_movie(const char* filename);
-static int     write_cache_file(const movie_data& md);
+static int write_cache_file(const movie_data& md);
 
+static bool s_do_output = false;
+static bool s_stop_on_errors = true;
 
-static bool    s_do_output = false;
-static bool    s_stop_on_errors = true;
-
-
-int    main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
 {
-       assert(tu_types_validate());
-
-       std::vector<const char*> infiles;
-
-       for (int arg = 1; arg < argc; arg++)
-       {
-               if (argv[arg][0] == '-')
-               {
-                       // Looks like an option.
-
-                       if (argv[arg][1] == 'h')
-                       {
-                               // Help.
-                               print_usage();
-                               exit(1);
-                       }
-                       else if (argv[arg][1] == 'w')
-                       {
-                               // Write cache files.
-                               s_do_output = true;
-                       }
-                       else if (argv[arg][1] == 'v')
-                       {
-                               // Be verbose; i.e. print log messages to 
stdout.
-                               s_verbose = true;
-
-                               if (argv[arg][2] == 'a')
-                               {
-                                       // Enable spew re: action.
-                                       gnash::set_verbose_action(true);
-                               }
-                               else if (argv[arg][2] == 'p')
-                               {
-                                       // Enable parse spew.
-                                       gnash::set_verbose_parse(true);
-                               }
-                               // ...
-                       }
-               }
-               else
-               {
-                       infiles.push_back(argv[arg]);
-               }
-       }
+    int c;
+    int verbosity = 0;
+    assert(tu_types_validate());
+    std::vector<const char*> infiles;
+    
+    // scan for the two main standard GNU options
+    for (c=0; c<argc; c++) {
+      if (strcmp("--help", argv[c]) == 0) {
+        usage(argv[0]);
+        exit(0);
+      }
+      if (strcmp("--version", argv[c]) == 0) {
+        cerr << "Gnash gprocessor version: " << GPROC_VERSION;
+        cerr << ", Gnash version: " << VERSION << endl;
+        exit(0);
+      }
+    }
+    
+    while ((c = getopt (argc, argv, "hwvap")) != -1) {
+       switch (c) {
+         case 'h':
+             usage (argv[0]);
+             break;
+         case 'w':
+             s_do_output = true;
+             break;
+         case 'v':
+             verbosity++;
+             dbglogfile.setVerbosity(verbosity);
+             dbglogfile << "Verbose output turned on" << endl;
+             break;
+         case 'a':
+             gnash::set_verbose_action(true);
+             break;
+         case 'p':
+             gnash::set_verbose_parse(true);
+             break;
+       }
+    }
+    
+    
+    // get the file name from the command line
+    while (optind < argc) {
+        infiles.push_back(argv[optind]);
+       optind++;
+    }
+
+    // No file names were supplied
+    if (infiles.size() == 0) {
+       printf("no input files\n");
+       usage(argv[0]);
+       exit(1);
+    }
 
-       if (infiles.size() == 0)
-       {
-               printf("no input files\n");
-               print_usage();
-               exit(1);
-       }
-
-       gnash::register_file_opener_callback(file_opener);
-       gnash::register_log_callback(log_callback);
-       gnash::set_use_cache_files(false);      // don't load old cache files!
+    gnash::register_file_opener_callback(file_opener);
+    gnash::set_use_cache_files(false); // don't load old cache files!
         
-       std::vector<movie_data> data;
+    std::vector<movie_data>    data;
 
-       // Play through all the movies.
-       for (int i = 0, n = infiles.size(); i < n; i++)
-       {
-               gnash::movie_definition*        m = play_movie(infiles[i]);
-               if (m == NULL)
-               {
-                       if (s_stop_on_errors)
-                       {
-                               // Fail.
-                               fprintf(stderr, "error playing through movie 
'%s', quitting\n", infiles[i]);
-                               exit(1);
-                       }
-               }
-               
-               movie_data      md;
-               md.m_movie = m;
-               md.m_filename = infiles[i];
-               data.push_back(md);
+    // Play through all the movies.
+    for (int i = 0, n = infiles.size(); i < n; i++) {
+       gnash::movie_definition*        m = play_movie(infiles[i]);
+       if (m == NULL) {
+           if (s_stop_on_errors) {
+               // Fail.
+               fprintf(stderr, "error playing through movie '%s', quitting\n", 
infiles[i]);
+               exit(1);
+           }
        }
-
-       // Now append processed data.
-       if (s_do_output)
-       {
-               for (int i = 0, n = data.size(); i < n; i++)
-               {
-                       int     error = write_cache_file(data[i]);
-                       if (error)
-                       {
-                               if (s_stop_on_errors)
-                               {
-                                       // Fail.
-                                       fprintf(stderr, "error processing movie 
'%s', quitting\n", data[i].m_filename.c_str());
-                                       exit(1);
-                               }
-                       }
+       
+       movie_data      md;
+       md.m_movie = m;
+       md.m_filename = infiles[i];
+       data.push_back(md);
+    }
+    
+    // Now append processed data.
+    if (s_do_output) {
+       for (int i = 0, n = data.size(); i < n; i++) {
+           int error = write_cache_file(data[i]);
+           if (error) {
+               if (s_stop_on_errors) {
+                   // Fail.
+                   fprintf(stderr, "error processing movie '%s', quitting\n", 
data[i].m_filename.c_str());
+                   exit(1);
                }
+           }
        }
-
-       return 0;
+    }
+    
+    return 0;
 }
 
-
-gnash::movie_definition*       play_movie(const char* filename)
 // Load the named movie, make an instance, and play it, virtually.
 // I.e. run through and render all the frames, even though we are not
 // actually doing any output (our output handlers are disabled).
@@ -226,115 +199,122 @@
 // or build font textures again.
 //
 // Return the movie definition.
+gnash::movie_definition*
+play_movie(const char* filename)
 {
-       gnash::movie_definition*        md = 
gnash::create_library_movie(filename);
-       if (md == NULL)
-       {
-               fprintf(stderr, "error: can't play movie '%s'\n", filename);
-               exit(1);
-       }
-       gnash::movie_interface* m = md->create_instance();
-       if (m == NULL)
-       {
-               fprintf(stderr, "error: can't create instance of movie '%s'\n", 
filename);
-               exit(1);
-       }
-
-       int     kick_count = 0;
-
-       // Run through the movie.
-       for (;;)
-       {
-               // @@ do we also have to run through all sprite frames
-               // as well?
-               //
-               // @@ also, ActionScript can rescale things
-               // dynamically -- we can't really do much about that I
-               // guess?
-               //
-               // @@ Maybe we should allow the user to specify some
-               // safety margin on scaled shapes.
-
-               int     last_frame = m->get_current_frame();
-               m->advance(0.010f);
-               m->display();
-
-               if (m->get_current_frame() == md->get_frame_count() - 1)
-               {
-                       // Done.
-                       break;
-               }
-
-               if (m->get_play_state() == gnash::movie_interface::STOP)
-               {
-                       // Kick the movie.
-                       printf("kicking movie, kick ct = %d\n", kick_count);
-                       m->goto_frame(last_frame + 1);
-                       m->set_play_state(gnash::movie_interface::PLAY);
-                       kick_count++;
-
-                       if (kick_count > 10)
-                       {
-                               printf("movie is stalled; giving up on playing 
it through.\n");
-                               break;
-                       }
-               }
-               else if (m->get_current_frame() < last_frame)
-               {
-                       // Hm, apparently we looped back.  Skip ahead...
-                       printf("loop back; jumping to frame %d\n", last_frame);
-                       m->goto_frame(last_frame + 1);
-               }
-               else
-               {
-                       kick_count = 0;
-               }
-       }
-
-       return md;
+    gnash::movie_definition*   md = gnash::create_library_movie(filename);
+    if (md == NULL) {
+       fprintf(stderr, "error: can't play movie '%s'\n", filename);
+       exit(1);
+    }
+    gnash::movie_interface*    m = md->create_instance();
+    if (m == NULL) {
+       fprintf(stderr, "error: can't create instance of movie '%s'\n", 
filename);
+       exit(1);
+    }
+    
+    int        kick_count = 0;
+    
+    // Run through the movie.
+    for (;;) {
+       // @@ do we also have to run through all sprite frames
+       // as well?
+       //
+       // @@ also, ActionScript can rescale things
+       // dynamically -- we can't really do much about that I
+       // guess?
+       //
+       // @@ Maybe we should allow the user to specify some
+       // safety margin on scaled shapes.
+       
+       int     last_frame = m->get_current_frame();
+       m->advance(0.010f);
+       m->display();
+       
+       if (m->get_current_frame() == md->get_frame_count() - 1) {
+           // Done.
+           break;
+       }
+       
+       if (m->get_play_state() == gnash::movie_interface::STOP) {
+           // Kick the movie.
+           printf("kicking movie, kick ct = %d\n", kick_count);
+           m->goto_frame(last_frame + 1);
+           m->set_play_state(gnash::movie_interface::PLAY);
+           kick_count++;
+           
+           if (kick_count > 10) {
+               printf("movie is stalled; giving up on playing it through.\n");
+               break;
+           }
+       } else if (m->get_current_frame() < last_frame) {
+           // Hm, apparently we looped back.  Skip ahead...
+           printf("loop back; jumping to frame %d\n", last_frame);
+           m->goto_frame(last_frame + 1);
+       } else {
+           kick_count = 0;
+       }
+    }
+    
+    return md;
 }
 
-
-int    write_cache_file(const movie_data& md)
+int
 // Write a cache file for the given movie.
+write_cache_file(const movie_data& md)
 {
-       // Open cache file.
-       tu_string       cache_filename(md.m_filename);
-       cache_filename += ".gsc";
-       tu_file out(cache_filename.c_str(), "wb");      // "gsc" == "gnash 
cache"
-       if (out.get_error() == TU_FILE_NO_ERROR)
-       {
-               // Write out the data.
-               gnash::cache_options    opt;
-               md.m_movie->output_cached_data(&out, opt);
-               if (out.get_error() == TU_FILE_NO_ERROR)
-               {
-                       printf(
-                               "wrote '%s'\n",
-                               cache_filename.c_str());
-               }
-               else
-               {
-                       fprintf(stderr, "error: write failure to '%s'\n", 
cache_filename.c_str());
-               }
-       }
-       else
-       {
-               fprintf(stderr, "error: can't open '%s' for cache file 
output\n", cache_filename.c_str());
-               return 1;
-       }
+    // Open cache file.
+    tu_string  cache_filename(md.m_filename);
+    cache_filename += ".gsc";
+    tu_file    out(cache_filename.c_str(), "wb");      // "gsc" == "gnash 
cache"
+    if (out.get_error() == TU_FILE_NO_ERROR) {
+       // Write out the data.
+       gnash::cache_options    opt;
+       md.m_movie->output_cached_data(&out, opt);
+       if (out.get_error() == TU_FILE_NO_ERROR) {
+           printf(
+               "wrote '%s'\n",
+               cache_filename.c_str());
+       } else {
+           fprintf(stderr, "error: write failure to '%s'\n", 
cache_filename.c_str());
+       }
+    } else {
+       fprintf(stderr, "error: can't open '%s' for cache file output\n", 
cache_filename.c_str());
+       return 1;
+    }
+    
+    // // xxx temp debug code: dump cached data to stdout
+    // tu_file tu_stdout(stdout, false);
+    // tu_stdout.copy_from(&cached_data);
+    
+    return 0;
+}
 
-       // // xxx temp debug code: dump cached data to stdout
-       // tu_file      tu_stdout(stdout, false);
-       // tu_stdout.copy_from(&cached_data);
 
-       return 0;
+static void
+usage (const char *name)
+{
+    printf(
+       "gprocessor -- an SWF preprocessor for Gnash.\n"
+       "\n"
+       "usage: %s [options] [swf files to process...]\n"
+       "\n"
+       "Preprocesses the given SWF movie files.  Optionally write preprocessed 
shape\n"
+       "and font data to cache files, so the associated SWF files can be 
loaded\n"
+       "faster by gameswf.\n"
+       "\n"
+       "options:\n"
+       "\n"
+       "  -h          Print this info.\n"
+       "  -w          Write a .gsc file with preprocessed info, for each input 
file.\n"
+       "  -v          Be verbose; i.e. print log messages to stdout\n"
+       "  -vp         Be verbose about movie parsing\n"
+       "  -va         Be verbose about ActionScript\n", name
+       );
 }
 
 
 // Local Variables:
 // mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
 // indent-tabs-mode: t
 // End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]