diff --git a/basis/bitstreams/bitstreams.factor b/basis/bitstreams/bitstreams.factor index 032e851a79..2aa0059542 100644 --- a/basis/bitstreams/bitstreams.factor +++ b/basis/bitstreams/bitstreams.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien.accessors assocs byte-arrays combinators -constructors destructors fry io io.binary io.encodings.binary -io.streams.byte-array kernel locals macros math math.ranges -multiline sequences sequences.private vectors byte-vectors -combinators.short-circuit math.bitwise ; +destructors fry io io.binary io.encodings.binary io.streams.byte-array +kernel locals macros math math.ranges multiline sequences +sequences.private vectors byte-vectors combinators.short-circuit +math.bitwise ; IN: bitstreams TUPLE: widthed { bits integer read-only } { #bits integer read-only } ; @@ -36,8 +36,12 @@ TUPLE: bit-writer TUPLE: msb0-bit-reader < bit-reader ; TUPLE: lsb0-bit-reader < bit-reader ; -CONSTRUCTOR: msb0-bit-reader ( bytes -- bs ) ; -CONSTRUCTOR: lsb0-bit-reader ( bytes -- bs ) ; + +: ( bytes -- bs ) + msb0-bit-reader new swap >>bytes ; inline + +: ( bytes -- bs ) + lsb0-bit-reader new swap >>bytes ; inline TUPLE: msb0-bit-writer < bit-writer ; TUPLE: lsb0-bit-writer < bit-writer ; diff --git a/basis/compression/huffman/huffman.factor b/basis/compression/huffman/huffman.factor index 6ef9c2fabc..9ece36e6cd 100755 --- a/basis/compression/huffman/huffman.factor +++ b/basis/compression/huffman/huffman.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2009 Marc Fauconneau. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs constructors fry +USING: accessors arrays assocs fry hashtables io kernel locals math math.order math.parser math.ranges multiline sequences ; IN: compression.huffman @@ -58,7 +58,10 @@ TUPLE: huffman-decoder { rtable } { bits/level } ; -CONSTRUCTOR: huffman-decoder ( bs tdesc -- decoder ) +: ( bs tdesc -- decoder ) + huffman-decoder new + swap >>tdesc + swap >>bs 16 >>bits/level [ ] [ tdesc>> ] [ bits/level>> 2^ ] tri reverse-table >>rtable ; diff --git a/basis/compression/inflate/inflate.factor b/basis/compression/inflate/inflate.factor index ab1caf3f6a..05ec94a794 100644 --- a/basis/compression/inflate/inflate.factor +++ b/basis/compression/inflate/inflate.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Marc Fauconneau. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs byte-arrays -byte-vectors combinators constructors fry grouping hashtables +byte-vectors combinators fry grouping hashtables compression.huffman images io.binary kernel locals math math.bitwise math.order math.ranges multiline sequences sorting ; diff --git a/basis/images/jpeg/jpeg.factor b/basis/images/jpeg/jpeg.factor index b66aed043d..f61254c3cf 100644 --- a/basis/images/jpeg/jpeg.factor +++ b/basis/images/jpeg/jpeg.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Marc Fauconneau. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays byte-arrays combinators -constructors grouping compression.huffman images +grouping compression.huffman images images.processing io io.binary io.encodings.binary io.files io.streams.byte-array kernel locals math math.bitwise math.constants math.functions math.matrices math.order @@ -21,7 +21,8 @@ TUPLE: jpeg-image < image ( headers bitstream -- image ) + jpeg-image new swap >>bitstream swap >>headers ; SINGLETONS: SOF DHT DAC RST SOI EOI SOS DQT DNL DRI DHP EXP APP JPG COM TEM RES ; @@ -56,12 +57,20 @@ APP JPG COM TEM RES ; TUPLE: jpeg-chunk length type data ; -CONSTRUCTOR: jpeg-chunk ( type length data -- jpeg-chunk ) ; +: ( type length data -- jpeg-chunk ) + jpeg-chunk new + swap >>data + swap >>length + swap >>type ; TUPLE: jpeg-color-info h v quant-table dc-huff-table ac-huff-table { diff initial: 0 } id ; -CONSTRUCTOR: jpeg-color-info ( h v quant-table -- jpeg-color-info ) ; +: ( h v quant-table -- jpeg-color-info ) + jpeg-color-info new + swap >>quant-table + swap >>v + swap >>h ; : jpeg> ( -- jpeg-image ) jpeg-image get ; diff --git a/basis/images/loader/loader.factor b/basis/images/loader/loader.factor index 51d4e0fadf..dc0eec75c2 100644 --- a/basis/images/loader/loader.factor +++ b/basis/images/loader/loader.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Doug Coleman, Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. -USING: constructors kernel splitting unicode.case combinators -accessors images io.pathnames namespaces assocs ; +USING: kernel splitting unicode.case combinators accessors images +io.pathnames namespaces assocs ; IN: images.loader ERROR: unknown-image-extension extension ; diff --git a/basis/images/png/png.factor b/basis/images/png/png.factor index eb6b29713c..bb470d8dd8 100755 --- a/basis/images/png/png.factor +++ b/basis/images/png/png.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors constructors images io io.binary io.encodings.ascii +USING: accessors images io io.binary io.encodings.ascii io.encodings.binary io.encodings.string io.files io.files.info kernel -sequences io.streams.limited fry combinators arrays math -checksums checksums.crc32 compression.inflate grouping byte-arrays -images.loader ; +sequences io.streams.limited fry combinators arrays math checksums +checksums.crc32 compression.inflate grouping byte-arrays images.loader ; IN: images.png SINGLETON: png-image @@ -15,12 +14,14 @@ TUPLE: loading-png width height bit-depth color-type compression-method filter-method interlace-method uncompressed ; -CONSTRUCTOR: loading-png ( -- image ) +: ( -- image ) + loading-png new V{ } clone >>chunks ; TUPLE: png-chunk length type data ; -CONSTRUCTOR: png-chunk ( -- png-chunk ) ; +: ( -- png-chunk ) + png-chunk new ; inline CONSTANT: png-header B{ HEX: 89 HEX: 50 HEX: 4e HEX: 47 HEX: 0d HEX: 0a HEX: 1a HEX: 0a } diff --git a/basis/images/tiff/tiff.factor b/basis/images/tiff/tiff.factor index e0de68b368..e00b05f2e7 100755 --- a/basis/images/tiff/tiff.factor +++ b/basis/images/tiff/tiff.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs byte-arrays classes combinators -compression.lzw constructors endian fry grouping images io +compression.lzw endian fry grouping images io io.binary io.encodings.ascii io.encodings.binary io.encodings.string io.encodings.utf8 io.files kernel math math.bitwise math.order math.parser pack prettyprint sequences @@ -12,14 +12,27 @@ IN: images.tiff SINGLETON: tiff-image TUPLE: loading-tiff endianness the-answer ifd-offset ifds ; -CONSTRUCTOR: loading-tiff ( -- tiff ) V{ } clone >>ifds ; + +: ( -- tiff ) + loading-tiff new V{ } clone >>ifds ; TUPLE: ifd count ifd-entries next processed-tags strips bitmap ; -CONSTRUCTOR: ifd ( count ifd-entries next -- ifd ) ; + +: ( count ifd-entries next -- ifd ) + ifd new + swap >>next + swap >>ifd-entries + swap >>count ; TUPLE: ifd-entry tag type count offset/value ; -CONSTRUCTOR: ifd-entry ( tag type count offset/value -- ifd-entry ) ; + +: ( tag type count offset/value -- ifd-entry ) + ifd-entry new + swap >>offset/value + swap >>count + swap >>type + swap >>tag ; SINGLETONS: photometric-interpretation photometric-interpretation-white-is-zero diff --git a/basis/constructors/authors.txt b/extra/constructors/authors.txt similarity index 100% rename from basis/constructors/authors.txt rename to extra/constructors/authors.txt diff --git a/basis/constructors/constructors-tests.factor b/extra/constructors/constructors-tests.factor similarity index 100% rename from basis/constructors/constructors-tests.factor rename to extra/constructors/constructors-tests.factor diff --git a/basis/constructors/constructors.factor b/extra/constructors/constructors.factor similarity index 100% rename from basis/constructors/constructors.factor rename to extra/constructors/constructors.factor diff --git a/basis/constructors/summary.txt b/extra/constructors/summary.txt similarity index 100% rename from basis/constructors/summary.txt rename to extra/constructors/summary.txt diff --git a/basis/constructors/tags.txt b/extra/constructors/tags.txt similarity index 100% rename from basis/constructors/tags.txt rename to extra/constructors/tags.txt