[Git][ghc/ghc][master] JS: clean up FFI 'fat arrow' calls in base:System.Posix.Internals (#23481)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jun 7 17:10:40 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
b7600997 by Josh Meredith at 2023-06-07T13:10:21-04:00
JS: clean up FFI 'fat arrow' calls in base:System.Posix.Internals (#23481)

- - - - -


1 changed file:

- libraries/base/System/Posix/Internals.hs


Changes:

=====================================
libraries/base/System/Posix/Internals.hs
=====================================
@@ -499,71 +499,71 @@ foreign import ccall unsafe "HsBase.h __hscore_lstat"
 #if defined(javascript_HOST_ARCH)
 
 foreign import javascript unsafe "(() => { return rts_isThreaded; })" rtsIsThreaded_ :: Int
-foreign import javascript interruptible "(($1_1, $2_2, $2, $c) => { return h$base_access($1_1,$2_2,$2,$c); })"
+foreign import javascript interruptible "h$base_access"
     c_access :: CString -> CInt -> IO CInt
-foreign import javascript interruptible "(($1_1, $2_2, $2, $c) => { return h$base_chmod($1_1,$2_2,$2,$c); })"
+foreign import javascript interruptible "h$base_chmod"
     c_chmod :: CString -> CMode -> IO CInt
-foreign import javascript interruptible "(($1,$c) => { return h$base_close($1,$c); })"
+foreign import javascript interruptible "h$base_close"
     c_close :: CInt -> IO CInt
-foreign import javascript interruptible "(($1, $c) => { return h$base_creat($1,$c); })"
+foreign import javascript interruptible "h$base_creat"
     c_creat :: CString -> CMode -> IO CInt
-foreign import javascript interruptible "(($1, $c) => { return h$base_dup($1, $c); })"
+foreign import javascript interruptible "h$base_dup"
     c_dup :: CInt -> IO CInt
-foreign import javascript interruptible "(($1, $2, $c) => { return h$base_dup2($1,$2,$c); })"
+foreign import javascript interruptible "h$base_dup2"
     c_dup2 :: CInt -> CInt -> IO CInt
-foreign import javascript interruptible "(($1,$2_1,$2_2,$c) => { return h$base_fstat($1,$2_1,$2_2,$c); })" -- fixme wrong type
+foreign import javascript interruptible "h$base_fstat" -- fixme wrong type
     c_fstat :: CInt -> Ptr CStat -> IO CInt
-foreign import javascript unsafe "(($1) => { return h$base_isatty($1); })"
+foreign import javascript unsafe "h$base_isatty"
     c_isatty :: CInt -> IO CInt
-foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_lseek($1,$2_1,$2_2,$3,$c); })"
+foreign import javascript interruptible "h$base_lseek"
    c_lseek :: CInt -> COff -> CInt -> IO COff
-foreign import javascript interruptible "(($1_1,$1_2,$2_1,$2_2,$c) => { return h$base_lstat($1_1,$1_2,$2_1,$2_2,$c); })" -- fixme wrong type
+foreign import javascript interruptible "h$base_lstat" -- fixme wrong type
    lstat :: CFilePath -> Ptr CStat -> IO CInt
-foreign import javascript interruptible "(($1_1,$1_2,$2,$3,$c) => { return h$base_open($1_1,$1_2,$2,$3,$c); })"
+foreign import javascript interruptible "h$base_open"
    c_open :: CFilePath -> CInt -> CMode -> IO CInt
-foreign import javascript interruptible "(($1_1,$1_2,$2,$3,$c) => { return h$base_open($1_1,$1_2,$2,$3,$c); })"
+foreign import javascript interruptible "h$base_open"
    c_interruptible_open_ :: CFilePath -> CInt -> CMode -> IO CInt
-foreign import javascript interruptible "(($1_1,$1_2,$2,$3,$c) => { return h$base_open($1_1,$1_2,$2,$3,$c); })"
+foreign import javascript interruptible "h$base_open"
    c_safe_open_ :: CFilePath -> CInt -> CMode -> IO CInt
-foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_read($1,$2_1,$2_2,$3,$c); })"
+foreign import javascript interruptible "h$base_read"
    c_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
-foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_read($1,$2_1,$2_2,$3,$c); })"
+foreign import javascript interruptible "h$base_read"
    c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
-foreign import javascript interruptible "(($1_1,$1_2,$2_1,$2_2,$c) => { return h$base_stat($1_1,$1_2,$2_1,$2_2,$c); })" -- fixme wrong type
+foreign import javascript interruptible "h$base_stat" -- fixme wrong type
    c_stat :: CFilePath -> Ptr CStat -> IO CInt
-foreign import javascript unsafe "(($1) => { return h$base_umask($1); })"
+foreign import javascript unsafe "h$base_umask"
    c_umask :: CMode -> IO CMode
-foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_write($1,$2_1,$2_2,$3,$c); })"
+foreign import javascript interruptible "h$base_write"
    c_write :: CInt -> Ptr Word8 -> CSize -> IO CSsize
-foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_write($1,$2_1,$2_2,$3,$c); })"
+foreign import javascript interruptible "h$base_write"
    c_safe_write :: CInt -> Ptr Word8 -> CSize -> IO CSsize
-foreign import javascript interruptible "(($1,$2_1,$2_2,$c) => { return h$base_ftruncate($1,$2_1,$2_2,$c); })" -- fixme COff
+foreign import javascript interruptible "h$base_ftruncate" -- fixme COff
    c_ftruncate :: CInt -> FileOffset -> IO CInt
-foreign import javascript interruptible "(($1_1,$1_2,$c) => { return h$base_unlink($1_1,$1_2,$c); })"
+foreign import javascript interruptible "h$base_unlink"
    c_unlink :: CString -> IO CInt
 foreign import javascript unsafe "h$base_getpid"
    c_getpid :: IO CPid
 -- foreign import ccall unsafe "HsBase.h fork"
 --   c_fork :: IO CPid
-foreign import javascript interruptible "($1_1,$1_2,$2_1,$2_2,$c) => { return h$base_link($1_1,$1_2,$2_1,$2_2,$c); })"
+foreign import javascript interruptible "h$base_link"
    c_link :: CString -> CString -> IO CInt
-foreign import javascript interruptible "(($1_1,$1_2,$2,$c) => { return h$base_mkfifo($1_1,$1_2,$2,$c); })"
+foreign import javascript interruptible "h$base_mkfifo"
    c_mkfifo :: CString -> CMode -> IO CInt
-foreign import javascript interruptible "(($1_1,$1_2,$c) => { return h$base_pipe($1_1,$1_2,$c); })"
+foreign import javascript interruptible "h$base_pipe"
   c_pipe :: Ptr CInt -> IO CInt
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_sigemptyset($1_1,$1_2); })"
+foreign import javascript unsafe "h$base_sigemptyset"
    c_sigemptyset :: Ptr CSigset -> IO CInt
-foreign import javascript unsafe "(($1_1,$1_2,$2) => { return h$base_sigaddset($1_1,$1_2,$2); })"
+foreign import javascript unsafe "h$base_sigaddset"
    c_sigaddset :: Ptr CSigset -> CInt -> IO CInt
-foreign import javascript unsafe "(($1,$2_1,$2_2,$3_1,$3_2) => { return h$base_sigprocmask($1,$2_1,$2_2,$3_1,$3_2); })"
+foreign import javascript unsafe "h$base_sigprocmask"
    c_sigprocmask :: CInt -> Ptr CSigset -> Ptr CSigset -> IO CInt
-foreign import javascript unsafe "(($1,$2_1,$2_2) => { return h$base_tcgetattr($1,$2_1,$2_2); })"
+foreign import javascript unsafe "h$base_tcgetattr"
    c_tcgetattr :: CInt -> Ptr CTermios -> IO CInt
