]> gitweb.factorcode.org Git - factor.git/commitdiff
io.encodings.utf16: add a utf16n word for native utf16 type.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 5 Aug 2019 20:08:09 +0000 (13:08 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 5 Aug 2019 20:08:09 +0000 (13:08 -0700)
remove io.encodings.utf16n vocabulary, which was kind of single purpose.
update a bunch of vocab usings.

25 files changed:
basis/bootstrap/stage2.factor
basis/core-text/core-text.factor
basis/environment/windows/windows.factor
basis/game/input/dinput/dinput.factor
basis/io/monitors/windows/windows.factor
basis/random/unix/unix.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.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 3ec202482745c14525492288846fa7382dff574e..8ff0d37d59edf231cdf60d9c880a5715c8def329 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 7e96b8b570828367d4ff8b2e6f9c65476a0f9f63..44d55f5fcd398ff1e46196bf6f4166b4768c809b 100644 (file)
@@ -4,9 +4,9 @@ USING: accessors alien.c-types alien.data alien.syntax arrays
 assocs cache colors combinators core-foundation
 core-foundation.attributed-strings core-foundation.strings
 core-graphics core-graphics.types core-text.fonts destructors
 assocs cache colors combinators core-foundation
 core-foundation.attributed-strings core-foundation.strings
 core-graphics core-graphics.types core-text.fonts destructors
-fonts init kernel locals make math math.functions math.order
-math.vectors memoize namespaces sequences strings
-io.encodings.utf16n io.encodings.string ;
+fonts init io.encodings.string io.encodings.utf16 kernel locals
+make math math.functions math.order math.vectors memoize
+namespaces sequences strings ;
 IN: core-text
 
 TYPEDEF: void* CTLineRef
 IN: core-text
 
 TYPEDEF: void* CTLineRef
index d3a4a3f4372c912aac30f3d285b98ebb037d42eb..888a341aff2c56f945e0410416b553f0ca652d04 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 78b8ac5444e615e201a15aac00ff5173d396b93c..939db437d8837b396095f6c5385cae685c75dbbf 100644 (file)
@@ -1,12 +1,11 @@
 USING: accessors alien alien.c-types alien.data alien.strings
 USING: accessors alien alien.c-types alien.data alien.strings
-arrays assocs byte-arrays combinators combinators.short-circuit
-continuations game.input game.input.dinput.keys-array
-io.encodings.utf16n kernel locals math
-math.bitwise math.rectangles namespaces parser sequences shuffle
-specialized-arrays ui.backend.windows vectors windows.com
-windows.directx.dinput windows.directx.dinput.constants
-windows.kernel32 windows.messages windows.ole32 windows.errors
-windows.user32 classes.struct ;
+arrays assocs byte-arrays classes.struct combinators
+combinators.short-circuit game.input
+game.input.dinput.keys-array kernel locals math math.bitwise
+math.rectangles namespaces sequences specialized-arrays
+ui.backend.windows vectors windows.com windows.directx.dinput
+windows.directx.dinput.constants windows.errors windows.kernel32
+windows.messages windows.ole32 windows.user32 ;
 SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA
 IN: game.input.dinput
 
 SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA
 IN: game.input.dinput
 
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 ffddde9f5b465902e7e481f4dcf93b94144e0630..6e662d78a258058398da2648a32d431a36ee0f70 100644 (file)
@@ -14,6 +14,7 @@ M: unix-random dispose reader>> dispose ;
 
 M: unix-random random-bytes* ( n tuple -- byte-array )
     reader>> stream-read ;
 
 M: unix-random random-bytes* ( n tuple -- byte-array )
     reader>> stream-read ;
+
 HINTS: M\ unix-random random-bytes* { fixnum unix-random } ;
 
 [
 HINTS: M\ unix-random random-bytes* { fixnum unix-random } ;
 
 [
index b1a3004ff15c51e62a40dcd6128e3469601f474d..00f93f0efacd595e2561906e64b3b2df33d99620 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 5ac61918eb1b4b40684554cd6e6d6628338575a0..c8838748dcafecf06a298ed50cd2149510738b07 100644 (file)
@@ -11,7 +11,7 @@ ui.commands ui.gadgets ui.gadgets.private ui.gadgets.worlds
 ui.gestures ui.private words sorting math.vectors
 ui.baseline-alignment ui.gadgets.line-support
 ui.gadgets.editors ui.backend.cocoa.input-methods
 ui.gestures ui.private words sorting math.vectors
 ui.baseline-alignment ui.gadgets.line-support
 ui.gadgets.editors ui.backend.cocoa.input-methods
-ui.backend.cocoa.input-methods.editors io.encodings.utf16n
+ui.backend.cocoa.input-methods.editors io.encodings.utf16
 io.encodings.string classes.struct ;
 IN: ui.backend.cocoa.views
 
 io.encodings.string classes.struct ;
 IN: ui.backend.cocoa.views
 
@@ -195,7 +195,7 @@ IMPORT: NSAttributedString
 
 :: >codepoint-index ( str utf16-index -- codepoint-index )
     0 utf16-index 2 * str utf16n encode subseq utf16n decode length ;
 
 :: >codepoint-index ( str utf16-index -- codepoint-index )
     0 utf16-index 2 * str utf16n encode subseq utf16n decode length ;
-    
+
 :: >utf16-index ( str codepoint-index -- utf16-index )
     0 codepoint-index str subseq utf16n encode length 2 / >integer ;
 
 :: >utf16-index ( str codepoint-index -- utf16-index )
     0 codepoint-index str subseq utf16n encode length 2 / >integer ;
 
index 7ab3297a63f73364dbb7a4638ce1aed664f7d64c..2924517bca4824603a4a61bcf016ba19b8887ed1 100644 (file)
@@ -3,7 +3,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data alien.strings arrays ascii assocs
 calendar classes classes.struct colors combinators continuations fry
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data alien.strings arrays ascii assocs
 calendar classes classes.struct colors combinators continuations fry
-io io.crlf io.encodings.utf16n kernel libc literals locals make math
+io io.crlf io.encodings.utf16 kernel libc literals locals 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 ui.gestures ui.pixel-formats
 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 ui.gestures ui.pixel-formats
index 38af6d8a9bbea5433eefc3657d3efe6338facf85..7b328e787b7e2325d846b3cce6e9eaf1c3f75f32 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
 locals math math.vectors namespaces sequences ui.text
 ui.text.private ;
 IN: ui.text.core-text
 locals math math.vectors namespaces sequences ui.text
 ui.text.private ;
 IN: ui.text.core-text
index 128b0ae18545e6e24c1de9d446f8f811ff74f628..8637e1335b8a7ce646fed80f2044a8aca12e3a9c 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
-continuations fry init io.encodings.utf16n kernel literals math
+continuations fry 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 ;
 namespaces 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 be9109827605f58e38fb9b0bb72f8b367a152131..bf7e79754ac5231a3f975b98a0f70a815fd8d111 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 3b4b8c70c373ae77eab9f069a22cb7a687146f80..af25decc5e2c6f31362814ae66948a0db23b63f8 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.vectors sequences ;
 FROM: alien.c-types => float short ;
 IN: windows.types
 math.vectors sequences ;
 FROM: alien.c-types => float short ;
 IN: windows.types
index 252163e332f8a7b10e34e7dfa5ab2ff40ef06689..068e443a13b061f81a038b8260ef83149f9f96ab 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors alien.c-types alien.data arrays assocs
 byte-arrays cache classes.struct colors colors.constants
 combinators destructors fonts images init io.encodings.string
 USING: accessors alien.c-types alien.data arrays assocs
 byte-arrays cache classes.struct colors colors.constants
 combinators destructors fonts images init io.encodings.string
-io.encodings.utf16n kernel literals locals math math.bitwise
+io.encodings.utf16 kernel literals locals math math.bitwise
 namespaces sequences specialized-arrays windows.errors
 windows.fonts windows.gdi32 windows.offscreen windows.ole32
 windows.types windows.usp10 ;
 namespaces sequences specialized-arrays windows.errors
 windows.fonts windows.gdi32 windows.offscreen windows.ole32
 windows.types windows.usp10 ;
index 545fe0b9f11509926d3423a36e8227a0ff3f5f5c..b7ccd9c47864553b49bfb2c29625392114979e08 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 help.syntax io
 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 kernel math
+io.backend io.encodings.utf16 io.encodings.utf8 kernel math
 quotations sequences system ;
 IN: alien
 
 quotations sequences system ;
 IN: alien
 
index 03d29738be4bd159ae444ba5b7be68a5ff90e8b9..d9739294b9c060f33321f6501d798277e85d8059 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.strings alien.c-types alien.data tools.test
 USING: alien.strings alien.c-types alien.data tools.test
-kernel libc io.encodings.utf8 io.encodings.utf16 io.encodings.utf16n
+kernel libc io.encodings.utf8 io.encodings.utf16
 io.encodings.ascii alien io.encodings.string io.encodings.latin1 ;
 
 { "\u0000ff" }
 io.encodings.ascii alien io.encodings.string io.encodings.latin1 ;
 
 { "\u0000ff" }
index 2a4b3d9ebc88a3be7c3925cfb058778e62b4b36c..cceed2f8af385de6dd5bea8d4420b5bcd4d57432 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 4e8e778edfcf83c7cd4aa584fdd73468b14ce2cb..5ef968a97b38292c4d4a55e821cc2e84e164dcf9 100644 (file)
@@ -9,6 +9,7 @@ ARTICLE: "io.encodings.utf16" "UTF-16 encoding"
     utf16
     utf16le
     utf16be
     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
+{ $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 112667575b4be9e01465f75ff5ab262d93361496..e844ff2afe6c3658353b9de2ed2e638b372876b7 100644 (file)
@@ -1,9 +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 combinators io io.binary
-io.encodings kernel math math.private namespaces sbufs
-sequences sequences.private splitting strings strings.private
-vectors ;
+USING: accessors alien.accessors byte-arrays io io.binary
+io.encodings kernel math math.private sequences
+sequences.private strings strings.private ;
 IN: io.encodings.utf16
 
 SINGLETON: utf16be
 IN: io.encodings.utf16
 
 SINGLETON: utf16be
@@ -161,4 +160,8 @@ M: utf16 <decoder> ( stream utf16 -- decoder )
 M: utf16 <encoder> ( stream utf16 -- encoder )
     drop bom-le over stream-write utf16le <encoder> ;
 
 M: utf16 <encoder> ( stream utf16 -- encoder )
     drop bom-le over stream-write utf16le <encoder> ;
 
+: le? ( -- ? ) B{ 1 0 0 0 } 0 alien-unsigned-4 1 = ; foldable
+
 PRIVATE>
 PRIVATE>
+
+: utf16n ( -- value ) le? utf16le utf16be ? ;
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> ;