Category : C Source Code
Archive   : JJBQC.ZIP
Filename : JJBSET.H
Output of file : JJBSET.H contained in archive : JJBQC.ZIP
/****************************************************************************
* *
* jjbset.h *
* *
* Copyright (c) 1989, JJB. All rights reserved. *
* *
* Purpose: *
* *
* The main reason for the get( and set( functions is to provide an *
* easy way to fetch and store integers and characters so they are *
* TRULY GLOBAL for all source and object files linked. *
* *
* The get( and set( functions use less memory and allow you to access *
* and change any variable in the entire JJB system. *
* *
* The second element in each array is permanently reserved for *
* your use only. Actually, each array sets aside a certain number *
* of elements which you, and only you, are allowed to use. *
* *
* JJB, 9236 church Rd suite 1082, Dallas, Tx 75231 (214) 341-1635 *
****************************************************************************/
/*
JJB has defined the following arrays as follows:
#define IARRYSIZE 80;
#define CARRYSIZE 10;
int iarry[IARRAYSIZE];
unsigned char carry[CARRAYSIZE];
The function jjb_initalize(), initalizes the integer and character
arrays to zero and initalizes some of the variables such as the
video mode and etc.
Each array sets aside a certain number of bytes for your
use only. Position [1] in each array is always the first
position you can use. The advantage is that you can store
and access integers, characters, long, and pointers from
any or all of your object modules.
You can not access the arrays themselve, but JJB provides you with
'get(' functions to fetch and 'set(' function to store array values.
Here are some examples:
#define T 1
#define ESC '\033'
int x;
char ch;
long lnum;
char *sp;
x = get(VATTRIB); fetch current attribute for video fast.
set(UPPER_SW,T); makes all keyboard input upper case.
ch = getc(KE); fetch the last key pressed on keyboard.
setc(KE,ESC); change last keypress to ESC.
lnum = getl(LFROM); fetches long from array
setl(LFROM,lnum); stores long in array
sp = getp(EIP); fetches char pointer from array
setp(EIP,sp); stores char pointer in array
In the first example, VATTRIB is defined as 33, so it points to
the 34th element in the integer array and the instruction get(VATTRIB)
will return the value of the current video attribute.
You should never have to set this value because JJB provides you
with higher level functions which give you complete attribute control.
For example, you can change your program colors by resetting the normal
color as follows in jjb_setup(): set(VNCOLOR, WHITE ONBLUE);
The printed documentation explains how easy it is to do.
The prototypes are:
int get(int) for the integer array
void set(int, int)
char getc(int) for the character array
void setc(int,char)
long getl(int) for the long array
void setl(int,long)
char *getp(int) for the pointer array
void setp(int,char *)
*/
/***************************************************************************
* *
* GET AN INTEGER FROM JJB *
* SET AN INTEGER IN JJB *
* *
* 'FROM JJB' means that the integer is stored in JJB.OBJ and not *
* in the file you are using. *
* *
***************************************************************************/
#ifndef IARRYSIZE
#define IARRYSIZE 80
/* 1 thru 29 are reserved for you the C programmer to use as you wish */
#define YOUCANUSE1 1
#define YOUCANUSE29 29
/* 30 thru 79 are reserved for JJB and are completely described in the
printed documentation. See JJBREAD.ME. */
#define UNUSED 30
#define VIDEOMODE 31
#define ONSTK 32
#define VATTRIB 33
#define VNCOLOR 34
#define VRCOLOR 35
#define VUCOLOR 36
#define VICOLOR 37
#define VNCOLORMENU 38
#define VRCOLORMENU 39
#define VUCOLORMENU 40
#define VWCOLORMENU 41
#define VEXITATTRIB 42
#define IKE 50
#define IKEU 51
#define IKEE 52
#define IKCODE 53
#define UPPER_SW 54
#define VCLRW_SW 55
#define F9OFF_SW 56
#define SHOWSETUP_SW 57
#define BEEPOFF_SW 58
#define KK_SW 59
#define NF_SW 60
#define HEADINGOFF_SW 61
#define BOTOFF_SW 62
#define ALTOFF_SW 63
/* internal JJB variables and switches enter( functions & JJBENTER.OBJ */
/* These are completely described in the printed documentation */
/* You really will have no need to access or change integers 75-79. */
#define EPTR 75
#define ESTART 76
#define EMAX 77
#define EDSP_SW 78
#define ENTER_SW 79
/****************************************************************************
* *
* GET A CHARACTER FROM JJB *
* SET A CHARACTER IN JJB *
* *
* 'getc( and setc( are the same as the integer function except they *
* fetch and store characters. *
* *
* Do not confuse 'getc(KE)' with 'get_ch()'. The function get_ch() waits *
* for a key to be pressed and then stores the values in the character *
* array under the definitions: KE, KEU, KEE and KCODE. get_ch() also *
* stores the integer equivalent in the integer arrays under the *
* definitions: IKE, IKEU, IKEE and IKCODE. *
* *
* When you 'getc(KEU)', all you are doing is fetching from the character *
* array the upper case character of the last keypress. You really do not *
* have to concern yourself with these variables because JJB provides you *
* with all the input functions you will ever need in the obj files *
* jjbinput.obj and jjbenter.obj. Plus you can design your own input *
* routines using the JJBENTER.OBJ functions. *
* *
* *
* char getc(int); ex: ch = getc(KE); reads last keypress *
* void setc(int,char); setc(USERC1,ch); stores char in USERC1 *
* *
* *
****************************************************************************/
#define CARRYSIZE 10 /* size of the character array */
#define USERC1 81 /* reverved for you the programmer to use */
#define USERC2 82 /* " */
#define USERC3 83 /* " */
#define KE 84 /* last keypress */
#define KEU 85 /* last keypress taken to upper case */
#define KEE 86 /* if KE = '\0', KEE holds special key value */
#define KCODE 87 /* keyboard scan code */
#define REMOVE 88
/* Note: You may be thinking that USERC1 above should be defined as 1,
instead of 81. You are correct.
However JJB has made it 81 for a reason.
The get( and set( functions check to make sure that the value being
sent to it is between 0 and 79. If not, an error message will occur.
Therefore if you use 'get(KE)' instead of the proper 'getc(KE)',
JJB will catch your error.
'getc(' and 'setc(' substracts 80 from the value being sent to
it before it fetches or stores a character.
*/
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define WHITE 7
#define GRAY 8
#define ONBLACK + 0
#define ONBLUE + ( BLUE * 16)
#define ONMAGENTA + ( MAGENTA * 16)
#define ONGREEN + ( GREEN * 16)
#define ONCYAN + ( CYAN * 16)
#define ONRED + ( RED * 16)
#define ONBROWN + ( BROWN * 16)
#define ONWHITE + ( WHITE * 16)
#define ONGRAY + ( GRAY * 16)
#define MAKEBRIGHT | 8
#define T 1
#define DRAWLINE 99
#endif
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/