]> gitweb.factorcode.org Git - factor.git/commitdiff
Update code not to use combinators.cleave
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 11 Mar 2009 13:44:27 +0000 (08:44 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 11 Mar 2009 13:44:27 +0000 (08:44 -0500)
extra/dns/cache/rr/rr.factor
extra/dns/dns.factor
extra/dns/server/server.factor
extra/update/util/util.factor

index 77d787ff276957f9f36edffb8daec6b99e0a9a1e..cb8019045226652de07a2ca32855f3dc65280faa 100644 (file)
@@ -1,7 +1,7 @@
 
 USING: kernel sequences assocs sets locals combinators
        accessors system math math.functions unicode.case prettyprint
-       combinators.cleave dns ;
+       combinators.smart dns ;
 
 IN: dns.cache.rr
 
@@ -16,7 +16,7 @@ TUPLE: <entry> time data ;
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : make-cache-key ( obj -- key )
-  { [ name>> >lower ] [ type>> unparse ] [ class>> unparse ] } 1arr " " join ;
+  [ [ name>> >lower ] [ type>> ] [ class>> ] tri ] output>array ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
index ca37691ba7fd9921908253d50291a9544c728101..cf98154e7adaf83e8285f8e99d4011976ec3b00a 100644 (file)
@@ -5,7 +5,7 @@ USING: kernel byte-arrays combinators strings arrays sequences splitting
        destructors
        io io.binary io.sockets io.encodings.binary
        accessors
-       combinators.cleave
+       combinators.smart
        newfx
        ;
 
@@ -145,12 +145,13 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : query->ba ( query -- ba )
+  [
     {
       [ name>>                 dn->ba ]
       [ type>>  type-table  of uint16->ba ]
       [ class>> class-table of uint16->ba ]
-    }
-  <arr> concat ;
+    } cleave
+  ] output>array concat ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -169,6 +170,7 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : soa->ba ( rdata -- ba )
+  [
     {
       [ mname>>   dn->ba ]
       [ rname>>   dn->ba ]
@@ -177,8 +179,8 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
       [ retry>>   uint32->ba ]
       [ expire>>  uint32->ba ]
       [ minimum>> uint32->ba ]
-    }
-  <arr> concat ;
+    } cleave
+  ] output>array concat ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -198,6 +200,7 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : rr->ba ( rr -- ba )
+  [
     {
       [ name>>                 dn->ba     ]
       [ type>>  type-table  of uint16->ba ]
@@ -207,12 +210,13 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
         [ type>>            ] [ rdata>> ] bi rdata->ba
         [ length uint16->ba ] [         ] bi append
       ]
-    }
-  <arr> concat ;
+    } cleave
+  ] output>array concat ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : header-bits-ba ( message -- ba )
+  [
     {
       [ qr>>                     15 shift ]
       [ opcode>> opcode-table of 11 shift ]
@@ -222,10 +226,11 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
       [ ra>>                      7 shift ]
       [ z>>                       4 shift ]
       [ rcode>>  rcode-table of   0 shift ]
-    }
-  <arr> sum uint16->ba ;
+    } cleave
+  ] sum-outputs uint16->ba ;
 
 : message->ba ( message -- ba )
+  [
     {
       [ id>> uint16->ba ]
       [ header-bits-ba ]
@@ -237,8 +242,8 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
       [ answer-section>>     [ rr->ba    ] map concat ]
       [ authority-section>>  [ rr->ba    ] map concat ]
       [ additional-section>> [ rr->ba    ] map concat ]
-    }
-  <arr> concat ;
+    } cleave
+  ] output>array concat ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -475,7 +480,7 @@ SYMBOLS: NO-ERROR FORMAT-ERROR SERVER-FAILURE NAME-ERROR NOT-IMPLEMENTED
 
 : ask ( message -- message ) dns-server ask-server ;
 
-: query->message ( query -- message ) <message> swap {1} >>question-section ;
+: query->message ( query -- message ) <message> swap 1array >>question-section ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
index d8a8adc88e7b583981b0698404b18b8e42fb2a2d..b14d765e8d09a99b2b47d55a754c26847303b36b 100644 (file)
@@ -1,8 +1,8 @@
 
 USING: kernel combinators sequences sets math threads namespaces continuations
        debugger io io.sockets unicode.case accessors destructors
-       combinators.cleave combinators.short-circuit 
-       newfx fry
+       combinators.short-circuit combinators.smart
+       newfx fry arrays
        dns dns.util dns.misc ;
 
 IN: dns.server
@@ -16,7 +16,7 @@ SYMBOL: records-var
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : {name-type-class} ( obj -- array )
-  { [ name>> >lower ] [ type>> ] [ class>> ] } <arr> ;
+  [ [ name>> >lower ] [ type>> ] [ class>> ] tri ] output>array ; 
 
 : rr=query? ( obj obj -- ? ) [ {name-type-class} ] bi@ = ;
 
@@ -52,9 +52,9 @@ SYMBOL: records-var
 
 : rr->rdata-names ( rr -- names/f )
     {
-      { [ dup type>> NS    = ] [ rdata>>            {1} ] }
-      { [ dup type>> MX    = ] [ rdata>> exchange>> {1} ] }
-      { [ dup type>> CNAME = ] [ rdata>>            {1} ] }
+      { [ dup type>> NS    = ] [ rdata>>            1array ] }
+      { [ dup type>> MX    = ] [ rdata>> exchange>> 1array ] }
+      { [ dup type>> CNAME = ] [ rdata>>            1array ] }
       { [ t ]                  [ drop f ] }
     }
   cond ;
index b638b61528e8d681e9056c3a9acfc88aaa5f9aa2..beeddc7abb7ac8a0604eaf727b60721c8a80a679 100644 (file)
@@ -1,6 +1,6 @@
 
 USING: kernel classes strings quotations words math math.parser arrays
-       combinators.cleave
+       combinators.smart
        accessors
        system prettyprint splitting
        sequences combinators sequences.deep
@@ -58,5 +58,5 @@ DEFER: to-strings
 
 : datestamp ( -- string )
   now
-    { year>> month>> day>> hour>> minute>> } <arr>
+  [ { [ year>> ] [ month>> ] [ day>> ] [ hour>> ] [ minute>> ] } cleave ] output>array
   [ pad-00 ] map "-" join ;