Dec 062017
 
A very complete set of high level I/O routines for Microsoft+Turbo C.
File JJBQC.ZIP from The Programmer’s Corner in
Category C Source Code
A very complete set of high level I/O routines for Microsoft+Turbo C.
File Name File Size Zip Size Zip Type
JJB.EXE 46247 18497 deflated
JJB.OBJ 26212 12295 deflated
JJBATOC.BAT 33 28 deflated
JJBDOLLR.OBJ 3672 1845 deflated
JJBGLOSS.DOC 23312 5659 deflated
JJBGO.BAT 65 50 deflated
JJBINPUT.OBJ 6477 3015 deflated
JJBKBD.H 9293 2051 deflated
JJBREAD.ME 14109 3920 deflated
JJBS1.BAT 34 31 deflated
JJBS2.BAT 31 30 deflated
JJBS3.BAT 35 32 deflated
JJBS4.BAT 31 30 deflated
JJBS5.BAT 32 31 deflated
JJBSET.H 9832 2808 deflated
JJBSHOW1.C 6751 1685 deflated
JJBSHOW2.C 4669 1075 deflated
JJBSHOW3.C 5074 1117 deflated
JJBSHOW4.C 9262 2309 deflated
JJBSHOW5.C 6971 2252 deflated
JJBSHOW5.EXE 34375 14727 deflated

Download File JJBQC.ZIP Here

Contents of the JJBGLOSS.DOC file





****************************************************************************
* *
* *
* JJBGLOSS.DOC *
* *
* *
* Copyright (c) 1989, JJB. All rights reserved. *
* *
* Purpose: *
* *
* The purpose of the glossary is to explain the basic JJB functions *
* and how to use them. *
* *
* In some cases, technically correct C jargon is replaced by words *
* the average person can understand. *
* *
* JJB, 9236 church Rd suite 1082, Dallas, Tx 75231 (214) 341-1635 *
****************************************************************************