-foreign import javascript unsafe "(($1,$2,$3_1,$3_2) => { return h$base_tcsetattr($1,$2,$3_1,$3_2); })"
+foreign import javascript unsafe "h$base_tcsetattr"
    c_tcsetattr :: CInt -> CInt -> Ptr CTermios -> IO CInt
-foreign import javascript unsafe "(($1_1,$1_2,$2_1,$2_2) => { return h$base_utime($1_1,$1_2,$2_1,$2_2); })" -- should this be async?
+foreign import javascript unsafe "h$base_utime" -- should this be async?
    c_utime :: CString -> Ptr CUtimbuf -> IO CInt
-foreign import javascript interruptible "(($1,$2_1,$2_2,$3,$c) => { return h$base_waitpid($1,$2_1,$2_2,$3,$c); })"
+foreign import javascript interruptible "h$base_waitpid"
    c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid
 
 foreign import javascript unsafe "(() => { return h$base_o_rdonly; })"   o_RDONLY   :: CInt
@@ -577,11 +577,11 @@ foreign import javascript unsafe "(() => { return h$base_o_noctty; })"   o_NOCTT
 foreign import javascript unsafe "(() => { return h$base_o_nonblock; })" o_NONBLOCK :: CInt
 foreign import javascript unsafe "(() => { return h$base_o_binary; })"   o_BINARY   :: CInt
 
-foreign import javascript unsafe "(($1) => { return h$base_c_s_isreg($1); })"  c_s_isreg  :: CMode -> CInt
-foreign import javascript unsafe "(($1) => { return h$base_c_s_ischr($1); })"  c_s_ischr  :: CMode -> CInt
-foreign import javascript unsafe "(($1) => { return h$base_c_s_isblk($1); })"  c_s_isblk  :: CMode -> CInt
-foreign import javascript unsafe "(($1) => { return h$base_c_s_isdir($1); })"  c_s_isdir  :: CMode -> CInt
-foreign import javascript unsafe "(($1) => { return h$base_c_s_isfifo($1); })" c_s_isfifo :: CMode -> CInt
+foreign import javascript unsafe "h$base_c_s_isreg"  c_s_isreg  :: CMode -> CInt
+foreign import javascript unsafe "h$base_c_s_ischr"  c_s_ischr  :: CMode -> CInt
+foreign import javascript unsafe "h$base_c_s_isblk"  c_s_isblk  :: CMode -> CInt
+foreign import javascript unsafe "h$base_c_s_isdir"  c_s_isdir  :: CMode -> CInt
+foreign import javascript unsafe "h$base_c_s_isfifo" c_s_isfifo :: CMode -> CInt
 
 s_isreg  :: CMode -> Bool
 s_isreg cm = c_s_isreg cm /= 0
@@ -595,11 +595,11 @@ s_isfifo :: CMode -> Bool
 s_isfifo cm = c_s_isfifo cm /= 0
 
 foreign import javascript unsafe "(() => { return h$base_sizeof_stat; })" sizeof_stat :: Int
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_st_mtime($1_1,$1_2); })"    st_mtime :: Ptr CStat -> IO CTime
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_st_size($1_1,$1_2); })"     st_size :: Ptr CStat -> IO Int64
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_st_mode($1_1,$1_2); })"     st_mode :: Ptr CStat -> IO CMode
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_st_dev($1_1,$1_2); })"      st_dev :: Ptr CStat -> IO CDev
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_st_ino($1_1,$1_2); })"      st_ino :: Ptr CStat -> IO CIno
+foreign import javascript unsafe "h$base_st_mtime"    st_mtime :: Ptr CStat -> IO CTime
+foreign import javascript unsafe "h$base_st_size"     st_size :: Ptr CStat -> IO Int64
+foreign import javascript unsafe "h$base_st_mode"     st_mode :: Ptr CStat -> IO CMode
+foreign import javascript unsafe "h$base_st_dev"      st_dev :: Ptr CStat -> IO CDev
+foreign import javascript unsafe "h$base_st_ino"      st_ino :: Ptr CStat -> IO CIno
 
 foreign import javascript unsafe "(() => { return h$base_echo; })"            const_echo :: CInt
 foreign import javascript unsafe "(() => { return h$base_tcsanow; })"         const_tcsanow :: CInt
