| Operations on Ti Groups (*.tig)

### tifiles_te_create

TIEXPORT2 TigEntry* TICALL tifiles_te_create(const char *filename, FileClass type, CalcModel model)

Allocates a TigEntry structure and allocates fields (aka call #tifiles_content_create_flash/regular for you).

filename : | internal filename in archive.
type : | file type (regular or flash)
model : | calculator model
Return value : | the allocated block.

### tifiles_te_delete

TIEXPORT2 int TICALL tifiles_te_delete(TigEntry* entry)

Destroy a #TigEntry structure as well as fields.

entry : | a #TigEntry structure.
Return value : | none.

### tifiles_te_create_array

TIEXPORT2 TigEntry** TICALL tifiles_te_create_array(int nelts)

Allocate a NULL-terminated array of #TigEntry structures. You have to allocate each elements of the array by yourself.

nelts : | size of NULL-terminated array (number of #TigEntry structures).
Return value : | the array or NULL if error.

### tifiles_te_resize_array

TIEXPORT2 TigEntry** TICALL tifiles_te_resize_array(TigEntry** array, int nelts)

Re-allocate a NULL-terminated array of #TigEntry structures. You have to allocate each elements of the array by yourself.

array : | address of array
nelts : | size of NULL-terminated array (number of #TigEntry structures).
Return value : | the array or NULL if error.

### tifiles_ve_delete_array

TIEXPORT2 void TICALL tifiles_te_delete_array(TigEntry** array)

Free the whole array (data buffer, TigEntry structure and array itself).

array : | an NULL-terminated array of TigEntry structures.
Return value : | none.

### tifiles_te_sizeof_array

TIEXPORT2 int TICALL tifiles_te_sizeof_array(TigEntry** array)

Returns the size of a #TigEntry array.

array : | an NULL-terminated array of TigEntry structures.
r : | number of FileContent entries
f : | number of FlashContent entries
Return value : | none.

### tifiles_content_add_te

TIEXPORT2 int TICALL tifiles_content_add_te(TigContent *content, TigEntry *te)

Adds the entry to the file content and updates internal structures. Beware: the entry is not duplicated.

content : | a file content (TiGroup).
te : | the entry to add
Return value : | the number of entries.

### tifiles_content_del_te

TIEXPORT2 int TICALL tifiles_content_del_te(TigContent *content, TigEntry *te)

Search for entry name and remove it from file content.

content : | a file content (TiGroup).
te : | the entry to remove
Return value : | the number of entries or -1 if not found.

### tifiles_tigroup_add_file

TIEXPORT2 int TICALL tifiles_tigroup_add_file(const char *src_filename, const char *dst_filename)

Add src_filename content to dst_filename content and write to dst_filename.

src_filename : | the file to add to TiGroup file
dst_filename : | the TiGroup file (must exist!)
Return value : | 0 if successful, an error code otherwise.

### tifiles_tigroup_del_file

TIEXPORT2 int TICALL tifiles_tigroup_del_file(TigEntry *entry, const char *filename)

Search for entry and remove it from file.

src_filename : | the file to remove from TiGroup file
dst_filename : | the TiGroup file
Return value : | 0 if successful, an error code otherwise.

### tifiles_tigroup_contents

TIEXPORT2 int TICALL tifiles_tigroup_contents(FileContent **src_contents1, FlashContent **src_contents2, TigContent **dst_content)

Group several #FileContent/#FlashContent structures into a single one. Must be freed when no longer used by a call to #tifiles_content_delete_tigroup.

src_contents1 : | a pointer on an array of #FileContent structures or NULL. The array must be NULL-terminated.
src_contents2 : | a pointer on an array of #FlashContent structures or NULL. The array must be NULL-terminated.
dst_content : | the address of a pointer. This pointer will see the allocated TiGroup file.
Return value : | an error code if unsuccessful, 0 otherwise.

### tifiles_untigroup_content

TIEXPORT2 int TICALL tifiles_untigroup_content(TigContent *src_content, FileContent ***dst_contents1, FlashContent ***dst_contents2)

src_content : | a pointer on the structure to unpack.
dst_contents1 : | the address of your pointer. This pointers will point on a
dst_contents2 : | the address of your pointer. This pointers will point on a
Return value : | an error code if unsuccessful, 0 otherwise.

### tifiles_group_files

TIEXPORT2 int TICALL tifiles_tigroup_files(char **src_filenames, const char *dst_filename)

Group several TI files (regular/flash) into a single one (TiGroup file).

src_filenames : | a NULL-terminated array of strings (list of files to group).
dst_filename : | the filename where to store the TiGroup.
Return value : | an error code if unsuccessful, 0 otherwise.

### tifiles_ungroup_file

TIEXPORT2 int TICALL tifiles_untigroup_file(const char *src_filename, char ***dst_filenames)

src_filename : | full path of file to ungroup.
dst_filenames : | NULL or the address of a pointer where to store a NULL-terminated
Return value : | there is no existence check; files may be overwritten ! %dst_filenames must be freed when no longer used. Return value: an error code if unsuccessful, 0 otherwise.

### tifiles_content_create_tigroup

TIEXPORT2 TigContent* TICALL tifiles_content_create_tigroup(CalcModel model, int n)

Allocates a TigContent structure. Note: the calculator model is not required if the content is used for file reading but is compulsory for file writing.

model : | a calculator model or CALC_NONE.
n : | number of #tigEntry entries
Return value : | the allocated block.

### tifiles_content_delete_tigroup

TIEXPORT2 int TICALL tifiles_content_delete_tigroup(TigContent *content)

Free the whole content of a @TigContent structure and the content itself.

Return value : | none.

### tifiles_file_read_tigroup

TIEXPORT2 int TICALL tifiles_file_read_tigroup(const char *filename, TigContent *content)

This function loads a TiGroup from \a filename and places its content into \a content.

filename : | the name of file to load.
content : | where to store content (may be re-allocated).
Return value : | an error code if unsuccessful, 0 otherwise.

### tifiles_file_write_tigroup

TIEXPORT2 int TICALL tifiles_file_write_tigroup(const char *filename, TigContent *content)

This function store TiGroup contents to file. Please note that contents can contains no data. In this case, the file is void but created.

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

### tifiles_file_display_tigroup

TIEXPORT2 int TICALL tifiles_file_display_tigroup(const char *filename)

This function shows file contents (similar to "unzip -l filename").

filename : | the name of file to load.
Return value : | an error code if unsuccessful, 0 otherwise.

### Return to the main index