Calculator library
Reference manual





What in this manual ?

This documentation is for those who want use the library under Linux or Windows. This library is being ported under BeOS and is going to be ported on Macintosh computers.
The documentation is divided into six chapters:

Chapter 1: Introduction discusses adding the library to your system and provides an overview of handled calculators and available functions.

Chapter 2: Data types tells about the different definition of types which are provided to the user.

Chapter 3: Setting up calculator guides you through the steps to set up the calculator on your computer.

Chapter 4: General functions details the software functions that are not specific to the calculator type.

Chapter 5: Calculator functions details functions that are specific to the calculator.

Chapter 6: Appendices include installation instructions for the libTIcalc library and procedures to add the lib to your system. In addition the Appendix D explains the procedure for compiling programs which use this library. For your convenience separate Appendices cover "Flags for use", a "Code Index" and a list of "Error messages".


I Introduction

Chapter 1 provides an overview of the libTicalc library. The topics covered are:

Overview

The library contains routines to handle the different calculators trough/thru a set of functions. This library is a kind of calculator API.

The supported calculators are: TI82, TI83, TI83+, TI85, TI86; TI89, TI92 and TI92+. The library is well designed (I hope !) so this is not difficult to support a new calculator.

The file format used is the TI's original file format used by the TIGraphLink software.

Remark: the libTIcalc library is (almost) independent of the platform. It can works under Linux, Windows 9x, Windows NT4, Solaris and so on.


Functions

The libTIcalc is a set of 'C' languages subroutines designed to handle the different calculators through a same set of functions. This is a kind of API.

The libTIcalc library (Linux version) was written and tested using gcc under Linux. It was ported under Windows and tested using the Microsoft Visual C++ version 5.0. It seems that others compilers such as Borland C++ 4.0 or DJGPP do not work because they do not support long filenames ! In my mind, Microsoft compiler is a good choice (hmm, I prefer Linux and its GNU tools !).

The functions are supplied both in source form and linked as a DLL. The source code is released under the GPL licence and the libraries under the LGPL license.

Each function is presented with its formal definition, including data types of all input and output variables. A brief description of the purpose of the function is provided along with the legal values for inputs where applicable. All structures and flags used by the libTIcalc library are in Appendix G: "Flags for use".

Functions are written as "C" functions, i.e. they return values. A non zero value signifies an error.


Conventions used

To help differentiate between different kinds of information, the following text styles are used in the Reference Manual.

Functions look like this (charter font).
Variables look like this (courier font).
Parameter look like this (helmet font).
File names look like this (timmons font, bold).
FLAGS look like this (timmons font).


II Data types

Chapter 2 details the different data types provided to the user. These types are defined in the cable_defs.h file.
There are 5 data structures and they are defined as below.

The first one is used to store informations about TI variables. This structure is widely used for directory list, group files, selections and so on. This is the basic element of a linked list.

struct varinfo
{
char varname[9]; // Name of the var
byte vartype; // Type of the var
byte varlocked; // Attribute of the var (locked, archived, none)
longword varsize; // Real size of the var
char translate[9]; // Real name of the var

int is_folder; // 1 if folder, 0 if variable
struct varinfo *folder; // Points to the parent folder (current format)
struct varinfo *next; // Next variable (current format)
};
typedef struct varinfo VAR_INFO;

The first field contains the name of the variable ('binary' name) whereas the fifth contains the real name (as showed in the VAR-LINK menu). The second field contains the type of the variable depending on the calculator type, the third contains the attribute of the variable which can be normal, locked or archived. The fourth field contains the size of the variable (real size as in the VAR-LINK menu).
The last three fields are used for linked list. Linked list are used by the directory list function and the group file header functions. They are also used by tilp for managing selections.
The is_folder field defines whether the structure contains a variable name or a folder name. Use this field to detect a node in the directory list.
The last field implements the linked list.
The seventh field is more particular, this is a pointer on the structure of the parent folder.
Schematic:

The second structure is used for the screendump function only:

struct screen_coord
{
byte width; // real width
byte height; // real height
byte clipped_width; // clipped width (89 for instance)
byte clipped_height; // clipped height (idem)
};
typedef struct screen_coord SCR_COORD;


