Category : C Source Code
Archive   : TCU_31.ZIP
Filename : TCU.H

 
Output of file : TCU.H contained in archive : TCU_31.ZIP
/*==========================================================================*
* *
* Header #include file for Turbo-C Utilities version 3.1a *
* ------------------------------------------------------- *
* *
* (c) Copyright Karl Keyte, 1990 *
* *
* Karl Keyte *
* European Space Operations Centre Phone: Private, +(49) 6150 2499 *
* Robert-Bosch Strasse 5 Work, +(49) 6151 902041 *
* 6100 Darmstadt e-Mail: [email protected] *
* West Germany Bix: kkeyte *
* *
*==========================================================================*/


#if !defined(__TCU)
#define __TCU

#define BOX_SINGLE 1 /* Box bordered by single lines */
#define BOX_DOUBLE 2 /* Box bordered by double lines */
#define BOX_BLANK 3 /* Box bordered by spaces */


#define ESC_ESC 0x01 /* ESCAPE key exit */
#define ESC_PGUP 0x02 /* Page Up key exit */
#define ESC_PGDN 0x04 /* Page Down key exit */
#define ESC_CLEFT 0x08 /* Cursor left exit */
#define ESC_CRIGHT 0x10 /* Cursor right exit */
#define ESC_FUNC 0x20 /* Function key exit */
#define ESC_CNTL_C 0x40 /* Control-C exit */
#define ESC_MOUSE_CLICK_L 0xE000 /* Left mouse button click */
#define ESC_MOUSE_CLICK_R 0xE100 /* Right mouse button click */


#define MENU_TITLE 1 /* Title */
#define MENU_BOX 2 /* Surrounding box */
#define MENU_OPTION 3 /* Option line */
#define MENU_SELECT 4 /* Selected option line */
#define MENU_UNAVAIL 5 /* Unavailable option line */


#define TCU_OK 0 /* Successful TCU service */
#define TCU_ERROR 1 /* Unsuccessful TCU service */


#define FORM_EDIT 1 /* Enable edit ability for field */
#define FORM_NOEDIT 2 /* Disable edit ability for field */
#define FORM_ECHO 3 /* Echo field when input */
#define FORM_NOECHO 4 /* No echo on input field */
#define FORM_ENTER 5 /* Enter the field in edit */
#define FORM_NOENTER 6 /* Don't enter the field in edit */
#define FORM_CONFIRM 7 /* Field needs ENTER to confirm */
#define FORM_NOCONFIRM 8 /* No ENTER needed to confirm */


#define FRM_MAXFIELD 128 /* Maximum fields on form */
#define MAX_SCREEN_LINES 25 /* Number of lines on screen */


#define FLD_INT 1 /* Integer (32 bits) */
#define FLD_FLOAT 2 /* Floating point (64 bits) */
#define FLD_STRING 3 /* String, ASCIIZ format */
#define FLD_DATE 4 /* Date (01.01.70 ...) */
#define FLD_LOGICAL 5 /* True/False, Yes/No, On/Off */
#define FLD_CHOICE 6 /* Enumerated choice type */
#define FLD_BUTTON 7 /* Button selection field */


#define FLD_DAYFIRST 1 /* Dates with day number first */
#define FLD_MONTHFIRST 2 /* Dates with month number first */


#define FLD_TRUEFALSE 1 /* Logicals as TRUE/FALSE */
#define FLD_YESNO 2 /* Logicals as YES/NO */
#define FLD_ONOFF 3 /* Logicals as ON/OFF */


#define FLD_ESCNEXT 1 /* NEXT FIELD field edit escape */
#define FLD_ESCPREV 2 /* PREVIOUS FIELD escape */
#define FLD_ESCFIRST 3 /* FIRST FIELD escape */
#define FLD_ESCLAST 4 /* LAST FIELD escape */
#define FLD_SELECT 5 /* Field select escape */
#define FLD_CLICKSELECT 6 /* Mouse click field select */
#define FLD_ESCESC -1 /* ESC key escape */
#define FLD_ESCCNTLC -2 /* CNTL/C key escape */
#define FLD_ESCPGUP -3 /* Page-Up key escape */
#define FLD_ESCPGDN -4 /* Page-Down key escape */
#define FLD_FNKEYSAVE -5 /* Function key save escape */
#define FLD_FNKEYESC -6 /* Function key abort escape */
#define FLD_BUTTONSAVE -7 /* Button save escape */
#define FLD_BUTTONESC -8 /* Button abort escape */


typedef struct {
short x, y; /* X and Y coords of current pos */
short height, /* External size of menu */
width; /* External width of menu */
char *title; /* Title of menu */
unsigned char title_attrib, /* Attributes of title */
box_attrib, /* Attributes of surrounding box */
option_attrib, /* Attributes of menu option */
select_attrib, /* Attributes of selected option */
unavail_attrib; /* Attributes of unavailables */
unsigned char escape_keys; /* Keys which allow exit */
unsigned char box_type; /* Type of external box */
unsigned char last_selection; /* Last selected option */
void far (*help_fn)(int); /* User's help function */
char **options; /* Pointer to list of options */
unsigned char *cover_zone; /* Pointer to covered screen */
unsigned char short_code; /* Flags if short code select on */
unsigned long option_avail; /* Option availability flags */
} MENU;


typedef struct {
int in_use; /* Flags current use mode */
char *cover_zone,
*title;
int height,
width;
unsigned char box_attrib,
window_attrib,
input_attrib,
title_attrib,
box_type;
unsigned char with_input;
int input_x,
input_y;
char *input_str;
char *txt_line[MAX_SCREEN_LINES - 2];
int txt_lines;
} NOTICE;


typedef struct {
int in_use; /* Flags current use mode */
char *cover_zone;
char *title;
int cursor_x,
cursor_y,
height,
width,
pos_x,
pos_y;
unsigned char box_attrib,
title_attrib,
window_attrib,
box_type;
} WINDOW;


typedef struct {
unsigned char linecolour, /* Colour of header line */
optioncolour, /* Colour of possible options */
selectcolour; /* Colour of selected option */
char **headings; /* List of header titles */
MENU **menus; /* List of menus */
void far (*help_fn)(int); /* User's help function */
unsigned char selected, /* Currently selected menu */
use_mode; /* Current mode of use */
unsigned char *cover_zone; /* Screen contents area */
unsigned char short_code; /* Flags if short code select on */
} PULLDOWN;


typedef struct {
unsigned char sel, /* Selected choice */
max; /* Maximum choices available */
char *str; /* String of separated choices */
} CHOICE_TYPE;


typedef union {
long v_int; /* Integer field value */
double v_float; /* Floating field value */
char *v_string; /* String field value */
unsigned short v_date; /* Date value (days -> 01.01.70) */
unsigned char v_logical; /* Logical field value */
CHOICE_TYPE v_choice; /* Enumerated choice type */
} FIELD_VALUE;


typedef struct {
char f_name[9]; /* Field name */
unsigned char f_type, /* Type of field */
f_size, /* Width of field on screen */
f_decimal, /* Decimal places if numeric */
f_present, /* Presentation form of data */
f_xpos, /* Window x-coordinate */
f_ypos; /* Window y-coordinate */
unsigned char f_usemin, /* Flags use of minimum range */
f_usemax, /* Flags use of maximum range */
f_useval, /* Flags if initial value used */
f_usetmp; /* Flags if string template used */
union {
struct {
long f_min, /* Minimum value */
f_max; /* Maximum value */
} i;
struct {
double f_min, /* Minimum value */
f_max; /* Maximum value */
} f;
struct {
unsigned short f_min, /* Minimum value */
f_max; /* Maximum value */
} d;
} range;
unsigned char f_colour; /* Colour attributes */
struct {
unsigned int a_ronly : 1, /* Read only flag */
a_noecho : 1, /* No-echo input flag */
a_fixtext : 1, /* Fixed text field flag */
a_param : 1, /* Non-editable variable field */
a_confirm : 1; /* ENTER confirmation needed flag */
} attrib;
FIELD_VALUE val; /* Value of field */
unsigned char dummy; /* Marker for start of pointers */
char *f_template; /* Template for string inputs */
} FIELD;


