Commit 5eaf905d authored by gsamain's avatar gsamain

Use builtin acthon types directly, do not rely on lookup anymore

parent 166685f9
......@@ -380,6 +380,7 @@ builtin_structs_table = [
# inject acthon interfaces
def inject_acthon_interfaces(self):
global acthon_result_type, acthon_message_type, acthon_sync_type, acthon_queue_type, acthon_activable_type
def init_scope(scope):
scope.is_cpp_class_scope = 1
scope.inherited_var_entries = []
......@@ -394,7 +395,7 @@ def inject_acthon_interfaces(self):
result_scope = Scope("ActhonResultInterface", self, None)
init_scope(result_scope)
result_type = PyrexTypes.CypClassType(
acthon_result_type = result_type = PyrexTypes.CypClassType(
"ActhonResultInterface", result_scope, "ActhonResultInterface", (PyrexTypes.cy_object_type,),
lock_mode="nolock", activable=False)
result_scope.type = result_type
......@@ -443,7 +444,7 @@ def inject_acthon_interfaces(self):
message_scope = Scope("ActhonMessageInterface", self, None)
init_scope(message_scope)
message_type = PyrexTypes.CypClassType(
acthon_message_type = message_type = PyrexTypes.CypClassType(
"ActhonMessageInterface", message_scope, "ActhonMessageInterface", (PyrexTypes.cy_object_type,),
lock_mode="nolock", activable=False)
message_scope.type = message_type
......@@ -456,7 +457,7 @@ def inject_acthon_interfaces(self):
sync_scope = Scope("ActhonSyncInterface", self, None)
init_scope(sync_scope)
sync_type = PyrexTypes.CypClassType(
acthon_sync_type = sync_type = PyrexTypes.CypClassType(
"ActhonSyncInterface", sync_scope, "ActhonSyncInterface", (PyrexTypes.cy_object_type,),
lock_mode="nolock", activable=False)
sync_scope.type = sync_type
......@@ -522,7 +523,7 @@ def inject_acthon_interfaces(self):
queue_scope = Scope("ActhonQueueInterface", self, None)
init_scope(queue_scope)
queue_type = PyrexTypes.CypClassType(
acthon_queue_type = queue_type = PyrexTypes.CypClassType(
"ActhonQueueInterface", queue_scope, "ActhonQueueInterface", (PyrexTypes.cy_object_type,),
lock_mode="nolock", activable=False)
queue_scope.type = queue_type
......@@ -550,7 +551,7 @@ def inject_acthon_interfaces(self):
activable_scope = Scope("ActhonActivableClass", self, None)
init_scope(activable_scope)
activable_type = PyrexTypes.CypClassType(
acthon_activable_type = activable_type = PyrexTypes.CypClassType(
"ActhonActivableClass", activable_scope, "ActhonActivableClass", (PyrexTypes.cy_object_type,),
lock_mode="nolock", activable=False)
activable_entry = self.declare("ActhonActivableClass", None, activable_type, "ActhonActivableClass", "extern")
......
......@@ -1132,7 +1132,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("}")
def generate_cyp_class_activated_class(self, entry, code):
result_interface_entry = entry.scope.lookup("ActhonResultInterface")
from . import Builtin
result_interface_type = Builtin.acthon_result_type
activable_bases_cnames = [base.cname for base in entry.type.base_classes if base.activable]
activable_bases_inheritance_list = ["public %s::Activated" % cname for cname in activable_bases_cnames]
if activable_bases_cnames:
......@@ -1170,9 +1171,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
activated_method_arg_decl_code = ", ".join(["ActhonSyncInterface* sync_object"] + reified_arg_decl_list)
function_header = reified_function_entry.type.function_header_code(reified_function_entry.cname, activated_method_arg_decl_code)
function_code = result_interface_entry.type.declaration_code(function_header)
function_code = result_interface_type.declaration_code(function_header)
code.putln("%s {" % function_code)
code.putln("%s = this->_active_result_class();" % result_interface_entry.type.declaration_code("result_object"))
code.putln("%s = this->_active_result_class();" % result_interface_type.declaration_code("result_object"))
message_constructor_args_list = ["this->_passive_self", "sync_object", "result_object"] + reified_arg_cname_list
message_constructor_args_code = ", ".join(message_constructor_args_list)
......
......@@ -721,9 +721,11 @@ class Scope(object):
# Declaring active_self member and activate function (its definition is generated automatically)
act_attr_name = Naming.builtin_prefix + "_active_self"
scope.declare_var("<active_self>", act_type, pos, cname=act_attr_name)
queue_type = self.lookup("ActhonQueueInterface").type
from . import Builtin
queue_type = Builtin.acthon_queue_type
result_type = Builtin.acthon_result_type
queue_arg = PyrexTypes.CFuncTypeArg("queue", queue_type, pos)
result_type = PyrexTypes.CPtrType(PyrexTypes.CFuncType(self.lookup("ActhonResultInterface").type, [], nogil = 1))
result_type = PyrexTypes.CPtrType(PyrexTypes.CFuncType(result_type, [], nogil = 1))
result_arg = PyrexTypes.CFuncTypeArg("result", result_type, pos)
activate_type = PyrexTypes.CFuncType(act_type, [queue_arg, result_arg], nogil = 1, optional_arg_count = 2)
......@@ -2613,14 +2615,15 @@ class CppClassScope(Scope):
reifying_entry.reified_entry = entry
self.reifying_entries.append(reifying_entry)
# Add the base method to the Activated member class
from . import Builtin
activated_class_entry = self.lookup_here("Activated")
result_interface_entry = self.lookup("ActhonResultInterface")
sync_interface_entry = self.lookup("ActhonSyncInterface")
result_type = Builtin.acthon_result_type
sync_type = Builtin.acthon_sync_type
activated_method_sync_attr_type = PyrexTypes.CFuncTypeArg(
"sync_method", sync_interface_entry.type, entry.pos, "sync_method")
"sync_method", sync_type, entry.pos, "sync_method")
activated_method_type = PyrexTypes.CFuncType(result_interface_entry.type,
activated_method_type = PyrexTypes.CFuncType(result_type,
[activated_method_sync_attr_type] + entry.type.args, nogil=entry.type.nogil,
has_varargs = entry.type.has_varargs,
optional_arg_count = entry.type.optional_arg_count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment