Exemple #1
0
 def c_gen_code(self):
   '''Code generation for types'''
   methods = [
       ['global {0}'.format(m.c_defn_label), '{0}:'.format(m.c_defn_label)] \
     for m in self.methods]
   return [
     '',
     methods,
     '', '',  # Padding before the Subtype columns.
     self.c_gen_code_subtype_columns(),
     '', '',
     self.c_gen_class_info_table(),
     '', '',
     self.c_gen_code_create_array(),
     '', '',
     cit.generate_array_cit(self.canonical_name, self.c_array_cit_label,
         self.c_array_sit_column_label, self.c_array_subtype_column_label),
   ]
Exemple #2
0
  def c_gen_code(self):
    '''Code generation for types'''
    # Generate code for all the methods.
    methods = []
    for m in self.methods:
      methods.extend([m.c_gen_code(), ''])

    import code_gen.sit.selector_index_table as sit
    return [
      methods,
      '', '',  # Padding before the SIT/Subtype columns.
      sit.gen_code_sit_column(self.c_sit_column, self.c_sit_column_label),
      '', '',  # Padding between tables.
      self.c_gen_code_subtype_columns(),
      '', '',
      self.c_gen_code_create_instance(),
      '', '',
      self.c_gen_code_create_array(),
      '', '',
      cit.generate_array_cit(self.canonical_name, self.c_array_cit_label,
          self.c_array_sit_column_label, self.c_array_subtype_column_label),
      '', '',
      cit.generate_cit(self),  # THIS MUST BE LAST.
    ]