Table Management

Reference Section

_ctbl_to_iptr
_ctbl_to_lptr
_ctbl_to_ptr
_index_char
_index_int
_is_inctbl
_is_initbl
_is_inxctbl
_is_inxitbl
_itbl_to_iptr
_itbl_to_lptr
_itbl_to_ptr
_xctbl_to_iptr
_xctbl_to_lptr
_xctbl_to_ptr
_xindex_char
_xindex_int
_xitbl_to_iptr
_xitbl_to_lptr
_xitbl_to_ptr
_xlat_char
_xlat_int
_xxlat_char
_xxlat_int

_ctbl_to_iptr


Descrip
Gets a pointer to a int array element using a char reference table.

Syntax
#include <table.h>
int near *_ctbl_to_iptr(const char far *table, char chr);

Returns
A pointer to the corresponding element in the array if chr was found in table.

NULL if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, a pointer to the corresponding element in the integer array is returned. If no matching character is found, NULL is returned.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of chr in table by 2 and then adding this to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64k.

The format of a char-to-int reference table is as follows:

struct {
int near *array; /* Address of array (near pointer) */
int entries; /* Number of entries in this table */
char tbl_start[NUM_ENTRIES];/* Table starts here */
} table;

When using the above structure, the tbl_start field would be specified for the table parameter. See the technical notes for more information.

C/C++ Example
	{
	   int array[5] = {10,20,30,40};
	   int near *pointer;
	   struct {
	      int near *array;
	      int entries;
	      char tbl[6];
	   } table = {NULL, 5, "123"};
	   table.array = (int near *)array;
	   ...
	   pointer = _ctbl_to_iptr (table.tbl, '3');
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   int array[5] = {10,20,30,40,50};
	   struct {
	    int near *array;
	    int entries;
	    char tbl[6];
	      } table = {NULL, 5, "12345"};
	   ...
	   table.array = (int near *)array;
	   lea bx,table.tbl/* DS:BX -> table */
	   mov al,'3'	/* AL = reference char */
	ctbl_to_iptr ();/* was char found? */
	 jc c_to_iptr_010/*   n: go continue */
	...    	 /*   y: handle "not found" */
	c_to_iptr_010:
	...
	}

Source file _TBPTRCI.ASM ASM equiv BTBL_TO_WPTR
See also
_ctbl_to_lptr, _ctbl_to_ptr, _is_inctbl, _itbl_to_iptr, _xctbl_to_iptr

_ctbl_to_lptr


Descrip
Gets a pointer to a long array element using a char reference table.

Syntax
#include <table.h>
long int near *_ctbl_to_lptr(const char far *table, char chr);

Returns
A pointer to the corresponding element in the array if chr was found in table.

NULL if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, the address of the corresponding element in the long int array is returned. NULL is returned if no matching character is found.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of chr in table by 4 and then adding this to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64k.

The format of a char-to-long reference table is as follows:

