lib: move pseudo-toplevel methods from Object
authorJean Privat <jean@pryen.org>
Fri, 16 Oct 2015 17:57:15 +0000 (13:57 -0400)
committerJean Privat <jean@pryen.org>
Fri, 16 Oct 2015 17:57:15 +0000 (13:57 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/bcm2835/bcm2835.nit
lib/core/time.nit
lib/signals.nit

index 48f0ed2..d77d134 100644 (file)
@@ -25,11 +25,9 @@ in "C Header" `{
        #include <bcm2835.h>
 `}
 
-redef class Object
-       protected fun bcm2835_init: Bool `{ return bcm2835_init(); `}
-       protected fun bcm2835_close `{ bcm2835_close(); `}
-       protected fun bcm2835_debug=(v: Bool) `{ bcm2835_set_debug(v); `}
-end
+fun bcm2835_init: Bool `{ return bcm2835_init(); `}
+fun bcm2835_close `{ bcm2835_close(); `}
+fun bcm2835_debug=(v: Bool) `{ bcm2835_set_debug(v); `}
 
 # A physical binary pin
 interface Pin
index adac6ff..6c99016 100644 (file)
@@ -21,10 +21,8 @@ in "C Header" `{
        #include <time.h>
 `}
 
-redef class Object
-       # Unix time: the number of seconds elapsed since January 1, 1970
-       protected fun get_time: Int `{ return time(NULL); `}
-end
+# Unix time: the number of seconds elapsed since January 1, 1970
+fun get_time: Int `{ return time(NULL); `}
 
 redef class Sys
        # Wait a specific number of second and nanoseconds
index 440fd39..002ff89 100644 (file)
@@ -203,30 +203,27 @@ interface SignalHandler
        `}
 end
 
-redef interface Object
-
-       # Check signals for safe operation
-       # will callback receiver of raised signals
-       # can callback any instance of SignalHandler, not just this one
-       protected fun check_signals: Bool is extern import SignalHandler.receive_signal `{
-               int sig;
-               int raised_something = 0;
-
-               for (sig = 0; sig < 32; sig ++)
-                       if (nit_signals_list[sig].raised) {
-                               nit_signals_list[sig].raised = 0;
-                               raised_something = 1;
-                               SignalHandler handler = (SignalHandler)nit_signals_list[sig].handler;
-                               SignalHandler_receive_signal(handler, sig);
-                       }
+# Check signals for safe operation
+# will callback receiver of raised signals
+# can callback any instance of SignalHandler, not just this one
+fun check_signals: Bool is extern import SignalHandler.receive_signal `{
+       int sig;
+       int raised_something = 0;
+
+       for (sig = 0; sig < 32; sig ++)
+               if (nit_signals_list[sig].raised) {
+                       nit_signals_list[sig].raised = 0;
+                       raised_something = 1;
+                       SignalHandler handler = (SignalHandler)nit_signals_list[sig].handler;
+                       SignalHandler_receive_signal(handler, sig);
+               }
 
-               return raised_something;
-       `}
+       return raised_something;
+`}
 
-       # Set alarm signal
-       # can callback any instance of SignalHandler, not just this one
-       protected fun set_alarm(sec: Int) `{ alarm(sec); `}
-end
+# Set alarm signal
+# can callback any instance of SignalHandler, not just this one
+fun set_alarm(sec: Int) `{ alarm(sec); `}
 
 redef class Process
        # Send a signal to the process