This structure is modified by the screendump function for providing informations about the screen capture independantly of the calculator type.

The third structure is the structure which contains the set of functions for managing a calculator.

struct ti_calc
{
/* TI byte <-> type conversion functions, defined in the tiXX.c files */
const char * (*byte2type) (byte data);
byte (*type2byte) (char *s);
const char * (*byte2fext) (byte data);
byte (*fext2byte) (char *s);

/* TI routines, defined in the tiXX.c files */
int (*isready) (void);
int (*send_key) (int key);
int (*remote_control) (void);
int (*screendump) (byte **bitmap, byte *width, byte *height);
int (*receive_backup) (FILE *file, int mask_mode, longword *version);
int (*send_backup) (FILE *file, int mask_mode);
int (*directorylist) (struct varinfo *list, int *n_elts);
int (*receive_var) (FILE *file, int mask_mode,
char *varname, byte vartype, byte varlock);
int (*send_var) (FILE *file, int mask_mode);
int (*dump_rom) (FILE *file, int mask_mode);
int (*get_rom_version)(char *version);
int (*send_flash) (FILE *file, int mask_mode);

/* General purpose routines, calc dependant */
char* (*translate_varname) (char *varname, char *translate, byte vartype);
const struct ti_key (*ascii2ti_key) (unsigned char ascii_code);
void (*generate_single_file_header) (FILE *file,
int mask_mode,
const char *id,
struct varinfo *v);
void (*generate_group_file_header) (FILE *file,
int mask_mode,
const char *id,
struct varinfo *list,
int calc_type);

/* General purpose routines, calc independant */
const char* (*group_file_ext) (int calc_type);
const char* (*backup_file_ext) (int calc_type);
const int (*tixx_dir) (int calc_type);
const char* (*pak_name) (int calc_type);
};
typedef struct ti_calc TI_CALC;


You can see that there are 4 subsets of functions:
- the first subset manages the link between the name and its value both for variable type and file extension.
- the second subset contains the functions used to communicate with a TI calculator. These functions are described further in the text.
- the third subset contains general purpose routines which are calc dependant.
- the fourth and last subset contains some general purpose routines which are calc independent.
All these functions will be widely described.

The thourth structure allows some things such as progress bar updates and so on for programs with a GUI (Graphic User Interface). These functions are independent of the GUI but contains some code which is dependant of the GUI.

struct info_update
{
/* Variables to update */
int cancel;
char label_text[MAXCHARS];
float percentage;
float main_percentage;

/* Functions for updating */
void (*msg_box) (const char *t, char *s);
void (*pbar) (void);
void (*label) (void);
void (*refresh) (void);
};
typedef struct info_update INFO_UPDATE;

There are 2 subsets of fields.
The first one contains variables to update or monitor. Cancel is used by the GUI to notify the libTicable that the current transfer must be cancelled/aborted.
The second field is a text label used to display the name of the variable currently transferred.
The third field contains the percentage of the task (one transfer) whereas the fourth one contains the total percentage of the task (a group transfer).

The second subset contains functions used to display in the GUI the updated variables.
The first function display a message box with one label and one or two progress bars according to the operation.
The second function updates the progress bars.
The third function updates the two labels.
The fourth function launches a single loop in the graphic toolkit. Allow the graphic toolkit to capture and manage their events so that the application can respond to the user.

The fiftth structure contains informations about a TI key for a calculator.

struct ti_key
{
char *key_name;
char *key1;
word nothing;
char *key2;
word shift;
char *key3;
word second;
char *key4;
word diamond;
};
typedef struct ti_key TI_KEY;


The first field contains the name of the key such as "SPACE" ???.
To do. I do not remind how it works !!!



III Setting up a calculator

Chapter 2 guides you through the steps to set up a calculator on your computer. Detailed operating instructions for the functions are described in Chapter 3.


Global setup function

To implement the global setup functions call:

1. get_cable_version to check the library version number.
2. set_update to set the update functions used by the calculator functions for display current status.
3. set_calc to set the calculator to use according your calculator type and set the link cable to use. The link cable must have been previously initialized as explained in the libTIcable library documentation.


