[matroska] r758 - trunk/RbMatroska

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: mosu
Date: 2004-09-08 19:52:47 +0400 (Wed, 08 Sep 2004)
New Revision: 758

Modified:
   trunk/RbMatroska/gen_classes_from_libmatroska
   trunk/RbMatroska/matroska.rb
Log:
Better automatic generation of matroska.rb. Updated matroska.rb.

Modified: trunk/RbMatroska/gen_classes_from_libmatroska
===================================================================
--- trunk/RbMatroska/gen_classes_from_libmatroska	2004-09-08 14:35:21 UTC (rev 757)
+++ trunk/RbMatroska/gen_classes_from_libmatroska	2004-09-08 15:52:47 UTC (rev 758)
@@ -14,18 +14,58 @@
 # Written by Moritz Bunkus <[email protected]>.
 #
 
-cd ~/prog/video/libmatroska/src
-for CPP in *.cpp ; do
-  BASE=`basename $CPP .cpp`
-  H=../matroska/$BASE.h
+if [ "$MATROSKADIR" == "" ]; then
+  MATROSKADIR="$HOME/prog/video/libmatroska/src"
+fi
+if [ ! -f "$MATROSKADIR/KaxSegment.cpp" ]; then
+  MATROSKADIR="$MATROSKADIR/src"
+fi
+if [ ! -f "$MATROSKADIR/KaxSegment.cpp" ]; then
+  echo "Please set the MATROSKADIR environment variable to the libmatroska"
+  echo "source directory."
+  exit 1
+fi
 
-  echo "  # From ${CPP}"
+cat <<EOF
+#!/usr/bin/ruby
 
+#
+# Distributed under the MIT license
+# see the file COPYING for details
+# or visit http://www.opensource.org/licenses/mit-license.php
+#
+# \$Id\$
+#
+# Classes for the "Matroska EBML doc type". Generated with
+# gen_classes_from_libmatroska.
+#
+# Written by Moritz Bunkus <[email protected]>.
+#
+
+# This file is generated automatically by the
+# gen_classes_from_libmatroska script and should not be
+# modified manually!
+
+require "ebml"
+
+module Matroska
+EOF
+
+for CPP in "$MATROSKADIR"/*.cpp ; do
+  BASE=`basename "$CPP" .cpp | sed -e 's:.*/::'`
+  H="$MATROSKADIR/../matroska/$BASE.h"
+
+  FIRST=1
+
   egrep '^EbmlId.*TheId' $CPP | (while read LINE; do
     ID=`echo "$LINE" | sed 's/TheId.*(/ /' | awk '{ print $3 }' | sed s/,// | lower`
     LENGTH=`echo "$LINE" | sed 's/TheId.*(/ /' | awk '{ print $4 }' | sed 's/);//'`
     NAME=`echo "$LINE" | sed 's/_TheId.*//' | awk '{ print $2 }' | sed s/Kax//`
     PARENT=`egrep "class.*Kax${NAME} *:" $H | sed 's/:/ : /g' | awk '{ print $6 }' | sed 's/^Ebml/Ebml::/'`
+    if [ $FIRST -eq 1 ]; then
+      echo "  # From ${BASE}.cpp"
+      FIRST=0
+    fi
     cat <<EOF
   class ${NAME} < ${PARENT}
     def ${NAME}.global_id
@@ -38,3 +78,5 @@
 
     done)
 done
+
+echo end

Modified: trunk/RbMatroska/matroska.rb
===================================================================
--- trunk/RbMatroska/matroska.rb	2004-09-08 14:35:21 UTC (rev 757)
+++ trunk/RbMatroska/matroska.rb	2004-09-08 15:52:47 UTC (rev 758)
@@ -13,6 +13,10 @@
 # Written by Moritz Bunkus <[email protected]>.
 #
 
+# This file is generated automatically by the
+# gen_classes_from_libmatroska script and should not be
+# modified manually!
+
 require "ebml"
 
 module Matroska
@@ -238,8 +242,8 @@
     end
   end
 
-  class EditionManagedPrivate < Ebml::Binary
-    def EditionManagedPrivate.global_id
+  class ChapterProcessedPrivate < Ebml::Binary
+    def ChapterProcessedPrivate.global_id
       @@id ||= Ebml::Id.new(0x450d, 2)
       return @@id
     end
@@ -357,13 +361,6 @@
     end
   end
 
-  class ChapterProcessedPrivate < Ebml::Binary
-    def ChapterProcessedPrivate.global_id
-      @@id ||= Ebml::Id.new(0x450d, 2)
-      return @@id
-    end
-  end
-
   # From KaxCluster.cpp
   class Cluster < Ebml::Master
     def Cluster.global_id
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.