Mikolaj Zalewski : add links to menu dumps

Alexandre Julliard julliard at winehq.org
Fri Jun 19 08:36:18 CDT 2009


Module: tools
Branch: master
Commit: eeaf23603b8bc98488ca67266d602dd0c71cc766
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=eeaf23603b8bc98488ca67266d602dd0c71cc766

Author: Mikolaj Zalewski <mikolajz at tygrys.dom>
Date:   Sat Mar  1 15:06:22 2008 +0100

add links to menu dumps

---

 php/lib.php      |   37 ++++++++++++++++++++++++++++++++++++-
 php/resfile.php  |   24 ++++++++++--------------
 php/resource.php |    2 +-
 scripts/ver.pl   |   13 +++++++------
 4 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/php/lib.php b/php/lib.php
index e11ef5e..9b17c2b 100644
--- a/php/lib.php
+++ b/php/lib.php
@@ -101,7 +101,42 @@ function get_resfile_name($resfile)
 
 function get_resource_name($type, $name)
 {
-    return "Resource ".$type." ".$name;
+    $types = array();
+    $types[1] = "CURSOR";
+    $types[2] = "BITMAP";
+    $types[3] = "ICON";
+    $types[4] = "MENU";
+    $types[5] = "DIALOG";
+    $types[6] = "STRINGTABLE";
+    $types[7] = "FONTDIR";
+    $types[8] = "FONT";
+    $types[9] = "ACCELERATOR";
+    $types[10] = "RCDATA";
+    $types[11] = "MESSAGE";
+    $types[12] = "GROUP_CURSOR";
+    $types[14] = "GROUP_ICON";
+    $types[16] = "VERSION";
+    $types[260] = "MENUEX";
+    $types[262] = "DIALOGEX";
+
+    if (is_numeric($name))
+        $pname = "#".$name;
+    else
+        $pname = $name;
+
+    if (isset($types[$type]))
+        $ret = $types[$type]." ".$pname;
+    else
+        $ret = $types[$type]." ".$pname;
+
+    if ($type == 6)
+        $ret .= " (strings ".($name*16 - 16)."..".($name*16 - 1).")";
+    return $ret;    
+}
+
+function is_dumpable_type($type)
+{
+    return ($type == 4) || ($type == 6);
 }
 
 function update_lang_from_resfile($lang, $resfile)
diff --git a/php/resfile.php b/php/resfile.php
index 3a80e83..e4eb7ad 100644
--- a/php/resfile.php
+++ b/php/resfile.php
@@ -40,25 +40,21 @@ foreach ($msgs as $value)
     }
     if (isset($icon))
         echo "<img src=\"img/icon-".$icon."\" width=\"32\">";
-        
-    if (preg_match("/STRINGTABLE ([0-9]+)/", $value, $m)) {
-        $id0 = $m[1]*16 - 16;
-        $id1 = $m[1]*16 - 1;
-        if (strpos($value, "Missing: ") === 0)
-        {
-            $value = preg_replace("/STRINGTABLE ([0-9]+)/",
-                "STRINGTABLE #".$m[1]." (strings $id0..$id1)",
-                $value);
-        }
-        else
+
+    if (preg_match("/@RES\(([^:\)]+):([^:\)]+)\)/", $value, $m))
+    {
+        if (is_dumpable_type($m[1]) && (strpos($value, "Missing: ") !== 0))
         {
             $error = (strpos($value, "Error: ") === 0);
-            $value = preg_replace("/STRINGTABLE ([0-9]+)/",
-                gen_resource_a($lang, $resfile, 6, $m[1], $error).
-                "STRINGTABLE #".$m[1]." (strings $id0..$id1)</a>",
+            $value = preg_replace("/@RES\(([^:\)]+):([^:\)]+)\)/", 
+                gen_resource_a($lang, $resfile, $m[1], $m[2], $error).
+                get_resource_name($m[1], $m[2])."</a>",
                 $value);
         }
+        else
+            $value = preg_replace("/@RES\(([^:\)]+):([^:\)]+)\)/", get_resource_name($m[1], $m[2]), $value);
     }
+
     echo "</td><td>".$value."</td></tr>\n";
 }
 ?>
diff --git a/php/resource.php b/php/resource.php
index beb2a56..d745d7f 100644
--- a/php/resource.php
+++ b/php/resource.php
@@ -28,7 +28,7 @@ $compare = isset($_REQUEST['compare']);
 <body>
 <?php dump_menu_root() ?> &gt <?php dump_menu_lang($lang) ?> &gt <?php dump_menu_resfile($lang, $resfile) ?> &gt
 <?php dump_menu_resource($lang, $resfile, $type, $id) ?>
-<h1>Resource <?php echo "$id ($type)"?></h1>
+<h1>Dump of <?php echo get_resource_name($type, $id) ?></h1>
 
 <?php
 
diff --git a/scripts/ver.pl b/scripts/ver.pl
index a25b275..a80f6fa 100755
--- a/scripts/ver.pl
+++ b/scripts/ver.pl
@@ -44,12 +44,13 @@ sub resource_name {
 #        return "STRINGTABLE #".$name." (strings ".($name*16-16)."..".($name*16-1).")";
 #    }
 #    print "arg1=$type arg2=$name\n";
-    if (defined($types[$type])) {
-        $typename = $types[$type];
-    } else {
-        $typename = $type."";
-    }
-    return "$typename ".$name;
+#    if (defined($types[$type])) {
+#        $typename = $types[$type];
+#    } else {
+#        $typename = $type."";
+#    }
+#    return "$typename ".$name;
+    return "\@RES($type:$name)";
 };
 
 sub resource_name2 {




More information about the wine-cvs mailing list