gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash utilities/Makefile.am ChangeLog utilities...


From: Rob Savoye
Subject: [Gnash-commit] gnash utilities/Makefile.am ChangeLog utilities...
Date: Thu, 20 Dec 2007 02:01:39 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/12/20 02:01:39

Modified files:
        utilities      : Makefile.am 
        .              : ChangeLog 
Added files:
        utilities      : soldumper.cpp 

Log message:
                * utilities/soldumper: Dump the contents of any .sol file. 
Useful
                to know what's being stored about you in binary files.
                * utilities/Makefile.am: Add soldumper.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/Makefile.am?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/soldumper.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5224&r2=1.5225

Patches:
Index: utilities/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/utilities/Makefile.am,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- utilities/Makefile.am       7 Dec 2007 17:41:37 -0000       1.60
+++ utilities/Makefile.am       20 Dec 2007 02:01:38 -0000      1.61
@@ -49,6 +49,7 @@
         -I$(top_srcdir)        \
         -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/libamf \
         -I$(top_srcdir)/server \
         -I$(top_srcdir)/server/parser \
         -I$(top_srcdir)/server/vm \
@@ -75,7 +76,7 @@
  GNASH_LIBS += $(GLIB_LIBS) $(GSTREAMER_LIBS)
 #endif
 
-bin_PROGRAMS = gprocessor
+bin_PROGRAMS = gprocessor soldumper
 noinst_PROGRAMS = dumpshm
 #check_PROGRAMS = gdebug.swf
 
@@ -88,6 +89,9 @@
 dumpshm_SOURCES = dumpshm.cpp
 dumpshm_LDADD = $(GNASH_LIBS)
 
+soldumper_SOURCES = soldumper.cpp
+soldumper_LDADD = $(GNASH_LIBS)
+
 # Rebuild with GCC 4.x Mudflap support
 mudflap:
        @echo "Rebuilding with GCC Mudflap support"

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5224
retrieving revision 1.5225
diff -u -b -r1.5224 -r1.5225
--- ChangeLog   19 Dec 2007 22:06:35 -0000      1.5224
+++ ChangeLog   20 Dec 2007 02:01:38 -0000      1.5225
@@ -1,3 +1,9 @@
+2007-12-19  Rob Savoye  <address@hidden>
+
+       * utilities/soldumper: Dump the contents of any .sol file. Useful
+       to know what's being stored about you in binary files.
+       * utilities/Makefile.am: Add soldumper.
+
 2007-12-19 Sandro Santilli <address@hidden>
 
        * server/asobj/SharedObject.cpp: make SharedObject.flush more

Index: utilities/soldumper.cpp
===================================================================
RCS file: utilities/soldumper.cpp
diff -N utilities/soldumper.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ utilities/soldumper.cpp     20 Dec 2007 02:01:38 -0000      1.1
@@ -0,0 +1,182 @@
+// 
+//   Copyright (C) 2005, 2006, 2007 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 3 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
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <dirent.h>
+#include <iostream>
+#include <stdarg.h>
+#include <cstring>
+#include <sys/stat.h>
+
+extern "C"{
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifndef __GNUC__
+extern int optind, getopt(int, char *const *, const char *);
+extern char *optarg;
+#endif
+}
+
+#include "log.h"
+#include "rc.h"
+#include "amf.h"
+#include "sol.h"
+
+using namespace std;
+using namespace gnash;
+
+namespace {
+gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+}
+
+static void usage (void);
+void dump_ctrl(void *ptr);
+int
+main(int argc, char *argv[])
+{
+    unsigned int          i;
+    int                   c;
+    bool                  localdir = false;
+    bool                  listdir = false;
+    int                   size  = 0;
+    string                filespec, realname, tmpname;
+    struct dirent         *entry;
+    vector<const char *>  dirlist;
+    
+    // Enable native language support, i.e. internationalization
+#ifdef ENABLE_NLS
+    setlocale (LC_MESSAGES, "");
+    bindtextdomain (PACKAGE, LOCALEDIR);
+    textdomain (PACKAGE);
+#endif
+    /* This initializes the DBG_MSG macros */ 
+    while ((c = getopt (argc, argv, "hvfl")) != -1) {
+        switch (c) {
+          case 'h':
+            usage ();
+            break;
+            
+         case 'v':
+              dbglogfile.setVerbosity();
+             log_msg (_("Verbose output turned on"));
+             break;
+              
+         case 'f':
+             log_msg (_("forcing local directory access only"));
+              localdir = true;
+             break;
+
+         case 'l':
+             log_msg (_("List .sol files in the default directory"));
+              listdir = true;
+             break;
+
+          default:
+            usage ();
+            break;
+        }
+    }
+    
+    
+    // If no command line arguments have been supplied, do nothing but
+    // print the  usage message.
+    if (argc < 2) {
+        usage();
+        exit(0);
+    }
+
+    // get the file name from the command line
+    if (optind < argc) {
+        filespec = argv[optind];
+        log_msg("Will use \"%s\" for sol files location", filespec.c_str());
+    }
+    
+    // List the .sol files in the default directory
+    if (listdir) {
+        const char *dirname;
+        if ((localdir) || (filespec[0] == '/') || (filespec[0] == '.')) {
+            if (filespec.size() == 0) {
+                dirname = "./";
+            } else {
+                dirname = filespec.c_str();
+            }
+        } else {
+            dirname = rcfile.getSOLSafeDir().c_str();
+        }
+        DIR *library_dir = NULL;
+        library_dir = opendir (dirname);
+        if (library_dir != NULL) {
+            // By convention, the first two entries in each directory are
+            // for . and .. (``dot'' and ``dot dot''), so we ignore those. The
+            // next directory read will get a real file, if any exists.
+            entry = readdir(library_dir);
+            entry = readdir(library_dir);
+        }
+        if (library_dir != NULL) {
+            for (i=0; entry>0; i++) {
+                entry = readdir(library_dir);
+                if (entry != NULL) {
+                    string::size_type pos;
+                    if (strstr(entry->d_name, ".sol")) {
+                        cout << "Found SOL: " << entry->d_name << endl;
+                    }
+                }
+            }
+        }
+        exit(0);
+    }
+    
+    string newspec;
+    if ((localdir) || (filespec[0] == '/') || (filespec[0] == '.')) {
+        newspec = filespec;
+    } else {
+        newspec = rcfile.getSOLSafeDir();
+        newspec += filespec;
+    }
+    
+    amf::SOL sol;
+    
+    if (sol.readFile(newspec)) {
+        log_msg("SOL file \"%s\" read in", newspec.c_str());
+    } else {
+        log_error("SOL file \"%s\" does not exist!", newspec.c_str());
+    }
+
+    sol.dump();
+}
+
+/// \brief  Display the command line arguments
+static void
+usage (void)
+{
+    cerr << _("This program dumps the internal data of a .sol file")
+         << endl;
+    cerr << _("Usage: soldumper [h] filename") << endl;
+    cerr << _("-h\tHelp") << endl;
+    exit (-1);
+}
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:




reply via email to

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