Setting up a calculator

To set a link cable, you must follow this sequence:

1. set_update: this function must be called prior to any others.
2. set_cable: this function must be called before set_calc for initializing your a link_cable.
3. set_calc: this function must be called whenever you change of calculator type.


IV General functions

Chapter 3 details the software functions that are not specific to a calculator type.
The flags included in each functions are defined in Appendix ?.

The functions listed below are described in this chapter:

get_calc_version
set_update
set_calc

get_calc_error
open_ti_file
close_ti_file


get_calc_version

Description: This functions returns the type the version number of the library as a string. This string as the following format: "major.minor.release" such as "1.1.9".

Syntax: const char *get_calc_version()

Input parameters: none.

Output Parameters: none.

Return values: const char pointer, to a string.


set_update


Description: This functions set up the update functions which are used by all calculator functions for displaying the current status (such as progress bars, text and son on).

Syntax: void set_update(struct info_update *iu,
void (*f1) (const char *, char *),
void (*f2) (void),
void (*f3) (void),
void (*f4) (void))

Input parameters:
-
iu, an info_update structure to fill with the arguments of the set_update function.
- f1, a function pointer on a 'message box' function (used ??).
- f2, a function pointer on a function which refresh the progress bar starting at the info_update.percentage and info_update.main_percentage fields.
- f3, a function pointer on a function which refresh the label starting at the info_update.label_text field.
- f4, a function pointer on a function which run a single loop of the graphic toolkit.

Output Parameters:
- iu, an info_update structure to fill with the arguments of the set_update function.

Return values: none.


set_calc

Description: this functions takes as first parameter the calculator type and as third parameter a link cable structure (get with the libTicable) and returns via the second parameter a structure of functions for managing operations independantly of the calculator type.

Syntax: void set_calc(int type, struct ti_calc *calc, struct link_cable *lc)

Input parameters:
- type: the type of calculator to use which can be one of the following flags: CALC_TI82, CALC_TI83, CALC_TI83P, CALC_TI85, CALC_TI86, CALC_TI89, CALC_TI92 or CALC_TI92P.
- lc: the address of the link_cable structure used with the libTIcable library.

Output Parameters:
- calc: a pointer on a structure which contains the twenty four (24) functions used for manipulating transfers with a TI calculator.

Return values: none.


get_calc_error

Description: returns the string corresponding to the error code returned by a calculator function. This function propagate the error code that is to say it returns the passed error code if it can not find the corresponding error message else it returns 0. This mechanism of propagation is useful for the main program for instance.

Syntax: int get_calc_error(int err_num, char *error_msg)

Input parameters: err_num, an error code returned by a calculator function.

Output Parameters: error_msg, a string which contains the corresponding error message.

Return values: int, 0 if the error code has been caught else the error code.


open_ti_file (subject to change)

Description: this function is used for opening a file. This is a reimplementation of the 'fopen' function.

Syntax: int open_ti_file(char *filename, char *mode, FILE **fd)

Input parameters:
- filename: the name of the file to open in read or write mode, depending on the mode parameter.
- mode: a string such as "rb" or "wt" for definining the file mode.
- fd: the address of a FILE* file descriptor.

Output Parameters: none.

Return values: a non zero value if an error occured.


close_ti_file (subject to change)

Description: this function is used for closing a file previously opened with the 'open_ti_file' function. This is a reimplementation of the 'fclose' function.

Syntax: int close_ti_file()

Input parameters: none.

Output Parameters: none.

Return values: a non zero value if an error occured.


V Calculator related functions

Chapter 4 details the software functions that are specific to calculators but independent of them.
The libTIcalc implements a general set of functions such as the 'remote_control' function but some calculator have not this capability. In this case, the function returns the ERR_VOID_FUNCTION error code.

The functions listed below (grouped by theme) are described in this chapter:

byte2type
type2byte
byte2fext
fext2byte

isready
send_key
remote_control
screendump
receive_backup
send_backup
directorylist
receive_var
send_var
dump_rom
get_rom_version
send_flash

translate_varname
ascii2ti_key
generate_single_file_header
generate_group_file_header

