home *** CD-ROM | disk | FTP | other *** search
- Subject: v18i061: GL Graphics Library for AT-clone Unix, Part03/07
- Newsgroups: comp.sources.unix
- Sender: sources
- Approved: rsalz@uunet.UU.NET
-
- Submitted-by: umix!m-net!dtlewis!lewis
- Posting-number: Volume 18, Issue 61
- Archive-name: gl_plot/part03
-
- # To recover, type "sh archive"
- echo restoring bitmaps.h
- sed 's/^X//' > bitmaps.h <<XxX--EOF--XxX
- X/* @(#) bitmaps.h 5.1 89/02/20 */
- X/*
- X * Copyright (c) David T. Lewis 1987, 1988
- X * All rights reserved.
- X *
- X * Permission is granted to use this for any personal noncommercial use.
- X * You may not distribute source or executable code for profit, nor
- X * may you distribute it with a commercial product without the written
- X * consent of the author. Please send modifications to the author for
- X * inclusion in updates to the program. Thanks.
- X */
- X
- X/* IBM/Epson printer parameters */
- X/* Number of print pixel columns across the page. */
- X#define PRINTDENSITY 960
- X/* Number of 8 pixel print rows down the page (times 3 for full page). */
- X#define PRINTLINES 30
- X
- X/* HP Laserjet+ printer parameters */
- X/* Number of bytes (8 pixels per byte) across the page. */
- X#define LJ_BYTES_PER_LINE 140
- X/* Number of 1 pixel print rows down the page (times 3 for full page). */
- X#define LJ_LINES 460
- X/* Define this so we don't need to rely on the sizeof() operator, which */
- X/* returns an integer value. This could be trouble for 16 bit integer */
- X/* machines. The sizeof(LJ_BUF_TYPE) is 140 * 460 = 64400. */
- X#define LJ_BUF_SIZE 64400
- X
- X/*
- X * Define the structure for CGA video memory.
- X */
- Xtypedef struct CGAMEM {
- X char page1[100][80];
- X char filler[192];
- X char page2[100][80];
- X} CGA_BUF_TYPE;
- X
- X/*
- X * Define the structure for EGA video memory.
- X */
- Xtypedef struct EGAMEM {
- X char mem[350][80];
- X} EGA_BUF_TYPE;
- X
- X/*
- X * Define the structure for Hercules video memory.
- X */
- Xtypedef struct HERCMEM {
- X char page1[87][90];
- X char filler1[362];
- X char page2[87][90];
- X char filler2[362];
- X char page3[87][90];
- X char filler3[362];
- X char page4[87][90];
- X} HERC_BUF_TYPE;
- X
- X/*
- X * Define the structure for a memory buffer for IBM printer bit map
- X * image. The horizontal resolution may be either 960 bits, or 480
- X * bits (in which case only part of the 960 characters is used in each
- X * line of the buffer). The buffer is divided into multiple pages so
- X * that it can fit into two memory segments of < 64K each. That is,
- X * three of these structures must be declared to make a complete print
- X * buffer for 90 * 960 byte printing.
- X */
- Xtypedef struct IBM_PR_BUF {
- X char buf[PRINTLINES][PRINTDENSITY];
- X} PR_BUF_TYPE; /* Three of these required! */
- X
- Xtypedef struct LJ_PR_BUF {
- X char buf[LJ_LINES][LJ_BYTES_PER_LINE];
- X} LJ_BUF_TYPE; /* Three of these required! */
- X
- XxX--EOF--XxX
- echo restoring cellfont.h
- sed 's/^X//' > cellfont.h <<XxX--EOF--XxX
- X/* @(#) cellfont.h 5.1 89/02/20 */
- X/* Note: Copyright status unknown. Presumed public domain. dtl 3-15-88*/
- X
- X/* RAM-Loadable Character Sets for the IBM PC
- X Richard Wilton
- X July 1986 */
- X
- X/* definitions for 8 by 8 characters 00 through FF */
- X
- Xstatic char charcell [2048]={
- X 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, /* 000 */
- X 0x07E,0x081,0x0A5,0x081,0x0BD,0x099,0x081,0x07E, /* 001 */
- X 0x07E,0x0FF,0x000,0x0FF,0x0C3,0x0E7,0x0FF,0x07E, /* 002 */
- X 0x06C,0x0FE,0x0FE,0x0FE,0x07C,0x038,0x010,0x000, /* 003 */
- X 0x010,0x038,0x07C,0x0FE,0x07C,0x038,0x010,0x000, /* 004 */
- X 0x038,0x07C,0x038,0x0FE,0x0FE,0x07C,0x038,0x07C, /* 005 */
- X 0x010,0x010,0x038,0x07C,0x0FE,0x07C,0x038,0x07C, /* 006 */
- X 0x000,0x000,0x018,0x03C,0x03C,0x018,0x000,0x000, /* 007 */
- X 0x0FF,0x0FF,0x0E7,0x0C3,0x0C3,0x0E7,0x0FF,0x0FF, /* 008 */
- X 0x000,0x03C,0x066,0x042,0x042,0x066,0x03C,0x000, /* 009 */
- X 0x0FF,0x0C3,0x099,0x0BD,0x0BD,0x099,0x0C3,0x0FF, /* 00A */
- X 0x00F,0x007,0x00F,0x07D,0x0CC,0x0CC,0x0CC,0x078, /* 00B */
- X 0x03C,0x066,0x066,0x066,0x03C,0x018,0x07E,0x018, /* 00C */
- X 0x03F,0x033,0x03F,0x030,0x030,0x070,0x0F0,0x0E0, /* 00D */
- X 0x07F,0x063,0x07F,0x063,0x063,0x067,0x0E6,0x0C0, /* 00E */
- X 0x099,0x05A,0x03C,0x0E7,0x0E7,0x03C,0x05A,0x099, /* 00F */
- X 0x080,0x0E0,0x0F8,0x0FE,0x0F8,0x0E0,0x080,0x000, /* 010 */
- X 0x002,0x00E,0x03E,0x0FE,0x03E,0x00E,0x002,0x000, /* 011 */
- X 0x018,0x03C,0x07E,0x018,0x018,0x07E,0x03C,0x018, /* 012 */
- X 0x066,0x066,0x066,0x066,0x066,0x000,0x066,0x000, /* 013 */
- X 0x07F,0x000,0x000,0x07B,0x01B,0x01B,0x01B,0x000, /* 014 */
- X 0x03E,0x063,0x038,0x06C,0x06C,0x038,0x0CC,0x078, /* 015 */
- X 0x000,0x000,0x000,0x000,0x07E,0x07E,0x07E,0x000, /* 016 */
- X 0x018,0x03C,0x07E,0x018,0x07E,0x03C,0x018,0x0FF, /* 017 */
- X 0x018,0x03C,0x07E,0x018,0x018,0x018,0x018,0x000, /* 018 */
- X 0x018,0x018,0x018,0x018,0x07E,0x03C,0x018,0x000, /* 019 */
- X 0x000,0x018,0x00C,0x0FE,0x00C,0x018,0x000,0x000, /* 01A */
- X 0x000,0x030,0x060,0x0FE,0x060,0x030,0x000,0x000, /* 01B */
- X 0x000,0x000,0x0C0,0x0C0,0x0C0,0x0FE,0x000,0x000, /* 01C */
- X 0x000,0x024,0x066,0x0FF,0x066,0x024,0x000,0x000, /* 01D */
- X 0x000,0x018,0x03C,0x07E,0x0FF,0x0FF,0x000,0x000, /* 01E */
- X 0x000,0x0FF,0x0FF,0x07E,0x03C,0x018,0x000,0x000, /* 01F */
- X 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, /* 020 */
- X 0x030,0x078,0x078,0x030,0x030,0x000,0x030,0x000, /* 021 */
- X 0x06C,0x06C,0x06C,0x000,0x000,0x000,0x000,0x000, /* 022 */
- X 0x06C,0x06C,0x0FE,0x06C,0x0FE,0x06C,0x06C,0x000, /* 023 */
- X 0x030,0x07C,0x0C0,0x078,0x00C,0x0F8,0x030,0x000, /* 024 */
- X 0x000,0x0C6,0x0CC,0x018,0x030,0x066,0x0C6,0x000, /* 025 */
- X 0x038,0x06C,0x038,0x076,0x0DC,0x0CC,0x076,0x000, /* 026 */
- X 0x060,0x060,0x0C0,0x000,0x000,0x000,0x000,0x000, /* 027 */
- X 0x018,0x030,0x060,0x060,0x060,0x030,0x018,0x000, /* 028 */
- X 0x060,0x030,0x018,0x018,0x018,0x030,0x060,0x000, /* 029 */
- X 0x000,0x066,0x03C,0x0FF,0x03C,0x066,0x000,0x000, /* 02A */
- X 0x000,0x030,0x030,0x0FC,0x030,0x030,0x000,0x000, /* 02B */
- X 0x000,0x000,0x000,0x000,0x000,0x030,0x030,0x060, /* 02C */
- X 0x000,0x000,0x000,0x0FC,0x000,0x000,0x000,0x000, /* 02D */
- X 0x000,0x000,0x000,0x000,0x000,0x030,0x030,0x000, /* 02E */
- X 0x006,0x00C,0x018,0x030,0x060,0x0C0,0x080,0x000, /* 02F */
- X 0x07C,0x0C6,0x0CE,0x0DE,0x0F6,0x0E6,0x07C,0x000, /* 030 */
- X 0x030,0x070,0x030,0x030,0x030,0x030,0x0FC,0x000, /* 031 */
- X 0x078,0x0CC,0x00C,0x038,0x060,0x0CC,0x0FC,0x000, /* 032 */
- X 0x078,0x0CC,0x00C,0x038,0x00C,0x0CC,0x078,0x000, /* 033 */
- X 0x01C,0x03C,0x06C,0x0CC,0x0FE,0x00C,0x01E,0x000, /* 034 */
- X 0x0FC,0x0C0,0x0F8,0x00C,0x00C,0x0CC,0x078,0x000, /* 035 */
- X 0x038,0x060,0x0C0,0x0F8,0x0CC,0x0CC,0x078,0x000, /* 036 */
- X 0x0FC,0x0CC,0x00C,0x018,0x030,0x030,0x030,0x000, /* 037 */
- X 0x078,0x0CC,0x0CC,0x078,0x0CC,0x0CC,0x078,0x000, /* 038 */
- X 0x078,0x0CC,0x0CC,0x07C,0x00C,0x018,0x070,0x000, /* 039 */
- X 0x000,0x030,0x030,0x000,0x000,0x030,0x030,0x000, /* 03A */
- X 0x000,0x030,0x030,0x000,0x000,0x030,0x030,0x060, /* 03B */
- X 0x018,0x030,0x060,0x0C0,0x060,0x030,0x018,0x000, /* 03C */
- X 0x000,0x000,0x0FC,0x000,0x000,0x0FC,0x000,0x000, /* 03D */
- X 0x060,0x030,0x018,0x00C,0x018,0x030,0x060,0x000, /* 03E */
- X 0x078,0x0CC,0x00C,0x018,0x030,0x000,0x030,0x000, /* 03F */
- X 0x07C,0x0C6,0x0DE,0x0DE,0x0DE,0x0C0,0x078,0x000, /* 040 */
- X 0x030,0x078,0x0CC,0x0CC,0x0FC,0x0CC,0x0CC,0x000, /* 041 */
- X 0x0FC,0x066,0x066,0x07C,0x066,0x066,0x0FC,0x000, /* 042 */
- X 0x03C,0x066,0x0C0,0x0C0,0x0C0,0x066,0x03C,0x000, /* 043 */
- X 0x0F8,0x06C,0x066,0x066,0x066,0x06C,0x0F8,0x000, /* 044 */
- X 0x0FE,0x062,0x068,0x078,0x068,0x062,0x0FE,0x000, /* 045 */
- X 0x0FE,0x062,0x068,0x078,0x068,0x060,0x0F0,0x000, /* 046 */
- X 0x03C,0x066,0x0C0,0x0C0,0x0CE,0x066,0x03E,0x000, /* 047 */
- X 0x0CC,0x0CC,0x0CC,0x0FC,0x0CC,0x0CC,0x0CC,0x000, /* 048 */
- X 0x078,0x030,0x030,0x030,0x030,0x030,0x078,0x000, /* 049 */
- X 0x01E,0x00C,0x00C,0x00C,0x0CC,0x0CC,0x078,0x000, /* 04A */
- X 0x0E6,0x066,0x06C,0x078,0x06C,0x066,0x0E6,0x000, /* 04B */
- X 0x0F0,0x060,0x060,0x060,0x062,0x066,0x0FE,0x000, /* 04C */
- X 0x0C6,0x0EE,0x0FE,0x0FE,0x0D6,0x0C6,0x0C6,0x000, /* 04D */
- X 0x0C6,0x0E6,0x0F6,0x0DE,0x0CE,0x0C6,0x0C6,0x000, /* 04E */
- X 0x038,0x06C,0x0C6,0x0C6,0x0C6,0x06C,0x038,0x000, /* 04F */
- X 0x0FC,0x066,0x066,0x07C,0x060,0x060,0x0F0,0x000, /* 050 */
- X 0x078,0x0CC,0x0CC,0x0CC,0x0DC,0x078,0x01C,0x000, /* 051 */
- X 0x0FC,0x066,0x066,0x07C,0x06C,0x066,0x0E6,0x000, /* 052 */
- X 0x078,0x0CC,0x0E0,0x070,0x01C,0x0CC,0x078,0x000, /* 053 */
- X 0x0FC,0x0B4,0x030,0x030,0x030,0x030,0x078,0x000, /* 054 */
- X 0x0CC,0x0CC,0x0CC,0x0CC,0x0CC,0x0CC,0x0FC,0x000, /* 055 */
- X 0x0CC,0x0CC,0x0CC,0x0CC,0x0CC,0x078,0x030,0x000, /* 056 */
- X 0x0C6,0x0C6,0x0C6,0x0D6,0x0FE,0x0EE,0x0C6,0x000, /* 057 */
- X 0x0C6,0x0C6,0x06C,0x038,0x038,0x06C,0x0C6,0x000, /* 058 */
- X 0x0CC,0x0CC,0x0CC,0x078,0x030,0x030,0x078,0x000, /* 059 */
- X 0x0FE,0x0C6,0x08C,0x018,0x032,0x066,0x0FE,0x000, /* 05A */
- X 0x078,0x060,0x060,0x060,0x060,0x060,0x078,0x000, /* 05B */
- X 0x0C0,0x060,0x030,0x018,0x00C,0x006,0x002,0x000, /* 05C */
- X 0x078,0x018,0x018,0x018,0x018,0x018,0x078,0x000, /* 05D */
- X 0x010,0x038,0x06C,0x0C6,0x000,0x000,0x000,0x000, /* 05E */
- X 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x0FF, /* 05F */
- X 0x030,0x030,0x018,0x000,0x000,0x000,0x000,0x000, /* 060 */
- X 0x000,0x000,0x078,0x00C,0x07C,0x0CC,0x076,0x000, /* 061 */
- X 0x0E0,0x060,0x060,0x07C,0x066,0x066,0x0DC,0x000, /* 062 */
- X 0x000,0x000,0x078,0x0CC,0x0C0,0x0CC,0x078,0x000, /* 063 */
- X 0x01C,0x00C,0x00C,0x07C,0x0CC,0x0CC,0x076,0x000, /* 064 */
- X 0x000,0x000,0x078,0x0CC,0x0FC,0x0C0,0x078,0x000, /* 065 */
- X 0x038,0x06C,0x060,0x0F0,0x060,0x060,0x0F0,0x000, /* 066 */
- X 0x000,0x000,0x076,0x0CC,0x0CC,0x07C,0x00C,0x0F8, /* 067 */
- X 0x0E0,0x060,0x06C,0x076,0x066,0x066,0x0E6,0x000, /* 068 */
- X 0x030,0x000,0x070,0x030,0x030,0x030,0x078,0x000, /* 069 */
- X 0x00C,0x000,0x00C,0x00C,0x00C,0x0CC,0x0CC,0x078, /* 06A */
- X 0x0E0,0x060,0x066,0x06C,0x078,0x06C,0x0E6,0x000, /* 06B */
- X 0x070,0x030,0x030,0x030,0x030,0x030,0x078,0x000, /* 06C */
- X 0x000,0x000,0x0CC,0x0FE,0x0FE,0x0D6,0x0C6,0x000, /* 06D */
- X 0x000,0x000,0x0F8,0x0CC,0x0CC,0x0CC,0x0CC,0x000, /* 06E */
- X 0x000,0x000,0x078,0x0CC,0x0CC,0x0CC,0x078,0x000, /* 06F */
- X 0x000,0x000,0x0DC,0x066,0x066,0x07C,0x060,0x0F0, /* 070 */
- X 0x000,0x000,0x076,0x0CC,0x0CC,0x07C,0x00C,0x01E, /* 071 */
- X 0x000,0x000,0x0DC,0x076,0x066,0x060,0x0F0,0x000, /* 072 */
- X 0x000,0x000,0x07C,0x0C0,0x078,0x00C,0x0F8,0x000, /* 073 */
- X 0x010,0x030,0x07C,0x030,0x030,0x034,0x018,0x000, /* 074 */
- X 0x000,0x000,0x0CC,0x0CC,0x0CC,0x0CC,0x076,0x000, /* 075 */
- X 0x000,0x000,0x0CC,0x0CC,0x0CC,0x078,0x030,0x000, /* 076 */
- X 0x000,0x000,0x0C6,0x0D6,0x0FE,0x0FE,0x06C,0x000, /* 077 */
- X 0x000,0x000,0x0C6,0x06C,0x038,0x06C,0x0C6,0x000, /* 078 */
- X 0x000,0x000,0x0CC,0x0CC,0x0CC,0x07C,0x00C,0x0F8, /* 079 */
- X 0x000,0x000,0x0FC,0x098,0x030,0x064,0x0FC,0x000, /* 07A */
- X 0x01C,0x030,0x030,0x0E0,0x030,0x030,0x01C,0x000, /* 07B */
- X 0x018,0x018,0x018,0x000,0x018,0x018,0x018,0x000, /* 07C */
- X 0x0E0,0x030,0x030,0x01C,0x030,0x030,0x0E0,0x000, /* 07D */
- X 0x076,0x0DC,0x000,0x000,0x000,0x000,0x000,0x000, /* 07E */
- X 0x000,0x010,0x038,0x06C,0x0C6,0x0C6,0x0FE,0x000, /* 07F */
- X 0x078,0x0CC,0x0C0,0x0CC,0x078,0x018,0x00C,0x078, /* 080 */
- X 0x000,0x066,0x000,0x066,0x066,0x066,0x03F,0x000, /* 081 */
- X 0x00E,0x000,0x03C,0x066,0x07E,0x060,0x03C,0x000, /* 082 */
- X 0x07E,0x0C3,0x03C,0x006,0x03E,0x066,0x03F,0x000, /* 083 */
- X 0x066,0x000,0x03C,0x006,0x03E,0x066,0x03F,0x000, /* 084 */
- X 0x070,0x000,0x03C,0x006,0x03E,0x066,0x03F,0x000, /* 085 */
- X 0x018,0x018,0x03C,0x006,0x03E,0x066,0x03F,0x000, /* 086 */
- X 0x000,0x000,0x03C,0x060,0x060,0x03C,0x006,0x01C, /* 087 */
- X 0x07E,0x0C3,0x03C,0x066,0x07E,0x060,0x03C,0x000, /* 088 */
- X 0x066,0x000,0x03C,0x066,0x07E,0x060,0x03C,0x000, /* 089 */
- X 0x070,0x000,0x03C,0x066,0x07E,0x060,0x03C,0x000, /* 08A */
- X 0x066,0x000,0x038,0x018,0x018,0x018,0x03C,0x000, /* 08B */
- X 0x07C,0x0C6,0x038,0x018,0x018,0x018,0x03C,0x000, /* 08C */
- X 0x070,0x000,0x038,0x018,0x018,0x018,0x03C,0x000, /* 08D */
- X 0x063,0x01C,0x036,0x063,0x07F,0x063,0x063,0x000, /* 08E */
- X 0x018,0x018,0x000,0x03C,0x066,0x07E,0x066,0x000, /* 08F */
- X 0x00E,0x000,0x07E,0x030,0x03C,0x030,0x07E,0x000, /* 090 */
- X 0x000,0x000,0x07F,0x00C,0x07F,0x0CC,0x07F,0x000, /* 091 */
- X 0x01F,0x036,0x066,0x07F,0x066,0x066,0x067,0x000, /* 092 */
- X 0x03C,0x066,0x000,0x03C,0x066,0x066,0x03C,0x000, /* 093 */
- X 0x000,0x066,0x000,0x03C,0x066,0x066,0x03C,0x000, /* 094 */
- X 0x000,0x070,0x000,0x03C,0x066,0x066,0x03C,0x000, /* 095 */
- X 0x03C,0x066,0x000,0x066,0x066,0x066,0x03F,0x000, /* 096 */
- X 0x000,0x070,0x000,0x066,0x066,0x066,0x03F,0x000, /* 097 */
- X 0x000,0x066,0x000,0x066,0x066,0x03E,0x006,0x07C, /* 098 */
- X 0x0C3,0x018,0x03C,0x066,0x066,0x03C,0x018,0x000, /* 099 */
- X 0x066,0x000,0x066,0x066,0x066,0x066,0x03C,0x000, /* 09A */
- X 0x018,0x018,0x07E,0x0C0,0x0C0,0x07E,0x018,0x018, /* 09B */
- X 0x01C,0x036,0x032,0x078,0x030,0x073,0x07E,0x000, /* 09C */
- X 0x066,0x066,0x03C,0x07E,0x018,0x07E,0x018,0x018, /* 09D */
- X 0x0F8,0x0CC,0x0CC,0x0FA,0x0C6,0x0CF,0x0C6,0x0C7, /* 09E */
- X 0x00E,0x01B,0x018,0x03C,0x018,0x018,0x0D8,0x070, /* 09F */
- X 0x00E,0x000,0x03C,0x006,0x03E,0x066,0x03F,0x000, /* 0A0 */
- X 0x01C,0x000,0x038,0x018,0x018,0x018,0x03C,0x000, /* 0A1 */
- X 0x000,0x00E,0x000,0x03C,0x066,0x066,0x03C,0x000, /* 0A2 */
- X 0x000,0x00E,0x000,0x066,0x066,0x066,0x03F,0x000, /* 0A3 */
- X 0x000,0x07C,0x000,0x07C,0x066,0x066,0x066,0x000, /* 0A4 */
- X 0x07E,0x000,0x066,0x076,0x07E,0x06E,0x066,0x000, /* 0A5 */
- X 0x03C,0x06C,0x06C,0x03E,0x000,0x07E,0x000,0x000, /* 0A6 */
- X 0x038,0x06C,0x06C,0x038,0x000,0x07C,0x000,0x000, /* 0A7 */
- X 0x018,0x000,0x018,0x030,0x060,0x066,0x03C,0x000, /* 0A8 */
- X 0x000,0x000,0x000,0x07E,0x060,0x060,0x000,0x000, /* 0A9 */
- X 0x000,0x000,0x000,0x07E,0x006,0x006,0x000,0x000, /* 0AA */
- X 0x0C3,0x0C6,0x0CC,0x0DE,0x033,0x066,0x0CC,0x00F, /* 0AB */
- X 0x0C3,0x0C6,0x0CC,0x000,0x037,0x06F,0x0CF,0x003, /* 0AC */
- X 0x018,0x018,0x000,0x018,0x018,0x018,0x018,0x000, /* 0AD */
- X 0x000,0x033,0x066,0x0CC,0x066,0x033,0x000,0x000, /* 0AE */
- X 0x000,0x0CC,0x066,0x033,0x066,0x0CC,0x000,0x000, /* 0AF */
- X 0x022,0x088,0x022,0x088,0x022,0x088,0x022,0x088, /* 0B0 */
- X 0x055,0x0AA,0x055,0x0AA,0x055,0x0AA,0x055,0x0AA, /* 0B1 */
- X 0x000,0x077,0x000,0x0EE,0x000,0x077,0x000,0x0EE, /* 0B2 */
- X 0x018,0x018,0x018,0x018,0x018,0x018,0x018,0x018, /* 0B3 */
- X 0x018,0x018,0x018,0x018,0x0F8,0x018,0x018,0x018, /* 0B4 */
- X 0x018,0x018,0x0F8,0x018,0x0F8,0x018,0x018,0x018, /* 0B5 */
- X 0x036,0x036,0x036,0x036,0x0F6,0x036,0x036,0x036, /* 0B6 */
- X 0x000,0x000,0x000,0x000,0x0FE,0x036,0x036,0x036, /* 0B7 */
- X 0x000,0x000,0x0F8,0x018,0x0F8,0x018,0x018,0x018, /* 0B8 */
- X 0x036,0x036,0x0F6,0x006,0x0F6,0x036,0x036,0x036, /* 0B9 */
- X 0x036,0x036,0x036,0x036,0x036,0x036,0x036,0x036, /* 0BA */
- X 0x000,0x000,0x0FE,0x006,0x0F6,0x036,0x036,0x036, /* 0BB */
- X 0x036,0x036,0x0F6,0x006,0x0FE,0x000,0x000,0x000, /* 0BC */
- X 0x036,0x036,0x036,0x036,0x0FE,0x000,0x000,0x000, /* 0BD */
- X 0x018,0x018,0x0F8,0x018,0x0F8,0x000,0x000,0x000, /* 0BE */
- X 0x000,0x000,0x000,0x000,0x0F8,0x018,0x018,0x018, /* 0BF */
- X 0x018,0x018,0x018,0x018,0x01F,0x000,0x000,0x000, /* 0C0 */
- X 0x018,0x018,0x018,0x018,0x0FF,0x000,0x000,0x000, /* 0C1 */
- X 0x000,0x000,0x000,0x000,0x0FF,0x018,0x018,0x018, /* 0C2 */
- X 0x018,0x018,0x018,0x018,0x01F,0x018,0x018,0x018, /* 0C3 */
- X 0x000,0x000,0x000,0x000,0x0FF,0x000,0x000,0x000, /* 0C4 */
- X 0x018,0x018,0x018,0x018,0x0FF,0x018,0x018,0x018, /* 0C5 */
- X 0x018,0x018,0x01F,0x018,0x01F,0x018,0x018,0x018, /* 0C6 */
- X 0x036,0x036,0x036,0x036,0x037,0x036,0x036,0x036, /* 0C7 */
- X 0x036,0x036,0x037,0x030,0x03F,0x000,0x000,0x000, /* 0C8 */
- X 0x000,0x000,0x03F,0x030,0x037,0x036,0x036,0x036, /* 0C9 */
- X 0x036,0x036,0x0F7,0x000,0x0FF,0x000,0x000,0x000, /* 0CA */
- X 0x000,0x000,0x0FF,0x000,0x0F7,0x036,0x036,0x036, /* 0CB */
- X 0x036,0x036,0x037,0x030,0x037,0x036,0x036,0x036, /* 0CC */
- X 0x000,0x000,0x0FF,0x000,0x0FF,0x000,0x000,0x000, /* 0CD */
- X 0x036,0x036,0x0F7,0x000,0x0F7,0x036,0x036,0x036, /* 0CE */
- X 0x018,0x018,0x0FF,0x000,0x0FF,0x000,0x000,0x000, /* 0CF */
- X 0x036,0x036,0x036,0x036,0x0FF,0x000,0x000,0x000, /* 0D0 */
- X 0x000,0x000,0x0FF,0x000,0x0FF,0x018,0x018,0x018, /* 0D1 */
- X 0x000,0x000,0x000,0x000,0x0FF,0x036,0x036,0x036, /* 0D2 */
- X 0x036,0x036,0x036,0x036,0x03F,0x000,0x000,0x000, /* 0D3 */
- X 0x018,0x018,0x01F,0x018,0x01F,0x000,0x000,0x000, /* 0D4 */
- X 0x000,0x000,0x01F,0x018,0x01F,0x018,0x018,0x018, /* 0D5 */
- X 0x000,0x000,0x000,0x000,0x03F,0x036,0x036,0x036, /* 0D6 */
- X 0x036,0x036,0x036,0x036,0x0FF,0x036,0x036,0x036, /* 0D7 */
- X 0x018,0x018,0x0FF,0x018,0x0FF,0x018,0x018,0x018, /* 0D8 */
- X 0x018,0x018,0x018,0x018,0x0F8,0x000,0x000,0x000, /* 0D9 */
- X 0x000,0x000,0x000,0x000,0x01F,0x018,0x018,0x018, /* 0DA */
- X 0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF, /* 0 */
- X 0x000,0x000,0x000,0x000,0x0FF,0x0FF,0x0FF,0x0FF, /* 0DC */
- X 0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,0x0F0,0x0F0, /* 0DD */
- X 0x00F,0x00F,0x00F,0x00F,0x00F,0x00F,0x00F,0x00F, /* 0DE */
- X 0x0FF,0x0FF,0x0FF,0x0FF,0x000,0x000,0x000,0x000, /* 0DF */
- X 0x000,0x000,0x03B,0x06E,0x064,0x06E,0x03B,0x000, /* 0E0 */
- X 0x000,0x03C,0x066,0x07C,0x066,0x07C,0x060,0x060, /* 0E1 */
- X 0x000,0x07E,0x066,0x060,0x060,0x060,0x060,0x000, /* 0E2 */
- X 0x000,0x07F,0x036,0x036,0x036,0x036,0x036,0x000, /* 0E3 */
- X 0x07E,0x066,0x030,0x018,0x030,0x066,0x07E,0x000, /* 0E4 */
- X 0x000,0x000,0x03F,0x06C,0x06C,0x06C,0x038,0x000, /* 0E5 */
- X 0x000,0x033,0x033,0x033,0x033,0x03E,0x030,0x060, /* 0E6 */
- X 0x000,0x03B,0x06E,0x00C,0x00C,0x00C,0x00C,0x000, /* 0E7 */
- X 0x07E,0x018,0x03C,0x066,0x066,0x03C,0x018,0x07E, /* 0E8 */
- X 0x01C,0x036,0x063,0x07F,0x063,0x036,0x01C,0x000, /* 0E9 */
- X 0x01C,0x036,0x063,0x063,0x036,0x036,0x077,0x000, /* 0EA */
- X 0x00E,0x018,0x00C,0x03E,0x066,0x066,0x03C,0x000, /* 0EB */
- X 0x000,0x000,0x07E,0x000,0x000,0x07E,0x000,0x000, /* 0EC */
- X 0x006,0x00C,0x07E,0x000,0x000,0x07E,0x060,0x0C0, /* 0ED */
- X 0x01C,0x060,0x0C0,0x0FC,0x0C0,0x060,0x01C,0x000, /* 0EE */
- X 0x03C,0x066,0x066,0x066,0x066,0x066,0x066,0x000, /* 0EF */
- X 0x000,0x07E,0x000,0x07E,0x000,0x07E,0x000,0x000, /* 0F0 */
- X 0x018,0x018,0x07E,0x018,0x018,0x000,0x07E,0x000, /* 0F1 */
- X 0x030,0x018,0x00C,0x018,0x030,0x000,0x07E,0x000, /* 0F2 */
- X 0x00C,0x018,0x030,0x018,0x00C,0x000,0x07E,0x000, /* 0F3 */
- X 0x00E,0x01B,0x01B,0x018,0x018,0x018,0x018,0x018, /* 0F4 */
- X 0x018,0x018,0x018,0x018,0x018,0x0D8,0x0D8,0x070, /* 0F5 */
- X 0x018,0x018,0x000,0x07E,0x000,0x018,0x018,0x000, /* 0F6 */
- X 0x000,0x076,0x0DC,0x000,0x076,0x0DC,0x000,0x000, /* 0F7 */
- X 0x038,0x06C,0x06C,0x038,0x000,0x000,0x000,0x000, /* 0F8 */
- X 0x000,0x000,0x000,0x018,0x018,0x000,0x000,0x000, /* 0F9 */
- X 0x000,0x000,0x000,0x000,0x018,0x000,0x000,0x000, /* 0FA */
- X 0x00F,0x00C,0x00C,0x00C,0x0EC,0x06C,0x03C,0x01C, /* 0FB */
- X 0x078,0x06C,0x06C,0x06C,0x06C,0x000,0x000,0x000, /* 0FC */
- X 0x070,0x018,0x030,0x060,0x078,0x000,0x000,0x000, /* 0FD */
- X 0x000,0x000,0x03C,0x03C,0x03C,0x03C,0x000,0x000, /* 0FE */
- X 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000 /* 0FF */
- X};
- XxX--EOF--XxX
- echo restoring g_pixctl.c
- sed 's/^X//' > g_pixctl.c <<XxX--EOF--XxX
- X
- X#ifndef lint
- Xstatic char sccsid[] = "@(#) g_pixctl.c 5.1 89/02/20";
- X#endif
- X
- X/*
- X * Copyright (c) David T. Lewis 1988
- X * All rights reserved.
- X *
- X * Permission is granted to use this for any personal noncommercial use.
- X * You may not distribute source or executable code for profit, nor
- X * may you distribute it with a commercial product without the written
- X * consent of the author. Please send modifications to the author for
- X * inclusion in updates to the program. Thanks.
- X */
- X
- X/*
- X * This module contains routines for setting pixel color and writing
- X * mode, and for setting line weight and style.
- X */
- X
- X#include "config.h"
- X#include "bitmaps.h"
- X#include "gf_types.h"
- X#include "graphics.h"
- X#include "modes.h"
- X
- X#define ROT_MASK ((long)0x80000000L)
- X
- Xextern struct GL_graphics graphics;
- Xextern int p_wr_pix();
- X
- Xstatic int p_mask_pix();
- Xstatic long current_style;
- X
- Xint (*p_do_pix)(); /* Called by n_draw() */
- X
- X/* Set the color to be used for all pixel operations. The returned */
- X/* value is the previous color setting. */
- X
- Xint g_pix_color(color)
- Xint color;
- X{
- X int last_color;
- X last_color = graphics.color;
- X graphics.color = color;
- X if (graphics.grafmode == EGA_COLOR_MODE) {
- X /* Write to EGA registers. Not yet implemented. */
- X /* Ditto for VGA. */
- X }
- X return(last_color);
- X}
- X
- X/* Set the pixel writing mode to update pixels in either OR mode */
- X/* (set the pixel on, regardless of previous state), or XOR mode */
- X/* (pixel is XORed with its previous value). XOR mode is used for */
- X/* things like graphics cursors which may be placed on the screen */
- X/* without destroying the previous screen contents. */
- X/* The returned value is the previous state of the pixel mode. */
- X
- Xint g_pix_mode(mode_val)
- Xint mode_val;
- X{
- X int last_mode;
- X last_mode = graphics.wrt_mode;
- X switch (mode_val) {
- X case CLEAR: /* (Not yet implemented) */
- X graphics.wrt_mode = CLEAR;
- X break;
- X case AND: /* (Not yet implemented) */
- X graphics.wrt_mode = AND;
- X break;
- X case OR:
- X graphics.wrt_mode = OR;
- X break;
- X case XOR:
- X graphics.wrt_mode = XOR;
- X break;
- X default:
- X graphics.wrt_mode = OR;
- X break;
- X }
- X return(last_mode);
- X}
- X
- X/* Set the line thickness to be used for all line drawing operations. */
- X/* The returned value is the previous line weight setting. */
- X
- Xint g_weight(lineweight)
- Xint lineweight;
- X{
- X int last_weight;
- X last_weight = graphics.lineweight;
- X graphics.lineweight = lineweight;
- X return(last_weight);
- X}
- X
- X/* P_mask_pix() will be used only if a line style is desired. */
- X/* Otherwise, we will directly invoke p_wr_pix(). */
- X
- Xstatic int p_mask_pix(x, y)
- Xint x, y;
- X{
- X /* If high bit in graphics.linestyle is a 1, then */
- X /* write the pixel; otherwise, don't write it. */
- X
- X if (((current_style & ROT_MASK)) != 0) {
- X /* High bit set, rotate the line style mask */
- X /* and write the pixel. */
- X current_style = current_style<<1;
- X current_style++;
- X return (p_wr_pix(x, y));
- X }
- X else {
- X /* Rotate mask, but don't write pixel. */
- X current_style = current_style<<1;
- X return(0);
- X }
- X}
- X
- X/* Line style (e.g. dot-dash) */
- X
- X/* Set the line style (e.g. dot-dash) to be used for all line drawing */
- X/* operations. The returned value is the previous line style setting. */
- X
- Xlong g_style(linestyle)
- Xlong linestyle;
- X{
- X long last_style;
- X last_style = graphics.linestyle;
- X
- X /* The current "state" of linestyle is stored in */
- X /* graphics.linestyle, and a copy of this value is */
- X /* kept locally in current_style, to be manipulated by */
- X /* the g_mask_pix() routine (above). */
- X graphics.linestyle = current_style = linestyle;
- X
- X /* Decide what type of pixel routine to use. If we */
- X /* have to consider line style, then we will use */
- X /* mask_pix(). */
- X if (linestyle == SOLID) {
- X p_do_pix = p_wr_pix;
- X }
- X else {
- X p_do_pix = p_mask_pix;
- X }
- X return(last_style);
- X}
- X
- X
- XxX--EOF--XxX
- echo restoring graphics.h
- sed 's/^X//' > graphics.h <<XxX--EOF--XxX
- X
- X/* @(#) graphics.h 5.1 89/02/20 */
- X/*
- X * Copyright (c) David T. Lewis 1987, 1988
- X * All rights reserved.
- X *
- X * Permission is granted to use this for any personal noncommercial use.
- X * You may not distribute source or executable code for profit, nor
- X * may you distribute it with a commercial product without the written
- X * consent of the author. Please send modifications to the author for
- X * inclusion in updates to the program. Thanks.
- X */
- X
- X/* Sun Dec 20 18:31:11 EST 1987 */
- X/* system5 dtlewis 2 2.2-U AT */
- X
- X#if XENIX_286 /* Support mixed memory model for MS compilers. */
- X#define FAR far
- X#else
- X#define FAR
- X#endif /* XENIX_286 */
- X
- X#define TRUE (1)
- X#define FALSE (0)
- X
- X/*
- X * The following are for MS-DOS and BIOS calls.
- X */
- X#define DOS 0x021
- X#define VIDEO_BIOS 0x010
- X#define SET_VIDEO_MODE 0x00
- X#define GET_VIDEO_MODE 0x0f
- X#define DOS_GET_TIME 0x2c
- X#define WRT_PIXEL 0x0C
- X
- X/*
- X * The following are masks for the four possible 2-bit pixel
- X * positions in CGA 320x200 mode.
- X */
- X#define PIX0 0x0C0
- X#define PIX1 0x030
- X#define PIX2 0x0C
- X#define PIX3 0x03
- X
- X/*
- X * Define range of the normalized 2D coordinate system
- X */
- X#define NRM_X_MIN 0
- X#define NRM_Y_MIN 0
- X#define NRM_X_MAX 32767
- X#define NRM_Y_MAX 32767
- X#define NRM_X_RANGE 0x7FFFL
- X#define NRM_Y_RANGE 0x7FFFL
- X
- X/*
- X * Define TRIG_SCALE, F_TRIG_SCALE and PTS_PER_QUADRANT for use in
- X * trig.c and related routines.
- X */
- X#define TRIG_SCALE 32768 /* Factor by which the cos and sin */
- X /* tables are multiplied in order to */
- X /* be able to use them in integer math. */
- X /* This also effects contents of */
- X /* cos_table and sin_table. */
- X
- X#define F_TRIG_SCALE 32768.0 /* Floating point version. */
- X
- X#define PTS_PER_QUADRANT 64 /* Don't change this without also */
- X /* changing the initializations for the */
- X /* cos_table and sin_table tables also! */
- X
- X#define X_CELL_BITS 8 /* Number of bits per character cell */
- X /* in X direction. */
- X
- X#define Y_CELL_BITS 8 /* Number of bits per character cell */
- X /* in Y direction. */
- X
- X/* Define transforms for normalized 2-D drawing space to pixel space. */
- X/* These routines convert from normalized (x,y) coordinates to local */
- X/* screen pixel coordinates. The normalized coordinate system extends */
- X/* from 0 to 32767 in the x direction, and from 0 to 32767 in the */
- X/* downward y direction, with the origin at the upper left of the */
- X/* screen. Screen aspect ratio is not taken into account. */
- X
- X#if N_TO_P_MACRO
- X#define n_to_p_x(x) ((int)(((long)x * graphics.x_extent) / NRM_X_RANGE))
- X#define n_to_p_y(y) ((int)(((long)y * graphics.y_extent) / NRM_Y_RANGE))
- X#else
- X/* See the machdep.c file for alternative routines for dumb compilers. */
- X#endif /* N_TO_P_MACRO */
- X
- Xstruct GL_graphics {
- X
- X int initialized; /* Set true by call to g_init(). */
- X
- X /* Pointers to structures representing screen (or printer) */
- X /* bitmaps. A separate pointer(s) are used for each possible */
- X /* bitmap type. */
- X
- X CGA_BUF_TYPE FAR *cgamem; /* Pointer to video memory segment. */
- X /* Will be used by the p_wr_pix() */
- X /* routine. */
- X
- X EGA_BUF_TYPE FAR *egamem; /* Pointer to video memory segment. */
- X /* Will be used by the p_wr_pix() */
- X /* routine. */
- X
- X HERC_BUF_TYPE FAR *hercmem; /* Pointer to video memory segment. */
- X /* Will be used by the p_wr_pix() */
- X /* routine. */
- X
- X PR_BUF_TYPE FAR *printbuf1; /* Pointers to IBM/Epson printer */
- X PR_BUF_TYPE FAR *printbuf2; /* bit map segments. Will be used */
- X PR_BUF_TYPE FAR *printbuf3; /* by the p_wr_pix() routine. */
- X
- X LJ_BUF_TYPE FAR *lj_buf1; /* Pointers to Laserjet printer bit */
- X LJ_BUF_TYPE FAR *lj_buf2; /* map segments. Will be used by */
- X LJ_BUF_TYPE FAR *lj_buf3; /* the p_wr_pix() routine. */
- X
- X /* The graphics "cursor" is used by all routines operating in */
- X /* normalized 2-D coordinate space. */
- X
- X int x_cursor; /* Graphics cursor position in pixel */
- X /* units on x axis. */
- X int y_cursor; /* Graphics cursor position in pixel */
- X /* units on y axis. */
- X
- X /* Dimensions of the physical screen. The width of the screen */
- X /* in pixels is, for example, 639 for a screen with 640 */
- X /* horizontal pixels. Aspect ratio varies according to the */
- X /* graphics mode and physical monitor used. */
- X
- X int x_extent, /* Width and height of screen in units */
- X y_extent; /* of pixels. */
- X
- X float aspect_ratio; /* Height of screen divided by width. */
- X
- X /* Variables used for coordinate transformations (partially */
- X /* implemented). */
- X
- X float xlate_x, /* Translation prior to rotation and */
- X xlate_y, /* scaling, perspective, viewports, and */
- X xlate_z; /* windows. */
- X
- X float offset_x, /* Offset from origin of world */
- X offset_y, /* coordinates (after translation), */
- X offset_z; /* about which we will rotate, scale, */
- X /* and do perspective. */
- X
- X float theta_x, /* Angle of rotation about x axis. */
- X /* (z to y right hand rule.) */
- X theta_y, /* Angle of rotation about y axis. */
- X /* (z to x right hand rule.) */
- X theta_z; /* Angle of rotation about x axis. */
- X /* (x to y right hand rule.) */
- X
- X /* Factors used in the 3D to 2D rotation matrix. We want to */
- X /* calculate them once, then use them repeatedly. */
- X
- X float c_tz_c_ty, /* cos(theta_z)*cos(theta_y) */
- X s_tz, /* sin(theta_z) */
- X s_ty, /* sin(theta_y) */
- X c_tz_c_tx, /* cos(theta_z)*cos(theta_x) */
- X s_tx; /* sin(theta_x) */
- X
- X float scale_factor; /* Scaling factor, after rotation, */
- X /* before perspective. */
- X
- X float perspect_dist; /* Perspective viewing distance. */
- X
- X int x_vport_ll, /* Lower left and upper right x and y */
- X y_vport_ll, /* coordinates of the viewport in the */
- X x_vport_ur, /* normalized coordinate space. */
- X y_vport_ur;
- X
- X int x_window_ll, /* Lower left and upper right x and y */
- X y_window_ll, /* coordinates of the active windo in */
- X x_window_ur, /* terms of normalized coordinate */
- X y_window_ur; /* space. */
- X
- X /* Drawing control variables. */
- X
- X int grafmode; /* Video display mode */
- X
- X int color; /* Color of line to draw */
- X
- X int lineweight; /* Line thickness */
- X
- X long linestyle; /* Line style (e.g. dot-dash) */
- X
- X int wrt_mode; /* Pixel writing mode (OR, XOR, etc) */
- X
- X /* Stroke font control parameters. */
- X
- X struct {
- X int xtic; /* Character to character distance */
- X int ytic; /* Line to line distance */
- X int xsize; /* Vertical character size */
- X int ysize; /* Horizontal character size */
- X float angle; /* Rotation angle of text line, in */
- X /* counterclockwise radians. */
- X float slant; /* Char slant angle, in clockwise */
- X /* radians. */
- X int angle_flag; /* Set TRUE if angle is non-zero. */
- X /* If TRUE, we need to do extra work to */
- X /* draw characters. */
- X int slant_flag; /* Set TRUE if slant is non-zero. */
- X /* If TRUE, we need to do extra work to */
- X /* draw characters. */
- X } strokefont, default_strokefont;
- X
- X /* Bitmap font parameters. */
- X
- X struct {
- X int chars_per_line;
- X int lines_per_screen;
- X int xtic; /* Character to character distance */
- X int ytic; /* Line to line distance */
- X int xmult; /* If 2, then make double wide, etc. */
- X int ymult; /* If 2, then make double high, etc. */
- X } cellfont;
- X};
- X
- XxX--EOF--XxX
- echo restoring machdep.c
- sed 's/^X//' > machdep.c <<XxX--EOF--XxX
- X#ifndef lint
- Xstatic char sccsid[] = "@(#) machdep.c 5.1 89/02/20";
- X#endif
- X
- X/*
- X * Copyright (c) David T. Lewis 1989
- X * All rights reserved.
- X *
- X * Permission is granted to use this for any personal noncommercial use.
- X * You may not distribute source or executable code for profit, nor
- X * may you distribute it with a commercial product without the written
- X * consent of the author. Please send modifications to the author for
- X * inclusion in updates to the program. Thanks.
- X */
- X
- X/* Mon Jan 23 00:01:41 EST 1989 */
- X/* Miscellaneous machine dependent routines required to support MS-DOS */
- X
- X#include <stdio.h>
- X#include "config.h"
- X#include "bitmaps.h"
- X#include "gf_types.h"
- X#include "graphics.h"
- X#if MIX_C
- X#include <stdlib.h>
- X#else
- X#include <sys/types.h>
- X#include <math.h>
- X#if MS_DOS
- X#include <dos.h>
- X#endif /* MS_DOS */
- X#endif /* MIX_C */
- X
- X#ifndef M_PI
- X#define M_PI 3.14159265358979323846
- X#endif /* M_PI */
- X
- X#define PTR_OK_STAT (0x90)
- X#define BIOS_PTR_INT (0x17)
- X#define DOS_KBY_STAT 0x0b
- X
- Xextern struct GL_graphics graphics;
- X
- X#if MS_DOS
- Xstatic REGISTERS inreg, outreg;
- X#endif /* MS_DOS */
- X
- X/* The next two routines can take the place of macros defined in */
- X/* graphics.h, for compilers that can't use them. */
- X
- X#if N_TO_P_MACRO
- X#else
- X
- Xint n_to_p_x(x)
- Xint x;
- X{
- X long lval;
- X lval = x;
- X lval *= graphics.x_extent;
- X lval /= NRM_X_RANGE;
- X return (lval);
- X}
- X
- Xint n_to_p_y(y)
- Xint y;
- X{
- X long lval;
- X lval = y;
- X lval *= graphics.y_extent;
- X lval /= NRM_Y_RANGE;
- X return (lval);
- X}
- X#endif /* N_TO_P_MACRO */
- X
- X#if HAS_FMOD
- X#else
- X/* fmod(3M) replacement for MIX-C compiler, MS-DOS. */
- X
- Xdouble fmod(x,y)
- Xdouble x, y;
- X{
- X /* x = i*y + f for some value i such that |f| < |y|. */
- X /* Solve for f. */
- X
- X long lval;
- X double dval;
- X
- X /* Check for zero or overflow */
- X if (x == 0L || y == 0L) return(0L);
- X
- X dval = x / y;
- X lval = (long)dval;
- X return (x - (double)lval * y);
- X}
- X#endif /* HAS_FMOD */
- X
- X#if HAS_ATAN2
- X#else
- X/* atan2(3M) replacement for MIX-C compiler, MS-DOS. */
- X/* Returns arctan of y/x. */
- X
- Xdouble atan2(y,x)
- Xdouble y, x;
- X{
- X if (x>=0) {
- X /* atan() works fine when angle is in */
- X /* 1st or 4th quadrant. */
- X return (atan (y/x));
- X }
- X else {
- X if (y<0) {
- X /* 3rd quadrant */
- X return ( -(M_PI - atan (y/x)));
- X }
- X else {
- X /* 2nd quadrant */
- X return (M_PI - atan (y/x));
- X }
- X }
- X}
- X#endif /* HAS_ATAN2 */
- X
- X#if HAS_SLEEP
- X#else
- X/* Replacement for the sleep() function (for some MS-DOS compilers). */
- X
- Xint sleep(seconds)
- Xint seconds;
- X{
- X/* It's OK for this to be inefficient, since we are only wasting */
- X/* time anyhow. Therefore, use the DOS call rather than BIOS. That */
- X/* way, we don't screw up the DOS system clock if we call BIOS at */
- X/* midnight. */
- X#define TICKS_PER_SEC 18.2
- X#define A_BIG_NUMBER 360000
- X long time_to_return;
- X long now;
- X /* Get the current time using DOS function 0x2c */
- X inreg.AH = DOS_GET_TIME;
- X DO_BIOS(DOS, &inreg, &outreg);
- X time_to_return = outreg.DL /* Hundredths */
- X + (outreg.DH * 100) /* Seconds */
- X + (outreg.CL * 6000) /* Minutes */
- X + (outreg.CH * 360000) /* Hours */
- X + (seconds * 100); /* Add delay time */
- X now = 0L;
- X while (now < time_to_return) {
- X /* Check the time until done. */
- X inreg.AH = DOS_GET_TIME;
- X DO_BIOS(DOS, &inreg, &outreg);
- X now = outreg.DL /* Hundredths */
- X + (outreg.DH * 100) /* Seconds */
- X + (outreg.CL * 6000) /* Minutes */
- X + (outreg.CH * 360000); /* Hours */
- X /* Check for rollover at midnight */
- X if ((time_to_return - now) > A_BIG_NUMBER) {
- X /* Subtract 24 hours */
- X time_to_return -= 360000 * 24;
- X }
- X }
- X return (0);
- X}
- X
- X#endif /* HAS_SLEEP */
- X
- X#if MS_DOS
- X/* Routines to get and set video modes for MS-DOS. See the defines in */
- X/* config.h to understand how the register assignments work. */
- X
- Xint g_setmod(mode)
- Xint mode;
- X{
- X /* BIOS interrupt 0x10 function 0 */
- X inreg.AH = SET_VIDEO_MODE;
- X inreg.AL = mode; /* Video mode */
- X DO_BIOS(VIDEO_BIOS, &inreg, &outreg);
- X return (0);
- X}
- X
- Xint g_getmod()
- X{
- X /* BIOS interrupt 0x10 function 0x0f */
- X inreg.AH = GET_VIDEO_MODE;
- X DO_BIOS(VIDEO_BIOS, &inreg, &outreg);
- X return (outreg.AL);
- X}
- X
- Xint bios_print(buffer, itemsize, no_of_items)
- Xchar *buffer;
- Xint itemsize;
- Xint no_of_items;
- X{
- X int idx, jdx;
- X int pstat = 0;
- X int size = itemsize * no_of_items;
- X for (idx=0 ;idx < size; idx++)
- X {
- X /* Wait for printer ready status */
- X for (jdx = 0, pstat = -1; pstat != PTR_OK_STAT; jdx++)
- X {
- X inreg.AH = 2;
- X DO_BIOS(BIOS_PTR_INT, &inreg, &outreg);
- X pstat = (0xf8) & (outreg.AH);
- X if (jdx > 30000)
- X {
- X fprintf(stderr,"Timeout on printer device\n",0);
- X return(0);
- X }
- X }
- X
- X /* Send a byte */
- X inreg.AH = 0;
- X inreg.AL = buffer[idx];
- X DO_BIOS(BIOS_PTR_INT, &inreg, &outreg);
- X
- X /* Call to get keyboard status, so DOS can check for */
- X /* interrupt signal (^C). */
- X inreg.AH = DOS_KBY_STAT;
- X DO_BIOS(DOS, &inreg, &outreg);
- X }
- X return(no_of_items);
- X}
- X
- X#endif /* MS_DOS */
- X
- X
- XxX--EOF--XxX
-
-
-