typedef struct {
unsigned int num_fields; /* Number of fields */
unsigned char colour, /* Colour attribute */
input_colour; /* Input field colour default */
char title[77]; /* Form title string */
unsigned char xpos, /* x-coordinate on screen */
ypos, /* y-coordinate on screen */
height, /* Height of form */
width, /* Width of form */
type, /* Form surround type */
title_attrib, /* Colour attributes for title */
current_field, /* Current field with focus */
use_mode; /* Flags whether in use/displayed */
struct {
unsigned int ronly : 1; /* Form is read only */
} attrib;
unsigned char dummy; /* Marker for start of pointers */
FIELD *field[FRM_MAXFIELD]; /* Fields */
int far (*verify_fn)(void *, int, FIELD_VALUE *); /* verify */
void far (*help_fn)(int); /* User's help function */
int far (*fn_key_fn)(void *, int, int); /* Fn. key handler */
int far (*button_fn)(void *, int); /* Button select handler */
unsigned char *cover_zone; /* Screen cover buffer */
} FORM;


typedef struct {
char name[9]; /* Field name */
unsigned char type, /* Type of field */
size, /* Width of field on screen */
decimal, /* Decimal places if numeric */
present, /* Presentation form of data */
xpos, /* Window x-coordinate */
ypos, /* Window y-coordinate */
usemin, /* Flags use of minimum range */
usemax, /* Flags use of maximum range */
useval, /* Flags if initial value used */
usetmp; /* Flags if string template used */
union {
struct {
long min, /* Minimum value */
max; /* Maximum value */
} i;
struct {
double min, /* Minimum value */
max; /* Maximum value */
} f;
struct {
unsigned short min, /* Minimum value */
max; /* Maximum value */
} d;
} range;
unsigned char colour; /* Colour attributes */
struct {
unsigned int ronly : 1, /* Read only flag */
noecho : 1, /* No-echo input flag */
fixtext : 1, /* Fixed text field flag */
param : 1, /* Non-editable variable field */
confirm : 1; /* ENTER confirmation needed flag */
} attr;
FIELD_VALUE val; /* Value of field */
} FIELD_INFO;


typedef struct {
unsigned int num_fields; /* Number of fields */
char *title; /* Title string of form */
unsigned char text_colour, /* Colour attribute */
field_colour, /* Input field colour default */
title_colour, /* Title string colour */
xpos, /* x-coordinate on screen */
ypos, /* y-coordinate on screen */
height, /* Height of form */
width, /* Width of form */
box_type, /* Form surround type */
mode, /* Flags whether in use/displayed */
verify_fn, /* Verification function active */
help_fn, /* Help function active */
fn_key_fn; /* 1 if fn. key handler active */
button_fn; /* 1 if button select handler */
struct {
unsigned int ronly : 1; /* Form is read only */
} attr;
} FORM_INFO;



/* Add prefix to function prototypes for C++ compilation */

#ifdef __cplusplus
#define c_cpp extern "C"
#else
#define c_cpp
#endif


/*--------------------------------------------------------------------------*/
/* */
/* Pop-Up & Pulldown Menu Services */
/* */
/*--------------------------------------------------------------------------*/


