~ chicken-core (chicken-5) 88b0864d37236ec7c9db117b0902c10391d8297d
commit 88b0864d37236ec7c9db117b0902c10391d8297d Author: Evan Hanson <evhan@foldling.org> AuthorDate: Tue Jun 13 08:20:18 2017 +1200 Commit: Kooda <kooda@upyum.com> CommitDate: Wed Jun 14 13:11:10 2017 +0200 Move duplicated posix module declarations into posix.scm This deduplicates the import and export lists of the posix modules in posix{unix,win}.scm, which are identical as of f4e53ff with the exception of two extra imports needed on Windows for its implementations of `process` and `file-mkstemp`. These exceptions have been left in posixwin.scm as supplemental import forms, but the rest of the posix module now lives solely in posix.scm. Signed-off-by: Kooda <kooda@upyum.com> diff --git a/posix.scm b/posix.scm index 4ab59096..b93d7bbe 100644 --- a/posix.scm +++ b/posix.scm @@ -39,11 +39,65 @@ (disable-interrupts) (not inline ##sys#interrupt-hook ##sys#user-interrupt-hook)) +(module chicken.posix + (block-device? call-with-input-pipe call-with-output-pipe + change-directory change-directory* character-device? close-input-pipe + close-output-pipe create-directory create-fifo create-pipe + create-session create-symbolic-link current-directory + current-effective-group-id current-effective-user-id + current-effective-user-name current-group-id current-process-id + current-user-id current-user-name delete-directory directory + directory? duplicate-fileno emergency-exit fcntl/dupfd fcntl/getfd + fcntl/getfl fcntl/setfd fcntl/setfl fifo? fifo? file-access-time + file-change-time file-close file-control file-creation-mode + file-execute-access? file-group file-link file-lock + file-lock/blocking file-mkstemp file-modification-time file-open + file-owner file-permissions file-position file-read file-read-access? + file-select file-size file-stat file-test-lock file-truncate + file-type file-unlock file-write file-write-access? fileno/stderr + fileno/stdin fileno/stdout find-files get-environment-variables + get-host-name glob local-time->seconds local-timezone-abbreviation + open-input-file* open-input-pipe open-output-file* open-output-pipe + open/append open/binary open/creat open/excl open/fsync open/noctty + open/noinherit open/nonblock open/rdonly open/rdwr open/read + open/sync open/text open/trunc open/write open/wronly + parent-process-id perm/irgrp perm/iroth perm/irusr perm/irwxg + perm/irwxo perm/irwxu perm/isgid perm/isuid perm/isvtx perm/iwgrp + perm/iwoth perm/iwusr perm/ixgrp perm/ixoth perm/ixusr pipe/buf + port->fileno process process* process-execute process-fork + process-group-id process-run process-signal process-sleep + process-spawn process-wait read-symbolic-link regular-file? + seconds->local-time seconds->string seconds->utc-time seek/cur + seek/end seek/set set-alarm! set-buffering-mode! + set-environment-variable! set-file-group! set-file-owner! + set-file-permissions! set-file-position! set-file-times! + set-root-directory! set-signal-handler! set-signal-mask! + signal-handler signal-mask signal-mask! signal-masked? signal-unmask! + signal/abrt signal/alrm signal/break signal/bus signal/chld + signal/cont signal/fpe signal/hup signal/ill signal/int signal/io + signal/kill signal/pipe signal/prof signal/quit signal/segv + signal/stop signal/term signal/trap signal/tstp signal/urg + signal/usr1 signal/usr2 signal/vtalrm signal/winch signal/xcpu + signal/xfsz signals-list socket? spawn/detach spawn/nowait + spawn/nowaito spawn/overlay spawn/wait string->time symbolic-link? + system-information terminal-name terminal-port? terminal-size + time->string unset-environment-variable! user-information + utc-time->seconds with-input-from-pipe with-output-to-pipe) + +(import scheme chicken) +(import chicken.bitwise + chicken.foreign + chicken.irregex + chicken.memory + chicken.pathname + chicken.port + chicken.time) + (cond-expand (platform-unix (include "posixunix.scm")) (platform-windows - (include "posixwin.scm"))) + (include "posixwin.scm")))) (module chicken.errno * (import scheme chicken) diff --git a/posixunix.scm b/posixunix.scm index f9d567e5..1a8902db 100644 --- a/posixunix.scm +++ b/posixunix.scm @@ -30,62 +30,6 @@ (define-foreign-variable _stat_st_blksize unsigned-int "C_statbuf.st_blksize") (define-foreign-variable _stat_st_blocks unsigned-int "C_statbuf.st_blocks") -(module chicken.posix - (emergency-exit call-with-input-pipe call-with-output-pipe change-directory - change-directory* close-input-pipe - close-output-pipe create-directory create-fifo create-pipe - create-session create-symbolic-link current-directory - current-effective-group-id current-effective-user-id - current-effective-user-name get-environment-variables - current-group-id current-process-id current-user-id current-user-name - delete-directory directory directory? duplicate-fileno - fcntl/dupfd fcntl/getfd fcntl/getfl fcntl/setfd fcntl/setfl - fifo? file-access-time file-change-time - file-creation-mode file-close file-control file-execute-access? - file-link file-lock file-lock/blocking file-mkstemp - file-modification-time file-open file-owner set-file-owner! - file-group set-file-group! file-permissions set-file-permissions! - file-position set-file-position! file-read file-read-access? - file-select file-size file-stat file-test-lock file-truncate - file-type file-unlock file-write file-write-access? fileno/stderr - fileno/stdin fileno/stdout find-files get-host-name glob - local-time->seconds local-timezone-abbreviation - open-input-file* open-input-pipe open-output-file* open-output-pipe - open/append open/binary open/creat open/excl open/fsync - open/noctty open/noinherit open/nonblock open/rdonly open/rdwr - open/read open/sync open/text open/trunc open/write open/wronly - parent-process-id perm/irgrp perm/iroth perm/irusr perm/irwxg - perm/irwxo perm/irwxu perm/isgid perm/isuid perm/isvtx perm/iwgrp - perm/iwoth perm/iwusr perm/ixgrp perm/ixoth perm/ixusr pipe/buf - port->fileno process process* process-execute process-fork - process-group-id process-run process-signal process-sleep - process-spawn process-wait read-symbolic-link regular-file? - seconds->local-time seconds->string seconds->utc-time seek/cur - seek/end seek/set set-alarm! set-buffering-mode! set-file-times! - set-root-directory! set-signal-handler! set-signal-mask! signal-handler - signal-mask signal-mask! signal-masked? signal-unmask! signal/abrt - signal/alrm signal/break signal/chld signal/cont signal/fpe - signal/bus signal/hup signal/ill signal/int signal/io signal/kill - signal/pipe signal/prof signal/quit signal/segv signal/stop - signal/term signal/trap signal/tstp signal/urg signal/usr1 - signal/usr2 signal/vtalrm signal/winch signal/xcpu signal/xfsz - signals-list spawn/overlay spawn/wait spawn/nowait spawn/nowaito - spawn/detach block-device? character-device? fifo? socket? - string->time symbolic-link? system-information terminal-name - terminal-port? terminal-size time->string user-information - set-environment-variable! unset-environment-variable! - utc-time->seconds with-input-from-pipe with-output-to-pipe) - -(import scheme chicken) -(import chicken.bitwise - chicken.condition - chicken.foreign - chicken.irregex - chicken.memory - chicken.pathname - chicken.port - chicken.time) - (include "posix-common.scm") #> @@ -1619,5 +1563,3 @@ static C_word C_i_fifo_p(C_word name) ;;; unimplemented stuff: (define-unimplemented process-spawn) - -) ; chicken.posix diff --git a/posixwin.scm b/posixwin.scm index 76f631c3..fec8759f 100644 --- a/posixwin.scm +++ b/posixwin.scm @@ -66,64 +66,6 @@ (define-foreign-variable _stat_st_blksize scheme-object "C_SCHEME_UNDEFINED") (define-foreign-variable _stat_st_blocks scheme-object "C_SCHEME_UNDEFINED") -(module chicken.posix - (emergency-exit call-with-input-pipe call-with-output-pipe change-directory - change-directory* close-input-pipe - close-output-pipe create-directory create-fifo create-pipe - create-session create-symbolic-link current-directory - current-effective-group-id current-effective-user-id - current-effective-user-name get-environment-variables - current-group-id current-process-id current-user-id current-user-name - delete-directory directory directory? duplicate-fileno - fcntl/dupfd fcntl/getfd fcntl/getfl fcntl/setfd fcntl/setfl - fifo? file-access-time file-change-time - file-creation-mode file-close file-control file-execute-access? - file-link file-lock file-lock/blocking file-mkstemp - file-modification-time file-open file-owner set-file-owner! - file-group set-file-group! file-permissions set-file-permissions! - file-position set-file-position! file-read file-read-access? - file-select file-size file-stat file-test-lock file-truncate - file-type file-unlock file-write file-write-access? fileno/stderr - fileno/stdin fileno/stdout find-files get-host-name glob - local-time->seconds local-timezone-abbreviation - open-input-file* open-input-pipe open-output-file* open-output-pipe - open/append open/binary open/creat open/excl open/fsync - open/noctty open/noinherit open/nonblock open/rdonly open/rdwr - open/read open/sync open/text open/trunc open/write open/wronly - parent-process-id perm/irgrp perm/iroth perm/irusr perm/irwxg - perm/irwxo perm/irwxu perm/isgid perm/isuid perm/isvtx perm/iwgrp - perm/iwoth perm/iwusr perm/ixgrp perm/ixoth perm/ixusr pipe/buf - port->fileno process process* process-execute process-fork - process-group-id process-run process-signal process-sleep - process-spawn process-wait read-symbolic-link regular-file? - seconds->local-time seconds->string seconds->utc-time seek/cur - seek/end seek/set set-alarm! set-buffering-mode! set-root-directory! - set-file-times! set-signal-handler! set-signal-mask! signal-handler - signal-mask signal-mask! signal-masked? signal-unmask! signal/abrt - signal/alrm signal/break signal/chld signal/cont signal/fpe - signal/bus signal/hup signal/ill signal/int signal/io signal/kill - signal/pipe signal/prof signal/quit signal/segv signal/stop - signal/term signal/trap signal/tstp signal/urg signal/usr1 - signal/usr2 signal/vtalrm signal/winch signal/xcpu signal/xfsz - signals-list spawn/overlay spawn/wait spawn/nowait spawn/nowaito - spawn/detach block-device? character-device? fifo? socket? - string->time symbolic-link? system-information terminal-name - terminal-port? terminal-size time->string user-information - set-environment-variable! unset-environment-variable! - utc-time->seconds with-input-from-pipe with-output-to-pipe) - -(import scheme chicken) -(import chicken.bitwise - chicken.condition - chicken.data-structures - chicken.foreign - chicken.irregex - chicken.memory - chicken.pathname - chicken.port - chicken.random - chicken.time) - (include "posix-common.scm") #> @@ -725,6 +667,9 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime) <# +(import (only chicken.data-structures string-intersperse) + (only chicken.random random)) + ;;; Lo-level I/O: (define-foreign-variable _pipe_buf int "PIPE_BUF") @@ -1377,5 +1322,3 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime) (define perm/isgid 0) (define perm/isuid 0) (define perm/isvtx 0) - -) ; chicken.posixTrap