/****************************************************************************
* *
* functions in file: *
* *
* JJB.OBJ JJBINPUT.OBJ JJBDOLLR.OBJ *
* --------------- ---------------------- ------------------- *
* *
* jjb_initalize() input( input_dollar( *
* jjb_start() input_num( enter_dollar( *
* group( input_lnum( *
* option( enter( *
* init( enter_num *
* leave( enter_lnum( *
* help( Plus additional *
* default() functions which *
* dosexit( let you make your *
* plus hidden own functions. *
* library functions *
* *
* The JJB quick library 'JJB.QLB' contains the functions above. *
* The .bat file 'JJBGO.BAT' can be used to create 'JJB.QLB' *
* *
****************************************************************************


The input functions above give you a trememdous amount of control over
input. You can input alpha-numeric, integer numeric or long numeric. You
can even specify the number range the input must fall into in order to
be acceptable. The functions are explained in this glossary.

The three enter functions make data entry very simple. You can also
design your own enter functions.


* ------------------------------------------------------------*
jjb_initalize()
* ------------------------------------------------------------*


'jjb_initalize()' initalizes the entire JJB system. It should always
be the first function in every program you write.

After jjb_initalize(), you may use any of the hidden JJB library,
see JJBREAD.ME for more on the hidden JJB library.

example:

main() {
jjb_initalize();

jjb_setup();

jjb_start();

}


* ------------------------------------------------------------*
jjb_setup()
* ------------------------------------------------------------*


'jjb_setup()' is the function to use for setting up all our program's
options. Place 'jjb_setup()' in your program.


Below is a list of functions you can use in jjb_setup():

group( to set up a new group
option( to set up an option
funct( to assign a function name to an option
init( to assign a function for initalizing
leave( to assign a function when leaving
help( to assign a function to the F1 key
default_opt() to label an option as the default option
dosexit( to assign a function for exiting your program
set( to change a JJB variable or switch setting
get( to fetch a JJB variable or switch setting

JJB allows you to see the setup if you set the SHOWSETUP_SW to true
before setting up your options. Once setup is correct, you should
remove the instruction so that your final program does not show the
setup.


#include

main() {
jjb_initalize();
jjb_setup();
jjb_start();
}


jjb_setup();
{ set(SHOWSETUP_SW,T);
group("Update");
option("Open a file");
}




* ------------------------------------------------------------*
jjb_start()
* ------------------------------------------------------------*

'jjb_start()' starts calling (executing) your program functions.


It is a continuous loop. Below is a simplified explanation:

jjb_start() {
while (1)
{
execute the function initalizing the group
execute the function initalizing the option

----> execute the function for the option.
(if new option is selected, do a long jump to here)

execute the function leaving the option
execute the fucntion leaving the group.

}

}

Every group and option can be initalized and exited with a function.

If the user of your program selects another option, JJB will do a
long jump back to this loop.

The actual code for this function is 10 times more complicated, but
the logic is the same.


Every keypress in your program is monitored by JJB to see what
action should be taken.

If the user of your program presses 'ALT' and selects an option, JJB:

1. Does a long jump back to this loop.
2. Executes the leave( function for the option if any.
3. Executes the leave( function for the group if different.
4. Executes the init( function for the new group if different.
5. Executes the init( function for the new option if any.
6. Executes the function for the option selected.



* -------------------------------------------------------------------------*
group(" string ")
* -------------------------------------------------------------------------*

void group(char *)

Use 'group(' to start setting up a new group of options.


Here is an examples: group("File");


The technical declaration for this function is 'void group(char *)'.
The void means that this function will not return anything when
it comes back. 'char *' means that when we go to this function,
it will immediately look to the stack expecting one address to be
there.

The address points to one byte in memory. In C we call this a string
or character pointer.


Everytime you use this function, JJB will start a new group of options.



You may have up to 10 groups.
Each group may have any number of options for a maximun of 50.
Group and option desciptions may be of any length with a
maximun of 1200 character for all.


You can not assign a function to a group. You can however assign
a function for initalizing the group and a function which will be
executed when leaving the group.



* -------------------------------------------------------------------------*
option(" string ")
option(" string ",DRAWLINE)
* -------------------------------------------------------------------------*


void option(char *)
void option(char *,int)

Use 'option(' to set up an option in your program.


Here are some examples:

option("Description of this option")
option("Description of this option",DRAWLINE)
option("De's'cription of this option")
option("Description of this option F6")


There are two acceptable prototypes for this function. Both
will set up an option. If you use ',DRAWLINE', JJB will draw a line
in the pull-down menu and separate the option from the next one.
'JJBSHOW1.C' shows you an example of this.


If you do not identify a letter with ' ', JJB will use the first letter
of the option description. If the first letter is already being used,
JJB will assign the second letter and so on.


A function key from F2 thru F8 may be assigned to any option.
To assign a function key to an option, just place it at the end
of the option description as shown in the example above.

From then on, anywhere in your program, if the user presses the
function key, your program will select that option. See example
in file 'JJBSHOW1.C'.


* -------------------------------------------------------------------------*
init(functionname)
leave(functionname)
* -------------------------------------------------------------------------*


You can initalize each group and/or option with a function.

You can leave each group and/or option with a function.


To assign an initalizing function to a group, use 'init(functionname)'
after 'group(' in jjb_setup().

To assign a leaving function to a group, use 'leave(functionname)'
after 'group(' in jjb_setup().


To assign an initalizing function to an option, use 'init(functionname)'
after 'option(' in jjb_setup().

To assign a leaving function to an option, use 'leave(functionname)'
after 'option(' in jjb_setup().




Here is an example:

jjb_setup() {

group("One");
init(init_one);
leave(leave_one);

option("Update file");
funct(update_file);
init(init_updatefile);
leave(leave_updatefile);

group("Two");
}



init_one() { printf("initalize group one \n");
leave_one() { printf("leaving group one \n");

update_file() { printf("This is the option function.\n"); }

init_updatefile() { printf("initalize update file \n");
leave_updatefile() { printf("leaving update file \n");


'JJBSHOW3.C' gives you more examples.


* -------------------------------------------------------------------------*
help(functionname)
* -------------------------------------------------------------------------*


Use 'help(' to assign a help function to the 'F1' key.


Here is how to do it:

-Write your help function.

-Use 'help(functionname)' to assign the function name.


The example below shows you how to set up a help function and
then assign it to the F1 key in jjb_setup(). The example uses
some of the hidden JJB library for saving, clearing and restoring
the screen.

my_help() {
vsave_screen();
vclr_screen();
loc(6,10);
printf("This is help text.")
loc(8,10);
printf("More help text.")
loc(10,10);
printf("Press any key ");
getch();
vrest_screen();
}

jjb_setup() {

help(my_help); /* assign function my_help() to F1 */


}