group_file_ext
backup_file_ext
tixx_dir
pak_name (obsolete)


All functions described below returns an error code which can have different origins. It could be a transfer error, a checksum error, an error during the opening of a file and so on. You can get the corresponding error message with the 'get_calc_error' function.

Remarque: ces 4 fonctions ne renvoient pas de code d'erreur. Et que ce passe-t-il si la chaine ne peut etre convertie ou le type n'existe pas ? A méditer...


byte2type

Description: this functions translate a TI vartype into a string. Example: 'STR' corresponds to the vartype 0x0C for a TI92.

Syntax: const char * (*byte2type) (byte data);

Input parameters:
- data, a TI calculator variable type.

Output Parameters: none.

Return values: a constant string containg the fully qualified TI variable type.


type2byte

Description: this function is the opposite function of the previous one. It translates a string variable type into a TI vartype.

Syntax: byte (*type2byte) (char *s);

Input parameters:
- s, a fully qualified TI variable type.

Output Parameters: none.

Return values: the corresponding TI vartype.


byte2fext

Description: this functions translate a TI vartype into a filename extension. Example: 'STR' corresponds to the filename extension ".92s" for a TI92. This function is conform to the filename externsion of TI's software.

Syntax: const char * (*byte2fext) (byte data);

Input parameters:
- data, a TI calculator variable type.

Output Parameters: none.

Return values: a constant string containg the filename extension with the dot ('.').


fext2byte

Description: this function is the opposite function of the previous one. It translates a filename extersion into a TI vartype.

Syntax: byte (*fext2byte) (char *s);

Input parameters:
- s, an extension filename.

Output Parameters: none.

Return values: the corresponding TI vartype.


isready


Description: this functions checks whether the TI calculator is ready.

Syntax: int (*isready) (void);


Input parameters:
none.

Output Parameters: none.

Return values: 0 if successful else an error code which can be turned into a string with the get_calc_error function.

Silent link capability: yes/no.

Supported calculators: yes/no.


send_key

Description: this functions sends a TI key code to the calculator.

Syntax: int (*send_key) (int key);

Input parameters:
- key, a TI scancode key such as KEY92_MODE. This constants are defined in a keysXX.h file.

Output Parameters: none.

Return values: 0 if successful else an error code which can be turned into a string with the get_calc_error function.


remote_control

Description: this functions toggles the calculator in remote control mode.

Syntax: int (*remote_control) (void);

Input parameters: none.

Output Parameters: none.

Return values: 0 if successful else an error code which can be turned into a string with the get_calc_error function.


screendump

Description: this functions does a capture of the screen calculator independantly ontax: int (*screendump) (byte **bitmap, int mask_mode,

struct screen_coord *sc);

Input parameters:

- bitmap, the address of a byte pointer. The function will automatically allocate the appropriate amount of memory for storing the entire screen. Once finished, it is necessary to free this buffer.
- mask_mode, a flag which can be one of the following: FULL_SCREEN or CLIPPED_SCREEN. This is especially useful for the TI89 calculator which have a screen as big as the TI92 one but only a part is displayed on the calculator. The still part can be used via ASM programming.
- sc, the adress of a screen_coord structure. The function use it for storing dependant calculator informations about the screen size (full and clipped size).

Output Parameters:

- bitmap, contains the screendump. The format is simple: one bit by pixel, row by row.
- sc, the screen_coord structure.

Return values: 0 if successful else an error code which can be turned into a string with the get_calc_error function.


receive_backup

Description: this functions either asks a backup and receives it, either waits it and receives it.

Syntax: int (*receive_backup) (FILE *file, int mask_mode, longword *version);

Input parameters:

- file, a file pointer. The file in which the backup will be stored.
- mask_mode, a flag which can be one of the following: MODE_NORMAL or MODE_KEEP_ARCH_ATTRIB (TI89).
- version, a pointer. Once the backup received, it contains the ROM version of the backup (TI92/92+ only).

Output Parameters:

- version, contains the ROM version of the calculator. Useful when the backup must be send for checking that the backup will not be send on a calculator with a different ROM version. This variable has the following format: 0x61566162 for a 1.12 version.

