X-Git-Url: http://nitlanguage.org diff --git a/contrib/online_ide/sources/nit/pnacl_nit.nit b/contrib/online_ide/sources/nit/pnacl_nit.nit index 07db5ed..567b0a2 100644 --- a/contrib/online_ide/sources/nit/pnacl_nit.nit +++ b/contrib/online_ide/sources/nit/pnacl_nit.nit @@ -17,12 +17,12 @@ # A version of the naive Nit interpreter for PNaCl. module pnacl_nit -import naive_interpreter -import debugger +import nitc::interpreter::naive_interpreter +import nitc::interpreter::debugger import pnacl -intrude import toolcontext -intrude import modelbuilder -intrude import standard::file +intrude import nitc::toolcontext +intrude import nitc::loader +intrude import core::file # We redefine exit to start a new thread before killing the one that called exit. redef fun exit(exit_value: Int) @@ -57,14 +57,14 @@ end redef class ToolContext # We don't need 'the compute_nit_dir'. - redef fun compute_nit_dir: nullable String + redef fun compute_nit_dir do return "/pnacl" end end -# We have to redef some IFStream methods because we don't use NativeFiles anymore. -redef class IFStream +# We have to redef some FileReader methods because we don't use NativeFiles anymore. +redef class FileReader # Looks in the 'files' HashMap. redef init open(path: String) @@ -72,7 +72,7 @@ redef class IFStream self.path = path var file = sys.files[path] prepare_buffer(file.length) - _buffer.append(file) + path.copy_to_native(_buffer, file.length, 0, 0) end redef fun close @@ -82,7 +82,7 @@ redef class IFStream redef fun fill_buffer do - _buffer.clear + buffer_reset end_reached = true end @@ -146,7 +146,7 @@ class Pnacl_nit # We need a model to collect stufs var model = new Model # An a model builder to parse files - var modelbuilder = new ModelBuilder(model, toolcontext.as(not null)) + var modelbuilder = new ModelBuilder(model, toolcontext) var arguments = toolcontext.option_context.rest var progname = arguments.first @@ -169,8 +169,8 @@ class Pnacl_nit mainmodule.set_imported_mmodules(mmodules) end - var self_mm = mainmodule.as(not null) - var self_args = arguments.as(not null) + var self_mm = mainmodule + var self_args = arguments if toolcontext.opt_debugger_autorun.value then modelbuilder.run_debugger_autorun(self_mm, self_args)