소스 검색

Make sure that the bootstrap file can be compiled

Yentl Van Tendeloo 8 년 전
부모
커밋
286b58ad13
3개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 2
      bootstrap/bootstrap.py
  2. 2 2
      interface/HUTN/hutn_compiler/model_bootstrap_visitor.py
  3. 5 5
      interface/HUTN/hutn_compiler/semantics_visitor.py

+ 2 - 2
bootstrap/bootstrap.py

@@ -209,7 +209,7 @@ def bootstrap():
 
                 # Compile all model definitions to ALC directly
                 total_alc = ""
-                binding_alc = 'Void initialize_MMs():\n\tinitialize_SCD("models/SimpleClassDiagrams")\n'
+                binding_alc = 'Void function initialize_MMs():\n\tinitialize_SCD("models/SimpleClassDiagrams")\n'
 
                 bootstrap_models = glob.glob("bootstrap/*.mvc")
                 for bootstrap_model in bootstrap_models:
@@ -230,7 +230,7 @@ def bootstrap():
                     mm.write(new_metamodels_alc)
 
                 # Compile all files and add to structure manually
-                bootstrap_files = glob.glob("bootstrap/*.alc")
+                bootstrap_files = glob.glob("bootstrap/*.alc") + glob.glob("bootstrap/.*.alc")
                 for bootstrap_file in bootstrap_files:
                     # Compile the subfile
                     bootstrap_file = bootstrap_file.replace("\\", "/")

+ 2 - 2
interface/HUTN/hutn_compiler/model_bootstrap_visitor.py

@@ -10,7 +10,7 @@ class ModelBootstrapVisitor(Visitor):
     def __init__(self, args):
         Visitor.__init__(self, args)
         model_name = [arg.split(":", 1)[1] for arg in args if arg.startswith("--modelname:")][0]
-        self.code = "Void function instantiate_%s():\n" % model_name
+        self.code = "Void function initialize_%s():\n" % model_name
         self.free_id = 0
         self.names = set()
         self.current_model = None
@@ -119,7 +119,7 @@ class ModelBootstrapVisitor(Visitor):
             attr_optional = len(tree.get_children("OPTIONAL")) > 0
             attr_type = children[1].get_text()
             #self.constructors.extend(["model_define_attribute", self.current_model, self.current_element[-1], attr_name, attr_optional, attr_type])
-            self.code += '\tmodel_define_attribute(%s, "%s", "%s", "%s", %s)\n' % (self.current_model, self.current_element[-1], attr_name, attr_optional, attr_type)
+            self.code += '\tmodel_define_attribute(%s, "%s", "%s", %s, "%s")\n' % (self.current_model, self.current_element[-1], attr_name, attr_optional, attr_type)
             full_attribute_name = self.current_element[-1] + "_" + attr_name
 
             if is_assign:

+ 5 - 5
interface/HUTN/hutn_compiler/semantics_visitor.py

@@ -528,11 +528,11 @@ class SemanticsVisitor(Visitor):
 
         if not symbol.is_func():
             if isinstance(symbol.type, types_mv.Element):
-                sys.stderr.write("{}:{}:{}: warning: calling a variable of type "
-                                 "'Element'\n".format(self.inputfiles[0],
-                                                      tree.startpos['line'],
-                                                      tree.startpos['column'],
-                                                      symbol.name))
+                #sys.stderr.write("{}:{}:{}: warning: calling a variable of type "
+                #                 "'Element'\n".format(self.inputfiles[0],
+                #                                      tree.startpos['line'],
+                #                                      tree.startpos['column'],
+                #                                      symbol.name))
                 return  # allow the call without knowing the declaration
             raise RuntimeError(
                 "{}:{}:{}: error: '{}' is a variable of type '{}', not a "