Return values: 0 if successful else an error code which can be turned into a string with the get_calc_error function.


send_backup

Description: this functions sends the backup to the calculator.

Syntax: int (*send_backup) (FILE *file, int mask_mode);

Input parameters:

- file, a file pointer. The file in which the backup has been stored.
- mask_mode, a flag which can be one of the following: MODE_NORMAL or MODE_KEEP_ARCH_ATTRIB (TI89).

Output Parameters: none.

Return values: 0 if successful else an error code which can be turned into a string with the get_calc_error function.


directorylist

Description: this functions does a directory listing of the calculator.

Syntax: int (*directorylist) (struct varinfo *list, int *n_elts);

Input parameters: none.

Output Parameters:
- list, the address of a varinfo structure. This structure is the first element of a linked list in which is stored the directory listing. The linked list is dynamically allocated and built by the directorylist function. The first element contains the current folder and other miscellenaous informations. Next, the others elements (variables or folders) are linked one by one.

- n_elts, the address of an integer variable. The function returns in this variable the number of elements which have been created and linked into the list. Indeed, there are n_elts+1 structures if the first one is counted.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


receive_var

Description: this functions receive one or more variables from the calculator.

Syntax: int (*receive_var) (FILE *file, int mask_mode,

char *varname, byte vartype, byte varlock);

Input parameters:

- file, a FILE pointer on a file opened with the open_ti_file function.

- mask_mode, a constant which describes the operation to do. This constant can be one of the following flags: MODE_RECEIVE_SINGLE_VAR, MODE_RECEIVE_FIRST_VAR, MODE_RECEIVE_VARS or MODE_RECEIVE_LAST_VAR.

- varname, a string. This is the name (full or local) of the variable to receive.
- vartype contains the TI vartype of the requested variable.
- varlock: unused ?!.

Output Parameters:
- varname contains for TI82/83/85/86 the '\0' character if a group file has been received else the varname of the unique variable
.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


send_var

Description: this functions send one or more variables to the calculator.

Syntax: int (*send_var) (FILE *file, int mask_mode);

Input parameters:

- file, a FILE pointer on a file opened with the open_ti_file function.

- mask_mode, a constant which describes the operation to do. This constant can be one of the following flags: MODE_SEND_ONE_VAR, MODE_SEND_LAST_VAR or MODE_SEND_VARS.

Output Parameters: none
.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


dump_rom

Description: this functions dumps the ROM of the calculator.

Syntax: int (*dump_rom) (FILE *file, int mask_mode);

Input parameters:

- file, a FILE pointer on a file opened with the open_ti_file function.

- mask_mode, a constant which describes the ROM type. Can be one of the following flags: ROM_1MB or ROM_2MB.

Output Parameters: none
.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


Note: works only with calculators equipped with FARGO.


get_rom_version

Description: this functions retrieves the ROM version of the calculator.

Syntax: int (*get_rom_version)(char *version);

Input parameters: none.

Output Parameters:

- version, a string containing the ROM version such as "1.11" for a TI92 calculator.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.



send_flash

Description: this functions sends a FLASH application to the calculator (only free FLASH apps).

Syntax: int (*send_flash) (FILE *file, int mask_mode);

Input parameters:

- file, a FILE pointer on a file opened with the open_ti_file function.

- mask_mode, a constant describing the operation to perform. Can be one of the following flags: ??.

Output Parameters: none
.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


translate_varname

Description: this functions translates a binary varname into an explicit varname (ASCII).

Syntax: char* (*translate_varname) (char *varname, char *translate, byte vartype);

Input parameters:

- varname, a string containing the binary name of a variable.

- vartype contains the vartype of the variable.

Output Parameters:

- translate: a pointer on a string. Beware, this string is not allocated by the function. A buffer must be used for this. The functions returns here the ASCII name of the variable. Some variables such as list or matrices on TI82 calculators must be displayed as "L1" or "[M]".


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


ascii2ti_key

Description: this functions translates an ASCII code into a TI scancode.

Syntax: const struct ti_key (*ascii2ti_key) (unsigned char ascii_code);

Input parameters:

- ascii_code: an ASCII code to translate..

Output Parameters:

