Author: particle
Date: Wed Oct  3 09:20:35 2007
New Revision: 21779

Modified:
   branches/pdd15oo/runtime/parrot/library/File/Spec.pir
   branches/pdd15oo/runtime/parrot/library/HTTP/Daemon.pir
   branches/pdd15oo/runtime/parrot/library/Parrot/Coroutine.pir
   branches/pdd15oo/runtime/parrot/library/Pg.pir

Log:
[library]: convert 'find_type' usage to 'new' and 'get_class'

Modified: branches/pdd15oo/runtime/parrot/library/File/Spec.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/File/Spec.pir       (original)
+++ branches/pdd15oo/runtime/parrot/library/File/Spec.pir       Wed Oct  3 
09:20:35 2007
@@ -9,8 +9,7 @@
 
     load_bytecode 'File/Spec.pir'
 
-    find_type classtype, 'File::Spec'
-    new spec, classtype
+    new spec, 'File::Spec'
 
     .local pmc x
     .local String a, b, c

Modified: branches/pdd15oo/runtime/parrot/library/HTTP/Daemon.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/HTTP/Daemon.pir     (original)
+++ branches/pdd15oo/runtime/parrot/library/HTTP/Daemon.pir     Wed Oct  3 
09:20:35 2007
@@ -11,8 +11,7 @@
   opts = new 'Hash'
   opts['LocalPort'] = 1234
   opts['LocalAddr'] = 'localhost'
-  clid = find_type ['HTTP'; 'Daemon']
-  d = new clid, opts
+  d = new ['HTTP';'Daemon'], opts
   unless d goto err
   d.'run'()
 
@@ -394,8 +393,7 @@
     .param pmc sock
     .local pmc active, conn
     active = getattribute self, 'active'
-    $I0 = find_type ['HTTP'; 'Daemon'; 'ClientConn']
-    conn = new $I0, sock
+    conn = new ['HTTP'; 'Daemon'; 'ClientConn'], sock
     conn.'server'(self)
     push active, conn
     self.'debug'("new conn\n")
@@ -584,8 +582,7 @@
     srv = self.'server'()
     srv.'debug'("reading from work\n")
     req_str = self.'_read'()
-    $I0 = find_type ['HTTP'; 'Request']
-    req = new $I0
+    req = new ['HTTP'; 'Request']
     req.'parse'(req_str)
     .return (req)
 .end
@@ -684,8 +681,7 @@
 
     srv.'debug'("req url: ", url, "\n")
 
-    $I0 = find_type ['HTTP'; 'Response']
-    resp = new $I0
+    resp = new ['HTTP'; 'Response']
 
     opts = srv.'opts'()
     $I0 = opts['parrot-docs']

Modified: branches/pdd15oo/runtime/parrot/library/Parrot/Coroutine.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Parrot/Coroutine.pir        
(original)
+++ branches/pdd15oo/runtime/parrot/library/Parrot/Coroutine.pir        Wed Oct 
 3 09:20:35 2007
@@ -57,10 +57,9 @@
         .param pmc tree
 
         .local int coro_class, idx
-        coro_class = find_type 'Parrot::Coroutine'
         .local pmc coro
         .const .Sub coro_sub = "enumerate_tree"
-        coro = new coro_class, coro_sub
+        coro = new 'Parrot::Coroutine', coro_sub
         ($P0 :optional, $I0 :opt_flag) = coro.'resume'(coro, tree)
         idx = 0
 
@@ -89,9 +88,9 @@
 .const int slot_resume_cont = 3 ## Continuation from which to resume.
 
 .sub __loadtime_create_class :load
-    find_type $I0, "Parrot::Coroutine"
-    if $I0 > 1 goto END
-    newclass $P0, "Parrot::Coroutine"
+    $P0 = get_class "Parrot::Coroutine"
+    unless null $P0 goto END
+    $P0 = newclass "Parrot::Coroutine"
     addattribute $P0, "state"
     addattribute $P0, "initial_sub"
     addattribute $P0, "yield_cont"

Modified: branches/pdd15oo/runtime/parrot/library/Pg.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Pg.pir      (original)
+++ branches/pdd15oo/runtime/parrot/library/Pg.pir      Wed Oct  3 09:20:35 2007
@@ -8,7 +8,7 @@
 =head1 SYNOPSIS
 
   .local pmc pg, con, res
-  pg = getclass 'Pg'
+  pg = get_class 'Pg'
   con = pg.'connectdb'('dbname = db')
   res = con.'exec'('SELECT * from tab')
   n = res.'ntuples'()
@@ -74,8 +74,7 @@
     .local pmc con, connectdb, o_con
     connectdb = get_global 'PQconnectdb' 
     con = connectdb(args)
-    $I0 = find_type ['Pg';'Conn']
-    o_con = new  $I0, con
+    o_con = new ['Pg';'Conn'], con
     # verify success
     .local int ok
     ok = o_con.'status'()
@@ -166,8 +165,7 @@
 .sub mk_res
     .param pmc res
     .local pmc o_res
-    $I0 = find_type ['Pg';'Result']
-    o_res = new $I0, res
+    o_res = new ['Pg';'Result'], res
     .return (o_res)
 .end
 

Reply via email to