]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 21 Sep 2009 04:02:49 +0000 (23:02 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 21 Sep 2009 04:02:49 +0000 (23:02 -0500)
Conflicts:
basis/classes/struct/struct-tests.factor
basis/functors/functors-tests.factor
basis/specialized-arrays/specialized-arrays-tests.factor

1  2 
basis/classes/struct/struct-tests.factor
basis/functors/functors-tests.factor
basis/specialized-arrays/specialized-arrays-tests.factor
core/syntax/syntax-docs.factor

index a282eb75eeec5d303449f07d2516ace191b78433,b60bfa375bef10fc4ea9735f71d8e52b6890860d..a026417171254e92af06af08a147390e66c8232a
@@@ -1,11 -1,13 +1,13 @@@
  ! (c)Joe Groff bsd license
- USING: accessors alien alien.c-types ascii
+ USING: accessors alien alien.c-types alien.data ascii
  assocs byte-arrays classes.struct classes.tuple.private
  combinators compiler.tree.debugger compiler.units destructors
  io.encodings.utf8 io.pathnames io.streams.string kernel libc
 -literals math mirrors multiline namespaces prettyprint
 +literals math mirrors namespaces prettyprint
  prettyprint.config see sequences specialized-arrays system
  tools.test parser lexer eval layouts ;
+ FROM: math => float ;
+ QUALIFIED-WITH: alien.c-types c
  SPECIALIZED-ARRAY: char
  SPECIALIZED-ARRAY: int
  SPECIALIZED-ARRAY: ushort
@@@ -46,9 -48,9 +48,9 @@@ STRUCT: struct-test-ba
  
  [ {
      { "underlying" B{ 98 0 0 98 127 0 0 127 0 0 0 0 } }
-     { { "x" "char" } 98            }
-     { { "y" "int"  } HEX: 7F00007F }
-     { { "z" "bool" } f             }
+     { { "x" char } 98            }
+     { { "y" int  } HEX: 7F00007F }
+     { { "z" bool } f             }
  } ] [
      B{ 98 0 0 98 127 0 0 127 0 0 0 0 } struct-test-foo memory>struct
      make-mirror >alist
  ] unit-test
  
  UNION-STRUCT: struct-test-float-and-bits
-     { f float }
+     { f c:float }
      { bits uint } ;
  
  [ 1.0 ] [ struct-test-float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test
@@@ -181,18 -183,18 +183,18 @@@ STRUCT: struct-test-string-pt
      ] with-scope
  ] unit-test
  