@@ -615,21 +615,21 @@ foreign import javascript unsafe "(() => { return h$base_f_setfd; })"         co
 foreign import javascript unsafe "(() => { return h$base_fd_cloexec; })"      const_fd_cloexec :: CLong
 foreign import javascript unsafe "(() => { return h$base_sizeof_termios; })"  sizeof_termios :: Int
 foreign import javascript unsafe "(() => { return h$base_sizeof_sigset_t; })" sizeof_sigset_t :: Int
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_lflag($1_1,$1_2); })"           c_lflag :: Ptr CTermios -> IO CTcflag
-foreign import javascript unsafe "(($1_1,$1_2,$2) => { return h$base_poke_lflag($1_1,$1_2,$2); })"      poke_c_lflag :: Ptr CTermios -> CTcflag -> IO ()
-foreign import javascript unsafe "(($1_1,$1_2) => { return h$base_ptr_c_cc($1_1,$1_2); })"        ptr_c_cc  :: Ptr CTermios -> IO (Ptr Word8)
+foreign import javascript unsafe "h$base_lflag"           c_lflag :: Ptr CTermios -> IO CTcflag
+foreign import javascript unsafe "h$base_poke_lflag"      poke_c_lflag :: Ptr CTermios -> CTcflag -> IO ()
+foreign import javascript unsafe "h$base_ptr_c_cc"        ptr_c_cc  :: Ptr CTermios -> IO (Ptr Word8)
 s_issock :: CMode -> Bool
 s_issock cmode = c_s_issock cmode /= 0
-foreign import javascript unsafe "(($1) => { return h$base_c_s_issock($1); })"          c_s_issock :: CMode -> CInt
+foreign import javascript unsafe "h$base_c_s_issock"          c_s_issock :: CMode -> CInt
 foreign import javascript unsafe "(() => { return h$base_default_buffer_size; })" dEFAULT_BUFFER_SIZE :: Int
 foreign import javascript unsafe "(() => { return h$base_SEEK_CUR; })"            sEEK_CUR :: CInt
 foreign import javascript unsafe "(() => { return h$base_SEEK_SET; })"            sEEK_SET :: CInt
 foreign import javascript unsafe "(() => { return h$base_SEEK_END; })"            sEEK_END :: CInt
 
 -- fixme, unclear if these can be supported, remove?
-foreign import javascript unsafe "(($1, $2) => { return h$base_c_fcntl_read($1,$2); })"  c_fcntl_read  :: CInt -> CInt -> IO CInt
-foreign import javascript unsafe "(($1, $2, $3) => { return h$base_c_fcntl_write($1,$2,$3); })" c_fcntl_write :: CInt -> CInt -> CLong -> IO CInt
-foreign import javascript unsafe "(($1,$2,$3_1,$3_2) => { return h$base_c_fcntl_lock($1,$2,$3_1,$3_2); })"  c_fcntl_lock  :: CInt -> CInt -> Ptr CFLock -> IO CInt
+foreign import javascript unsafe "h$base_c_fcntl_read"  c_fcntl_read  :: CInt -> CInt -> IO CInt
+foreign import javascript unsafe "h$base_c_fcntl_write" c_fcntl_write :: CInt -> CInt -> CLong -> IO CInt
+foreign import javascript unsafe "h$base_c_fcntl_lock"  c_fcntl_lock  :: CInt -> CInt -> Ptr CFLock -> IO CInt
 
 #else
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b76009974ff34fe7730fc0343a1977dd1a3183e2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b76009974ff34fe7730fc0343a1977dd1a3183e2
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230607/a54b3dfc/attachment-0001.html>


More information about the ghc-commits mailing list