#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
- #include <poll.h>
#include <errno.h>
+#ifndef _WIN32
+ #include <poll.h>
+#endif
`}
in "C" `{
end
private fun native_poll_in(fd: Int): Int `{
+#ifndef _WIN32
struct pollfd fds = {(int)fd, POLLIN, 0};
return poll(&fds, 1, 0);
+#else
+ return 0;
+#endif
`}
end
`}
private fun file_lstat: NativeFileStat `{
+#ifdef _WIN32
+ // FIXME use a higher level abstraction to support WIN32
+ return NULL;
+#else
struct stat* stat_element;
int res;
stat_element = malloc(sizeof(struct stat));
res = lstat(self, stat_element);
if (res == -1) return NULL;
return stat_element;
+#endif
`}
private fun file_mkdir(mode: Int): Bool `{
fun is_fifo: Bool `{ return S_ISFIFO(self->st_mode); `}
# Returns true if the type is a link
- fun is_lnk: Bool `{ return S_ISLNK(self->st_mode); `}
+ fun is_lnk: Bool `{
+#ifdef _WIN32
+ return 0;
+#else
+ return S_ISLNK(self->st_mode);
+#endif
+ `}
# Returns true if the type is a socket
- fun is_sock: Bool `{ return S_ISSOCK(self->st_mode); `}
+ fun is_sock: Bool `{
+#ifdef _WIN32
+ return 0;
+#else
+ return S_ISSOCK(self->st_mode);
+#endif
+ `}
end
# Instance of this class are standard FILE * pointers
private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]): nullable Int
import Array[Int].length, Array[Int].[], Int.as(nullable Int) `{
+#ifndef _WIN32
+ // FIXME use a higher level abstraction to support WIN32
+
int in_len, out_len, total_len;
struct pollfd *c_fds;
int i;
}
else if ( result < 0 )
fprintf( stderr, "Error in Stream:poll: %s\n", strerror( errno ) );
+#endif
return null_Int();
`}