| Operations on TI files (single/group only)

### tifiles_content_create_regular

TIEXPORT2 FileContent* TICALL tifiles_content_create_regular(CalcModel model)

Allocates a #FileContent structure.

model : | a calculator model (required).
Return value : | the allocated block.

### tifiles_content_delete_regular

TIEXPORT2 int TICALL tifiles_content_delete_regular(FileContent *content)

Free the whole content of a #FileContent structure.

Return value : | 0.

### tifiles_content_dup_regular

TIEXPORT2 FileContent* TICALL tifiles_content_dup_regular(FileContent *content)

Allocates and copies a new #FileContent structure.

Return value : | none.

### tifiles_file_read_regular

TIEXPORT2 int tifiles_file_read_regular(const char *filename, FileContent *content)

Load the single/group file into a FileContent structure.

filename : | name of single/group file to open.
content : | where to store the file content.
Return value : | an error code, 0 otherwise.

### tifiles_file_write_regular

TIEXPORT2 int tifiles_file_write_regular(const char *filename, FileContent *content, char **real_fname)

Write one (or several) variable(s) into a single (group) file. If filename is set to NULL, the function build a filename from varname and allocates resulting filename in %real_fname. %filename and %real_filename can be NULL but not both !

filename : | name of single/group file where to write or NULL.
content : | the file content to write.
real_fname : | pointer address or NULL. Must be freed if needed when no longer needed.
Return value : | an error code, 0 otherwise.

### tifiles_file_display_regular

TIEXPORT2 int TICALL tifiles_file_display_regular(FileContent *content)

Display file content information contained in a FileContent structure.

content : | the file content to show, a FileContent pointer.
Return value : | an error code, 0 otherwise.

### tifiles_content_create_backup

TIEXPORT2 BackupContent* TICALL tifiles_content_create_backup(CalcModel model)

Allocates a BackupContent structure.

model : | a calculator model or CALC_NONE.
Return value : | the allocated block.

### tifiles_content_delete_backup

TIEXPORT2 int TICALL tifiles_content_delete_backup(BackupContent *content)

Free the whole content of a BackupContent structure.

Return value : | none.

### tifiles_file_read_backup

TIEXPORT2 int tifiles_file_read_backup(const char *filename, BackupContent *content)

Load the backup file into a BackupContent structure.

filename : | name of backup file to open.
content : | where to store the file content.
Return value : | an error code, 0 otherwise.

### tifiles_file_write_backup

TIEXPORT2 int tifiles_file_write_backup(const char *filename, BackupContent *content)

Write backup into file.

filename : | name of backup file where to write.
content : | the file content to write.
Return value : | an error code, 0 otherwise.

### tifiles_file_display_backup

TIEXPORT2 int TICALL tifiles_file_display_backup(BackupContent *content)

Display file content information.

content : | the file content to show.
Return value : | an error code, 0 otherwise.

### tifiles_content_create_flash

TIEXPORT2 FlashContent* TICALL tifiles_content_create_flash(CalcModel model)

Allocates a #FlashContent structure.

model : | a calculator model (compulsory).
Return value : | the allocated block.

### tifiles_content_delete_flash

TIEXPORT2 int TICALL tifiles_content_delete_flash(FlashContent *content)

Free the whole content of a #FlashContent structure.

Return value : | always 0.

### tifiles_content_dup_flash

TIEXPORT2 FlashContent* TICALL tifiles_content_dup_flash(FlashContent *content)

Allocates and copies a new FlashContent structure.

Return value : | none.

### tifiles_file_read_flash

TIEXPORT2 int tifiles_file_read_flash(const char *filename, FlashContent *content)

Load the FLASH file into a FlashContent structure.

filename : | name of FLASH file to open.
content : | where to store the file content.
Return value : | an error code, 0 otherwise.

### tifiles_file_write_flash2

TIEXPORT2 int tifiles_file_write_flash2(const char *filename, FlashContent *content, char **real_fname)

Write a FLASH content to a file. If filename is set to NULL, the function build a filename from appname and allocates resulting filename in %real_fname. %filename and %real_fname can be NULL but not both !

filename : | name of flash file where to write or NULL.
content : | the file content to write.
real_fname : | pointer address or NULL. Must be freed if needed when no longer needed.
Return value : | an error code, 0 otherwise.

### tifiles_file_write_flash

TIEXPORT2 int tifiles_file_write_flash(const char *filename, FlashContent *content)

Write a FLASH content to a file. If filename is set to NULL, the function build a filename from appname.

filename : | name of flash file where to write or NULL.
content : | the file content to write.
Return value : | an error code, 0 otherwise.

### tifiles_file_display_flash

TIEXPORT2 int TICALL tifiles_file_display_flash(FlashContent *content)

Display file content information.

content : | the file content to show.
Return value : | an error code, 0 otherwise.

### tifiles_file_display

TIEXPORT2 int TICALL tifiles_file_display(const char *filename)

Determine file class and display internal content.

filename : | a TI file.
Return value : | an error code, 0 otherwise.

### tifiles_create_table_of_entries

TIEXPORT2 int** tifiles_create_table_of_entries(FileContent *content, unsigned int *nfolders)

The goal of this function is to parse the file content structure in order to build a table of entries so that it's easy to write it just after the header in a group file. Mainly used as an helper. The returned 'table' is an NULL-terminated array of int* pointers. Each pointers points on an integer array. Each cell are an index on the 'VarEntry* entries' array.

content : | a TI file content structure.
nfolders : | returns the number of folders in the file.
Return value : | a 2-dimensions allocated integer array. Must be freed with tifiles_free_table_of_entries when no longer used.

### Return to the main index