Merge branch 'c_ffi_alive_again'
authorJean Privat <jean@pryen.org>
Mon, 24 Feb 2014 22:49:20 +0000 (17:49 -0500)
committerJean Privat <jean@pryen.org>
Mon, 24 Feb 2014 22:49:20 +0000 (17:49 -0500)
Last of the serie

1  2 
lib/mnit_linux/sdl.nit
src/naive_interpreter.nit

diff --combined lib/mnit_linux/sdl.nit
  # limitations under the License.
  
  # SDL display support (used in Linux for windows and inputes only)
- module sdl
+ module sdl is
+       c_compiler_option(exec("sdl-config", "--cflags"))
+       c_linker_option(exec("sdl-config", "--libs"), "-lSDL_ttf")
+ end
  
  import mnit # for
  # import display
@@@ -330,7 -333,7 +333,7 @@@ class SDLKeyEven
  
        redef fun to_c: nullable Char
        do
 -              if key_name.length == 1 then return key_name.first
 +              if key_name.length == 1 then return key_name.chars.first
                return null
        end
  
@@@ -21,6 -21,7 +21,7 @@@ import litera
  import typing
  import auto_super_init
  import frontend
+ import common_ffi
  
  redef class ToolContext
        # --discover-call-trace
@@@ -751,13 -752,13 +752,13 @@@ redef class AInternMethPropde
                                if arg1 >= recvval.length or arg1 < 0 then
                                        debug("Illegal access on {recvval} for element {arg1}/{recvval.length}")
                                end
 -                              return v.char_instance(recvval[arg1])
 +                              return v.char_instance(recvval.chars[arg1])
                        else if pname == "[]=" then
                                var arg1 = args[1].to_i
                                if arg1 >= recvval.length or arg1 < 0 then
                                        debug("Illegal access on {recvval} for element {arg1}/{recvval.length}")
                                end
 -                              recvval[arg1] = args[2].val.as(Char)
 +                              recvval.chars[arg1] = args[2].val.as(Char)
                                return null
                        else if pname == "copy_to" then
                                # sig= copy_to(dest: NativeString, length: Int, from: Int, to: Int)
@@@ -1103,7 -1104,7 +1104,7 @@@ redef class AVarReassignExp
                var vari = v.frame.map[self.variable.as(not null)]
                var value = v.expr(self.n_value)
                if value == null then return
 -              var res = v.send(reassign_property.mproperty, [vari, value])
 +              var res = v.send(reassign_callsite.mproperty, [vari, value])
                assert res != null
                v.frame.map[self.variable.as(not null)] = res
        end
@@@ -1517,8 -1518,9 +1518,8 @@@ redef class ASendExp
                        if i == null then return null
                        args.add(i)
                end
 -              var mproperty = self.mproperty.as(not null)
  
 -              var res = v.send(mproperty, args)
 +              var res = v.send(callsite.mproperty, args)
                return res
        end
  end
@@@ -1537,15 -1539,16 +1538,15 @@@ redef class ASendReassignFormExp
                var value = v.expr(self.n_value)
                if value == null then return
  
 -              var mproperty = self.mproperty.as(not null)
 -              var read = v.send(mproperty, args)
 +              var read = v.send(callsite.mproperty, args)
                assert read != null
  
 -              var write = v.send(self.reassign_property.mproperty, [read, value])
 +              var write = v.send(reassign_callsite.mproperty, [read, value])
                assert write != null
  
                args.add(write)
  
 -              v.send(self.write_mproperty.as(not null), args)
 +              v.send(write_callsite.mproperty, args)
        end
  end
  
@@@ -1563,13 -1566,13 +1564,13 @@@ redef class ASuperExp
                        args = v.frame.arguments
                end
  
 -              var mproperty = self.mproperty
 -              if mproperty != null then
 -                      if mproperty.intro.msignature.arity == 0 then
 +              var callsite = self.callsite
 +              if callsite != null then
 +                      if callsite.mproperty.intro.msignature.arity == 0 then
                                args = [recv]
                        end
                        # Super init call
 -                      var res = v.send(mproperty, args)
 +                      var res = v.send(callsite.mproperty, args)
                        return res
                end
  
@@@ -1594,7 -1597,8 +1595,7 @@@ redef class ANewExp
                        if i == null then return null
                        args.add(i)
                end
 -              var mproperty = self.mproperty.as(not null)
 -              var res2 = v.send(mproperty, args)
 +              var res2 = v.send(callsite.mproperty, args)
                if res2 != null then
                        #self.debug("got {res2} from {mproperty}. drop {recv}")
                        return res2
@@@ -1638,7 -1642,7 +1639,7 @@@ redef class AAttrReassignExp
                if value == null then return
                var mproperty = self.mproperty.as(not null)
                var attr = v.read_attribute(mproperty, recv)
 -              var res = v.send(reassign_property.mproperty, [attr, value])
 +              var res = v.send(reassign_callsite.mproperty, [attr, value])
                assert res != null
                assert recv isa MutableInstance
                recv.attributes[mproperty] = res