diff --git a/basis/formatting/formatting-tests.factor b/basis/formatting/formatting-tests.factor index 79f386ff3d..478a84dc16 100644 --- a/basis/formatting/formatting-tests.factor +++ b/basis/formatting/formatting-tests.factor @@ -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 diff --git a/basis/formatting/formatting.factor b/basis/formatting/formatting.factor index 697616280b..c45f3fa238 100644 --- a/basis/formatting/formatting.factor +++ b/basis/formatting/formatting.factor @@ -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 ]] diff --git a/basis/unix/process/process.factor b/basis/unix/process/process.factor index b33b824a73..de63b8449c 100644 --- a/basis/unix/process/process.factor +++ b/basis/unix/process/process.factor @@ -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 ] 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 ; diff --git a/basis/unix/types/linux/linux.factor b/basis/unix/types/linux/linux.factor index 9380e50d84..c5de4c2c92 100644 --- a/basis/unix/types/linux/linux.factor +++ b/basis/unix/types/linux/linux.factor @@ -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 diff --git a/build.sh b/build.sh index 2c59230754..5414b06825 100755 --- a/build.sh +++ b/build.sh @@ -498,7 +498,7 @@ git_fetch() { branch=$(current_git_branch) rm -f "$(update_script_name)" - $ECHO git fetch "$GIT_URL" "$branch" + $ECHO git fetch "$GIT_URL" "$branch" invoke_git fetch "$GIT_URL" "$branch" if update_script_changed; then