* -------------------------------------------------------------------------*
default_opt()
* -------------------------------------------------------------------------*


When JJB starts, it will begin executing the default option.
Use this function in jjb_setup() after the option you want to be
the default option.


If you do not assign a default option, JJB will use the first option
set up in jjb_setup(). In the example below, the default option
will be the second option in the second group "Communication Devices":


jjb_setup() {

group("Update");
option("One");
option("Two");


group("Another");
option("Printer control");
option("Communications Devices");
default_opt();
option("Test Signals");

}


You may place 'default_opt()' after any option.

jjb_start() will start with the default option 'Communication Devices'.



* -------------------------------------------------------------------------*
dosexit(
* -------------------------------------------------------------------------*

'F9' is reserved for exiting to DOS.


If you want a function you write to be executed when exiting your
program, write the function and assign the function name in jjbsetup()
as follows:


jjbsetup() {
dosexit(myexit);

}

myexit() { printf("\nPrint this message when you exit."); getch(); }



You can disable the 'F9' feature so JJB will not exit your program.
To disable, set F9OFF_SW to true anywhere in jjb_setup() as follows:



#include


jjb_setup() {

set(F9OFF_SW,T);
}



/****************************************************************************
* *
* input( *
* input_num( *
* input_lnum( *
* input_dollar( *
* *
****************************************************************************


JJB provides you with four medium functions you can use for input. All
of these functions input strings and return the address of the string.

'input_num(' and 'input_lnum(' also edit the string being input to make
sure that the number entered falls within a from/to range.

'input_dollar(' is a very special function which formats the dollar
as you are inputting it just like an adding machine.


Prototypes: char * input(int)
char * input_num(int,int,int)
char * input_lnum(int,long,long)
char * input_dollar()

examples: char *sp;

sp = input(20);

sp = input_num(2,1,12);

long l1 = 100;
long l2 = 999999;
sp = input_lnum(6,l1,l2);

sp = input_dollar();


The first example returns the address of a string up to 20 characters in
length. The second example returns the address of a two character string
which if converted to an integer can not be less than one or greater than
12.


The third example returns the address of a string which contains a long.

The 'input' functions provided above should only be used when you can not
use the 'enter' functions explained below. The 'enter' functions do
10 times more than the 'input' functions.


/****************************************************************************
* *
* enter( *
* enter_num( *
* enter_lnum( *
* enter_dollar( *
* *
****************************************************************************


The 'enter' functions are designed to input entire screens of data
and automatically update a data base master record with the input.
'JJBSHOW5.C' is a good example of this.

Look at that file and notice that the first time through, JJB will
only display the data on the screen and not begin entering until
it comes to the 'etpr_start_with(int)' function.

'eptr' stands for enter pointer. Each 'enter(' increments this
pointer by one. If you press the 'UP' arrow, the pointer is decremented.
Only if data is actually entered, will JJB update the data file.

The printed documentation shows you how you can create your own
'enter' functions using the file 'jjbinput.obj'.


* -------------------------------------------------------------------------*
enter( row, col, " string ", char pointer, len)
* -------------------------------------------------------------------------*


prototype: enter(int,int, char *, char *, int)


The 'enter(' function does the same thing as the 'input(' function; plus
it allows you to precede the input with a label which will be bright on
the screen and dimmed after entry. The enter function also copies the
input to the address referenced by the data address.


enter(8,0,"Enter your name",data address,44)


One of the big advantages about the 'input' and 'enter' functions is
that JJB monitors every keypress looking for the ALT key for changing
options, F1 for help, F9 for exiting your program, etc.


The enter function is a very high-level routine. It automatically updates
the data file. It is designed to be used for entering entire screens
of data. Below is how your input might look on the screen:


Enter your name: ______________________________


Here is a list of what the enter functions do:

-Turn on bright intensity.
-Video fast the string at row and column.
-Turn on the input color for the input.
-Use the input( function to get the data.
-Look to see if the UP or DOWN ARROWS were pressed.
-Turn off bright intensity and turn off input color.
-Video fast the string and the input.
-Update the data address with the data you input.
-If '*' is pressed, clear data with null character.


The file JJBINPUT.OBJ also contains functions which allow you to make
your own enter functions. The printed documentation comes with many
examples showing you how easy it is to make your own enter routines.


Files 'JJBSHOW4.C' and 'JJBSHOW5.C' give you examples.



* -------------------------------------------------------------------------*
enter( row, col, " string ", char pointer, len, row, col)
* -------------------------------------------------------------------------*


prototype: enter(int,int, char *, char *, int, int, int )

This is an extention of the previous enter function. You can place the
data being input anywhere on the video screen. In the example below,
JJB will input on row 12, column 20.
char data[31];

enter( 10, 20, "Enter your name: ", &data[0], 30, 12, 20)


Enter your name:

______________________________


* -------------------------------------------------------------------------*
enter_num( 10, 20, "Enter month: ", dp, 2, 1, 12)
enter_num( row, col, " string ", data pointer, len, from, to)
* -------------------------------------------------------------------------*


prototype: enter_num(int,int, char *, char *, int, int, int)


Use 'enter_num(' to enter and edit integers.


'Enter_num(' is an extremely high-level function. It is designed to
do everything for you automatically. Use it to input integer
values. All values are input as strings but edited as integers and
they must fall within the from/to range in order to be acceptable.

Eventually the full power of JJB will sink into you. Every keypress
is monitored in the entire system. In any 'enter' function, the
user can:

-Press 'RET' and not change the data.
-Press 'ALT' and select another option.
-Press any assigned function key to change options.
-Press 'F1' for help.
-Press 'F9' for DOS exit.
-Press '*' to place blanks in the data string.
-Press 'UPARROW' to move up on the screen to the previous enter.
-Press 'DOWNARROW' or 'RETURN' to move down on the screen
to the next enter.
-Press 'CONTROL G' to put a programmers grid on the screen.

The enter functions are designed to integrate with future JJB software
which will automatically update large data bases with very little
programming effort.



* -------------------------------------------------------------------------*
enter_num( 10, 20, "Enter date: ", dp, 2, 1, 12, 10, 32 )
enter_num( row, col, " string ", data pointer, len, from, to, row,col)
* -------------------------------------------------------------------------*


prototype: enter_num(int,int, char *, char *, int, int, int, int, int)


This example is the same as the above except you may also send to this
function the row and column where you want the input to appear.

Here is an example of entering a date:

ent_date() {
char mo[3];
char day[3];
char yr[3];

vloc(10,33); vfs(" - - ");
enter_num(10, 20, "Enter date: ", &mo[0], 2, 1, 12, 10, 33)
enter_num(10, 20, "Enter date: ", &day[0], 2, 1, 31, 10, 36)
enter_num(10, 20, "Enter date: ", &yr[0], 2, 0, 99, 10, 39)
}


Below is how it could appear.


Enter date: __-__-__



* -------------------------------------------------------------------------*
enter_lnum( row, col, "string", char pointer, len, lfrom, lto)
enter_lnum( row, col, "string", char pointer, len, lfrom, lto, row,col)
* -------------------------------------------------------------------------*


The object file 'JJBINPUT.OBJ' also contains a function for entering long
numbers. Here is an example:

long lfrom = 1;
long lto = 999999;

char ck[7];

enter_lnum(10,20 "Enter check#: " ,&ck[0], 6, lfrom, lto)

If you are not storing numbers as strings, you can convert the
string to a long number as follows: 'lnum = strtol(&ck[0]);'




* -------------------------------------------------------------------------*
enter_dollar( row, col, "string", char pointer, irow, icol)
* -------------------------------------------------------------------------*


This function allows you display a dollar amount from a data file and
enter a new amount updating the file with the new amount.

The amount is entered as a string and formatted on the screen the same
way as an adding machine. Row and col refer to the place on the screen
you want "string" to appear. The dollar amount is input at irow and icol.

The function 'input_dollar(' and 'enter_dollar(' and in the object
file: JJBDOLLR.OBJ. See JJBSHOW5.C for an example.




* -------------------------------------------------------------------------*
end of: JJBGLOSS.DOC
* -------------------------------------------------------------------------*



 December 6, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)