Type Conversion Macros

Name

Type Conversion Macros -- macros for accessing some structure fields.

Synopsis

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


#define     FILEINFO_FILENAME               (fi)
#define     FILEINFO_NAME                   (fi)
#define     FILEINFO_EXTENSION              (fi)
#define     FILEINFO_FILETYPE               (fi)
#define     FILEINFO_CALCTYPE               (fi)
#define     FILEINFO_NUMVARS                (fi)
#define     FILEINFO_COMMENT                (fi)
#define     FILEINFO_VARINFO                (fi)
#define     FILEINFO_VARLIST                (fi)
#define     FILEINFO_SIZE                   (fi)

#define     VARINFO_PATH                    (vi)
#define     VARINFO_CALCNAME                (vi)
#define     VARINFO_REALNAME                (vi)
#define     VARINFO_TYPE                    (vi)
#define     VARINFO_ATTRIBUTE               (vi)
#define     VARINFO_SIZE                    (vi)
#define     VARINFO_VARSIZE                 (vi)
#define     VARINFO_CONTENT                 (vi)
#define     VARINFO_CALCTYPE                (vi)
#define     VARINFO_ISFOLDER                (vi)
#define     VARINFO_OFFSET                  (vi)

Description

These macros provide a portable method for accessing the fields of VarInfo and FileInfo structures (these structures are described in another topic).

Moreover, these macros allow me to change (eventually) some fields without changing the source code of program which could use the TiFFEP library.
 

Details

FILEINFO_FILENAME()

#define FILEINFO_FILENAME(fi)      ((fi)->filename)

Access the filename field of the FileInfo structure and return the fully qualified name of the file (path and name with extension).

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_NAME()

#define FILEINFO_FILENAME(fi)      ((fi)->name)

Access the name field of the FileInfo structure and return only the name of the file (with extension).

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_EXTENSION()

#define FILEINFO_EXTENSION(fi)      ((fi)->extension)

Access the extension field of the FileInfo structure and returns only the extension of the file.

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_FILETYPE()

#define FILEINFO_FILETYPE(fi)      ((fi)->file_type)

Access the filetype field of the FileInfo structure and returns the type of the file (backup, single, group, flash, ...). The returned value is a constant such as FILE_SINGLE.

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_CALCTYPE()

#define FILEINFO_CALCTYPE(fi)      ((fi)->calc_type)

Access the calctype field of the FileInfo structure and returns the calculator type associated with the file. The returned value is a constant such as CALC_TI92.

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_NUMVARS()

#define FILEINFO_NUMVARS(fi)      ((fi)->nul_of_vars)

Access the numvars field of the FileInfo structure. The returned value is the number of files contained in a group file, 1 otherwise.

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_COMMENT()

#define FILEINFO_FILENAME(fi)      ((fi)->comment)

Access the comment field of the FileInfo structure. The returned value is the comment stored in the file.

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_VARINFO()

#define FILEINFO_FILENAME(fi)      ((fi)->var_info)

Access the varinfo field of the FileInfo structure. The returned value is a pointer on the  the first element of the varlist (GList) which is made up of VarInfo structures.

 
i : a FileInfo structure.
Returns : the corresponding field. 

FILEINFO_VARLIST()

#define FILEINFO_FILENAME(fi)      ((fi)->var_list)

Access the varlist field of the FileInfo structure. The returned value is a pointer on the varlist linked list (GList) which is made up of VarInfo structures.

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_PATH()

#define VARINFO_PATH(vi)      ((vi)->var_path)

Access the path field of the VarInfo structure. The returned string contains the original location of the variable when received.

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_CALCNAME()

#define VARINFO_CALCNAME(vi)      ((vi)->var_name_b)

Access the calcname field of the VarInfo structure. The returned value is an array of char which contains the name of the variable as stored on the calculator. This is called the binary name.

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_REALNAME()

#define VARINFO_REALNAME(vi)      ((vi)->var_name_t)

Access the realname field of the VarInfo structure. The returned value is a string which contains the name of the variable under a readable form. This is called the real name.

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_TYPE()

#define VARNFO_TYPE(vi)      ((vi)->var_type)

Access the type field of the VarInfo structure. The returned value is a calculator independant value which represent the type of the variable (TYPE_TEXT, ...).

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_ATTRIBUTE()

#define VARINFO_ATTRIBUTE(vi)      ((vi)->var_attr)

Access the attribute field of the VarInfo structure. The returned value is an integer such as ATTRB_NONE, ATTRB_LOCK, ATTRB_ARCHIVE or ATTRB_PROTECTED.

 
i : a VarInfo structure.
Returns : the corresponding field. 

VARINFO_SIZE()

#define VARINFO_SIZE(vi)      ((vi)->var_size)

Access the sizee field of the VarInfo structure. The returned value is the real size of the variable (data content length).

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_CONTENT()

#define VARINFO_CONTENT(vi)      ((vi)->data)

Access the content field of the VarInfo structure. The returned value is a pointer (byte *) on the raw data content of the variable.

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_CALCTYPE()

#define VARINFO_CALCTYPE(vi)      ((vi)->calc_type)

Access the calctype field of the VarInfo structure. The retuned value is a constant defining the calculator type (CALC_TI92, ...).

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_ISFOLDER()

#define VARINFO_ISFOLDER(vi)      ((i)->is_folder)

Access the isfolder field of the VarInfo structure. The returned value is a constant which can be either IS_FOLDER or IS_VARIABLE according to the information stored in the structure.

 
i : a FileInfo structure.
Returns : the corresponding field. 

VARINFO_OFFSET()

#define VARINFO_OFFSET(vi)      ((vi)->offset)

Access the offset field of the VarInfo structure. The returned value is the offset of the variable entry in the TI file. This offset is 0 for the beginning of the file.

 
i : a FileInfo structure.
Returns : the corresponding field.