[svn:parrot] r45370 - trunk/runtime/parrot/library

fperrad at svn.parrot.org fperrad at svn.parrot.org
Thu Apr 1 12:35:23 UTC 2010


Author: fperrad
Date: Thu Apr  1 12:35:22 2010
New Revision: 45370
URL: https://trac.parrot.org/parrot/changeset/45370

Log:
[distutils] refactor (_mk_path_exe & _mk_path_installable)

Modified:
   trunk/runtime/parrot/library/distutils.pir

Modified: trunk/runtime/parrot/library/distutils.pir
==============================================================================
--- trunk/runtime/parrot/library/distutils.pir	Thu Apr  1 11:41:12 2010	(r45369)
+++ trunk/runtime/parrot/library/distutils.pir	Thu Apr  1 12:35:22 2010	(r45370)
@@ -999,10 +999,7 @@
     .local string bin, pbc
     bin = shift $P0
     pbc = hash[bin]
-    $I0 = length pbc
-    $I0 -= 4
-    $S0 = substr pbc, 0, $I0
-    $S1 = $S0 . exe
+    $S1 = _mk_path_exe(pbc, exe)
     $I0 = newer($S1, pbc)
     if $I0 goto L1
     .local string cmd
@@ -1015,6 +1012,16 @@
     .tailcall run_jobs(jobs)
 .end
 
+.sub '_mk_path_exe' :anon
+    .param string pbcname
+    .param string exe
+    $I0 = length pbcname
+    $I0 -= 4
+    $S0 = substr pbcname, 0, $I0
+    $S1 = $S0 . exe
+    .return ($S1)
+.end
+
 =item installable_pbc
 
 hash
@@ -1048,11 +1055,7 @@
     .local string bin, pbc
     bin = shift $P0
     pbc = hash[bin]
-    $I0 = length pbc
-    $I0 -= 4
-    $S0 = substr pbc, 0, $I0
-    $S1 = "installable_" . $S0
-    $S1 .= exe
+    $S1 = _mk_path_installable(pbc, exe)
     $I0 = newer($S1, pbc)
     if $I0 goto L1
     .local string cmd
@@ -1070,6 +1073,17 @@
     .tailcall run_jobs(jobs)
 .end
 
+.sub '_mk_path_installable' :anon
+    .param string pbcname
+    .param string exe
+    $I0 = length pbcname
+    $I0 -= 4
+    $S0 = substr pbcname, 0, $I0
+    $S1 = "installable_" . $S0
+    $S1 .= exe
+    .return ($S1)
+.end
+
 .sub '_has_strip' :anon
     .param string cflags        :optional
     .param int has_cflags       :opt_flag
@@ -1735,14 +1749,11 @@
     unless $P0 goto L2
     bin = shift $P0
     pbc = hash[bin]
-    $I0 = length pbc
-    $I0 -= 4
-    $S0 = substr pbc, 0, $I0
-    $S1 = $S0 . exe
+    $S1 = _mk_path_exe(pbc, exe)
     unlink($S1, 1 :named('verbose'))
-    $S1 = $S0 . '.c'
+    $S1 = _mk_path_exe(pbc, '.c')
     unlink($S1, 1 :named('verbose'))
-    $S1 = $S0 . obj
+    $S1 = _mk_path_exe(pbc, obj)
     unlink($S1, 1 :named('verbose'))
     goto L1
   L2:
@@ -1771,15 +1782,11 @@
     unless $P0 goto L2
     bin = shift $P0
     pbc = hash[bin]
-    $I0 = length pbc
-    $I0 -= 4
-    $S0 = substr pbc, 0, $I0
-    $S1 = 'installable_' . $S0
-    $S1 .= exe
+    $S1 = _mk_path_installable(pbc, exe)
     unlink($S1, 1 :named('verbose'))
-    $S1 = $S0 . '.c'
+    $S1 = _mk_path_exe(pbc, '.c')
     unlink($S1, 1 :named('verbose'))
-    $S1 = $S0 . obj
+    $S1 = _mk_path_exe(pbc, obj)
     unlink($S1, 1 :named('verbose'))
     goto L1
   L2:
@@ -2611,11 +2618,7 @@
     unless $P0 goto L2
     bin = shift $P0
     pbc = hash[bin]
-    $I0 = length pbc
-    $I0 -= 4
-    $S0 = substr pbc, 0, $I0
-    $S1 = 'installable_' . $S0
-    $S1 .= exe
+    $S1 = _mk_path_installable(pbc, exe)
     $S2 = bindir . '/'
     $S2 .= bin
     $S2 .= exe


More information about the parrot-commits mailing list