home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.update.uu.se
/
ftp.update.uu.se.2014.03.zip
/
ftp.update.uu.se
/
pub
/
rainbow
/
msdos
/
decus
/
RB140
/
grlib03a.arj
/
CREQ.C
< prev
next >
Wrap
Text File
|
1988-12-19
|
5KB
|
130 lines
/***********************************************************/
/* */
/* HIGHER LEVEL 'C' FUNCTIONS FOR THE GRAPHICS LIBRARY */
/* */
/***********************************************************/
#include <stdio.h>
#include <graph.h>
/************************************************************************/
/* */
/* F U N C T I O N ld_font(font_fn, font_number) */
/* char *font_fn; */
/* int font_number; */
/* */
/* purpose: load data in a file into one of the graphics */
/* font arrays. */
/* */
/* entry: font_fn is the name of the file. */
/* font_number number to be loaded. [0 to 3] */
/* */
/* exit: NULL if font loaded OK. */
/* EOF if an error occured */
/* */
/************************************************************************/
ld_font(font_fn,font_number)
char *font_fn;
int font_number;
{
FILE *ffile;
int i;
if ( (ffile = fopen(font_fn,"rb")) == NULL) {
fprintf(stderr,"cannot open font file %s\n",font_fn);
return(EOF);
}
font_number &= 3;
if (tfonts[font_number] == NULL) {
if ((tfonts[font_number] = malloc(2560)) == NULL) {
fprintf(stderr,"Can't allocate memory for %s\n",font_fn);
return(EOF);
}
}
if ( (i = fread(tfonts[font_number],2560,1,ffile)) == NULL || i < 1) {
fprintf(stderr,"Incomplete read of font file - %s\n",font_fn);
return(EOF);
}
fclose(ffile);
return(NULL);
}
/************************************************************************/
/* */
/* F U N C T I O N ld_wsdets(ws_num, type, ws_file) */
/* int ws_num, type; */
/* char *ws_file; */
/* */
/* purpose: load work_station data from file */
/* */
/* exit: NULL work_station loaded OK. */
/* EOF if work_station file could not be found. */
/* */
/************************************************************************/
static char ws_no_err[] = {"Cannot open Work_station file %s\n"};
static char *notice =
"MSDOS Graphics Library 3.00 25-Apr-85 (c) Digital Equipment Co. Ltd.\n";
static char *wsdrivers[] = {
/*01*/ "SMIDMON.GRA",
/*02*/ "SHIGHMON.GRA",
/*03*/ "SMIDCOL.GRA",
/*04*/ "SHIGHCOL.GRA",
/*05*/ "DMID.GRA",
/*06*/ "DHIGH.GRA"
};
ld_wsdets(ws_num, type, ws_file)
int ws_num, type;
char *ws_file;
{
FILE *wfile;
int fsz, i;
unsigned char *mws;
for(i = 0; i < MAX_WS; i++) {
if (gr_data[i].ws_ty) break;
}
if (i == MAX_WS) fprintf(stderr,notice);
if (type < 0) {
if ((wfile = fopen(ws_file, "rb")) == NULL ) {
fprintf(stderr, ws_no_err, ws_file);
return(EOF);
}
}
else if (type == 0 || type > 6) {
fprintf(stderr,"Work_station %d out of range\n", type);
return(EOF);
}
else if ((wfile = fopen(wsdrivers[--type],"rb")) == NULL) {
fprintf(stderr, ws_no_err, wsdrivers[type]);
return(EOF);
}
mws = (char *) &cur_ws;
fsz = sizeof(struct work_station);
fread(mws, fsz, 1, wfile);
fclose(wfile);
return(NULL);
}
/************************************************************************/
/* */
/* F U N C T I O N conout_(char) */
/* */
/* purpose: output character to console */
/* */
/* entry: char to be output */
/* */
/* exit: none. */
/* */
/************************************************************************/
conout_(c)
unsigned char c;
{
putc(c, stderr);
}