]> gitweb.factorcode.org Git - factor.git/commitdiff
io.encodings.utf16n: merge with io.encodings.utf16
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 21 Jan 2022 21:16:36 +0000 (13:16 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 21 Jan 2022 21:16:36 +0000 (13:16 -0800)
24 files changed:
basis/bootstrap/stage2.factor
basis/core-text/core-text.factor
basis/environment/windows/windows.factor
basis/io/monitors/windows/windows.factor
basis/tools/ps/windows/windows.factor
basis/ui/backend/cocoa/views/views.factor
basis/ui/backend/windows/windows.factor
basis/ui/text/core-text/core-text.factor
basis/windows/dropfiles/dropfiles.factor
basis/windows/registry/registry-tests.factor
basis/windows/registry/registry.factor
basis/windows/types/types.factor
basis/windows/uniscribe/uniscribe.factor
core/alien/alien-docs.factor
core/alien/strings/strings-tests.factor
core/alien/strings/strings.factor
core/io/encodings/utf16/utf16-docs.factor
core/io/encodings/utf16/utf16-tests.factor
core/io/encodings/utf16/utf16.factor
core/io/encodings/utf16n/authors.txt [deleted file]
core/io/encodings/utf16n/summary.txt [deleted file]
core/io/encodings/utf16n/utf16n-docs.factor [deleted file]
core/io/encodings/utf16n/utf16n-tests.factor [deleted file]
core/io/encodings/utf16n/utf16n.factor [deleted file]

index 3e6e58a8bb6eb1dd7df76162b80a92795e031acf..ee6c3492723f49c3a09d1dff813a11deba1e9eb0 100644 (file)
@@ -13,10 +13,8 @@ SYMBOL: bootstrap-time
 : strip-encodings ( -- )
     os unix? [
         [
 : strip-encodings ( -- )
     os unix? [
         [
-            P" resource:core/io/encodings/utf16/utf16.factor"
-            P" resource:core/io/encodings/utf16n/utf16n.factor" [ forget ] bi@
-            "io.encodings.utf16"
-            "io.encodings.utf16n" [ loaded-child-vocab-names [ forget-vocab ] each ] bi@
+            P" resource:core/io/encodings/utf16/utf16.factor" forget
+            "io.encodings.utf16" loaded-child-vocab-names [ forget-vocab ] each
         ] with-compilation-unit
     ] when ;
 
         ] with-compilation-unit
     ] when ;
 
index d94d850ab5e678e96d283a96148594f80fc77af6..9b98890c801e060965b215848a0353436e1758df 100644 (file)
@@ -4,7 +4,7 @@ USING: accessors alien.c-types alien.data alien.syntax arrays
 assocs cache classes colors combinators core-foundation
 core-foundation.attributed-strings core-foundation.strings
 core-graphics core-graphics.types core-text.fonts destructors
 assocs cache classes colors combinators core-foundation
 core-foundation.attributed-strings core-foundation.strings
 core-graphics core-graphics.types core-text.fonts destructors
-fonts init io.encodings.string io.encodings.utf16n kernel make
+fonts init io.encodings.string io.encodings.utf16 kernel make
 math math.functions math.order math.vectors namespaces opengl
 sequences strings ;
 IN: core-text
 math math.functions math.order math.vectors namespaces opengl
 sequences strings ;
 IN: core-text
index 2ff126c8871eec40aaa7bc4c7aacbd338b52930f..4c0d00d2ca6df119f6b4ca620ef09c084a34e4de 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.strings fry io.encodings.utf16n kernel
+USING: alien.strings fry io.encodings.utf16 kernel
 splitting windows windows.kernel32 windows.types system
 environment alien.data sequences windows.errors
 io.streams.memory io.encodings io specialized-arrays ;
 splitting windows windows.kernel32 windows.types system
 environment alien.data sequences windows.errors
 io.streams.memory io.encodings io specialized-arrays ;
index 4c99ca18c85f0628b2bf7c30863567fa51d0a0df..958fa3ed3a1b2ee0734ea09020df83ea2b92ba00 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data arrays classes.struct
 combinators continuations destructors fry io.backend
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data arrays classes.struct
 combinators continuations destructors fry io.backend
-io.encodings.string io.encodings.utf16n io.files.windows
+io.encodings.string io.encodings.utf16 io.files.windows
 io.monitors io.pathnames io.ports kernel literals locals make
 math sequences system threads windows.errors windows.kernel32
 windows.types ;
 io.monitors io.pathnames io.ports kernel literals locals make
 math sequences system threads windows.errors windows.kernel32
 windows.types ;
index a21d8644d275b3e7ff07bf8f94d506519a34ea18..b5bc8d15f0bf9648180a6c40de8c8e5e2328a8da 100644 (file)
@@ -1,7 +1,7 @@
 USING: accessors alien alien.c-types alien.data alien.syntax
 arrays byte-arrays classes.struct combinators.short-circuit
 continuations destructors fry io io.encodings.string
 USING: accessors alien alien.c-types alien.data alien.syntax
 arrays byte-arrays classes.struct combinators.short-circuit
 continuations destructors fry io io.encodings.string
-io.encodings.utf16n kernel literals locals math sequences
+io.encodings.utf16 kernel literals locals math sequences
 strings system tools.ps windows.errors windows.handles
 windows.kernel32 windows.ntdll windows.types ;
 IN: tools.ps.windows
 strings system tools.ps windows.errors windows.handles
 windows.kernel32 windows.ntdll windows.types ;
 IN: tools.ps.windows
index dda758f11d005d2b9b87536f87063e2762e27d78..be51f635b72c4b39b07c3376a57e491899b14bf6 100644 (file)
@@ -6,7 +6,7 @@ arrays assocs classes cocoa cocoa.application cocoa.classes
 cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.touchbar
 cocoa.types cocoa.views combinators continuations
 core-foundation.strings core-graphics core-graphics.types
 cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.touchbar
 cocoa.types cocoa.views combinators continuations
 core-foundation.strings core-graphics core-graphics.types
-core-text debugger io.encodings.string io.encodings.utf16n
+core-text debugger io.encodings.string io.encodings.utf16
 io.encodings.utf8 kernel literals math math.order math.parser
 math.rectangles math.vectors namespaces opengl sequences
 splitting threads ui.backend.cocoa.input-methods ui.commands
 io.encodings.utf8 kernel literals math math.order math.parser
 math.rectangles math.vectors namespaces opengl sequences
 splitting threads ui.backend.cocoa.input-methods ui.commands
index b379581df6589c49be8598d5d702b0c462dd0e32..4281dd83947a20f2f43e66e0decac030cb1bf249 100644 (file)
@@ -4,7 +4,7 @@
 USING: accessors alien alien.c-types alien.data alien.strings
 arrays ascii assocs assocs.extras byte-arrays calendar classes
 classes.struct colors combinators continuations io io.crlf
 USING: accessors alien alien.c-types alien.data alien.strings
 arrays ascii assocs assocs.extras byte-arrays calendar classes
 classes.struct colors combinators continuations io io.crlf
-io.encodings.string io.encodings.utf16n io.encodings.utf8 kernel
+io.encodings.string io.encodings.utf16 io.encodings.utf8 kernel
 libc literals make math math.bitwise namespaces sequences sets
 specialized-arrays strings threads ui ui.backend ui.clipboards
 ui.event-loop ui.gadgets ui.gadgets.private ui.gadgets.worlds
 libc literals make math math.bitwise namespaces sequences sets
 specialized-arrays strings threads ui ui.backend ui.clipboards
 ui.event-loop ui.gadgets ui.gadgets.private ui.gadgets.worlds
index f8e93690b9403d7c31da4c3072b4b9b320904ccb..135d00970e7bd2eb33edd911bf8b5e192dbc01ba 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors cache core-graphics.types core-text
 ! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors cache core-graphics.types core-text
-core-text.fonts io.encodings.string io.encodings.utf16n kernel
+core-text.fonts io.encodings.string io.encodings.utf16 kernel
 math math.vectors namespaces opengl sequences ui.text
 ui.text.private ;
 IN: ui.text.core-text
 math math.vectors namespaces opengl sequences ui.text
 ui.text.private ;
 IN: ui.text.core-text
index 194502c4ebd1711d04e145069e84cb608703f14d..1c0e1dde484448f8a8ac5509c6d0df26fcb3850e 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2017-2018 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data alien.libraries alien.strings
 ! Copyright (C) 2017-2018 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data alien.libraries alien.strings
-init io.encodings.utf16n kernel literals math namespaces
+init io.encodings.utf16 kernel literals math namespaces
 sequences ui.backend.windows ui.gadgets.worlds
 ui.gestures windows.errors windows.messages windows.shell32
 windows.types windows.user32 ;
 sequences ui.backend.windows ui.gadgets.worlds
 ui.gestures windows.errors windows.messages windows.shell32
 windows.types windows.user32 ;
index 839f2eecd396954b1fdd2351535ba109afa6385f..cf5853377464866821f2e2dfd7be3f97fa97fe8d 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2010 Doug Coleman.
 ! Copyright (C) 2018 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
 ! Copyright (C) 2010 Doug Coleman.
 ! Copyright (C) 2018 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: byte-arrays io.encodings.string io.encodings.utf16n
+USING: byte-arrays io.encodings.string io.encodings.utf16
 kernel sequences tools.test windows.advapi32 windows.kernel32
 windows.registry ;
 IN: windows.registry.tests
 kernel sequences tools.test windows.advapi32 windows.kernel32
 windows.registry ;
 IN: windows.registry.tests
index 21e326539ff59fc7b5b7ed925a760e07b108ea5d..8bb4d6d26e7ac21d1bbcbe59bfd2289d17c8cda8 100644 (file)
@@ -3,7 +3,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.data byte-arrays
 classes.struct continuations io.encodings.string
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.data byte-arrays
 classes.struct continuations io.encodings.string
-io.encodings.utf16n kernel literals locals math sequences sets
+io.encodings.utf16 kernel literals locals math sequences sets
 splitting windows windows.advapi32 windows.errors
 windows.kernel32 windows.time windows.types ;
 IN: windows.registry
 splitting windows windows.advapi32 windows.errors
 windows.kernel32 windows.time windows.types ;
 IN: windows.registry
index e6fe0622428861cfacf3839a31318b70c13d70c1..5827d5c9b92ab981be1ba9abf1e0079b928e2db3 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2006 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types alien.syntax classes.struct colors
 ! Copyright (C) 2005, 2006 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types alien.syntax classes.struct colors
-io.encodings.utf16n io.encodings.utf8 kernel math math.bitwise
+io.encodings.utf16 io.encodings.utf8 kernel math math.bitwise
 math.functions math.vectors sequences ;
 FROM: alien.c-types => float short ;
 IN: windows.types
 math.functions math.vectors sequences ;
 FROM: alien.c-types => float short ;
 IN: windows.types
index 08f33b0f1755ef984d2678ef62eabe9d56c543b6..326d17a9c0ac74ed6bb906d976d8035eab65e344 100644 (file)
@@ -3,7 +3,7 @@
 
 USING: accessors alien.c-types alien.data arrays assocs
 byte-arrays cache classes.struct colors combinators destructors
 
 USING: accessors alien.c-types alien.data arrays assocs
 byte-arrays cache classes.struct colors combinators destructors
-fonts images init io.encodings.string io.encodings.utf16n kernel
+fonts images init io.encodings.string io.encodings.utf16 kernel
 literals locals math math.bitwise math.functions namespaces
 sequences specialized-arrays windows.errors windows.fonts
 windows.gdi32 windows.offscreen windows.ole32 windows.types
 literals locals math math.bitwise math.functions namespaces
 sequences specialized-arrays windows.errors windows.fonts
 windows.gdi32 windows.offscreen windows.ole32 windows.types
index 37a4efe278355c609cb12286640438deb7ed417a..3c83e17a06d6f6a387778e7afc4fd521b948e035 100644 (file)
@@ -1,6 +1,6 @@
 USING: alien.accessors alien.c-types alien.libraries
 alien.strings alien.syntax byte-arrays cpu.x86 eval help.markup
 USING: alien.accessors alien.c-types alien.libraries
 alien.strings alien.syntax byte-arrays cpu.x86 eval help.markup
-help.syntax io io.backend io.encodings.utf16n io.encodings.utf8
+help.syntax io io.backend io.encodings.utf16 io.encodings.utf8
 kernel math quotations sequences system ;
 IN: alien
 
 kernel math quotations sequences system ;
 IN: alien
 
index a288a54d93b2b88288fcb1c1e69d5b13cdbe4e9a..06781f1566a50ca6c4db86ec0e1933f3015670fa 100644 (file)
@@ -1,6 +1,6 @@
 USING: alien alien.data alien.strings io.encodings.ascii
 io.encodings.latin1 io.encodings.string io.encodings.utf16
 USING: alien alien.data alien.strings io.encodings.ascii
 io.encodings.latin1 io.encodings.string io.encodings.utf16
-io.encodings.utf16n io.encodings.utf8 kernel libc tools.test ;
+io.encodings.utf8 kernel libc tools.test ;
 
 { "\u0000ff" }
 [ "\u0000ff" latin1 string>alien latin1 alien>string ]
 
 { "\u0000ff" }
 [ "\u0000ff" latin1 string>alien latin1 alien>string ]
index a7ddb3dd80ca8a60ef41edbbceeeb08bc94d8633..60b7eaa6ce60e8710a795a4c5d8f0f29aa7fe56b 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008, 2011 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien arrays byte-arrays byte-vectors init io
 ! Copyright (C) 2008, 2011 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien arrays byte-arrays byte-vectors init io
-io.encodings io.encodings.ascii io.encodings.utf16n
+io.encodings io.encodings.ascii io.encodings.utf16
 io.encodings.utf8 io.streams.memory kernel kernel.private math
 namespaces sequences sequences.private strings strings.private
 system system.private ;
 io.encodings.utf8 io.streams.memory kernel kernel.private math
 namespaces sequences sequences.private strings strings.private
 system system.private ;
index 6b046f3e69b506a82e2740be701851477308d05e..b6c89853882de794d1d52b897ed88686ee3a1ed1 100644 (file)
@@ -4,11 +4,12 @@ USING: help.markup help.syntax ;
 IN: io.encodings.utf16
 
 ARTICLE: "io.encodings.utf16" "UTF-16 encoding"
 IN: io.encodings.utf16
 
 ARTICLE: "io.encodings.utf16" "UTF-16 encoding"
-"The UTF-16 encoding is a variable-width encoding. Unicode code points are encoded as 2 or 4 byte sequences. There are three encoding descriptor classes for working with UTF-16, depending on endianness or the presence of a BOM:"
+"The UTF-16 encoding is a variable-width encoding. Unicode code points are encoded as 2 or 4 byte sequences. There are four encoding descriptor classes for working with UTF-16, depending on endianness or the presence of a BOM:"
 { $subsections
     utf16
     utf16le
     utf16be
 { $subsections
     utf16
     utf16le
     utf16be
+    utf16n
 } ;
 
 ABOUT: "io.encodings.utf16"
 } ;
 
 ABOUT: "io.encodings.utf16"
@@ -25,4 +26,8 @@ HELP: utf16
 { $class-description "The encoding descriptor for UTF-16, that is, UTF-16 with a byte order mark. This is the most useful for general input and output in UTF-16. Streams can be made which read or write wth this encoding." }
 { $see-also "encodings-introduction" } ;
 
 { $class-description "The encoding descriptor for UTF-16, that is, UTF-16 with a byte order mark. This is the most useful for general input and output in UTF-16. Streams can be made which read or write wth this encoding." }
 { $see-also "encodings-introduction" } ;
 
-{ utf16 utf16le utf16be } related-words
+HELP: utf16n
+{ $class-description "The encoding descriptor for UTF-16 without a byte order mark in native endian order. This is useful mostly for FFI calls which take input of strings of the type " { $snippet "wchar_t*" } "." }
+{ $see-also "encodings-introduction" } ;
+
+{ utf16 utf16le utf16be utf16n } related-words
index 0b704532d213a202f67e2fa8ce0b0da91ef63e47..71a16c63b21486c771288b36e229378f193bfa93 100644 (file)
@@ -1,7 +1,9 @@
 ! Copyright (C) 2008 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 ! Copyright (C) 2008 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays io.encodings.string io.encodings.utf16 strings
+USING: accessors alien.data arrays io.encodings.string
+io.encodings.utf16 io.streams.byte-array kernel strings
 tools.test ;
 tools.test ;
+IN: io.encodings.utf16.tests
 
 { { CHAR: x } } [ B{ 0 CHAR: x } utf16be decode >array ] unit-test
 { { 0x1D11E } } [ B{ 0xD8 0x34 0xDD 0x1E } utf16be decode >array ] unit-test
 
 { { CHAR: x } } [ B{ 0 CHAR: x } utf16be decode >array ] unit-test
 { { 0x1D11E } } [ B{ 0xD8 0x34 0xDD 0x1E } utf16be decode >array ] unit-test
@@ -26,3 +28,10 @@ tools.test ;
 
 { B{ CHAR: a 0 CHAR: b 0 CHAR: c 0 } } [ "abc" utf16le encode ] unit-test
 { B{ 0 CHAR: a 0 CHAR: b 0 CHAR: c } } [ "abc" utf16be encode ] unit-test
 
 { B{ CHAR: a 0 CHAR: b 0 CHAR: c 0 } } [ "abc" utf16le encode ] unit-test
 { B{ 0 CHAR: a 0 CHAR: b 0 CHAR: c } } [ "abc" utf16be encode ] unit-test
+
+: correct-endian ( obj -- ? )
+    code>> little-endian? utf16le utf16be ? = ;
+
+{ t } [ B{ } utf16n <byte-reader> correct-endian ] unit-test
+{ t } [ utf16n <byte-writer> correct-endian ] unit-test
+
index 2777649aa9d84f328273cd11645a3541907d5c8f..01fc02c1bb499406438a1ec7d32727c4203d3c6e 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2006, 2009 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 ! Copyright (C) 2006, 2009 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors byte-arrays io io.encodings kernel math
-math.private sequences sequences.private strings strings.private ;
+USING: accessors alien.accessors byte-arrays io io.encodings
+kernel math math.private sequences sequences.private strings
+strings.private ;
 IN: io.encodings.utf16
 
 SINGLETON: utf16be
 IN: io.encodings.utf16
 
 SINGLETON: utf16be
@@ -163,3 +164,12 @@ M: utf16 <encoder>
     drop bom-le over stream-write utf16le <encoder> ;
 
 PRIVATE>
     drop bom-le over stream-write utf16le <encoder> ;
 
 PRIVATE>
+
+SINGLETON: utf16n
+
+: choose-utf16-endian ( -- descriptor )
+    B{ 1 0 0 0 } 0 alien-unsigned-4 1 = utf16le utf16be ? ; foldable
+
+M: utf16n <decoder> drop choose-utf16-endian <decoder> ;
+
+M: utf16n <encoder> drop choose-utf16-endian <encoder> ;
diff --git a/core/io/encodings/utf16n/authors.txt b/core/io/encodings/utf16n/authors.txt
deleted file mode 100644 (file)
index f990dd0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Daniel Ehrenberg
diff --git a/core/io/encodings/utf16n/summary.txt b/core/io/encodings/utf16n/summary.txt
deleted file mode 100644 (file)
index 4d94d1b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UTF16 encoding with native byte order
diff --git a/core/io/encodings/utf16n/utf16n-docs.factor b/core/io/encodings/utf16n/utf16n-docs.factor
deleted file mode 100644 (file)
index 9ccf483..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-USING: help.markup help.syntax ;
-IN: io.encodings.utf16n
-
-HELP: utf16n
-{ $class-description "The encoding descriptor for UTF-16 without a byte order mark in native endian order. This is useful mostly for FFI calls which take input of strings of the type wchar_t*" }
-{ $see-also "encodings-introduction" } ;
diff --git a/core/io/encodings/utf16n/utf16n-tests.factor b/core/io/encodings/utf16n/utf16n-tests.factor
deleted file mode 100644 (file)
index c76e090..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-USING: accessors alien.data io.encodings.utf16
-io.encodings.utf16n io.streams.byte-array kernel tools.test ;
-IN: io.encodings.utf16n.tests
-
-: correct-endian ( obj -- ? )
-    code>> little-endian? [ utf16le = ] [ utf16be = ] if ;
-
-{ t } [ B{ } utf16n <byte-reader> correct-endian ] unit-test
-{ t } [ utf16n <byte-writer> correct-endian ] unit-test
diff --git a/core/io/encodings/utf16n/utf16n.factor b/core/io/encodings/utf16n/utf16n.factor
deleted file mode 100644 (file)
index 6e178c1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: io.encodings io.encodings.utf16 kernel alien.accessors ;
-IN: io.encodings.utf16n
-
-! Native-order UTF-16
-
-SINGLETON: utf16n
-
-: choose-utf16-endian ( -- descriptor )
-    B{ 1 0 0 0 } 0 alien-unsigned-4 1 = utf16le utf16be ? ; foldable
-
-M: utf16n <decoder> drop choose-utf16-endian <decoder> ;
-
-M: utf16n <encoder> drop choose-utf16-endian <encoder> ;