Paul Vriens : transl: Move a function to lib_res for re-use.

Alexandre Julliard julliard at winehq.org
Tue Aug 4 09:28:07 CDT 2009


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

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Fri Jul 31 20:12:03 2009 +0200

transl: Move a function to lib_res for re-use.

---

 transl/php/lib_res.php  |   25 +++++++++++++++++++++++++
 transl/php/resource.php |   26 --------------------------
 2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/transl/php/lib_res.php b/transl/php/lib_res.php
index a7af016..21ba98d 100644
--- a/transl/php/lib_res.php
+++ b/transl/php/lib_res.php
@@ -253,6 +253,31 @@ function diff_sequences(&$res1, $count1, &$res2, $count2, $compare_method)
     return array_reverse($out);
 }
 
+function load_resource(&$resources, $type, $id, $langid, &$res)
+{
+    $file_type = $type & 0xff;  /* wrc adds 0x100 for *EX resource*/
+    $resdata = $resources->loadResource($file_type, $id, get_lang_binid($langid));
+    if (!$resdata)
+        die("Resource not found in *.res file\n");
+    switch ($type)
+    {
+        case 4:   /* RT_MENU */
+            $res = new MenuResource($resdata[0], $resdata[1]);
+            return TRUE;
+        case 5:   /* RT_DIALOG */
+        case 261: /* res_dialogex */
+            $res = new DialogResource($resdata[0], $resdata[1]);
+            return TRUE;
+        case 6:   /* RT_STRING*/
+            $res = new StringTable($resdata[0], $resdata[1], $id);
+            return TRUE;
+        case 11:  /* RT_MESSAGETABLE */
+            $res = new MessageTable($resdata[0], $resdata[1], $id);
+            return TRUE;
+        default:
+            die("Unhandled resource type $type");
+    }
+}
 
 class ResFile
 {
diff --git a/transl/php/resource.php b/transl/php/resource.php
index 4f51879..db9e3ac 100644
--- a/transl/php/resource.php
+++ b/transl/php/resource.php
@@ -25,32 +25,6 @@ $compare = isset($_REQUEST['compare']);
 
 <?php
 
-function load_resource(&$resources, $type, $id, $langid, &$res)
-{
-    $file_type = $type & 0xff;  /* wrc adds 0x100 for *EX resource*/
-    $resdata = $resources->loadResource($file_type, $id, get_lang_binid($langid));
-    if (!$resdata)
-        die("Resource not found in *.res file\n");
-    switch ($type)
-    {
-        case 4:   /* RT_MENU */
-            $res = new MenuResource($resdata[0], $resdata[1]);
-            return TRUE;
-        case 5:   /* RT_DIALOG */
-        case 261: /* res_dialogex */
-            $res = new DialogResource($resdata[0], $resdata[1]);
-            return TRUE;
-        case 6:   /* RT_STRING*/
-            $res = new StringTable($resdata[0], $resdata[1], $id);
-            return TRUE;
-        case 11:  /* RT_MESSAGETABLE */
-            $res = new MessageTable($resdata[0], $resdata[1], $id);
-            return TRUE;
-        default:
-            die("Unhandled resource type $type");
-    }
-}
-
 $resources = new ResFile(get_res_path($resfile));
 
 $res_lang = update_lang_from_resfile($lang, $resfile);




More information about the wine-cvs mailing list