- [ "USING: classes.struct ;
 -[ <" USING: alien.c-types classes.struct ;
++[ "USING: alien.c-types classes.struct ;
  IN: classes.struct.tests
  STRUCT: struct-test-foo
      { x char initial: 0 } { y int initial: 123 } { z bool } ;
 -"> ]
 +" ]
  [ [ struct-test-foo see ] with-string-writer ] unit-test
  
- [ "USING: classes.struct ;
 -[ <" USING: alien.c-types classes.struct ;
++[ "USING: alien.c-types classes.struct ;
  IN: classes.struct.tests
  UNION-STRUCT: struct-test-float-and-bits
      { f float initial: 0.0 } { bits uint initial: 0 } ;
 -"> ]
 +" ]
  [ [ struct-test-float-and-bits see ] with-string-writer ] unit-test
  
  [ {
          { offset 0 }
          { initial 0 }
          { class fixnum }
-         { type "char" }
+         { type char }
      }
      T{ struct-slot-spec
          { name "y" }
          { offset 4 }
          { initial 123 }
          { class integer }
-         { type "int" }
+         { type int }
      }
      T{ struct-slot-spec
          { name "z" }
          { offset 8 }
          { initial f }
-         { type "bool" }
+         { type bool }
          { class object }
      }
  } ] [ "struct-test-foo" c-type fields>> ] unit-test
      T{ struct-slot-spec
          { name "f" }
          { offset 0 }
-         { type "float" }
+         { type c:float }
          { class float }
          { initial 0.0 }
      }
      T{ struct-slot-spec
          { name "bits" }
          { offset 0 }
-         { type "uint" }
+         { type uint }
          { class integer }
          { initial 0 }
      }
@@@ -277,7 -279,7 +279,7 @@@ STRUCT: struct-test-array-slot
  ] unit-test
  
  STRUCT: struct-test-optimization
-     { x { "int" 3 } } { y int } ;
+     { x { int 3 } } { y int } ;
  
  SPECIALIZED-ARRAY: struct-test-optimization
  
index 0145e8d9899446554073f97989db556463efb41a,58da96aa171279efbb15692ac4158075b1ba04b8..544c2ed1e4a10ca2c69c38d1415588816d58a47e
@@@ -1,5 -1,6 +1,6 @@@
  USING: classes.struct functors tools.test math words kernel
- parser io.streams.string generic ;
+ multiline parser io.streams.string generic ;
+ QUALIFIED-WITH: alien.c-types c
  IN: functors.tests
  
  <<
@@@ -104,13 -105,14 +105,13 @@@ M: integer W 1 + 
  
  ! Does replacing an ordinary word with a functor-generated one work?
  [ [ ] ] [
 -    <" IN: functors.tests
 +    "IN: functors.tests
  
      TUPLE: some-tuple ;
      : some-word ( -- ) ;
      GENERIC: some-generic ( a -- b )
      M: some-tuple some-generic ;
 -    SYMBOL: some-symbol
 -    "> <string-reader> "functors-test" parse-stream
 +    SYMBOL: some-symbol" <string-reader> "functors-test" parse-stream
  ] unit-test
  
  : test-redefinition ( -- )
@@@ -143,8 -145,9 +144,8 @@@ SYMBOL: W-symbo
  ;FUNCTOR
  
  [ [ ] ] [
 -    <" IN: functors.tests
 -    << "some" redefine-test >>
 -    "> <string-reader> "functors-test" parse-stream
 +    """IN: functors.tests
 +    << "some" redefine-test >>""" <string-reader> "functors-test" parse-stream
  ] unit-test
  
  test-redefinition
@@@ -158,15 -161,15 +159,15 @@@ T-class DEFINES-CLASS ${T
  WHERE
  
  STRUCT: T-class
-     { NAME int }
+     { NAME c:int }
      { x { TYPE 4 } }
-     { y { "short" N } }
+     { y { c:short N } }
      { z TYPE initial: 5 }
-     { float { "float" 2 } } ;
+     { float { c:float 2 } } ;
  
  ;FUNCTOR
  
- "a-struct" "nemo" "char" 2 define-a-struct
+ "a-struct" "nemo" c:char 2 define-a-struct
  
  >>
  
              { offset 0 }
              { class integer }
              { initial 0 } 
-             { type "int" }
+             { type c:int }
          }
          T{ struct-slot-spec
              { name "x" }
              { offset 4 }
              { class object }
              { initial f } 
-             { type { "char" 4 } }
+             { type { c:char 4 } }
          }
          T{ struct-slot-spec
              { name "y" }
              { offset 8 }
              { class object }
              { initial f } 
-             { type { "short" 2 } }
+             { type { c:short 2 } }
          }
          T{ struct-slot-spec
              { name "z" }
              { offset 12 }
              { class fixnum }
              { initial 5 } 
-             { type "char" }
+             { type c:char }
          }
          T{ struct-slot-spec
              { name "float" }
              { offset 16 }
              { class object }
              { initial f } 
-             { type { "float" 2 } }
+             { type { c:float 2 } }
          }
      }
  ] [ a-struct struct-slots ] unit-test
index 1b9bd7e2b28da4f3029aefbd8c5c9c7abbdde49c,5d88f42d5021fc68b858e5ba4125191da08b1772..56f7f8a1cd2678e0f1cbb95b667ae1d4ae9eea22
@@@ -3,8 -3,9 +3,9 @@@ USING: tools.test alien.syntax speciali
  specialized-arrays.private sequences alien.c-types accessors
  kernel arrays combinators compiler compiler.units classes.struct
  combinators.smart compiler.tree.debugger math libc destructors
- sequences.private eval words vocabs namespaces assocs
- prettyprint ;
+ sequences.private multiline eval words vocabs namespaces
+ assocs prettyprint alien.data ;
+ FROM: alien.c-types => float ;
  
  SPECIALIZED-ARRAY: int
  SPECIALIZED-ARRAY: bool
@@@ -124,22 -125,22 +125,22 @@@ SPECIALIZED-ARRAY: fixed-strin
  ] unit-test
  
  [
 -    <"
 +    """
  IN: specialized-arrays.tests
  USING: specialized-arrays ;
  
 -SPECIALIZED-ARRAY: __does_not_exist__ "> eval( -- )
 +SPECIALIZED-ARRAY: __does_not_exist__ """ eval( -- )
  ] must-fail
  
  [ ] [
 -    <"
 +    """
  IN: specialized-arrays.tests
  USING: classes.struct specialized-arrays ;
  
  STRUCT: __does_not_exist__ { x int } ;
  
  SPECIALIZED-ARRAY: __does_not_exist__
 -"> eval( -- )
 +""" eval( -- )
  ] unit-test
  
  [ f ] [
index 551cc76c0e343c50d2edafa74f8aadd103ed68fd,394ae3f67c58c203f005dbb41150c0548dd683eb..aceca29ccdb04387033dd2119d2af55191ebd353
@@@ -532,7 -532,7 +532,7 @@@ HELP: CHAR
  HELP: "
  { $syntax "\"string...\"" }
  { $values { "string" "literal and escaped characters" } }
 -{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", and appends the resulting string to the parse tree. String literals cannot span multiple lines. Strings containing the " { $link POSTPONE: " } " character and various other special characters can be read by inserting " { $link "escape" } "." }
 +{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } ", and appends the resulting string to the parse tree. String literals can span multiple lines. Strings containing the " { $link POSTPONE: " } " character and various other special characters can be read by inserting " { $link "escape" } "." }
  { $examples
    "A string with a newline in it:"
    { $example "USE: io" "\"Hello\\nworld\" print" "Hello\nworld" }
@@@ -593,10 -593,13 +593,13 @@@ HELP: #
  { $description "Discards all input until the end of the line." } ;
  
  HELP: HEX:
- { $syntax "HEX: integer" }
- { $values { "integer" "hexadecimal digits (0-9, a-f, A-F)" } }
- { $description "Adds an integer read from a hexadecimal literal to the parse tree." }
- { $examples { $example "USE: prettyprint" "HEX: ff ." "255" } } ;
+ { $syntax "HEX: NNN" "HEX: NNN.NNNpEEE" }
+ { $values { "N" "hexadecimal digit (0-9, a-f, A-F)" } { "pEEE" "decimal exponent value" } }
+ { $description "Adds an integer or floating-point value read from a hexadecimal literal to the parse tree." }
+ { $examples
+     { $example "USE: prettyprint" "HEX: ff ." "255" }
+     { $example "USE: prettyprint" "HEX: 1.8p5 ." "48.0" }
+ } ;
  
  HELP: OCT:
  { $syntax "OCT: integer" }