move put string to string where it belongs
This commit is contained in:
parent
f8ba77dff7
commit
7136450bde
@ -24,11 +24,6 @@ module Register
|
||||
emit_syscall( function , :exit )
|
||||
return function
|
||||
end
|
||||
def putstring context
|
||||
function = Virtual::CompiledMethodInfo.create_method(:Kernel , :putstring , [] )
|
||||
emit_syscall( function , :putstring )
|
||||
function
|
||||
end
|
||||
def exit context
|
||||
function = Virtual::CompiledMethodInfo.create_method(:Kernel,:exit , [])
|
||||
function.info.return_type = Virtual::Integer
|
||||
@ -43,7 +38,6 @@ module Register
|
||||
return function
|
||||
end
|
||||
|
||||
private
|
||||
def emit_syscall function , name
|
||||
save_message( function )
|
||||
function.info.add_code Syscall.new( name )
|
||||
|
@ -73,5 +73,6 @@ module Register
|
||||
end
|
||||
|
||||
require_relative "integer"
|
||||
require_relative "array"
|
||||
require_relative "list"
|
||||
require_relative "kernel"
|
||||
require_relative "word"
|
||||
|
14
lib/register/builtin/word.rb
Normal file
14
lib/register/builtin/word.rb
Normal file
@ -0,0 +1,14 @@
|
||||
module Register
|
||||
module Builtin
|
||||
module Word
|
||||
module ClassMethods
|
||||
def putstring context
|
||||
function = Virtual::CompiledMethodInfo.create_method(:Word , :putstring , [] )
|
||||
Kernel.emit_syscall( function , :putstring )
|
||||
function
|
||||
end
|
||||
end
|
||||
extend ClassMethods
|
||||
end
|
||||
end
|
||||
end
|
@ -105,10 +105,12 @@ module Virtual
|
||||
end
|
||||
obj = @class_mappings[:Kernel ]
|
||||
# create dummy main first, __init__ calls it
|
||||
[:putstring,:exit,:__send , :__init__ ].each do |f|
|
||||
[:exit,:__send , :__init__ ].each do |f|
|
||||
obj.add_instance_method Register::Builtin::Kernel.send(f , nil)
|
||||
end
|
||||
|
||||
@class_mappings[:Word].add_instance_method Register::Builtin::Word.send(:putstring , nil)
|
||||
|
||||
obj = @class_mappings[:Integer ]
|
||||
[:putint,:fibo].each do |f|
|
||||
obj.add_instance_method Register::Builtin::Integer.send(f , nil)
|
||||
|
Loading…
Reference in New Issue
Block a user