Revert "io.encodings.utf16: add a utf16n word for native utf16 type."
This reverts commit ad24fa414f
.
clean-linux-x86-64
parent
04fab09c8f
commit
41db42a571
|
@ -13,8 +13,10 @@ SYMBOL: bootstrap-time
|
||||||
: strip-encodings ( -- )
|
: strip-encodings ( -- )
|
||||||
os unix? [
|
os unix? [
|
||||||
[
|
[
|
||||||
P" resource:core/io/encodings/utf16/utf16.factor" forget
|
P" resource:core/io/encodings/utf16/utf16.factor"
|
||||||
"io.encodings.utf16" loaded-child-vocab-names [ forget-vocab ] each
|
P" resource:core/io/encodings/utf16n/utf16n.factor" [ forget ] bi@
|
||||||
|
"io.encodings.utf16"
|
||||||
|
"io.encodings.utf16n" [ loaded-child-vocab-names [ forget-vocab ] each ] bi@
|
||||||
] with-compilation-unit
|
] with-compilation-unit
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ USING: accessors alien.c-types alien.data alien.syntax arrays
|
||||||
assocs cache colors combinators core-foundation
|
assocs cache colors combinators core-foundation
|
||||||
core-foundation.attributed-strings core-foundation.strings
|
core-foundation.attributed-strings core-foundation.strings
|
||||||
core-graphics core-graphics.types core-text.fonts destructors
|
core-graphics core-graphics.types core-text.fonts destructors
|
||||||
fonts init io.encodings.string io.encodings.utf16 kernel locals
|
fonts init kernel locals make math math.functions math.order
|
||||||
make math math.functions math.order math.vectors memoize
|
math.vectors memoize namespaces sequences strings
|
||||||
namespaces sequences strings ;
|
io.encodings.utf16n io.encodings.string ;
|
||||||
IN: core-text
|
IN: core-text
|
||||||
|
|
||||||
TYPEDEF: void* CTLineRef
|
TYPEDEF: void* CTLineRef
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien.strings fry io.encodings.utf16 kernel
|
USING: alien.strings fry io.encodings.utf16n kernel
|
||||||
splitting windows windows.kernel32 windows.types system
|
splitting windows windows.kernel32 windows.types system
|
||||||
environment alien.data sequences windows.errors
|
environment alien.data sequences windows.errors
|
||||||
io.streams.memory io.encodings io specialized-arrays ;
|
io.streams.memory io.encodings io specialized-arrays ;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
USING: accessors alien alien.c-types alien.data alien.strings
|
USING: accessors alien alien.c-types alien.data alien.strings
|
||||||
arrays assocs byte-arrays classes.struct combinators
|
arrays assocs byte-arrays combinators combinators.short-circuit
|
||||||
combinators.short-circuit game.input
|
continuations game.input game.input.dinput.keys-array
|
||||||
game.input.dinput.keys-array kernel locals math math.bitwise
|
io.encodings.utf16n kernel locals math
|
||||||
math.rectangles namespaces sequences specialized-arrays
|
math.bitwise math.rectangles namespaces parser sequences shuffle
|
||||||
ui.backend.windows vectors windows.com windows.directx.dinput
|
specialized-arrays ui.backend.windows vectors windows.com
|
||||||
windows.directx.dinput.constants windows.errors windows.kernel32
|
windows.directx.dinput windows.directx.dinput.constants
|
||||||
windows.messages windows.ole32 windows.user32 ;
|
windows.kernel32 windows.messages windows.ole32 windows.errors
|
||||||
|
windows.user32 classes.struct ;
|
||||||
SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA
|
SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA
|
||||||
IN: game.input.dinput
|
IN: game.input.dinput
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.data arrays classes.struct
|
USING: accessors alien alien.data arrays classes.struct
|
||||||
combinators continuations destructors fry io.backend
|
combinators continuations destructors fry io.backend
|
||||||
io.encodings.string io.encodings.utf16 io.files.windows
|
io.encodings.string io.encodings.utf16n io.files.windows
|
||||||
io.monitors io.pathnames io.ports kernel literals locals make
|
io.monitors io.pathnames io.ports kernel literals locals make
|
||||||
math sequences system threads windows.errors windows.kernel32
|
math sequences system threads windows.errors windows.kernel32
|
||||||
windows.types ;
|
windows.types ;
|
||||||
|
|
|
@ -14,7 +14,6 @@ M: unix-random dispose reader>> dispose ;
|
||||||
|
|
||||||
M: unix-random random-bytes* ( n tuple -- byte-array )
|
M: unix-random random-bytes* ( n tuple -- byte-array )
|
||||||
reader>> stream-read ;
|
reader>> stream-read ;
|
||||||
|
|
||||||
HINTS: M\ unix-random random-bytes* { fixnum unix-random } ;
|
HINTS: M\ unix-random random-bytes* { fixnum unix-random } ;
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: accessors alien alien.c-types alien.data alien.syntax
|
USING: accessors alien alien.c-types alien.data alien.syntax
|
||||||
arrays byte-arrays classes.struct combinators.short-circuit
|
arrays byte-arrays classes.struct combinators.short-circuit
|
||||||
continuations destructors fry io io.encodings.string
|
continuations destructors fry io io.encodings.string
|
||||||
io.encodings.utf16 kernel literals locals math sequences
|
io.encodings.utf16n kernel literals locals math sequences
|
||||||
strings system tools.ps windows.errors windows.handles
|
strings system tools.ps windows.errors windows.handles
|
||||||
windows.kernel32 windows.ntdll windows.types ;
|
windows.kernel32 windows.ntdll windows.types ;
|
||||||
IN: tools.ps.windows
|
IN: tools.ps.windows
|
||||||
|
|
|
@ -11,7 +11,7 @@ ui.commands ui.gadgets ui.gadgets.private ui.gadgets.worlds
|
||||||
ui.gestures ui.private words sorting math.vectors
|
ui.gestures ui.private words sorting math.vectors
|
||||||
ui.baseline-alignment ui.gadgets.line-support
|
ui.baseline-alignment ui.gadgets.line-support
|
||||||
ui.gadgets.editors ui.backend.cocoa.input-methods
|
ui.gadgets.editors ui.backend.cocoa.input-methods
|
||||||
ui.backend.cocoa.input-methods.editors io.encodings.utf16
|
ui.backend.cocoa.input-methods.editors io.encodings.utf16n
|
||||||
io.encodings.string classes.struct ;
|
io.encodings.string classes.struct ;
|
||||||
IN: ui.backend.cocoa.views
|
IN: ui.backend.cocoa.views
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ IMPORT: NSAttributedString
|
||||||
|
|
||||||
:: >codepoint-index ( str utf16-index -- codepoint-index )
|
:: >codepoint-index ( str utf16-index -- codepoint-index )
|
||||||
0 utf16-index 2 * str utf16n encode subseq utf16n decode length ;
|
0 utf16-index 2 * str utf16n encode subseq utf16n decode length ;
|
||||||
|
|
||||||
:: >utf16-index ( str codepoint-index -- utf16-index )
|
:: >utf16-index ( str codepoint-index -- utf16-index )
|
||||||
0 codepoint-index str subseq utf16n encode length 2 / >integer ;
|
0 codepoint-index str subseq utf16n encode length 2 / >integer ;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.data alien.strings arrays ascii assocs
|
USING: accessors alien alien.data alien.strings arrays ascii assocs
|
||||||
calendar classes classes.struct colors combinators continuations fry
|
calendar classes classes.struct colors combinators continuations fry
|
||||||
io io.crlf io.encodings.utf16 kernel libc literals locals make math
|
io io.crlf io.encodings.utf16n kernel libc literals locals make math
|
||||||
math.bitwise namespaces sequences sets specialized-arrays strings
|
math.bitwise namespaces sequences sets specialized-arrays strings
|
||||||
threads ui ui.backend ui.clipboards ui.event-loop ui.gadgets
|
threads ui ui.backend ui.clipboards ui.event-loop ui.gadgets
|
||||||
ui.gadgets.private ui.gadgets.worlds ui.gestures ui.pixel-formats
|
ui.gadgets.private ui.gadgets.worlds ui.gestures ui.pixel-formats
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2009, 2010 Slava Pestov.
|
! Copyright (C) 2009, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors cache core-graphics.types core-text
|
USING: accessors cache core-graphics.types core-text
|
||||||
core-text.fonts io.encodings.string io.encodings.utf16 kernel
|
core-text.fonts io.encodings.string io.encodings.utf16n kernel
|
||||||
locals math math.vectors namespaces sequences ui.text
|
locals math math.vectors namespaces sequences ui.text
|
||||||
ui.text.private ;
|
ui.text.private ;
|
||||||
IN: ui.text.core-text
|
IN: ui.text.core-text
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2017-2018 Alexander Ilin.
|
! Copyright (C) 2017-2018 Alexander Ilin.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.data alien.libraries alien.strings
|
USING: accessors alien alien.data alien.libraries alien.strings
|
||||||
continuations fry init io.encodings.utf16 kernel literals math
|
continuations fry init io.encodings.utf16n kernel literals math
|
||||||
namespaces sequences ui.backend.windows ui.gadgets.worlds
|
namespaces sequences ui.backend.windows ui.gadgets.worlds
|
||||||
ui.gestures windows.errors windows.messages windows.shell32
|
ui.gestures windows.errors windows.messages windows.shell32
|
||||||
windows.types windows.user32 ;
|
windows.types windows.user32 ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2010 Doug Coleman.
|
! Copyright (C) 2010 Doug Coleman.
|
||||||
! Copyright (C) 2018 Alexander Ilin.
|
! Copyright (C) 2018 Alexander Ilin.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: byte-arrays io.encodings.string io.encodings.utf16
|
USING: byte-arrays io.encodings.string io.encodings.utf16n
|
||||||
kernel sequences tools.test windows.advapi32 windows.kernel32
|
kernel sequences tools.test windows.advapi32 windows.kernel32
|
||||||
windows.registry ;
|
windows.registry ;
|
||||||
IN: windows.registry.tests
|
IN: windows.registry.tests
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.c-types alien.data byte-arrays
|
USING: accessors alien.c-types alien.data byte-arrays
|
||||||
classes.struct continuations io.encodings.string
|
classes.struct continuations io.encodings.string
|
||||||
io.encodings.utf16 kernel literals locals math sequences sets
|
io.encodings.utf16n kernel literals locals math sequences sets
|
||||||
splitting windows windows.advapi32 windows.errors
|
splitting windows windows.advapi32 windows.errors
|
||||||
windows.kernel32 windows.time windows.types ;
|
windows.kernel32 windows.time windows.types ;
|
||||||
IN: windows.registry
|
IN: windows.registry
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2005, 2006 Doug Coleman.
|
! Copyright (C) 2005, 2006 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien.c-types alien.syntax classes.struct colors
|
USING: alien.c-types alien.syntax classes.struct colors
|
||||||
io.encodings.utf16 io.encodings.utf8 kernel math math.bitwise
|
io.encodings.utf16n io.encodings.utf8 kernel math math.bitwise
|
||||||
math.vectors sequences ;
|
math.vectors sequences ;
|
||||||
FROM: alien.c-types => float short ;
|
FROM: alien.c-types => float short ;
|
||||||
IN: windows.types
|
IN: windows.types
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors alien.c-types alien.data arrays assocs
|
USING: accessors alien.c-types alien.data arrays assocs
|
||||||
byte-arrays cache classes.struct colors colors.constants
|
byte-arrays cache classes.struct colors colors.constants
|
||||||
combinators destructors fonts images init io.encodings.string
|
combinators destructors fonts images init io.encodings.string
|
||||||
io.encodings.utf16 kernel literals locals math math.bitwise
|
io.encodings.utf16n kernel literals locals math math.bitwise
|
||||||
namespaces sequences specialized-arrays windows.errors
|
namespaces sequences specialized-arrays windows.errors
|
||||||
windows.fonts windows.gdi32 windows.offscreen windows.ole32
|
windows.fonts windows.gdi32 windows.offscreen windows.ole32
|
||||||
windows.types windows.usp10 ;
|
windows.types windows.usp10 ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: alien.accessors alien.c-types alien.libraries alien.strings
|
USING: alien.accessors alien.c-types alien.libraries alien.strings
|
||||||
alien.syntax byte-arrays cpu.x86 eval help.markup help.syntax io
|
alien.syntax byte-arrays cpu.x86 eval help.markup help.syntax io
|
||||||
io.backend io.encodings.utf16 io.encodings.utf8 kernel math
|
io.backend io.encodings.utf16n io.encodings.utf8 kernel math
|
||||||
quotations sequences system ;
|
quotations sequences system ;
|
||||||
IN: alien
|
IN: alien
|
||||||
|
|
||||||
|
|
|
@ -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
|
kernel libc io.encodings.utf8 io.encodings.utf16 io.encodings.utf16n
|
||||||
io.encodings.ascii alien io.encodings.string io.encodings.latin1 ;
|
io.encodings.ascii alien io.encodings.string io.encodings.latin1 ;
|
||||||
|
|
||||||
{ "\u0000ff" }
|
{ "\u0000ff" }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008, 2011 Slava Pestov.
|
! Copyright (C) 2008, 2011 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien arrays byte-arrays byte-vectors init io
|
USING: accessors alien arrays byte-arrays byte-vectors init io
|
||||||
io.encodings io.encodings.ascii io.encodings.utf16
|
io.encodings io.encodings.ascii io.encodings.utf16n
|
||||||
io.encodings.utf8 io.streams.memory kernel kernel.private math
|
io.encodings.utf8 io.streams.memory kernel kernel.private math
|
||||||
namespaces sequences sequences.private strings strings.private
|
namespaces sequences sequences.private strings strings.private
|
||||||
system system.private ;
|
system system.private ;
|
||||||
|
|
|
@ -9,7 +9,6 @@ ARTICLE: "io.encodings.utf16" "UTF-16 encoding"
|
||||||
utf16
|
utf16
|
||||||
utf16le
|
utf16le
|
||||||
utf16be
|
utf16be
|
||||||
utf16n
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
ABOUT: "io.encodings.utf16"
|
ABOUT: "io.encodings.utf16"
|
||||||
|
@ -26,8 +25,4 @@ 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." }
|
{ $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" } ;
|
{ $see-also "encodings-introduction" } ;
|
||||||
|
|
||||||
HELP: utf16n
|
{ utf16 utf16le utf16be } related-words
|
||||||
{ $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
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
! Copyright (C) 2006, 2009 Daniel Ehrenberg.
|
! Copyright (C) 2006, 2009 Daniel Ehrenberg.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.accessors byte-arrays io io.binary
|
USING: accessors byte-arrays combinators io io.binary
|
||||||
io.encodings kernel math math.private sequences
|
io.encodings kernel math math.private namespaces sbufs
|
||||||
sequences.private strings strings.private ;
|
sequences sequences.private splitting strings strings.private
|
||||||
|
vectors ;
|
||||||
IN: io.encodings.utf16
|
IN: io.encodings.utf16
|
||||||
|
|
||||||
SINGLETON: utf16be
|
SINGLETON: utf16be
|
||||||
|
@ -160,8 +161,4 @@ M: utf16 <decoder> ( stream utf16 -- decoder )
|
||||||
M: utf16 <encoder> ( stream utf16 -- encoder )
|
M: utf16 <encoder> ( stream utf16 -- encoder )
|
||||||
drop bom-le over stream-write utf16le <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 ? ;
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Daniel Ehrenberg
|
|
@ -0,0 +1 @@
|
||||||
|
UTF16 encoding with native byte order
|
|
@ -0,0 +1,6 @@
|
||||||
|
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" } ;
|
|
@ -0,0 +1,9 @@
|
||||||
|
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
|
|
@ -0,0 +1,15 @@
|
||||||
|
! 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> ;
|
Loading…
Reference in New Issue