- a ti_key structure: this structure contains a full TI scancode for differents combinations (Diamond, Alpha and so on).


Return values:
none.


generate_single_file_header

Description: this functions generates the file header for the receiving_var function.

Syntax: void (*generate_single_file_header) (FILE *file,

int mask_mode,

const char *id,

struct varinfo *v);

Input parameters:

- file, a FILE pointer on a file opened with the open_ti_file function.

- mask_mode: a constant which defines the operation to perform. The constant can be one of the following flags: ??.

- id: a constant string dependant of the calculator type. It can be "**TI89**", "**TI92**" or "**TI92+*".

- v, a varinfo structure which gather all required informations about the variable for building the file header.

Output Parameters: none.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


generate_group_file_header

Description: this functions generates the file header for the receiving_var function.

Syntax: void (*generate_group_file_header) (FILE *file,

int mask_mode,

const char *id,

struct varinfo *list,

int calc_type);

Input parameters:

- file, a FILE pointer on a file opened with the open_ti_file function.

- mask_mode: a constant which defines the operation to perform. The constant can be one of the following flags: ??.

- id: a constant string dependant of the calculator type. It can be "**TI89**", "**TI92**" or "**TI92+*".

- list, a linked list of varinfo structures which gather all required informations for building the file header.

- calc_type: the calculator type.

Output Parameters: none.


Return values:
0 if successful else an error code which can be turned into a string with the get_calc_error function.


group_file_ext

Description: this functions returns the file extension of TI grouped files according to the calculator type.

Syntax: const char* (*group_file_ext) (int calc_type);

Input parameters:

- calc_type: the calculator type.

Output Parameters: none.


Return values:
a string wich contains the filename extension such as ".92g" for a TI92 grouped file.


backup_file_ext

Description: this functions returns the file extension of TI backup files according to the calculator type.

Syntax: const char* (*backup_file_ext) (int calc_type);

Input parameters:

- calc_type: the calculator type.

Output Parameters: none.


Return values:
a string wich contains the filename extension such as ".92b" for a TI92 backup file.


const_tixx_dir

Description: this functions returns the TI vartype of a folder according to the calculator type.

Syntax: const int (*tixx_dir) (int calc_type);

Input parameters:

- calc_type: the calculator type.

Output Parameters: none.


Return values:
a value containing the TI vartype such as 0x1C for a TI92 folder.


backup_file_ext (obsolete)

Description: this functions returns the file extension of a PAK files according to the calculator type. PAK files was used by the first versions of tilp. Now, tilp use the original TI file format.

Syntax: const char* (*pak_name) (int calc_type);

Input parameters:

- calc_type: the calculator type.

Output Parameters: none.


Return values:
a string wich contains the filename extension of a PAK file.

VI Appendices

Appendix A: installation instructions.
Appendix B: compiling programs under Linux and/or Windows.
Appendix C: flags for use.
Appendix D: software tools library
Appendix E: Code Index.
Appendix F: Error Messages.
Appendix G: Function Index.


Appendix A: installation instructions

This appendix explains the procedure for adding/using libTIcable library on your system.

Linux procedure: retrieve a tarball of the library source code, make a 'tar xvzf libticable.tar.gz', go into the libTIcable directory. Type 'configure' to check your system and create the Makefile. Next, type 'make' to compile the library and at last, type 'make install' to install it.
By default, the shared object 'libti_cable.so' is placed in the '/usr/lib' directory and necessary links are created.
The headers files are placed in the '/usr/include/ti' directory. For including them, you just have to place a #include <ti/foo.h> on the beginning of your program.

Windows procedure: retrieve a ZIP archive of the library source code and uncompress it in the default folder. Next, place the .DLL file in the same directory than your program (local folder) or place it either in the C:\Windows\System32 directory either in the C:\WinNT\System32 directory according to your OS type.


Appendix B: compiling programs under Linux and/or Windows

Linux procedure: I provide the source of the library. Its installation as described above provides the shared object and necessary headers files. You just have to include the right headers files and compile your program during the linking/last stage with the -lti_cable option on the gcc command line.

