Merge branch 'master' into modern-harvey4
commit
94a1a8a2af
|
@ -143,6 +143,7 @@ IN: formatting.tests
|
|||
{ "[####monkey]" } [ "monkey" "[%'#10s]" sprintf ] unit-test
|
||||
{ "[many monke]" } [ "many monkeys" "[%10.10s]" sprintf ] unit-test
|
||||
|
||||
{ "{ 1, 2, 3 }" } [ BV{ 1 2 3 } "%[%d, %]" sprintf ] unit-test
|
||||
{ "{ 1, 2, 3 }" } [ { 1 2 3 } "%[%s, %]" sprintf ] unit-test
|
||||
{ "{ 1:2, 3:4 }" } [ H{ { 1 2 } { 3 4 } } "%[%s: %s %]" sprintf ] unit-test
|
||||
|
||||
|
|
|
@ -136,9 +136,9 @@ numbers = sign pad numbers_ => [[ unclip-last prefix compose-all [ fix-sign
|
|||
|
||||
types = strings|numbers
|
||||
|
||||
lists = "[%" types ", %]" => [[ second '[ _ map ", " join "{ " prepend " }" append ] ]]
|
||||
lists = "[%" types ", %]" => [[ second '[ _ { } map-as ", " join "{ " " }" surround ] ]]
|
||||
|
||||
assocs = "[%" types ": %" types " %]" => [[ [ second ] [ fourth ] bi '[ unzip [ _ map ] dip _ map zip [ ":" join ] map ", " join "{ " prepend " }" append ] ]]
|
||||
assocs = "[%" types ": %" types " %]" => [[ [ second ] [ fourth ] bi '[ [ _ _ bi* ":" glue ] { } assoc>map ", " join "{ " " }" surround ] ]]
|
||||
|
||||
formats = "%" (types|fmt-%|lists|assocs|unknown) => [[ second ]]
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
USING: alien.c-types alien.data alien.syntax io.encodings.utf8
|
||||
kernel libc math sequences unix unix.types unix.utilities ;
|
||||
USING: alien.c-types alien.data alien.syntax classes.struct
|
||||
generalizations io.encodings.utf8 kernel libc math sequences
|
||||
unix unix.types unix.utilities ;
|
||||
IN: unix.process
|
||||
|
||||
! Low-level Unix process launching utilities. These are used
|
||||
|
@ -14,6 +15,30 @@ FUNCTION: int execv ( c-string path, c-string* argv )
|
|||
FUNCTION: int execvp ( c-string path, c-string* argv )
|
||||
FUNCTION: int execve ( c-string path, c-string* argv, c-string* envp )
|
||||
|
||||
|
||||
TYPEDEF: void posix_spawn_file_actions_t
|
||||
TYPEDEF: void posix_spawnattr_t
|
||||
|
||||
FUNCTION: int posix_spawn ( pid_t *pid, c-string path,
|
||||
posix_spawn_file_actions_t *file_actions,
|
||||
posix_spawnattr_t *attrp,
|
||||
c-string* argv, c-string* envp )
|
||||
|
||||
FUNCTION: int posix_spawnp ( pid_t *pid, c-string file,
|
||||
posix_spawn_file_actions_t *file_actions,
|
||||
posix_spawnattr_t *attrp,
|
||||
c-string* argv, c-string* envp )
|
||||
|
||||
: posix-spawn ( path posix_spawn_file_actions_t* posix_spawnattr_t* argv envp -- pid_t )
|
||||
[ [ 0 pid_t <ref> ] dip utf8 malloc-string ] 4dip
|
||||
[ utf8 strings>alien ] bi@
|
||||
[
|
||||
posix_spawnp dup 0 = [ drop ] [ throw-errno ] if
|
||||
] 6 nkeep 5drop pid_t deref ;
|
||||
|
||||
: posix-spawn-args-with-path ( seq -- int )
|
||||
[ first f f ] keep f posix-spawn ;
|
||||
|
||||
: exec ( pathname argv -- int )
|
||||
[ utf8 malloc-string ] [ utf8 strings>alien ] bi* execv ;
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ TYPEDEF: ulong __ulongword_type
|
|||
TYPEDEF: long __sword_type
|
||||
TYPEDEF: ulong __uword_type
|
||||
TYPEDEF: long __slongword_type
|
||||
TYPEDEF: uint __u32
|
||||
TYPEDEF: ulonglong __u64
|
||||
TYPEDEF: uint __u32_type
|
||||
TYPEDEF: int __s32_type
|
||||
|
||||
|
@ -22,6 +24,7 @@ TYPEDEF: __slongword_type blksize_t
|
|||
TYPEDEF: __slongword_type blkcnt_t
|
||||
TYPEDEF: __sword_type ssize_t
|
||||
TYPEDEF: __s32_type pid_t
|
||||
TYPEDEF: ulong sigset_t
|
||||
TYPEDEF: __slongword_type time_t
|
||||
TYPEDEF: __slongword_type __time_t
|
||||
|
||||
|
|
Loading…
Reference in New Issue