kernel libc math threads system
alien.c-types alien.arrays alien.strings sequences combinators
combinators.short-circuit ascii splitting alien strings
-assocs namespaces io.files.private accessors ;
+assocs namespaces io.files.private accessors tr ;
IN: io.windows.nt.files
M: winnt cwd
unicode-prefix prepend
] unless ;
+TR: normalize-separators "/" "\\" ;
+
M: winnt normalize-path ( string -- string' )
(normalize-path)
- { { CHAR: / CHAR: \\ } } substitute
+ normalize-separators
prepend-prefix ;
M: winnt CreateFile-flags ( DWORD -- DWORD )
! See http://factorcode.org/license.txt for BSD license.
USING: kernel io.streams.string io strings splitting sequences math
math.parser assocs classes words namespaces prettyprint
- hashtables mirrors ;
+ hashtables mirrors tr ;
IN: json.writer
#! Writes the object out to a stream in JSON format
M: sequence json-print ( array -- )
CHAR: [ write1 [ >json ] map "," join write CHAR: ] write1 ;
-: jsvar-encode ( string -- string )
- #! Convert the string so that it contains characters usable within
- #! javascript variable names.
- { { CHAR: - CHAR: _ } } substitute ;
+TR: jsvar-encode "-" "_" ;
: tuple>fields ( object -- seq )
<mirror> [
: nths ( seq indices -- seq' )
swap [ nth ] curry map ;
-: replace ( str oldseq newseq -- str' )
- zip >hashtable substitute ;
-
: remove-nth ( seq n -- seq' )
cut-slice rest-slice append ;
USING: io.files io words alien kernel math.parser alien.syntax
io.launcher system assocs arrays sequences namespaces qualified
system math generator.fixup io.encodings.ascii accessors
-generic ;
+generic tr ;
IN: tools.disassembler
: in-file ( -- path ) "gdb-in.txt" temp-file ;
try-process
out-file ascii file-lines ;
-: tabs>spaces ( str -- str' )
- { { CHAR: \t CHAR: \s } } substitute ;
+TR: tabs>spaces "\t" "\s" ;
: disassemble ( obj -- )
make-disassemble-cmd run-gdb
! See http://factorcode.org/license.txt for BSD license.\r
USING: threads io.files io.monitors init kernel\r
vocabs vocabs.loader tools.vocabs namespaces continuations\r
-sequences splitting assocs command-line concurrency.messaging io.backend sets ;\r
+sequences splitting assocs command-line concurrency.messaging\r
+io.backend sets tr ;\r
IN: tools.vocabs.monitor\r
\r
+TR: convert-separators "/\\" ".." ;\r
+\r
: vocab-dir>vocab-name ( path -- vocab )\r
- left-trim-separators right-trim-separators\r
- { { CHAR: / CHAR: . } { CHAR: \\ CHAR: . } } substitute ;\r
+ left-trim-separators\r
+ right-trim-separators\r
+ convert-separators ;\r
\r
: path>vocab-name ( path -- vocab )\r
dup ".factor" tail? [ parent-directory ] when ;\r
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays definitions kernel sequences strings
math assocs words generic namespaces assocs quotations splitting
-ui.gestures unicode.case unicode.categories ;
+ui.gestures unicode.case unicode.categories tr ;
IN: ui.commands
SYMBOL: +nullary+
swap pick commands set-at
update-gestures ;
+TR: convert-command-name "-" " " ;
+
: (command-name) ( string -- newstring )
- { { CHAR: - CHAR: \s } } substitute >title ;
+ convert-command-name >title ;
M: word command-name ( word -- str )
name>>
: process-names ( data -- names-hash )
1 swap (process-data) [
ascii-lower { { CHAR: \s CHAR: - } } substitute swap
- ] assoc-map >hashtable ;
+ ] H{ } assoc-map-as ;
: multihex ( hexstring -- string )
" " split [ hex> ] map sift ;