]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix conflicts
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 2 Dec 2008 02:39:43 +0000 (20:39 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 2 Dec 2008 02:39:43 +0000 (20:39 -0600)
1  2 
basis/alien/c-types/c-types.factor
basis/alien/structs/structs.factor
basis/cocoa/views/views.factor
basis/db/postgresql/lib/lib.factor
basis/ui/render/render.factor
basis/x11/glx/glx.factor
core/words/words.factor

index 7500a12832b62a0a83f5042c923be022440aae40,de8d36521e588a522767b6e9998c86e7eaf0c52c..5fe139a56fe9ead4741474d2c2d7e22c7d5d57a5
@@@ -21,7 -21,7 +21,7 @@@ reg-class size align stack-align? 
  : new-c-type ( class -- type )
      new
          int-regs >>reg-class
 -        object >>class ;
 +        object >>class ; inline
  
  : <c-type> ( -- type )
      \ c-type new-c-type ;
@@@ -52,7 -52,7 +52,7 @@@ GENERIC: c-type ( name -- type ) foldab
  
  : parse-array-type ( name -- array )
      "[" split unclip
-     >r [ "]" ?tail drop string>number ] map r> prefix ;
+     [ [ "]" ?tail drop string>number ] map ] dip prefix ;
  
  M: string c-type ( name -- type )
      CHAR: ] over member? [
@@@ -180,12 -180,12 +180,12 @@@ M: byte-array byte-length length 
  
  : c-getter ( name -- quot )
      c-type-getter [
 -        [ "Cannot read struct fields with type" throw ]
 +        [ "Cannot read struct fields with this type" throw ]
      ] unless* ;
  
  : c-setter ( name -- quot )
      c-type-setter [
 -        [ "Cannot write struct fields with type" throw ]
 +        [ "Cannot write struct fields with this type" throw ]
      ] unless* ;
  
  : <c-array> ( n type -- array )
      1 swap malloc-array ; inline
  
  : malloc-byte-array ( byte-array -- alien )
-     dup length dup malloc [ -rot memcpy ] keep ;
+     dup length [ nip malloc dup ] 2keep memcpy ;
  
  : memory>byte-array ( alien len -- byte-array )
-     dup <byte-array> [ -rot memcpy ] keep ;
+     [ nip <byte-array> dup ] 2keep memcpy ;
  
  : byte-array>memory ( byte-array base -- )
      swap dup length memcpy ;
  
 -: (define-nth) ( word type quot -- )
 +: array-accessor ( type quot -- def )
      [
          \ swap , [ heap-size , [ * >fixnum ] % ] [ % ] bi*
 -    ] [ ] make define-inline ;
 -
 -: nth-word ( name vocab -- word )
 -    [ "-nth" append ] dip create ;
 -
 -: define-nth ( name vocab -- )
 -    dupd nth-word swap dup c-getter (define-nth) ;
 -
 -: set-nth-word ( name vocab -- word )
 -    [ "set-" swap "-nth" 3append ] dip create ;
 -
 -: define-set-nth ( name vocab -- )
 -    dupd set-nth-word swap dup c-setter (define-nth) ;
 +    ] [ ] make ;
  
  : typedef ( old new -- ) c-types get set-at ;
  
 -: define-c-type ( type name vocab -- )
 -    [ tuck typedef ] dip [ define-nth ] 2keep define-set-nth ;
 -
  TUPLE: long-long-type < c-type ;
  
  : <long-long-type> ( -- type )
