Exemple #1
0
 def load(source, dirname, filename):
     # Write text to file buffer.
     src_bytes = source.encode(Document.encoding, "replace")
     src_len = len(src_bytes)
     buf_len = src_len + Document.initial_gap_size
     fileid = name_table.Get_Identifier(filename.encode('utf-8'))
     if os.path.isabs(filename):
         dirid = name_table.Null_Identifier
     else:
         dirid = name_table.Get_Identifier(dirname.encode('utf-8'))
     sfe = files_map.Reserve_Source_File(dirid, fileid, buf_len)
     files_map_editor.Fill_Text(sfe, ctypes.c_char_p(src_bytes), src_len)
     return sfe
Exemple #2
0
 def reload(self, source):
     """Reload the source of a document.  """
     src_bytes = source.encode(Document.encoding, "replace")
     files_map_editor.Fill_Text(self._fe, ctypes.c_char_p(src_bytes),
                                len(src_bytes))