fun endwin is extern
end
-redef class Sys
- # Wait a specific number of second and nanoseconds
- # FIXME: should not be in the curses module
- fun nanosleep(sec, nanosec: Int) is extern
-end
-
redef class Stdin
# Is these something to read? (non blocking)
# FIXME: should not be in the curses module
*/
#include "curses.nit.h"
-#include <time.h>
#include <poll.h>
/*
}
/*
-C implementation of curses::Sys::nanosleep
-*/
-void Sys_nanosleep___impl( Sys recv, bigint sec, bigint nanosec ) {
- const struct timespec req = {sec, nanosec};
- nanosleep(&req, NULL);
-}
-
-/*
C implementation of curses::Stdin::poll_in
*/
int Stdin_poll_in___impl( Stdin recv ) {
void Window_wclear___impl( Window recv );
void Window_delwin___impl( Window recv );
void Window_endwin___impl( Window recv );
-void Sys_nanosleep___impl( Sys recv, bigint sec, bigint nanosec );
int Stdin_poll_in___impl( Stdin recv );
#endif
# Unix time: the number of seconds elapsed since January 1, 1970
protected fun get_time: Int is extern "kernel_Any_Any_get_time_0"
end
+
+redef class Sys
+ # Wait a specific number of second and nanoseconds
+ fun nanosleep(sec, nanosec: Int) is extern "std_nanosleep"
+end
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2008 Floréal Morandat <morandat@lirmm.fr>
+ *
+ * This file is free software, which comes along with NIT. This software is
+ * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "time_nit.h"
+
+void std_nanosleep_(long sec,long nanosec) {
+ const struct timespec req = {sec, nanosec};
+ nanosleep(&req, NULL);
+}
#include <time.h>
#define kernel_Any_Any_get_time_0(self) time(NULL)
-
+#define std_nanosleep(self, sec, nanosec) std_nanosleep_(sec, nanosec);
+void std_nanosleep_(long sec, long nanosec);
#endif