TI-Files Functions

Name

TI-Files Functions -- support for manipulating files independantly of the TI File Format.

Synopsis

#include <tiffep.h> (ti_files.h)


Types

struct      FileInfo;
struct      VarInfo;


DLLEXPORTed functions

gint        tiffep_load_file_informations           (gchar *filename,
                                                     FileInfo **fi);
gint        tiffep_load_file_content                (gchar *filename,
                                                     FileInfo **fi);
gint        tiffep_close_file                       (FileInfo *fi);


Internal functions

gint        load_file_informations_82_83_85_86      (FILE *file,
                                                     FileInfo *fi);
gint        load_file_informations_89_92_92p        (FILE *file,
                                                     FileInfo *fi);

gint        load_file_informations_89_92_92p_single (FILE *file,
                                                     FileInfo *fi);
gint        load_file_informations_89_92_92p_backup (FILE *file,
                                                     FileInfo *fi);
gint        load_file_informations_89_92_92p_group  (FILE *file,
                                                     FileInfo *fi);
gint        load_file_informations_89_92_92p_flash  (FILE *file,
                                                     FileInfo *fi);

gint        load_file_content_82_83_85_86           (FILE *file,
                                                     FileInfo *fi);
gint        load_file_content_89_92_92p             (FILE *file,
                                                     FileInfo *fi);

Description

The load_file_informations and load_file_content  provide support for TI files. They load the file and store its content in an format independant FileInfo structure.

Details

struct VarInfo

struct VarInfo
{
  gchar    *var_path;
  gchar    *var_name_b;
  gchar    *var_name_t;
  gint     var_type;
  gint     var_atrb;
  longword var_size;
  byte     *data;
  int      calc_type;
  long     offset;

  int      is_folder;
};

The VarInfo struct is a data structure representing a TI variable. Use the 'Type Conversion Macros' for accssing these fields. Do not use direct access for a better compatibility.
- var_path: the path of the variable,
- var_name_b: the binary name that is to say as stored in the calculator,
- var_name_t: the real name of the variable that is to say readable by human people,
- var_type: the type of variable. Can be one of the following value: TYPE_TEXT, ... See the 'Misc defs' for the complete list of values.
- var_atrb: the attribute of the variable. The variable can be locked, protected or (exclusive or) archived or nothing.
- var_size: the real size of the variable (size of the data block),
- data: the variable content,
- calc_type: the calculator type: 82...92+. A constant such as TYPE_TI92.
- offset: the number of bytes from the beginning of the file up to the data block,
- is_folder: defines whether the structure contains information about a folder entry or a variable entry.



struct FileInfo

struct FileInfo
{
  gchar    *filename;
  gchar    *name;
  gchar    *extension;
  gint     file_type;
  gint     calc_type;
  gint     num_of_vars;
  gchar    *comment;
  gint     data_size;

  GList    *var_list;
  VarInfo  *var_info;
};

The FileInfo struct is a data structure representing a TI file. Use the 'Type Conversion Macros' for accssing these fields. Do not use direct access for a better compatibility.
- filename: the complete name of the file (path, name and extension),
- name: the name of the file with path,
- extension: the extension of the filename,
- file_type: the type of file such as single, group, backup or flash file,
- calc_type: the type of calculator (82...92+),
num_of_vars: the number of variables contained in the specified file,
- comment: the comment stored in the file,
- data_size: the total size of the data block(s),
var_list: a linked list of VarInfo elements. This list contains informations about each variable of the file (group file),
- var_info: simply a pointer on the first element of the var_list field.



tiffep_load_file_informations ()

gint        tiffep_load_file_informations   (gchar *filename,
                                             FileInfo **fi);
This function load all informations about a TI file in the FileInfo structure. The content of the file is not loaded.
The structure passed as argument is the address of a FileInfo pointer which is allocated internally. It must be freed when no longer needed.
filename : the name of a file to load 
fi :
an allocated FileInfo structure
Returns : an error code, 0 otherwise.