struct {
long int near *array;/* Address of array (near pointer) */
int entries; /* Number of entries in this table */
char tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

When using the above structure, the tbl_start field would be specified for the table parameter. See the technical notes for more information.

C/C++ Example
	{
	   long int array[5] = {10,20,30,40};
	   long int near *pointer;
	   struct {
	      long int near *array;
	      int entries;
	      char tbl[6];
	   } table = {(long int near *)NULL, 5, "123"};
	   table.array = (long int near *)array;
	   ...
	   pointer = _ctbl_to_lptr (table.tbl, '3');
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   long int array[5] = {10,20,30,40,50};
	   struct {
	 long int near *array;
	 int entries;
	 char table[6];
	   } table = {NULL, 5, "12345"};
	...
	table.array = (long int near *)array;
	lea bx,table.table/* DS:BX -> table */
	mov al,'3'	 /* AL = reference char */
	ctbl_to_lptr ();/* was char found? */
	 jc c_to_lptr_010/*   n: go continue */
	...    	 /*   y: handle "not found" */
	c_to_lptr_010:
	...
	}

Source file _TBPTRCL.ASM ASM equiv BTBL_TO_DPTR
See also
_ctbl_to_iptr, _ctbl_to_ptr, _is_inctbl, _itbl_to_lptr, _xctbl_to_lptr

_ctbl_to_ptr


Descrip
Gets a pointer to an array element using a char reference table.

Syntax
#include <table.h>
void near *_ctbl_to_ptr(const char far *table, char chr, int size);

Returns
A pointer to the corresponding element in the array if chr was found in table.

NULL if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, a pointer to the corresponding element in the array is returned. If no matching character is found, NULL is returned.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of chr in table by size and then adding this to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64k.

The format of a char reference table is as follows:

struct {
void near *array; /* Address of array (near pointer) */
int entries; /* Number of entries in this table */
char tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

When using the above structure, the tbl_start field would be specified for the table parameter. See the technical notes for more information.

C/C++ Example
	{
	   struct filestru {
	      char filename[13];
	      int date;
	      long int size;
	      int attr;
	   };
	   struct filestru array[5];
	   struct filestru near *pointer;
	   struct {
	      struct filestru near *array;
	      int entries;
	      char tbl[6];
	   } table = {NULL, 5, "123"};
	   table.array = (struct filestru near *)array;
	   ...
	   pointer = (struct filestru*)_ctbl_to_ptr (table.tbl, '3',
	      sizeof (struct filestru));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct filestru {
	   char filename[13];
	   int date;
	   long int size;
	   int attr;
	      };
	   struct filestru array[5];
	   int size = sizeof (struct filestru);
	   struct {
	    struct filestru near *array;
	    int entries;
	    char table[6];
	      } table = {NULL, 5, "12345"};
	   ...
	   table.array = (struct filestru near *)array;
	   lea bx,table.table/* DS:BX -> table */
	   mov al,'3'	/* AL = reference char */
	   mov cx,size	    /* CX = element size */
	   ctbl_to_ptr ();    /* was char found? */
	    jc c_to_ptr_010/*   n: go continue */
	   ... 	 	/*   y: handle "not found" */
	c_to_ptr_010:
	   ...
	}

Source file _TBPTRC.ASM ASM equiv BTBL_TO_PTR
See also
_ctbl_to_iptr, _ctbl_to_lptr, _is_inctbl, _itbl_to_ptr, _xctbl_to_ptr

_index_char


Descrip
Determines the index of a char in an index table.

Syntax
#include <table.h>
int _index_char(const char far *table, char chr);

Returns
The index of chr in table if chr was found in table.

-1 if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, its index is returned. -1 is returned if no matching character is found.

Indices for table entries are numbered sequentially in ascending order from the starting index. For example, a table with 25 entries and a starting index of 13 would have indices ranging from 13 to 37. The return value is undefined if the resulting index exceeds 64k.

The format of an index table is as follows:

struct {
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
char tbl_start[NUM_ENTRIES]/* start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   char index;
	   struct {
	      int start;
	      int entries;
	      char tbl[5];
	   } table = {'a', 4, "ab"};
	   ...
	   index = _index_char (table.tbl, 'a');
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct {
	int start;
	int entries;
	char table[5];
	   } table = {'a', 4, "abcd"};
	...
	lea bx,table.table/* DS:BX -> table */
	mov al,'a'	 /* AL = char to locate */
	index_char ();	 /* was char found? */
	 jc dx_char_010/*   n: go continue */
	...    	 /*   y: "not found" condition */
	dx_char_010:
	...
	}

Source file _TBINDC.ASM ASM equiv INDEX_BYTE
See also
_index_char, _xlat_char

_index_int


Descrip
Determines the index of an int in an index table.

Syntax
#include <table.h>
int _index_int(const int far *table, int num);

Returns
Index of num in table if num was found in table.

-1 if num was not found in table

Notes
This function searches table, starting with the first entry, until an integer is found which matches num. If a matching integer is found, its index is returned. -1 is returned if no matching integer is found.

Indices for table entries are numbered sequentially in ascending order from the starting index. For example, a table with 25 entries and a starting index of 13 would have indices ranging from 13 to 37. The return value is undefined if the resulting index exceeds 64k.

The format of an index table is as follows:

struct {
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
int tbl_start[NUM_ENTRIES]/* start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int index;
	   struct {
	      int start;
	      int entries;
	      int tbl[5];
	   } table = {10, 4, 10, 20, 3};
	   ...
	   index = _index_int (table.tbl, 10);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct {
	    int start;
	    int entries;
	    int table[5];
	    } table = {10, 4, {10, 20, 30, 40}};
	   ...
	   lea bx,table.table/* DS:BX -> table */
	   mov ax,10	/* AX = int to locate */
	   index_int ();	/* was int found? */
	    jncdx_int_010/*   y: go continue */
	   ... 	 	/*   n: "not found" */
	dx_int_010:
	   ...
	}

Source file _TBINDI.ASM ASM equiv INDEX_WORD
See also
_index_int, _xlat_int

_is_inctbl


Descrip
Checks for the presence of a char in a char table.

Syntax
#include <table.h>
int _is_inctbl(const char far *table, char chr);

Returns
1 if chr was found in table.

0 if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. 1 is returned if a matching character is found. 0 is returned if no matching character is found.

The format of a character table is as follows:

struct {
int num_entries; /* number of entries in the table */
char tbl_start[NUM_ENTRIES];/* start of the table */
}table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

The above table format is a subset of both the index and reference table formats (including the extended versions of these formats). Therefore, this function may also be used on any of these tables.

C/C++ Example
	{
	   struct {
	      int start;
	      int entries;
	      char tbl[5];
	   } table = {'a', 4, "ab"};
	   if (_is_inctbl (table.tbl, 'a'))
	   {
	      ...
	   } else
	   {
	      ...
	   }
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct {
	    int start;
	    int entries;
	    char table[5];
	   } table = {'a', 4, "abcd"};
	   ...
	   lea bx,table.table/* DS:BX -> table */
	   mov al,'a'	/* AL = char to locate */
	   is_inctbl ();	/* was char found? */
	    jc is_inc_010/*   n: continue */
	   ... 	 	/*   y: character located */
	is_inc_010:
	   ...
	}

Source file _TBCHKC.ASM ASM equiv IS_INBTBL
See also
_index_char, _is_initbl, _is_inxctbl, _xlat_char

_is_initbl


Descrip
Checks for the presence of a int in a int table.

Syntax
#include <table.h>
int _is_initbl(const int far *table, int num);

Returns
1 if num was found in table.

0 if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer is found which matches num. 1 is returned if a matching integer is found. 0 is returned if no matching integer is found.

The format of an integer table is as follows:

struct {
int num_entries; /* number of entries in table */
int tbl_start[NUM_ENTRIES];/* start of the table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

The above table format is a subset of both the index and reference table formats (including the extended versions of these formats). Therefore, this function may also be used on any of these tables.

C/C++ Example
	{
	   struct {
	      int start;
	      int entries;
	      int tbl[5];
	   } table = {0,5,10,20,30};
	   if (_is_initbl (table.tbl, 10))
	   {
	      ...
	   } else
	   {
	      ...
	   }
	}

Inline Assembly Example
	#include <inline.h>
	   {
	      struct {
	    int start;
	    int entries;
	    int table[5];
	   } table = {0, 5, {10,20,30,40,50}};
	   ...
	   lea bx,table.table/* DS:BX -> table */
	   mov ax,10	/* AX = int to locate */
	   is_initbl ();	/* was int found? */
	    jc is_ini_010/*   n: continue */
	   ... 	 	/*   y: character located */
	is_ini_010:
	   ...
	}

Source file _TBCHKI.ASM ASM equiv IS_INWTBL
See also
_index_int, _is_inctbl, _is_inxitbl, _xlat_int

_is_inxctbl


Descrip
Checks for the presence of char in an extended char table.

Syntax
#include <table.h>
int _is_inxctbl(const char far *table, char chr);

Returns
1 if chr was found in table.

0 if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. 1 is returned if a matching character is found. If no matching character is found, the next table in the chain is searched, and so on. 0 is returned if no matching character is found in any of the chained tables.

The format of extended character table is as follows:

struct {
char near *next; /* Offset of next table in chain (-1=none) */
int ignored; /* (not used by this function) */
int num_entries; /* Number of entries in table */
char tbl_start[NUM_ENTRIES]/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

The above table format is identical to both the extended index and extended reference table formats, so this function may be used on any of these extended tables.

C/C++ Example
	{
	   struct {
	      char near *next;
	      int start;
	      int entries;
	      char tbl[5];
	   } table2 = {(char near *)-1, 'a', 4, "ab"},
	   table1 = {NULL,'A', 4,"AB"};
	   table1.next = (char near *)table2.tbl;
	   if (_is_inxctbl (table1.tbl, 'a'))
	   {
	      ...
	   } else
	   {
	      ...
	   }
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct tbl{
	    char near *next;
	    int start;
	    int entries;
	    char table[5];
	   };
	   struct tbl table2 = {(char near *)-1, 'a', 4, "abcd"};
	   struct tbl table1 = {NULL,'A', 4,"ABCD"};
	   ...
	   table1.next = (char near *)table2.table;
	   lea bx,table1.table/* DS:BX -> table */
	   mov al,'a'	/* AL = char to locate */
	   is_inxctbl ();	/* was char found? */
	    jc is_inxc_010/*   n: continue */
	   ... 	 	/*   y: character located */
	is_inxc_010:
	   ...
	}

Source file _TBXCHKC.ASM ASM equiv IS_INXBTBL
See also
_xindex_char, _is_inxitbl, _is_inctbl, _xxlat_char

_is_inxitbl


Descrip
Checks for the presence of a int in an extended int table.

Syntax
#include <table.h>
int _is_inxitbl(const int far *table, int num);

Returns
1 if num was found in table.

0 if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer is found which matches num. 1 is returned if a matching integer is found. If no matching integer is found, the next table in the chain is searched, and so on. 0 is returned if no matching integer is found in any of the chained tables.

The format of extended integer table is as follows:

struct {
int near *next; /* Offset of next table in chain (-1=none) */
int ignored; /* (not used by this function) */
int num_entries; /* Number of entries in table */
int tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

The above table format is identical to both the extended index and extended reference table formats, so this function may be used on any of these extended tables.

C/C++ Example
	{
	   struct table {
	      int near *next;
	      int start;
	      int entries;
	      int tbl[5];
	   };
	   struct table table2 = {(int near *)-1, 0, 5, 10,20,30,};
	   struct table table1 = {NULL, 0, 5, 11,21,31,};
	   table1.next = (int near *)table2.tbl;
	   if (_is_inxitbl (table1.tbl, 10))
	   {
	      ...
	   } else
	   {
	      ...
	   }
	}

Inline Assembly Example
	#include <inline.h>
	{
	      struct tbl {
	    int near *next;
	    int start;
	    int entries;
	    int table[5];
	   };
	   struct tbl table2 = {(int near *)-1, 0, 5, {10,20,30,40,50}};
	   struct tbl table1 = {NULL, 0, 5, {11,21,31,41,51}};
	   ...
	   table1.next = (int near *)table2.table;
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,10	/* AX = int to locate */
	   is_inxitbl ();	/* was int found? */
	    jc is_inxi_010/*   n: continue */
	   	  ... 	/*   y: character located */
	is_inxi_010:
	   ...
	}

Source file _TBXCHKI.ASM ASM equiv IS_INXWTBL
See also
_xindex_int, _is_inxctbl, _is_initbl, _xxlat_int

_itbl_to_iptr


Descrip
Gets a pointer to a int array element using an int reference table.

Syntax
#include <table.h>
int near *_itbl_to_iptr(const int far *table, int num);

Returns
A pointer to the corresponding element in the array if num was found in table.

NULL if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer is found which matches num. If a matching integer is found, the address of the corresponding element in the integer array is returned. NULL is returned if no matching integer is found.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of num in table by 2 and then adding this to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64k.

The format of an int-to-int reference table is as follows:

struct {
int near *array; /* Address of array (offset only) */
int num_entries; /* Number of entries in this table */
int tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int array[5] = {10,20,30,40};
	   int near *pointer;
	   struct {
	      int near *array;
	      int entries;
	      int tbl[5];
	   } table = {NULL, 5, {11,12,13,};
	   table.array = (int near *)array;
	   ...
	   pointer = _itbl_to_iptr (table.tbl, 11);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   int array[5] = {10,20,30,40,50};
	   struct {
	    int near *array;
	    int entries;
	    int table[5];
	   } table = {NULL, 5, {11,12,13,14,15}};
	   ...
	   table.array = (int near *)array;
	   lea bx,table.table/* DS:BX -> table */
	   mov ax,11	/* AX = reference int */
	   itbl_to_iptr ();/* was int found? */
	    jc i_to_iptr_010/*   n: continue */
	   ... 	 	/*   y: character located */
	i_to_iptr_010:
	   ...
	}

Source file _TBPTRII.ASM ASM equiv WTBL_TO_WPTR
See also
_ctbl_to_iptr, _is_initbl, _itbl_to_lptr, _itbl_to_ptr, _xitbl_to_iptr

_itbl_to_lptr


Descrip
Gets a pointer to a long int array element using an int reference table.

Syntax
#include <table.h>
long int near *_itbl_to_lptr(const int far *table, int num);

Returns
A pointer to the corresponding element in the array if num was not found in table.

NULL if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer is found which matches num. If a matching integer is found, the address of the corresponding element in the long integer array is returned. NULL is returned if no matching integer is found.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of num in table by 4 and then adding this to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64k.

The format of an int-to-long int reference table is as follows:

struct {
long int near *array;/* Address of array (offset only) */
int num_entries; /* Number of entries in this table */
int tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field would be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   long int array[5] = {10,20,30,40};
	   long int near *pointer;
	   struct {
	      long int near *array;
	      int entries;
	      int tbl[5];
	   } table = {NULL, 5, {11,12,13,};
	   table.array = (long int near *)array;
	   ...
	   pointer = _itbl_to_lptr (table.tbl, 11);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   long int array[5] = {10,20,30,40,50};
	   struct {
	    long int near *array;
	    int entries;
	    int table[5];
	   } table = {NULL, 5, {11,12,13,14,15}};
	   ...
	   table.array = (long int near *)array;
	   lea bx,table.table/* DS:BX -> table */
	   mov ax,11	/* AX = reference int */
	   itbl_to_lptr ();/* was int found? */
	    jc i_to_lptr_010/*   n: continue */
	   ... 	 	/*   y: character located */
	i_to_lptr_010:
	   ...
	}

Source file _TBPTRIL.ASM ASM equiv WTBL_TO_DPTR
See also
_ctbl_to_lptr, _is_initbl, _itbl_to_iptr, _itbl_to_ptr, _xitbl_to_lptr

_itbl_to_ptr


Descrip
Gets a pointer to an array element using an int reference table.

Syntax
#include <table.h>
void near *_itbl_to_ptr(const int far *table, int num, int size);

Returns
A pointer to the corresponding element in the array if num was found in table.

NULL if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer is found which matches num. If a matching integer is found, the address of the corresponding element in the array is returned. NULL is returned if no matching integer is found.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of integer in table by size and then adding this to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64k.

The format of an integer reference table is as follows:

struct {
void near *array; /* Address of array (offset only) */
int num_entries; /* Number of entries in this table */
int table[NUM_ENTRIES];/* Start of table */
}table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   struct filestru {
	      char filename[13];
	      int date;
	      long int size;
	      int attr;
	   };
	   struct filestru array[5];
	   struct filestru near *pointer;
	   struct {
	      struct filestru near *array;
	      int entries;
	      int tbl[5];
	   } table = {NULL, 5, {11,12,13,}};
	   table.array = (struct filestru near *) array;
	   ...
	   pointer = (struct filestru*)_itbl_to_ptr (table.tbl, 11,
	      sizeof (struct filestru));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct filestru {
	    char filename[13];
	    int date;
	    long int size;
	    int attr;
	   };
	   struct filestru array[5];
	   int size = sizeof (struct filestru);
	   struct {
	   struct filestru near *array;
	    int entries;
	    int table[5];
	   } table = {NULL, 5, {11,12,13,14,15}};
	   ...
	      table.array = (struct filestru near *)array;
	   lea bx,table.table/* DS:BX -> table */
	   mov ax,11	/* AX = reference int */
	   mov cx,size	    /* CX = element size */
	   itbl_to_ptr ();    /* was int found? */
	    jc i_to_ptr_010/*   n: continue */
	   ... 	 	/*   y: character located */
	i_to_ptr_010:
	   ...
	}

Source file _TBPTRI.ASM ASM equiv WTBL_TO_PTR
See also
_ctbl_to_ptr, _is_initbl, _itbl_to_iptr, _itbl_to_lptr, _xitbl_to_ptr

_xctbl_to_iptr


Descrip
Gets a pointer to an int array element using an extended char reference table.

Syntax
#include <table.h>
int near *_xctbl_to_iptr(const char far *table, char chr);

Returns
A pointer to the corresponding array element if chr was found in table.

NULL if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, the address of the corresponding element in the int array is returned. If no matching character is found, the next table in the chain is searched, and so on. NULL is returned if no matching character is found in any of the chained tables.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of the matching character in table by 2 and then adding this value to the int array address provided in the reference table. The return value is undefined if the resulting address exceeds 64K.

The format of an extended char-to-int reference table is as follows:

struct {
char near *next; /* Next table in chain (-1 if none) */
int near *array; /* Address of array (near pointer) */
int entries; /* Number of entries in this table */
char tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int array1[5] = {10,20,30,40}, array2[5] = {10,20,40,60};
	   int near *pointer;
	   struct table{
	      char near *next;
	      int near *array;
	      int entries;
	      char tbl[6];
	   };
	   struct table table2 = {(char near *)-1, NULL, 5, "123};
	   struct table table1 = {NULL, NULL ,5,"ABC};
	   table1.next = (char near *)table2.tbl;
	   table2.array = (int near *)array2;
	   table1.array = (int near *)array1;
	   ...
	   pointer = _xctbl_to_iptr (table1.tbl, '3');
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   int array1[5]={10,20,30,40,50}, array2[5]={10,20,40,60,70};
	   struct tbl{
	      char near *next;
	      int near *array;
	      int entries;
	      char table[6];
	   };
	   struct tbl table2 = {(char near *)-1, NULL, 5, "12345"};
	   struct tbl table1 = {NULL , NULL, 5, "ABCDE"};
	   table1.next = (char near *)table2.table;
	   table2.array = (int near *)array2;
	   table1.array = (int near *)array1;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov al,'3'	/* AL = reference char */
	   xctbl_to_iptr ();/* was char found? */
	    jc xc_to_iptr_010/*   n: go continue */
	   ... 	 	/*   y: char not found */
	xc_to_iptr_010:
	   ...
	}

Source file _TBPTXCI.ASM ASM equiv XBTBL_TO_WPTR
See also
_ctbl_to_iptr, _is_inxctbl, _xctbl_to_lptr, _xctbl_to_ptr, _xitbl_to_iptr

_xctbl_to_lptr


Descrip
Gets a pointer to a long array element using an extended char reference table.

Syntax
#include <table.h>
long near *_xctbl_to_lptr(const char far *table, char chr);

Returns
A pointer to the corresponding array element if chr was found in table.

NULL if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, the address of the corresponding element in the long array is returned. If no matching character is found, the next table in the chain is searched, and so on. NULL is returned if no matching character is found in any of the chained tables.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of character in table by 4 and then adding this value to the long array address provided in the reference table. The return value is undefined if the resulting address exceeds 64K.

The format of an extended char-to-long reference table is as follows:

struct {
char near *next; /* Next table in chain (-1 if none) */
long int near *array;/* Address of array (near pointer) */
int entries; /* Number of entries in this table */
char tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   long int array1[5] = {10,20,30,40}, array2[5] = {10,20,40,60};
	   long int near *pointer;
	   struct table{
	      char near *next;
	      long int near *array;
	      int entries;
	      char tbl[6];
	   };
	   struct table table2 = {(char near *)-1, NULL, 5, "123};
	   struct table table1 = {NULL, NULL,5,"ABC};
	   table1.next = (char near *)table2.tbl;
	   table2.array = (long int near *)array2;
	   table1.array = (long int near *)array1;
	   ...
	   pointer = _xctbl_to_lptr (table1.tbl, '3');
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   long int array1[5]={10,20,30,40,50};
	   long int array2[5]={10,20,40,60,70};
	   struct tbl{
	      char near *next;
	      long int near *array;
	      int entries;
	      char table[6];
	   };
	   struct tbl table2 = {(char near *)-1, NULL, 5, "12345"};
	   struct tbl table1 = {NULL, NULL, 5, "ABCDE"};
	   table1.next = (char near *)table2.table;
	   table2.array  = (long int near *)array2;
	   table1.array  = (long int near *)array1;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov al,'3'	/* AL = reference char */
	   xctbl_to_lptr ();/* was char found? */
	    jc xc_to_lptr_010/*   n: go continue */
	   ... 	 	/*   y: char not found */
	xc_to_lptr_010:
	   ...
	}

Source file _TBPTXCL.ASM ASM equiv XBTBL_TO_DPTR
See also
_ctbl_to_lptr, _is_inxctbl, _xctbl_to_iptr, _xctbl_to_ptr, _xitbl_to_lptr

_xctbl_to_ptr


Descrip
Gets a pointer to an array element using an extended char reference table.

Syntax
#include <table.h>
void near *_xctbl_to_ptr(const char far *table, char chr, int size);

Returns
A pointer to the corresponding array element if chr was found in table.

NULL if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, the address of the corresponding element in the array is returned. If no matching character is found, the next table in the chain is searched, and so on. NULL is returned if no matching character is found in any of the chained tables.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of character in table by size and then adding this value to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64K.

The format of an extended char reference table is as follows:

struct {
char near *next; /* Next table in chain (-1 if none) */
void near *array; /* Address of array (near pointer) */
int entries; /* Number of entries in this table */
char tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   struct filestru {
	      char filename[13];
	      int date;
	      long int size;
	      int attr;
	   };
	   struct filestru array1[5], array2[5];
	   struct filestru near *pointer;
	   struct table{
	      char near *next;
	      struct filestru near *array;
	      int entries;
	      char tbl[6];
	   };
	   struct table table2 = {(char near *)-1, NULL, 5, "123};
	   struct table table1 = {NULL,NULL,5,"ABC};
	   table1.next = (char near *)table2.tbl;
	   table2.array = (struct filestru near *)array2;
	   table1.array = (struct filestru near *)array1;
	   ...
	   pointer = (struct filestru*)_xctbl_to_ptr (table1.tbl, '3',
	   	  sizeof (struct filestru));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct filestru {
	      char filename[13];
	      int date;
	      long int size;
	      int attr;
	   };
	   struct filestru array1[5], array2[5];
	   int size = sizeof (struct filestru);
	   struct tbl{
	      char near *next;
	      struct filestru near *array;
	      int entries;
	      char table[6];
	   };
	   struct tbl table2 = {(char near *)-1, NULL, 5, "12345"},
	   table1 = {NULL, NULL, 5,"ABCDE"};
	   table1.next = (char near *)table2.table;
	   table2.array = (struct filestru near *)array2;
	   table1.array = (struct filestru near *)array1;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov al,'3'	/* AL = reference char */
	   mov cx,size	    /* CX = element size */
	   xctbl_to_ptr ();/* was char found? */
	    jc xc_to_ptr_010/*   n: go continue */
	   ... 	 	/*   y: char not found */
	xc_to_ptr_010:
	   ...
	}

Source file _TBPTXC.ASM ASM equiv XBTBL_TO_PTR
See also
_ctbl_to_ptr, _is_inxctbl, _xctbl_to_lptr, _xctbl_to_iptr, _xitbl_to_ptr

_xindex_char


Descrip
Determines the index of a char in an index table.

Syntax
#include <table.h>
int _xindex_char(const char far *table, char chr);

Returns
The index of chr in table if chr was found in table.

-1 if chr was not found in table.

Notes
This function searches table, starting with the first entry, until a character is found which matches chr. If a matching character is found, its index is returned. If no matching character is found, the next table in the chain is searched, and so on. -1 is returned if no matching character is found in any of the chained tables.

Indices for table entries are numbered sequentially in ascending order from the starting index. For example, a table with 25 entries and a starting index of 13 would have indices ranging from 13 to 37. The return value is undefined if the resulting index exceeds 64K.

The format of an extended char index table is as follows:

struct {
char near *next; /* Next table in chain (-1=none) */
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
char tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   char index;
	   struct table{
	      char near *next;
	      int start;
	      int entries;
	      char tbl[5];
	   };
	   struct table table2 = {(char near *)-1, 'a', 4, "ab};
	   struct table table1 = {NULL, 'A', 4, "AB};
	   table1.next = (char near *)table2.tbl;
	   ...
	   index = _xindex_char (table1.tbl, 'a');
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct tbl{
	      char near *next;
	      int start;
	      int entries;
	      char table[5];
	   };
	   struct tbl table2 = {(char near *)-1, 'a', 4, "abcd"};
	   struct tbl table1 = {NULL, 'A', 4, "ABCD"};
	   table1.next = (char near *)table2.table;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov al,'a'	/* AL = char to locate */
	   xindex_char ();    /* was char found? */
	    jc xdx_char_010/*   n: go continue */
	   ... 	 	/*   y: char not found */
	xdx_char_010:
	   ...
	}

Source file _TBXINDC.ASM ASM equiv XINDEX_BYTE
See also
_xindex_byte, _xxlat_byte

_xindex_int


Descrip
Determines the index of an int in an extended index table.

Syntax
#include <table.h>
int _xindex_int(const int far *table, int num);

Returns
The index of num in table if num was found in table.

-1 if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer value is found which matches num. If a matching integer value is found, its index is returned. If no matching integer is found, the next table in the chain is searched, and so on. -1 is returned if no matching integer is found in any of the chained tables.

Indices for table entries are numbered sequentially in ascending order from the starting index. For example, a table with 25 entries and a starting index of 13 would have indices ranging from 13 to 37. The return value is undefined if the resulting index exceeds 64K.

The format of an extended int index table is as follows:

struct {
int near *next; /* Next table in chain (-1=none) */
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
int tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int index;
	   struct table{
	      int near *next;
	      int start;
	      int entries;
	      int tbl[5];
	   };
	   struct table table2 = {(int near *)-1, 10, 4, {10, 20, 3};
	   struct table table1 = {NULL, 11, 4, {11, 12, 1};
	   table1.next = (int near *)table2.tbl;
	   ...
	   index = _xindex_int (table1.tbl, 10);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct tbl{
	      int near *next;
	      int start;
	      int entries;
	      int table[5];
	   };
	   struct tbl table2 = {(int near *)-1, 10, 4, {10, 20, 30, 40}};
	   struct tbl table1 = {NULL, 11, 4, {11, 12, 13, 14}};
	   table1.next = (int near *)table2.table;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,10	/* AX = int to locate */
	   xindex_int ();	/* was int found? */
	    jc xdx_int_010/*   n: go continue */
	   ... 	 	/*   y: int not found */
	xdx_int_010:
	   ...
	}

Source file _TBXINDI.ASM ASM equiv XINDEX_WORD
See also
_xindex_int, _xxlat_int

_xitbl_to_iptr


Descrip
Gets a pointer to a int array element using an extended int reference table.

Syntax
#include <table.h>
int near *_xitbl_to_iptr(const int far *table, int num);

Returns
A pointer to the corresponding array element if num was found in table.

NULL if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer value is found which matches num. If a matching integer value is found, the address of the corresponding element in the int array is returned. If no matching integer value is found, the next table in the chain is searched, and so on. NULL is returned if no matching integer value is found in any of the chained tables.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of the matching integer value in table by 2 and then adding this value to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64K.

The format of an extended int-to-int reference table is as follows:

struct {
int near *next; /* Next table in chain (-1 if none) */
int near *array; /* Address of array (near pointer) */
int entries; /* Number of entries in this table */
int tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int array1[5] = {10,20,30,40}, array2[5] = {10,20,40,60};
	   int near *pointer;
	   struct table{
	      int near *next;
	      int near *array;
	      int entries;
	      int tbl[5];
	   };
	   struct table table2 = {(int near *)-1, NULL, 5, {1,2,};
	   struct table table1 = {NULL,NULL,5,{6,7,8};
	   table1.next = (int near *)table2.tbl;
	   table2.array = (int near *)array2;
	   table1.array = (int near *)array1;
	   ...
	   pointer = _xitbl_to_iptr (table1.tbl, 3);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   int array1[5]={10,20,30,40,50}, array2[5]={10,20,40,60,70};
	   struct tbl {
	      int near *next;
	      int near *array;
	      int entries;
	      int table[5];
	   } table2 = {(int near *)-1, NULL, 5, {1,2,3,4,5}},
	    table1 = {NULL, NULL, 5, {6,7,8,9,10}};
	      table1.next = (int near *)table2.table;
	      table2.array = (int near *)array2;
	      table1.array = (int near *)array1;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,3	/* AX = reference int */
	   xitbl_to_iptr ();/* was int found? */
	    jc xi_to_iptr_010/*   n: go continue */
	   ... 	 	/*   y: int not found */
	xi_to_iptr_010:
	   ...
	}

Source file _TBPTXII.ASM ASM equiv XWTBL_TO_WPTR
See also
_itbl_to_iptr, _is_inxitbl, _xitbl_to_ptr, _xitbl_to_lptr, _xctbl_to_iptr

_xitbl_to_lptr


Descrip
Gets a pointer to a long array element using an extended int reference table.

Syntax
#include <table.h>
long int near *_xitbl_to_lptr(const int far *table, int num);

Returns
A pointer to the corresponding array element if num was found in table.

NULL if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer value is found which matches num. If a matching integer value is found, the address of the corresponding element in the long array is returned. If no matching integer value is found, the next table in the chain is searched, and so on. NULL is returned if no matching integer value is found in any of the chained tables.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of the matching integer value in table by 4 and then adding this value to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64K.

The format of an extended int-to-long reference table is as follows:

struct {
int near *next; /* Next table in chain (-1 if none) */
long int near *array;/* Address of array (near pointer) */
int entries; /* Number of entries in this table */
int tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   long int array1[5] = {10,20,30,40}, array2[5] = {10,20,40,60};
	   long int near *pointer;
	   struct table{
	      int near *next;
	      long int near *array;
	      int entries;
	      int tbl[5];
	   };
	   struct table table2 = {(int near *)-1, NULL, 5, {1,2,};
	   struct table table1 = {NULL,NULL,5,{6,7,8};
	   table1.next = (int near *)table2.tbl;
	   table2.array = (long int near *)array2;
	   table1.array = (long int near *)array1;
	   ...
	   pointer = _xitbl_to_lptr (table1.tbl, 3);
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   long int array1[5] = {10,20,30,40,50};
	   long int array2[5] = {10,20,40,60,70};
	   struct {
	      int near *next;
	      int near *array;
	      int entries;
	      int table[5];
	   } table2 = {(int near *)-1, NULL, 5, {1,2,3,4,5}},
	   table1 = {NULL,NULL,5,{6,7,8,9,10}};
	   table1.next = (int near *)table2.table;
	   table2.array = (long int near *)array2;
	   table1.array = (long int near *)array1;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,3	/* AX = reference int */
	   xitbl_to_lptr ();/* was int found? */
	    jc xi_to_lptr_010/*   n: go continue */
	   ... 	 	/*   y: int not found */
	xi_to_lptr_010:
	   ...
	}

Source file _TBPTXIL.ASM ASM equiv XWTBL_TO_DPTR
See also
_itbl_to_lptr, _is_inxitbl, _xitbl_to_ptr, _xitbl_to_iptr, _xctbl_to_lptr

_xitbl_to_ptr


Descrip
Gets a pointer to an array element using an extended int reference table.

Syntax
#include <table.h>
void near *_xitbl_to_ptr(const int far *table, int num, int size);

Returns
A pointer to the corresponding array element if num was found in table.

NULL if num was not found in table.

Notes
This function searches table, starting with the first entry, until an integer value is found which matches num. If a matching integer value is found, the address of the corresponding element in the array is returned. If no matching integer value is found, the next table in the chain is searched, and so on. NULL is returned if no matching integer value is found in any of the chained tables.

Addresses of corresponding array elements are determined by multiplying the origin 0 index of the matching integer value in table by size and then adding this value to the array address provided in the reference table. The return value is undefined if the resulting address exceeds 64K.

The format of an extended int reference table is as follows:

struct {
int near *next; /* Next table in chain (-1 if none) */
void near *array; /* Address of array (near pointer) */
int entries; /* Number of entries in this table */
int tbl_start[NUM_ENTRIES];/* The table starts here */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   struct filestru {
	      char filename[13];
	      int date;
	      long int size;
	      int attr;
	   };
	   struct filestru array1[5], array2[5];
	   struct filestru near *pointer;
	   struct table{
	      int near *next;
	      struct filestru near *array;
	      int entries;
	      int tbl[5];
	   };
	   struct table table2 = {(int near *)-1, NULL, 5, {1,2,};
	   struct table table1 = {NULL, NULL ,5,{6,7,8};
	   table1.next = (int near *)table2.tbl;
	   table2.array = (struct filestru near *)array2;
	   table1.array = (struct filestru near *)array1;
	   ...
	   pointer = (struct filestru*)_xitbl_to_ptr (table1.tbl, 3,
	   	  sizeof (struct filestru));
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct filestru {
	      char filename[13];
	      int date;
	      long int size;
	      int attr;
	   };
	   struct filestru array1[5], array2[5];
	   int size = sizeof (struct filestru);
	   struct {
	      int near *next;
	      struct filestru near *array;
	      int entries;
	      int table[5];
	   } table2 = {(int near *)-1, NULL, 5, {1,2,3,4,5}},
	   table1 = {NULL,NULL,5,{6,7,8,9,10}};
	   table1.next = (int near *)table2.table;
	   table2.array = (struct filestru near *)array2;
	   table1.array = (struct filestru near *)array1;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,3	/* AX = reference int */
	   mov cx,size	    /* CX = element size */
	   xitbl_to_ptr ();/* was int found? */
	    jc xi_to_ptr_010/*   n: go continue */
	   ... 	 	/*   y: int not found */
	xi_to_ptr_010:
	   ...
	}

Source file _TBPTXI.ASM ASM equiv XWTBL_TO_PTR
See also
_itbl_to_ptr, _is_inxitbl, _xitbl_to_iptr, _xitbl_to_lptr, _xctbl_to_ptr

_xlat_char


Descrip
Gets a char from an index table.

Syntax
#include <table.h>
int _xlat_char(const char far *table, int index);

Returns
The element in the table that corresponds to index if index is present in table.

-1 if index is not found in table.

Notes
This function checks index against the starting and ending indices of the table. If index falls within this range, the corresponding char value from the table is returned. If index does not fall within this range, -1 is returned. For example, if index were 17 and the table's starting index were 13, then the 5th entry in the table would be returned (as long as the table contained at least 5 entries).

The format of a char index table is as follows:

struct {
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
char tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int chr;
	   struct {
	      int start;
	      int entries;
	      char tbl[5];
	   } table = {'a', 4, "abcd"};
	   ...
	   chr = _xlat_char (table.tbl, 'a');
	   if (chr == -1)
	   {
	   	  /* "index" was not found */
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   struct {
	      int start;
	      int entries;
	      char table[5];
	   } table = {'a', 4, "abcd"};
	   ...
	  lea bx,table.table/* DS:BX -> table */
	    mov ax,2	 /* AX=index of char to retrieve */
	    xlat_char ();	 /* was index present in table? */
	     jc xlat_char_010/*   n: go continue */
	    ... 	  	 /*   y: index not present */
	xlat_char_010:
	    ...
	}

Source file _TBXLATC.ASM ASM equiv XLAT_BYTE
See also
_index_char, _xlat_int, _xxlat_char

_xlat_int


Descrip
Gets an int from an index table.

Syntax
#include <table.h>
int _xlat_int(const int far *table, int index);

Returns
The element that corresponds to index if index is present in table.

-1 if index is not found in table.

Notes
This function checks index against the starting and ending indices for the table. If index falls within this range, the corresponding int value from the table is returned. If index does not fall within this range, -1 is returned. For example, if index were 17 and the table's starting index were 13, then the 5th entry in the table would be returned (as long as the table contained at least 5 entries).

The format of an int index table is as follows:

struct {
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
int tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int num;
	   struct {
	      int start;
	      int entries;
	      int tbl[5];
	   } table = {1, 4, {1,2,3,4,5};
	   ...
	   num = _xlat_int (table.tbl, 1);
	   {
	   	  /* "index" was not found */
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   int num;
	   struct {
	      int start;
	      int entries;
	      int table[5];
	   } table = {1, 4, {1,2,3,4,5}};
	    ...
	    lea bx,table.table/* DS:BX -> table */
	    mov ax,1	 /* AX=index of int to retrieve */
	    xlat_int ();	 /* was index present in table? */
	     jc xlat_int_010/*   n: go continue */
	    ... 	  	 /*   y: index not preset */
	xlat_int_010:
	    ...
	}

Source file _TBXLATI.ASM ASM equiv XLAT_WORD
See also
_index_int, _xlat_char, _xxlat_int

_xxlat_char


Descrip
Gets a char from an extended index table.

Syntax
#include <table.h>
int _xxlat_char(const char far *table, int index);

Returns
The element that corresponds to index if index is present in table.

-1 if index is not found in table.

Notes
This function checks index against the starting and ending indices of the table. If index falls within this range, the corresponding char value is returned. If index does not fall within this range, the next table in the chain is examined, and so on. If none of the chained tables contain index, -1 is returned. For example, if index were 17 and the table's starting index were 13, then the 5th entry in the table would be returned (as long as the table contained at least 5 entries).

The format of an extended char index table is as follows:

struct {
int near *next; /* Next table in chain (near pointer) */
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
char tbl_start[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int chr;
	   struct table{
	      char near *next;
	      int start;
	      int entries;
	      char tbl[5];
	   };
	   struct table table2 = {(char near *)-1, 'a', 4, "abcd"};
	   struct table table1 = {NULL, 'A', 4, "AB};
	   table1.next = (char near *)table2.tbl;
	   ...
	   chr = _xxlat_char (table1.tbl, 'a');
	   if (chr == -1)
	   {
	   	  /* "index" was not found */
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   char chr;
	   struct {
	      char near *next;
	      int start;
	      int entries;
	      char table[5];
	   } table2 = {(char near *)-1, 'a', 4, "abcd"},
	   table1 = {NULL, 'A', 4, "ABCD"};
	   table1.next = (char near *)table2.table;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,2	/* AX = index not present */
	   xxlat_char ();	/* was index present in table? */
	    jc xxlat_char_010/*   n: go continue */
	   ... 	 	/*   y: index not found */
	xxlat_char_010:
	   ...
	}

Source file _TBXXLTC.ASM ASM equiv XXLAT_BYTE
See also
_xindex_char, _xlat_char, _xxlat_int

_xxlat_int


Descrip
Gets an int from an extended index table.

Syntax
#include <table.h>
int _xxlat_int(const int far *table, int index);

Returns
The element that corresponds to index if index is present in table.

-1 if index is not found in table.

Notes
This function checks index against the starting and ending indices for the table. If index falls within this range, the corresponding int value from the table is returned. If index does not fall within this range, the next table in the chain is examined, and so on. If none of the chained tables contain index, -1 is returned. For example, if index were 17 and the table's starting index were 13, then the 5th entry in the table would be returned (as long as the table contained at least 5 entries).

The format of an extended int index table is as follows:

struct {
int near *next; /* Next table in chain (near pointer) */
unsigned int start; /* Starting index */
int num_entries; /* Number of entries in table */
int table[NUM_ENTRIES];/* Start of table */
} table;

WARNING! When using the above structure, the address of the tbl_start field must be specified for the table parameter. See the Table Management technical notes for more information.

C/C++ Example
	{
	   int num;
	   struct table{
	      int near *next;
	      int start;
	      int entries;
	      int tbl[5];
	   };
	   struct table table2 = {(int near *)-1, 1, 4, {1,2,3,4,5};
	   struct table table1 = {NULL, 10, 4, {10,20,30,};
	   table1.next = (int near *)table2.tbl;
	   ...
	   num = _xxlat_int (table1.tbl, 1);
	   {
	    	   /* "index" was not found */
	   }
	   ...
	}

Inline Assembly Example
	#include <inline.h>
	{
	   int num;
	   struct {
	      int near *next;
	      int start;
	      int entries;
	      int table[5];
	   } table2 = {(int near *)-1, 1, 4, {1,2,3,4,5}},
	   table1 = {NULL, 10, 4, {10,20,30,40,50}};
	   table1.next = (int near *)table2.table;
	   ...
	   lea bx,table1.table/* DS:BX -> table */
	   mov ax,1	/* AX=index of int to retrieve */
	   xxlat_int ();	/* was index present in table? */
	    jc xxlat_int_010/*   n: go continue */
	   ... 	 	/*   y: index not found */
	xxlat_int_010:
	   ...
	   _xxlat_int (table1.table, 1, &num);
	   ...
	}

Source file _TBXXLTI.ASM ASM equiv XXLAT_WORD
See also
_xindex_int, _xlat_int, _xxlat_char