def main():
  logging.basicConfig(level=logging.WARNING,format='%(asctime)s - %(levelname)s - %(message)s',stream=sys.stdout)
  
  parser_runner.parse_all_units()
  parser_runner.visit_all_units(create_c_code_for_file)
  parser_runner.visit_all_units(write_c_code_files)
  create_swingame_h()
Example #2
0
def main():
    logging.basicConfig(level=logging.WARNING,format='%(asctime)s - %(levelname)s - %(message)s',stream=sys.stdout)
    
    parser_runner.parse_all_units()
    parser_runner.visit_all_units(create_pas_code_for_file)
    parser_runner.visit_all_units(create_c_code_for_file) # needed for Type.h and SGSDK.h
    parser_runner.visit_all_units(write_pas_code_files)
    def __init__(self):

        # Regular expressions for catching `linked-code` and ``code-formated`` text
        self.p_code = re.compile(r'``(.*?)``')
        self.p_kind = re.compile(r'`(.*?)`')
        # Keep all the identifiers we need...
        ids = self.ids = {
            'files': {},
            'methods': {},
            'umethods': {},
            'types': {},
            'structs': {},
            'enums': {},
            'classes': {},
            'consts': {}, #TODO
        }
        
        # Load the signatures from other languages...
        parser_runner.visit_all_units(create_c_code_for_file)
        parser_runner.visit_all_units(create_pas_code_for_file)
        
        # Gather identifier details
        parser_runner.visit_all_units(self._file_visitor)
        
        # Build link-calls back to method parameters
        for key, m in ids['umethods'].items():
            if m.params:
                for p in m.params:
                    # only keep the special types, not Longint etc
                    if p.data_type.name in ids['types']:
                        ids['types'][p.data_type.name]['used_by'][m.uname] = m
Example #4
0
def write_pas_unit_code():
    """Write the code for the SwinGame.pas unit"""
    
    global _my_writer
    _my_writer = FileWriter('../../Generated/Pascal/lib/SwinGame.pas')
    _my_writer.writeln('// SwinGame.pas was generated on %s' % datetime.now())
    _my_writer.writeln('// ')
    _my_writer.writeln(pas_lib.unit_header_pas % { 
        'uses' : '%s' % ', '.join( [ tpl[0] for tpl in parser_runner.all_units]),
        })
        
    _my_writer.indent()
    
    parser_runner.visit_all_units(write_pas_interface_code)
    _my_writer.outdent()
    _my_writer.writeln(pas_lib.unit_implementation_pas)
    _my_writer.indent()
    parser_runner.visit_all_units(write_pas_code_files)
    _my_writer.outdent()
    
    _my_writer.writeln(pas_lib.footer_txt)
    _my_writer.close()
def main():
    global classes_file_writer
    classes_file_writer = FileWriter('%s/SGTypes.h'% _out_path)
    classes_file_writer.writeln('#import "Types.h"')
    
    logging.basicConfig(level=logging.WARNING,format='%(asctime)s - %(levelname)s - %(message)s',stream=sys.stdout)
    
    parser_runner.parse_all_units()
    parser_runner.visit_all_units(lang_c.create_c_code_for_file)
    parser_runner.visit_all_units(lambda the_file, other: lang_c.write_c_code_files(the_file, other, _out_path))
    
    parser_runner.visit_all_units(_file_visitor)
    classes_file_writer.close()
    create_swingame_h()
Example #6
0
def main():
    global classes_file_writer
    classes_file_writer = FileWriter('%s/SGTypes.h'% _out_path)
    classes_file_writer.writeln('#import "Types.h"')
    
    logging.basicConfig(level=logging.WARNING,format='%(asctime)s - %(levelname)s - %(message)s',stream=sys.stdout)
    
    parser_runner.parse_all_units()
    parser_runner.visit_all_units(lang_c.create_c_code_for_file)
    parser_runner.visit_all_units(lambda the_file, other: lang_c.write_c_code_files(the_file, other, _out_path))
    
    parser_runner.visit_all_units(_file_visitor)
    classes_file_writer.close()
    create_swingame_h()
 def __init__(self, idcollection):
     self.doc = None
     self.details_docs = dict()                          # Dictionary of details files
     self.idcollection = idcollection
     self.last_method = None 
     parser_runner.visit_all_units(self.present_unit_for_file)