Windows procedure: I provide a DLL for use with all versions of Windows and for the Microsoft compiler only. If you want use it with a Borland compiler, you have to recompile the library since the calling conventions are not the same (standard call calling convention ("stdcall") for Borland, C calling convention ("cdecl") for Microsoft).
To compile Windows program, to link together with the appropriate DLL, perform the following steps:
1. a .lib file is provided. Include the .lib file as part of your project.
2. include the "cable_interface.h" header files at the top of your test program. This header file include three files. The first, "typedefs.h" contains some type definitions. The second, "cable_defs.h" contains...


Appendix C: flags for use

Flags are grouped according to the function in which they are used. Some flags are used in more than one function, and they are duplicated in each section for clarity. Most flags are input parameters to the functions they are listed under.

NOTE: Always use flags where provided, rather than the value associated with it, since values may change. For example, use LINK_TGL with set_cable rather than 1.


is_folder (varinfo structure)

VARIABLE

0

The struct describes a variable

FOLDER

1

The struct describes a folder



screendump

FULL_SCREEN

0

Full screen

CLIPPED_SCREEN

1

Clipped screen



Path

FULL_PATH

0

Variable with full path

LOCAL_PATH

1

Variable in local folder



File format

NORMAL_FORMAT

0

Use normal file format (don't keep archive attribute)

EXTENDED_FORMAT

1

Use extended file format (keep the archive attribute in the file)



Calculator type

CALC_TI92P

1

TI92+ calculator type

CALC_TI92

2

TI92 calculator type

CALC_TI89

3

TI89 calculator type

CALC_TI86

4

TI86 calculator type

CALC_TI85

5

TI85 calculator type

CALC_TI83P

6

TI83+ calculator type

CALC_TI83

7

TI83 calculator type

CALC_TI82

8

TI82 calculator type

CALC_TI73

9

TI73 calculator type



Transfer mode

MODE_NORMAL

0

Blank parameter

MODE_RECEIVE_SINGLE_VAR

1

One variable to receive, not a group

MODE_RECEIVE_FIRST_VAR

2

The first var of a group to receive

MODE_RECEIVE_VARS

4

Neither the first var, neither the last var of a group file to receive

MODE_RECEIVE_LAST_VAR

8

The last var of a group to receive

MODE_SEND_ONE_VAR

16

Send a unique variable (not a group of vars)

MODE_SEND_LAST_VAR

32

Send the last varriable of a group file

MODE_SEND_VARS

64

Send the variables but not the last of a group file

MODE_LOCAL_PATH

128

Send variable in the current folder

MODE_FULL_PATH

256

Send variable in the original folder

MODE_USE_2ND_HEADER

512

Force sending, even if the variable already exists

MODE_IDLIST

1024

Request an Idlist

MODE_APPS

2048

Send a free FLASH application

MODE_AMS

4096

Send a FLASH Operating System (such as AMS)



ROMdump

ROM_1MB

1

Receive an 1 MegaBytes ROM

ROM_2MB

2

Receive a 2 MegaBytes ROM



Appendix D: software tools library


Filename

Ext

Description

Ti82

C/H

Manage the TI82 calculator

Ti83

C/H

Manage the TI83 calculator

Ti83p

C/H

Manage the TI83+

Ti85

C/H

Manage the TI85

Ti86

C/H

Manage the TI86

Ti89

C/H

Manage the TI89

Ti92

C/H

Manage the TI92

Ti92p

C/H

Manage the TI92+ calculator

Probe

C

Try to auto-detect the calculator type

Const

C/H

Functions which contains some constants such as file extensions...

Group

C/H

Generates the file header for single and group files

Trans

C/H

Translate some binary varname into explicit varnames

Verbose

C/H

A platform dependant display function

Interface

C

The interface of the library

Error

C/H

Manage the error codes and error messages

Errorcodes

H

The list of error codes and error messages

Calc_defs

H

Structure and macro definitions

Calc_interface

H

The header which contains the prototype of exported functions




Defs82

H

Macro definitions for the TI82 calculator

Defs83

H

Macro definitions for the TI83 calculator

Defs83p

H

Macro definitions for the TI83+ calculator

Defs85

H

Macro definitions for the TI85 calculator

Defs86

H

Macro definitions for the TI86 calculator

Defs89

H

Macro definitions for the TI89 calculator

Defs92

H

Macro definitions for the TI92 calculator

Defs92p

H

Macro definitions for the TI92+ calculator




Keys89

H

Macro definitions for the TI89 keys

Keys92

H

Macro definitions for the TI92 keys


La doc s'arrête ici !!!
Doc stops here !!!


Appendix E: Code Index

The libTIcable is a set of 'C' language subroutines designed to handle the different link cable types though a unique set of functions. Below is an alphabetical listing of all libTIcable functions and the name of the C file which contains its programming code.

The functions below are exported functions:

Driver function

Code filename

get_calc_version

interface.c

set_update

interface.c

set_calc

interface.c

open_ti_file

interface.c

close_ti_file

interface.c



get_calc_error

Error.c



The functions below are internal functions:

Driver function

Code filename

par_init_port, par_open_port, par_put, par_get, par_probe, par_close_port, par_term_port, par_check_port

Parlink.c

ser_init_port, ser_open_port, ser_put, ser_get, ser_probe_port, ser_close_port, ser_term_port, ser_check_port

Serlink.c

tig_init_port, tig_open_port, tig_put, tig_get, tig_probe_port, tig_close_port, tig_term_port, tig_check_port

Tiglink.c

avr_init_port, avr_open_port, avr_put, avr_get, avr_probe_port, avr_close_port, avr_term_port, avr_check_port

Avrlink.c

vtl_init_port, vtl_open_port, vtl_put, vtl_get, vtl_probe_port, vtl_close_port, vtl_term_port, vtl_check_port

Vtllink.c

detect_port

probe_cable.c

detect_cable




Appendix F: Error Messages

All routines in the libTIcable are written as 'C' functions i.e., thery return values. A non zero value signifies an error. Full error messages may be printed using the get_cable_error function. Below is a list of all error messages, the value of each, and an explanation of the error.

L = Linux
W = Windows9x or Windows NT4

Error code

Value

L & W

Explanation

ERR_ABORT

-1

L/W

Operation aborted

ERR_ROOT

1

L

Root permissions required

ERR_SND_BIT_TIMEOUT

2

L/W

Send bit timeout

ERR_RCV_BIT_TIMEOUT

3

L/W

Receive bit timeout

ERR_OPEN_SER_DEVICE

32

L

Unable to open a serial device (/dev/ttySx)

ERR_SND_BYT

33

L/W

Send byte error

ERR_RCV_BYT

34

L/W

Receive byte error

ERR_SND_BYT_TIMEOUT

36

L/W

Send byte timeout

ERR_RCV_BYT_TIMEOUT

35

L/W

Receive byte timeout

ERR_CREATE_FILE

41

W

Unable to open a COM port (COMx)

ERR_OPEN_COM_PORT

42

W

Unable to open a COM port (COMx)

ERR_READ_FILE

47

W

Error while reading the COM port

ERR_OPEN_TIDEV_DEV

48

L

Error while opening a 'tidev' char device

ERR_VT0_ALREADY_USED

49

L/W

Error when the pipe is already used

ERR_VT1_ALREADY_USED

50

L/W

Error when the pipe is already used

ERR_OPEN_PIPE

51

L/W

Unable to open a pipe

ERR_PIPE_FCNTL

52

L

Unable to modify the pipe characteristics

ERR_OPP_NOT_AVAIL

53

L/W

No answer

ERR_CLOSE_PIPE

54


Unable to close a pipe

ERR_BYTE_LOST

55

L

A byte might have been lost due to check_port

ERR_ILLEGAL_OP

56

L

An illegal argument has been used



Appendix G: Function Index

To do...

---------------------

I hope this documentation to be useful. If you have comments, suggestions, and so on, feel free to mail me.
If you want additional informations, fire me an e-mail...

libTIcalc, (c) 1999-2000, Romain Liévin
All code is placed under GPL license and libraries under the LGPL license.
Lib version 1.2.5 devel.
Doc version 1.0, 2000/09/28.
This doc has been written with StarOffice 5.1 Personnal Edition for Linux. SGML could be a better choice but I have not enough time to learn it ...