remove parfait module magic

since we are now ruby sorcerers, not just wizards, we remove the Parfait module in the compiler (Still have to avoid the name clashes)
This commit is contained in:
Torsten Rüger 2019-09-09 11:54:45 +03:00
parent 104f4c5109
commit fc8de10964
5 changed files with 26 additions and 18 deletions

View File

@ -20,12 +20,12 @@ module Parfait
end end
end end
["object" , "data_object","integer","factory" ].each do |file_name|
path = File.expand_path( "../parfait/#{file_name}.rb" , __FILE__)
module_eval( File.read path)
end
end end
require_relative "parfait/object"
require_relative "parfait/data_object"
require_relative "parfait/integer"
require_relative "parfait/factory"
require_relative "parfait/behaviour" require_relative "parfait/behaviour"
require_relative "parfait/class" require_relative "parfait/class"
require_relative "parfait/meta_class" require_relative "parfait/meta_class"

View File

@ -19,6 +19,7 @@
# DataObjects still have a type, and so can have objects before the data starts # DataObjects still have a type, and so can have objects before the data starts
# #
# A marker class # A marker class
module Parfait
class DataObject < Object class DataObject < Object
def self.type_length def self.type_length
@ -52,3 +53,4 @@
32 32
end end
end end
end

View File

@ -1,16 +1,18 @@
# A factory has the one job of handing out new instances # A factory has the one job of handing out new instances
# #
# A factory is for a specific type (currently, may change by size at some point) # A factory is for a specific type (currently, may change by size at some point)
# #
# get_next_object is the main entry point, all other functions help to get more # get_next_object is the main entry point, all other functions help to get more
# memory and objects as needed # memory and objects as needed
# #
# A factory keeps a reserve, and in case the freelist is empty, switches that in _immediately # A factory keeps a reserve, and in case the freelist is empty, switches that in _immediately
# This is especially useful for messages, that can then be used even they run out. # This is especially useful for messages, that can then be used even they run out.
# #
# The idea (especially for messages) is to call out from the MessageSetup to the # The idea (especially for messages) is to call out from the MessageSetup to the
# factory when the next (not current) is nil. # factory when the next (not current) is nil.
# This is btw just as easy a check, as the next needs to be gotten to swap the list. # This is btw just as easy a check, as the next needs to be gotten to swap the list.
module Parfait
class Factory < Object class Factory < Object
attr :type , :for_type , :next_object , :reserve , :attribute_name , :page_size attr :type , :for_type , :next_object , :reserve , :attribute_name , :page_size
@ -113,3 +115,4 @@
obj obj
end end
end end
end

View File

@ -3,6 +3,7 @@
# - they have fixed value # - they have fixed value
# - they are immutable fo rthe most part (or to the user) # - they are immutable fo rthe most part (or to the user)
# #
module Parfait
class Integer < Data4 class Integer < Data4
attr :type, :next_integer attr :type, :next_integer
@ -90,3 +91,4 @@
1 # 0 type 1 # 0 type
end end
end end
end

View File

@ -12,7 +12,7 @@
# The Type also defines the class of the object # The Type also defines the class of the object
# The Type is **always** the first entry (index 0) in an object # The Type is **always** the first entry (index 0) in an object
module Parfait
class Object class Object
attr :type attr :type
@ -99,3 +99,4 @@
end end
end end
end