c_cpp int change_menu_attribs (MENU *, int, unsigned char);
c_cpp int change_menu_escapes (MENU *, unsigned char);
c_cpp int clear_menu_in_pulldown (PULLDOWN *);
c_cpp int define_menu (MENU *, char *, unsigned char,
unsigned char, unsigned char,
unsigned char, unsigned char,
unsigned char, unsigned char, char **,
unsigned char);
c_cpp int define_pulldown (PULLDOWN *, unsigned char, unsigned char,
unsigned char, char **, unsigned char,
MENU **);
c_cpp int display_menu (MENU *, int, int);
c_cpp int display_pulldown_header (PULLDOWN *);
c_cpp int escape_fkey (void);
c_cpp int new_pulldown_cover (PULLDOWN *);
c_cpp int read_menu_selection (MENU *);
c_cpp int read_pulldown_selection (PULLDOWN *, int *, int *);
c_cpp int remove_menu (MENU *);
c_cpp int remove_pulldown (PULLDOWN *);
c_cpp int set_menu_help (MENU *, void far (*)(int));
c_cpp int set_menu_option (MENU *, int, int);
c_cpp int set_pulldown_help (PULLDOWN *, void far (*)(int));



/*--------------------------------------------------------------------------*/
/* */
/* Window Utilities */
/* */
/*--------------------------------------------------------------------------*/


c_cpp int clear_notice (NOTICE *);
c_cpp int display_notice (NOTICE *, int, int);
c_cpp int get_confirm (int, int, unsigned char, unsigned char,
char *, ...);
c_cpp int notice_text (NOTICE *, char *, ...);
c_cpp int prepare_notice (NOTICE *, char *, unsigned char,
unsigned char, unsigned char,
unsigned char);
c_cpp int prompt_input (NOTICE *, int, int, char *,
unsigned char);



/*--------------------------------------------------------------------------*/
/* */
/* Screen/Form Utilities */
/* */
/*--------------------------------------------------------------------------*/


c_cpp int display_form (FORM *, int, int);
c_cpp int edit_form (FORM *, int, int *);
c_cpp int get_field (FORM *, int, FIELD_VALUE *);
c_cpp int get_field_id (FORM *, char *, int *);
c_cpp int get_field_info (FORM *, int, FIELD_INFO *);
c_cpp int get_form_info (FORM *, FORM_INFO *);
c_cpp int load_form (FORM *, char *);
c_cpp int load_image_form (FORM *, char *);
c_cpp int put_field (FORM *, int, FIELD_VALUE *);
c_cpp int remove_form (FORM *);
c_cpp int select_field (FORM *, int, int *);
c_cpp int set_button_fn (FORM *, int far (*)(FORM *, int));
c_cpp int set_field_attrib (FORM *, int, unsigned char);
c_cpp int set_field_mode (FORM *, int, int);
c_cpp int set_field_verify (FORM *, int far (*)(FORM *, int, FIELD_VALUE *));
c_cpp int set_form_fnkey_fn (FORM *, int far (*)(FORM *, int, int));
c_cpp int set_form_help (FORM *, void far (*)(int));
c_cpp int set_form_mode (FORM *, int);
c_cpp int unload_form (FORM *);



/*--------------------------------------------------------------------------*/
/* */
/* Windowing Utilities */
/* */
/*--------------------------------------------------------------------------*/


c_cpp int change_colour (WINDOW *, unsigned char);
c_cpp int clear_window (WINDOW *);
c_cpp int close_window (WINDOW *);
c_cpp int open_window (WINDOW *, int, int, int, int, char *,
unsigned char, unsigned char, unsigned char,
unsigned char);
c_cpp int position_cursor (WINDOW *, int, int);
c_cpp int wprintf (WINDOW *, char *, ...);
c_cpp int wgets (WINDOW *, int, char *, int *);



/*--------------------------------------------------------------------------*/
/* */
/* General Utilities */
/* */
/*--------------------------------------------------------------------------*/


c_cpp unsigned char colour_attrib (int, int);
c_cpp char *date_string (unsigned short, unsigned char);
c_cpp unsigned short date_value (char *, unsigned char);
c_cpp int set_mouse_mode (unsigned char);


#endif


  3 Responses to “Category : C Source Code
Archive   : TCU_31.ZIP
Filename : TCU.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/