contrib: update contribs to use `self` in FFI
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 25 May 2015 19:19:51 +0000 (15:19 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 26 May 2015 15:59:10 +0000 (11:59 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/sort_downloads/src/sort_downloads.nit
contrib/wiringPi/lib/wiringPi.nit

index 6b849c9..4cfc3a1 100755 (executable)
@@ -65,7 +65,7 @@ redef class String
        # Returns null on success
        fun file_rename_to(dest: String): nullable String import String.to_cstring,
        NativeString.to_s, String.as nullable `{
-               int res = rename(String_to_cstring(recv), String_to_cstring(dest));
+               int res = rename(String_to_cstring(self), String_to_cstring(dest));
                if (res == 0) return null_String();
                return String_as_nullable(NativeString_to_s(strerror(errno)));
        `}
index 2852256..ac91fdb 100644 (file)
@@ -53,28 +53,28 @@ extern class RPiPin `{ CRPiPin *`}
        `}
 
        # The pin `id` depends on wiringPi setup used
-       fun id: Int `{ return recv->id; `}
+       fun id: Int `{ return self->id; `}
 
        # Sets the mode of the pin
-       fun mode(mode: RPiPinMode) `{ pinMode(recv->id, mode); `}
+       fun mode(mode: RPiPinMode) `{ pinMode(self->id, mode); `}
 
        # This sets the pull-up or pull-down resistor mode on the given pin,
        # which should be set as an input.
-       fun pullup_dncontrol(pud: PUDControl) `{ pullUpDnControl(recv->id, pud); `}
+       fun pullup_dncontrol(pud: PUDControl) `{ pullUpDnControl(self->id, pud); `}
 
        # Writes the value HIGH or LOW (true or false) to the given pin which must
        # have been previously set as an output.
-       fun write(high: Bool) `{ digitalWrite(recv->id, high? HIGH: LOW); `}
+       fun write(high: Bool) `{ digitalWrite(self->id, high? HIGH: LOW); `}
 
        # Writes the value to the PWM register for the given pin.
        # The Raspberry Pi has one on-board PWM pin, pin 1 (BMC_GPIO 18, Phys 12)
        # and the range is 0-1024.
        # Other PWM devices may have other PWM ranges.
-       fun pwm_write(value: Int) `{ pwmWrite(recv->id, value); `}
+       fun pwm_write(value: Int) `{ pwmWrite(self->id, value); `}
 
        # This function returns the value read at the given pin.
        # It will be HIGH or LOW (true or false) depending on the logic level at the pin.
-       fun read: Bool `{ return digitalRead(recv->id) == HIGH? true: false; `}
+       fun read: Bool `{ return digitalRead(self->id) == HIGH? true: false; `}
 end
 
 # RPI Pin modes