@@@ -233,24 -248,54 +233,24 @@@ M: long-long-type box-parameter ( n typ
  M: long-long-type box-return ( type -- )
      f swap box-parameter ;
  
 -: define-deref ( name vocab -- )
 -    [ dup CHAR: * prefix ] dip create
 -    swap c-getter 0 prefix define-inline ;
 +: define-deref ( name -- )
 +    [ CHAR: * prefix "alien.c-types" create ]
 +    [ c-getter 0 prefix ] bi
 +    define-inline ;
  
 -: define-out ( name vocab -- )
 -    over [ <c-object> tuck 0 ] over c-setter append swap
 -    [ constructor-word ] 2dip prefix define-inline ;
 +: define-out ( name -- )
 +    [ "alien.c-types" constructor-word ]
 +    [ [ [ <c-object> ] curry ] [ c-setter ] bi append ] bi
 +    define-inline ;
  
  : c-bool> ( int -- ? )
      zero? not ;
  
 -: >c-array ( seq type word -- byte-array )
 -    [ [ dup length ] dip <c-array> ] dip
 -    [ [ execute ] 2curry each-index ] 2keep drop ; inline
 -
 -: >c-array-quot ( type vocab -- quot )
 -    dupd set-nth-word [ >c-array ] 2curry ;
 -
 -: to-array-word ( name vocab -- word )
 -    [ ">c-" swap "-array" 3append ] dip create ;
 -
 -: define-to-array ( type vocab -- )
 -    [ to-array-word ] 2keep >c-array-quot
 -    (( array -- byte-array )) define-declared ;
 -
 -: c-array>quot ( type vocab -- quot )
 -    [
 -        \ swap ,
 -        nth-word 1quotation ,
 -        [ curry map ] %
 -    ] [ ] make ;
 -
 -: from-array-word ( name vocab -- word )
 -    [ "c-" swap "-array>" 3append ] dip create ;
 -
 -: define-from-array ( type vocab -- )
 -    [ from-array-word ] 2keep c-array>quot
 -    (( c-ptr n -- array )) define-declared ;
 -
  : define-primitive-type ( type name -- )
 -    "alien.c-types"
 -    {
 -        [ define-c-type ]
 -        [ define-deref ]
 -        [ define-to-array ]
 -        [ define-from-array ]
 -        [ define-out ]
 -    } 2cleave ;
 +    [ typedef ]
 +    [ define-deref ]
 +    [ define-out ]
 +    tri ;
  
  : expand-constants ( c-type -- c-type' )
      dup array? [
  : if-void ( type true false -- )
      pick "void" = [ drop nip call ] [ nip call ] if ; inline
  
 +: primitive-types
 +    {
 +        "char" "uchar"
 +        "short" "ushort"
 +        "int" "uint"
 +        "long" "ulong"
 +        "longlong" "ulonglong"
 +        "float" "double"
 +        "void*" "bool"
 +    } ;
 +
  [
      <c-type>
          c-ptr >>class
index eb1528b649079a5d3ec336653fb2e304af0fdd5e,d1fdbef4c04620f9f58b475765db5d88c74d3f78..9bbb5ce2aa1ad57d7f5e7d8ea5bc99440d959d9f
@@@ -38,10 -38,10 +38,10 @@@ M: struct-type stack-siz
  
  : c-struct? ( type -- ? ) (c-type) struct-type? ;
  
 -: (define-struct) ( name vocab size align fields -- )
 +: (define-struct) ( name size align fields -- )
-     >r [ align ] keep r>
+     [ [ align ] keep ] dip
      struct-type boa
 -    -rot define-c-type ;
 +    swap typedef ;
  
  : define-struct-early ( name vocab fields -- fields )
      [ first2 <field-spec> ] with with map ;
      [ c-type-align ] map supremum ;
  
  : define-struct ( name vocab fields -- )
-     pick >r
-     [ struct-offsets ] keep
-     [ [ type>> ] map compute-struct-align ] keep
-     [ (define-struct) ] keep
-     r> [ swap define-field ] curry each ;
+     pick [
+         [ struct-offsets ] keep
+         [ [ type>> ] map compute-struct-align ] keep
+         [ (define-struct) ] keep
+     ] dip [ swap define-field ] curry each ;
  
  : define-union ( name vocab members -- )
      [ expand-constants ] map
index 3e7bd26965860577a0e618b9df10a1d55769e4a9,cd113b5c642c1e79179822d7992d29b362dea94c..be67f03184e12347b8596f897c6c3c8ce16b1663
@@@ -1,8 -1,8 +1,8 @@@
 -! Copyright (C) 2006, 2007 Slava Pestov
 +! Copyright (C) 2006, 2008 Slava Pestov
  ! See http://factorcode.org/license.txt for BSD license.
 -USING: alien.c-types arrays kernel math namespaces make cocoa
 -cocoa.messages cocoa.classes cocoa.types sequences
 -continuations ;
 +USING: specialized-arrays.int arrays kernel math namespaces make
 +cocoa cocoa.messages cocoa.classes cocoa.types sequences
 +continuations accessors ;
  IN: cocoa.views
  
  : NSOpenGLPFAAllRenderers 1 ;
@@@ -69,12 -69,12 +69,12 @@@ PRIVATE
              NSOpenGLPFASamples , 8 ,
          ] when
          0 ,
 -    ] { } make >c-int-array
 +    ] int-array{ } make underlying>>
      -> initWithAttributes:
      -> autorelease ;
  
  : <GLView> ( class dim -- view )
-     >r -> alloc 0 0 r> first2 <NSRect> <PixelFormat>
+     [ -> alloc 0 0 ] dip first2 <NSRect> <PixelFormat>
      -> initWithFrame:pixelFormat:
      dup 1 -> setPostsBoundsChangedNotifications:
      dup 1 -> setPostsFrameChangedNotifications: ;
      swap NSRect-h >fixnum 2array ;
  
  : mouse-location ( view event -- loc )
-     over >r
-     -> locationInWindow f -> convertPoint:fromView:
-     dup NSPoint-x swap NSPoint-y
-     r> -> frame NSRect-h swap - 2array ;
+     [
+         -> locationInWindow f -> convertPoint:fromView:
+         [ NSPoint-x ] [ NSPoint-y ] bi
+     ] [ drop -> frame NSRect-h ] 2bi
+     swap - 2array ;
  
  USE: opengl.gl
  USE: alien.syntax
index 0a12f4374ab1cdc0a4b45ece00a3b51e719fe7c6,3a5942fce3d5a244aed0defa79fafa031803525e..5149d14f3d8986d5a77c1b015b970cc010244e45
@@@ -5,8 -5,7 +5,8 @@@ quotations sequences db.postgresql.ffi 
  db.types tools.walker ascii splitting math.parser combinators
  libc shuffle calendar.format byte-arrays destructors prettyprint
  accessors strings serialize io.encodings.binary io.encodings.utf8
 -alien.strings io.streams.byte-array summary present urls ;
 +alien.strings io.streams.byte-array summary present urls
 +specialized-arrays.uint specialized-arrays.alien ;
  IN: db.postgresql.lib
  
  : postgresql-result-error-message ( res -- str/f )
@@@ -65,7 -64,7 +65,7 @@@ M: postgresql-result-null summary ( ob
      } case ;
  
  : param-types ( statement -- seq )
 -    in-params>> [ type>> type>oid ] map >c-uint-array ;
 +    in-params>> [ type>> type>oid ] uint-array{ } map-as underlying>> ;
  
  : malloc-byte-array/length ( byte-array -- alien length )
      [ malloc-byte-array &free ] [ length ] bi ;
@@@ -76,7 -75,7 +76,7 @@@
  : param-values ( statement -- seq seq2 )
      [ bind-params>> ] [ in-params>> ] bi
      [
-         >r value>> r> type>> {
+         [ value>> ] [ type>> ] bi* {
              { FACTOR-BLOB [
                  dup [ object>bytes malloc-byte-array/length ] [ 0 ] if
              ] }
      ] 2map flip [
          f f
      ] [
 -        first2 [ >c-void*-array ] [ >c-uint-array ] bi*
 +        first2 [ >void*-array underlying>> ] [ >uint-array underlying>> ] bi*
      ] if-empty ;
  
  : param-formats ( statement -- seq )
 -    in-params>> [ type>> type>param-format ] map >c-uint-array ;
 +    in-params>> [ type>> type>param-format ] uint-array{ } map-as underlying>> ;
  
  : do-postgresql-bound-statement ( statement -- res )
      [
-         >r db get handle>> r>
+         [ db get handle>> ] dip
          {
              [ sql>> ]
              [ bind-params>> length ]
  
  : pq-get-string ( handle row column -- obj )
      3dup PQgetvalue utf8 alien>string
-     dup empty? [ >r pq-get-is-null f r> ? ] [ 3nip ] if ;
+     dup empty? [ [ pq-get-is-null f ] dip ? ] [ 3nip ] if ;
  
  : pq-get-number ( handle row column -- obj )
      pq-get-string dup [ string>number ] when ;
index e5b4bb8867cfc76c9734c0c69a5a936763e72f21,4ce36dc3bd660665fd0393c30812f35ed6f75d6c..5cbac9798a054f096eb736b12d0eaa9619b9c38b
@@@ -3,7 -3,7 +3,7 @@@
  USING: accessors alien alien.c-types arrays hashtables io kernel
  math namespaces opengl opengl.gl opengl.glu sequences strings
  io.styles vectors combinators math.vectors ui.gadgets colors
 -math.order math.geometry.rect locals ;
 +math.order math.geometry.rect locals specialized-arrays.float ;
  IN: ui.render
  
  SYMBOL: clip
@@@ -138,11 -138,10 +138,11 @@@ TUPLE: gradient < caching-pen colors la
      direction dim v* dim over v- swap
      colors length dup 1- v/n [ v*n ] with map
      [ dup rot v+ 2array ] with map
 -    concat concat >c-float-array ;
 +    concat concat >float-array ;
  
  : gradient-colors ( colors -- seq )
 -    [ color>raw 4array dup 2array ] map concat concat >c-float-array ;
 +    [ color>raw 4array dup 2array ] map concat concat
 +    >float-array ;
  
  M: gradient recompute-pen ( gadget gradient -- )
      tuck
@@@ -174,7 -173,7 +174,7 @@@ boundary-vertice
  boundary-count ;
  
  : <polygon> ( color points -- polygon )
 -    dup close-path [ [ concat >c-float-array ] [ length ] bi ] bi@
 +    dup close-path [ [ concat >float-array ] [ length ] bi ] bi@
      polygon boa ;
  
  M: polygon draw-boundary
@@@ -228,7 -227,7 +228,7 @@@ HOOK: free-fonts font-renderer ( world 
      dup string? [
          string-width
      ] [
-         0 -rot [ string-width max ] with each
+         [ 0 ] 2dip [ string-width max ] with each
      ] if ;
  
  : text-dim ( open-font text -- dim )
diff --combined basis/x11/glx/glx.factor
index 99bae97b14090f4991072e1f01f7158dc3b5bd3d,7a2012f0eab8a7156ac29b349e1e11e7fd68f53c..cd4fa3395e58a58db0b84a1bcd8be6574987df2b
@@@ -2,8 -2,8 +2,8 @@@
  ! See http://factorcode.org/license.txt for BSD license.
  !
  ! based on glx.h from xfree86, and some of glxtokens.h
- USING: alien alien.c-types alien.syntax alien.syntax.private x11.xlib
+ USING: alien alien.c-types alien.syntax x11.xlib
 -namespaces make kernel sequences parser words ;
 +namespaces make kernel sequences parser words specialized-arrays.int ;
  IN: x11.glx
  
  LIBRARY: glx
@@@ -93,7 -93,7 +93,7 @@@ FUNCTION: void* glXGetProcAddressARB ( 
          GLX_DOUBLEBUFFER ,
          GLX_DEPTH_SIZE , 16 ,
          0 ,
 -    ] { } make >c-int-array
 +    ] int-array{ } make underlying>>
      glXChooseVisual
      [ "Could not get a double-buffered GLX RGBA visual" throw ] unless* ;
  
diff --combined core/words/words.factor
index 5c17d514c53922139abf4c78b141fb344e77300e,618e04ffb48ece7403198b08eab4ff6cd0b1b926..b36f8be6775c5eac3a0cfdf1e5308f103714bd5a
@@@ -221,7 -221,7 +221,7 @@@ M: word subwords drop f 
      "( gensym )" f <word> ;
  
  : define-temp ( quot -- word )
-     gensym dup rot define ;
+     [ gensym dup ] dip define ;
  
  : reveal ( word -- )
      dup [ name>> ] [ vocabulary>> ] bi dup vocab-words
@@@ -243,8 -243,6 +243,8 @@@ ERROR: bad-create name vocab 
  
  PREDICATE: parsing-word < word "parsing" word-prop ;
  
 +: make-parsing ( word -- ) t "parsing" set-word-prop ;
 +
  : delimiter? ( obj -- ? )
      dup word? [ "delimiter" word-prop ] [ drop f ] if ;