| 1 |
/* |
| 2 |
* NAME |
| 3 |
* pkin.h - header file for readchar() |
| 4 |
* SYNOPSIS |
| 5 |
* #include "pkfile.h" |
| 6 |
* |
| 7 |
* int readchar(name, c, cd) |
| 8 |
* char name[]; shalfword c; chardesc *cd; |
| 9 |
* DESCRIPTION |
| 10 |
* Readchar() opens the pkfile `name', checks if it's a legal pkfile, |
| 11 |
* and reads the character description of `c' into `cd'. Readchar() |
| 12 |
* returns TRUE (1) upon success, FALSE (0) if the character `c' is |
| 13 |
* not found in the pkfile. |
| 14 |
* |
| 15 |
* Parameter `cd' is a pointer to a the following structure: |
| 16 |
* typedef struct { |
| 17 |
* integer charcode, |
| 18 |
* cwidth, cheight, |
| 19 |
* xoff, yoff; |
| 20 |
* halfword *raster ; |
| 21 |
* } chardesc ; |
| 22 |
* |
| 23 |
* Charcode is the code of the character returned, cwidth and cheight |
| 24 |
* respectively the width and height of the character in pixels, |
| 25 |
* xoff and yoff are the offsets of first pixel to the reference point |
| 26 |
* of the character box. |
| 27 |
* Raster is a pointer to the bitmap describing the character. This |
| 28 |
* raster consists of cheight rows of (cwidth + 15) /16 words of |
| 29 |
* 16 bits each. Each row contains from left to right all cwidth |
| 30 |
* pixels of that row. |
| 31 |
* WARNING |
| 32 |
* If the machine has a default integer size of 16 bits, and 32-bit |
| 33 |
* integers must be manipulated with %ld, be carefull! |
| 34 |
* AUTHORS |
| 35 |
* Piet Tutelaers |
| 36 |
*/ |
| 37 |
|
| 38 |
#include <stdio.h> |
| 39 |
#include <stdlib.h> |
| 40 |
/* |
| 41 |
* Type declarations. integer must be a 32-bit signed; shalfword must |
| 42 |
* be a sixteen-bit signed; halfword must be a sixteen-bit unsigned; |
| 43 |
* quarterword must be an eight-bit unsigned. |
| 44 |
*/ |
| 45 |
typedef long integer; |
| 46 |
typedef short shalfword ; |
| 47 |
typedef unsigned short halfword ; |
| 48 |
typedef unsigned char quarterword ; |
| 49 |
typedef short Boolean ; |
| 50 |
/* |
| 51 |
* A chardesc describes an individual character. |
| 52 |
*/ |
| 53 |
typedef struct { |
| 54 |
integer charcode, |
| 55 |
cwidth, cheight, |
| 56 |
xoff, yoff; |
| 57 |
halfword *raster ; |
| 58 |
} chardesc ; |
| 59 |
|
| 60 |
int readchar(char *name, integer c, chardesc *cd); |