~ chicken-core (chicken-5) 057b54670df80bcbefbe8949460375539ac77d9f


commit 057b54670df80bcbefbe8949460375539ac77d9f
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Thu Jun 8 18:33:38 2017 +1200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Thu Jun 8 20:37:36 2017 +1200

    Include posix-common.scm before foreign declarations in posixwin.scm
    
    This ensures that all of the C-space includes and helper functions from
    posix-common.scm are visible in the foreign code for Windows. This was
    already the case in posixunix.scm, but needed to be done for
    posixwin.scm as well to avoid build failures after 6810aaac.

diff --git a/posixunix.scm b/posixunix.scm
index f20623ec..f9d567e5 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -88,8 +88,8 @@
 
 (include "posix-common.scm")
 
-(declare
-  (foreign-declare #<<EOF
+#>
+
 static C_TLS int C_wait_status;
 
 #include <sys/time.h>
@@ -400,8 +400,7 @@ static C_word C_i_fifo_p(C_word name)
   else return C_SCHEME_FALSE;
 }
 
-EOF
-) )
+<#
 
 ;; Faster versions of common operations
 
diff --git a/posixwin.scm b/posixwin.scm
index 9d4b381c..76f631c3 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -61,8 +61,73 @@
 
 
 (declare
-  (uses data-structures)
-  (foreign-declare #<<EOF
+  (uses data-structures))
+
+(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")
+
+#>
+
 #ifndef WIN32_LEAN_AND_MEAN
 # define WIN32_LEAN_AND_MEAN
 #endif
@@ -657,72 +722,8 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
   }
   return _utime(filename, &tb);
 }
-EOF
-) )
-
-(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")
 
+<#
 
 ;;; Lo-level I/O:
 
Trap