Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BIOS graphics for MINIX part 3/4

5 views
Skip to first unread message

ma...@levels.unisa.edu.au

unread,
Feb 13, 1992, 11:01:48 PM2/13/92
to
#!/bin/sh
# This is part 03 of a multipart archive
# ============= grafx10/kernel/console.c.cdif ==============
if test ! -d 'grafx10'; then
echo 'x - creating directory grafx10'
mkdir 'grafx10'
fi
if test ! -d 'grafx10/kernel'; then
echo 'x - creating directory grafx10/kernel'
mkdir 'grafx10/kernel'
fi
if test -f 'grafx10/kernel/console.c.cdif' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/kernel/console.c.cdif (File already exists)'
else
echo 'x - extracting grafx10/kernel/console.c.cdif (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/kernel/console.c.cdif' &&
*** /usr/src/kernel/console.c Mon Jun 17 11:40:48 1991
--- console.c Fri Aug 9 13:36:05 1991
***************
*** 745,751 ****
X /* Initialize the screen driver. */
X
X one_con_attribute = BLANK;
! if (ps) softscroll = TRUE;
X
X /* Tell the EGA card, if any, to simulate a 16K CGA card. */
X out_byte(EGA + INDEX, 4); /* register select */
--- 745,751 ----
X /* Initialize the screen driver. */
X
X one_con_attribute = BLANK;
! softscroll = TRUE; /* Need software scroll for /dev/grafx */
X
X /* Tell the EGA card, if any, to simulate a 16K CGA card. */
X out_byte(EGA + INDEX, 4); /* register select */
SHAR_EOF
chmod 0600 grafx10/kernel/console.c.cdif ||
echo 'restore of grafx10/kernel/console.c.cdif failed'
Wc_c="`wc -c < 'grafx10/kernel/console.c.cdif'`"
test 625 -eq "$Wc_c" ||
echo 'grafx10/kernel/console.c.cdif: original size 625, current size' "$Wc_c"
fi
# ============= grafx10/kernel/memory.c.cdiff ==============
if test -f 'grafx10/kernel/memory.c.cdiff' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/kernel/memory.c.cdiff (File already exists)'
else
echo 'x - extracting grafx10/kernel/memory.c.cdiff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/kernel/memory.c.cdiff' &&
*** /usr/src/kernel/memory.c Mon Jun 17 11:40:50 1991
--- memory.c Mon Oct 7 14:41:30 1991
***************
*** 4,9 ****
--- 4,16 ----
X * /dev/kmem - kernel virtual memory
X * /dev/ram - RAM disk
X * /dev/port - i/o ports ((CHIP == INTEL) only)
+ * /dev/grafx - graphics device
+
+ * /dev/grafix Additions
+ * Stage 1: Get character device working
+ * Stage 2: Get ioctl working
+ * Stage 3: Implement ioctl functions
+
X *
X * The driver supports the following operations (using message format m2):
X *
***************
*** 26,47 ****
X */
X
X #include "kernel.h"
X #include <minix/callnr.h>
X #include <minix/com.h>
X
X #ifdef PORT_DEV
! #define NR_RAMS 5 /* number of RAM-type devices */
! #else
! #define NR_RAMS 4
! #endif
X PRIVATE message mess; /* message buffer */
X PRIVATE phys_bytes ram_origin[NR_RAMS]; /* origin of each RAM disk */
X PRIVATE phys_bytes ram_limit[NR_RAMS]; /* limit of RAM disk per minor dev. */
X
X FORWARD int do_mem();
X FORWARD int do_setup();
X
X /*===========================================================================*
X * mem_task *
X *===========================================================================*/
X PUBLIC void mem_task()
--- 33,96 ----
X */
X
X #include "kernel.h"
+ #include <ggtty.h>
X #include <minix/callnr.h>
X #include <minix/com.h>
X
X #ifdef PORT_DEV
! #define NR_RAMS 6 /* number of RAM-type devices */
! #else
! #define NR_RAMS 5
! #endif
!
!
X PRIVATE message mess; /* message buffer */
X PRIVATE phys_bytes ram_origin[NR_RAMS]; /* origin of each RAM disk */
X PRIVATE phys_bytes ram_limit[NR_RAMS]; /* limit of RAM disk per minor dev. */
X
+ PRIVATE int in_graphics = FALSE;
+ PRIVATE spectrum vir_colour = 7; /* Virtual stuff */
+ PRIVATE coord vir_x = 0;
+ PRIVATE coord vir_y = 0;
+
X FORWARD int do_mem();
X FORWARD int do_setup();
X
X /*===========================================================================*
+ * replace *
+ *===========================================================================*/
+ PRIVATE void replace(from, to)
+ int from; /* vector to get replacement from */
+ int to; /* vector to replace */
+ {
+ /* Replace the vector 'to' in the interrupt table with its original BIOS
+ * vector 'from' in vec_table (they differ since the 8259 was reprogrammed).
+ * On the first call only, also restore all software interrupt vectors from
+ * vec_table except the trap vectors and SYS_VECTOR.
+ * (Doing it only on the first call is redundant, since this is only called
+ * once! We ought to swap our vectors back just before bios_wini replies.
+ * Then this routine should be made more efficient.)
+ */
+
+ phys_bytes phys_b;
+ static int repl_called = FALSE; /* set on first call of replace */
+ int vec;
+
+ phys_b = umap(proc_ptr, D, (vir_bytes) vec_table, VECTOR_BYTES);
+ if (!repl_called) {
+ for (vec = 16; vec < VECTOR_BYTES / 4; ++vec)
+ if (vec != SYS_VECTOR &&
+ !(vec >= IRQ0_VECTOR && vec < IRQ0_VECTOR + 8) &&
+ !(vec >= IRQ8_VECTOR && vec < IRQ8_VECTOR + 8))
+ phys_copy(phys_b + 4L * vec, 4L * vec, 4L);
+ repl_called = TRUE;
+ }
+ lock();
+ phys_copy(phys_b + 4L * from, 4L * to, 4L);
+ unlock();
+ }
+
+ /*===========================================================================*
X * mem_task *
X *===========================================================================*/
X PUBLIC void mem_task()
***************
*** 60,65 ****
--- 109,118 ----
X else
X ram_limit[MEM_DEV] = 0x1000000; /* above 16M not mapped on 386 */
X ram_limit[PORT_DEV] = 0x10000;
+
+ /* Set up for graphics device map */
+ ram_origin[GRAFX_DEV] = G_BASE;
+ ram_limit[GRAFX_DEV] = ((phys_bytes) 0x100000) + ram_origin[GRAFX_DEV];
X #else
X #if (CHIP == M68000)
X ram_limit[MEM_DEV] = MEM_BYTES;
***************
*** 68,73 ****
--- 121,130 ----
X #endif
X #endif
X
+ /* set up int 010 */
+ if (pc_at)
+ replace( (DISPLAY_IRQ & 0x07) + BIOS_IRQ8_VEC, DISPLAY_VECTOR);
+
X /* Here is the main loop of the memory task. It waits for a message, carries
X * it out, and sends a reply.
X */
***************
*** 88,98 ****
X default: r = EINVAL; break;
X }
X
! /* Finally, prepare and send the reply message. */
! mess.m_type = TASK_REPLY;
! mess.REP_PROC_NR = proc_nr;
! mess.REP_STATUS = r;
! send(caller, &mess);
X }
X }
X
--- 145,157 ----
X default: r = EINVAL; break;
X }
X
! if (mess.DEVICE != GRAFX_DEV) {
! /* Finally, prepare and send the reply message. */
! mess.m_type = TASK_REPLY;
! mess.REP_PROC_NR = proc_nr;
! mess.REP_STATUS = r;
! send(caller, &mess);
! }
X }
X }
X
***************
*** 103,109 ****
X PRIVATE int do_mem(m_ptr)
X register message *m_ptr; /* pointer to read or write message */
X {
! /* Read or write /dev/null, /dev/mem, /dev/kmem, /dev/ram or /dev/port. */
X
X int device, count, endport, port, portval;
X phys_bytes mem_phys, user_phys;
--- 162,169 ----
X PRIVATE int do_mem(m_ptr)
X register message *m_ptr; /* pointer to read or write message */
X {
! /* Read or write
! /dev/null, /dev/mem, /dev/kmem, /dev/ram, /dev/port and /dev/grafx. */
X
X int device, count, endport, port, portval;
X phys_bytes mem_phys, user_phys;
***************
*** 151,156 ****
--- 211,329 ----
X return(count);
X }
X
+ PRIVATE void swap(a,b)
+ int *a,*b;
+ {
+ int i;
+ i = *b;
+ *b = *a;
+ *a = i;
+ }
+
+ PRIVATE void putpixel(x,y)
+ coord x,y;
+ {
+ Ax = 0x0C00 + (spectrum) vir_colour;
+ Bx = 0;
+ Cx = x;
+ Dx = y;
+ bios10();
+ }
+
+ PRIVATE void bres_x(xa,ya,xb,dx,dy,change)
+ int xa,ya,xb,dx,dy;
+ char change;
+ {
+ int x;
+ int y = ya;
+ int e_noinc = dy + dy;
+ int e = e_noinc - dx;
+ int e_inc = e - dx;
+
+ for (x = xa; x <= xb; x++) {
+ putpixel(x,y);
+ if (e < 0)
+ e += e_noinc;
+ else {
+ y += change;
+ e += e_inc;
+ }
+ }
+ return;
+ }
+
+ bres_y(xa,ya,yb,dx,dy,change)
+ int xa,ya,yb,dx,dy;
+ char change;
+ {
+ int x = xa;
+ int y;
+ int e_noinc = dx + dx;
+ int e = e_noinc - dy;
+ int e_inc = e - dy;
+
+ for (y = ya; y <= yb; y++) {
+ putpixel(x,y);
+ if (e < 0)
+ e += e_noinc;
+ else {
+ x += change;
+ e += e_inc;
+ }
+ }
+ return;
+ }
+
+
+ PRIVATE void myline(x1, y1, x2, y2)
+ int x1,y1,x2,y2;
+ {
+ int i;
+ int dx;
+ int dy;
+
+ /* swap values so we go from low to high */
+ if (x1 > x2) {
+ swap(&x1,&x2);
+ swap(&y1,&y2);
+ }
+
+ dy = y2 - y1;
+ dx = x2 - x1;
+
+ /* Cater for tricky situations */
+ if (dx == 0) {
+ if (y1 > y2)
+ swap(&y2,&y1);
+ for (i = y1; i <= y2; i++) /* vertical line */
+ putpixel(x1,i);
+ return;
+ }
+ else if (dy == 0) {
+ for (i = x1; i <= x2; i++) /* horizontal line */
+ putpixel(i,y1);
+ return;
+ }
+ else if (dy > 0 ) {
+ if ((dy/dx) < 1)
+ bres_x(x1,y1,x2,dx,dy,1);
+ else
+ bres_y(x1,y1,y2,dx,dy,1);
+ }
+ else {
+ if ((dy/dx) > -1)
+ bres_x(x1,y1,x2,dx,-dy,-1);
+ else {
+ swap(&x1,&x2);
+ swap(&y1,&y2);
+ dx = x2 - x1;
+ dy = y2 - y1;
+ bres_y(x1,y1,y2,-dx,dy,-1);
+ }
+ }
+ return;
+ }
+
X
X /*===========================================================================*
X * do_setup *
***************
*** 161,170 ****
X /* Set parameters for one of the disk RAMs. */
X
X int device;
!
! device = m_ptr->DEVICE;
! if (device != RAM_DEV) return(ENXIO); /* bad minor device */
! ram_origin[device] = m_ptr->POSITION;
! ram_limit[device] = m_ptr->POSITION + (long) m_ptr->COUNT * BLOCK_SIZE;
! return(OK);
! }
--- 334,428 ----
X /* Set parameters for one of the disk RAMs. */
X
X int device;
! long flags, erki;
! int r;
! int speed;
! message ioctl_mess;
!
! device = m_ptr->DEVICE;
!
! switch(device) {
! case GRAFX_DEV: {
! switch (m_ptr->TTY_REQUEST) {
! case GIOCENTER: {
! Ax = G_MODE;
! bios10();
! in_graphics = TRUE;
! break;
! }
! case GIOCRETURN: {
! if (in_graphics) {
! Ax = TEXT_MODE;
! bios10();
! in_graphics = FALSE;
! }
! break;
! }
! case GIOCTEST: {
! int i;
!
! for (i = 0; i < G_COLOURS; i++) {
! Ax = 0x0e00 + '*';
! Bx = i;
! bios10();
! }
! myline(0,0,G_MAX_X,G_MAX_Y);
! break;
! }
! case GIOCPLOT:
! vir_x = (m_ptr->TTY_SPEK >> 16);
! vir_y = ((m_ptr->TTY_SPEK << 16)>> 16);
! putpixel(vir_x,vir_y);
! break;
! case GIOCCOLOUR:
! vir_colour = (m_ptr->TTY_SPEK >> 24) & BYTE;
! break;
!
! case GIOCTEXT:
! Ax = 0x0e00 + ((m_ptr->TTY_SPEK >> 24) & BYTE);
! Bx = vir_colour;
! bios10();
! break;
! case GIOCMOVE:
! /* Set virtual x and y */
! vir_x = (m_ptr->TTY_SPEK >> 16);
! vir_y = (m_ptr->TTY_SPEK >> 0) & 0xffff;
! /* Now set text cursor, for printing text (really!) */
! Ax = 0x0200;
! Bx = 0;
! Dx = ((vir_y / G_CY_DIV) << 8) + (vir_x / G_CX_DIV);
! bios10();
! break;
!
! case GIOCLINE: {
! coord x1 = (m_ptr->TTY_SPEK >>16);
! coord y1 = ((m_ptr->TTY_SPEK <<16) >> 16);
! coord x2 = (m_ptr->TTY_FLAGS >>16);
! coord y2 = ((m_ptr->TTY_FLAGS <<16) >> 16);
! myline(x1,y1,x2,y2);
! break;
! }
! }
!
! ioctl_mess.m_type = TASK_REPLY;
! ioctl_mess.REP_PROC_NR = m_ptr->PROC_NR;
! ioctl_mess.REP_STATUS = r;
! ioctl_mess.TTY_FLAGS = flags;
! ioctl_mess.TTY_SPEK = erki;
!
! send(m_ptr->m_source, &ioctl_mess);
!
! break;
! }
!
! case RAM_DEV: {
! ram_origin[device] = m_ptr->POSITION;
! ram_limit[device] = m_ptr->POSITION + (long) m_ptr->COUNT * BLOCK_SIZE;
! break;
! }
! default:
! return(ENXIO); /* bad minor device */
! }
! return(OK);
! }
!
SHAR_EOF
chmod 0600 grafx10/kernel/memory.c.cdiff ||
echo 'restore of grafx10/kernel/memory.c.cdiff failed'
Wc_c="`wc -c < 'grafx10/kernel/memory.c.cdiff'`"
test 9759 -eq "$Wc_c" ||
echo 'grafx10/kernel/memory.c.cdiff: original size 9759, current size' "$Wc_c"
fi
# ============= grafx10/kernel/wini.c.cdiff ==============
if test -f 'grafx10/kernel/wini.c.cdiff' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/kernel/wini.c.cdiff (File already exists)'
else
echo 'x - extracting grafx10/kernel/wini.c.cdiff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/kernel/wini.c.cdiff' &&
*** /usr/src/kernel/wini.c Mon Aug 5 13:52:48 1991
--- wini.c Fri Aug 9 13:27:45 1991
***************
*** 120,126 ****
X vir_bytes wn_address; /* user virtual address */
X } wini[NR_DEVICES];
X
! PUBLIC int using_bios = FALSE; /* this disk driver does not use the BIOS */
X
X PRIVATE int w_need_reset = FALSE; /* set to 1 when controller must be reset */
X PRIVATE int nr_drives; /* Number of drives */
--- 120,127 ----
X vir_bytes wn_address; /* user virtual address */
X } wini[NR_DEVICES];
X
! PUBLIC int using_bios = TRUE; /* this disk driver does not use the BIOS */
! /* BUT the /dev/grafx DOES!!!!*/
X
X PRIVATE int w_need_reset = FALSE; /* set to 1 when controller must be reset */
X PRIVATE int nr_drives; /* Number of drives */
SHAR_EOF
chmod 0600 grafx10/kernel/wini.c.cdiff ||
echo 'restore of grafx10/kernel/wini.c.cdiff failed'
Wc_c="`wc -c < 'grafx10/kernel/wini.c.cdiff'`"
test 760 -eq "$Wc_c" ||
echo 'grafx10/kernel/wini.c.cdiff: original size 760, current size' "$Wc_c"
fi
# ============= grafx10/kernel/const.h.cdiff ==============
if test -f 'grafx10/kernel/const.h.cdiff' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/kernel/const.h.cdiff (File already exists)'
else
echo 'x - extracting grafx10/kernel/const.h.cdiff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/kernel/const.h.cdiff' &&
*** /usr/src/kernel/const.h Mon Jun 17 11:41:07 1991
--- const.h Mon Aug 26 14:26:39 1991
***************
*** 67,72 ****
--- 67,73 ----
X #define PRINTER_IRQ 7
X #define AT_WINI_IRQ 14 /* at winchester */
X #define PS_KEYB_IRQ 9 /* keyboard interrupt vector for PS/2 */
+ #define DISPLAY_IRQ 16 /* display interrupt vector */
X
X /* Hardware vector numbers. */
X #define CLOCK_VECTOR ((CLOCK_IRQ & 0x07) + IRQ0_VECTOR)
***************
*** 79,84 ****
--- 80,86 ----
X #define PRINTER_VECTOR ((PRINTER_IRQ & 0x07) + IRQ0_VECTOR)
X #define AT_WINI_VECTOR ((AT_WINI_IRQ & 0x07) + IRQ8_VECTOR)
X #define PS_KEYB_VECTOR ((PS_KEYB_IRQ & 0x07) + IRQ8_VECTOR)
+ #define DISPLAY_VECTOR ((DISPLAY_IRQ & 0x07) + IRQ8_VECTOR)
X
X /* BIOS parameter vectors. */
X #define WINI_0_PARM_VEC 0x41
SHAR_EOF
chmod 0600 grafx10/kernel/const.h.cdiff ||
echo 'restore of grafx10/kernel/const.h.cdiff failed'
Wc_c="`wc -c < 'grafx10/kernel/const.h.cdiff'`"
test 818 -eq "$Wc_c" ||
echo 'grafx10/kernel/const.h.cdiff: original size 818, current size' "$Wc_c"
fi
# ============= grafx10/kernel/klib88.x.cdiff ==============
if test -f 'grafx10/kernel/klib88.x.cdiff' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/kernel/klib88.x.cdiff (File already exists)'
else
echo 'x - extracting grafx10/kernel/klib88.x.cdiff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/kernel/klib88.x.cdiff' &&
*** /usr/src/kernel/klib88.x Mon Jun 17 11:41:09 1991
--- klib88.x Fri Aug 9 12:44:53 1991
***************
*** 1,6 ****
--- 1,7 ----
X | This file contains a number of assembly code utility routines needed by the
X | kernel. They are:
X
+ .define _bios10 | make BIOS 10 call for display (real mode only)
X .define _bios13 | make BIOS 13 call for disk I/O (real mode only)
X .define _build_sig | build 4 word structure pushed onto stack for signals
X .define _check_mem | check a block of memory, return the valid size
***************
*** 78,88 ****
X
X .text
X |*===========================================================================*
! |* bios13 *
! |*===========================================================================*
! | PUBLIC void bios13();
!
! _bios13: | make a BIOS 0x13 call for disk I/O
X push ax | save the registers
X push bx
X push cx
--- 79,89 ----
X
X .text
X |*===========================================================================*
! |* bios10 *
! |*===========================================================================*
! | PUBLIC void bios10();
!
! _bios10: | make a BIOS 0x10 call for display
X push ax | save the registers
X push bx
X push cx
***************
*** 93,99 ****
X mov cx,_Cx
X mov dx,_Dx
X mov es,_Es
! int 0x13 | make the BIOS call
X mov _Ax,ax | save results
X mov _Bx,bx
X mov _Cx,cx
--- 94,100 ----
X mov cx,_Cx
X mov dx,_Dx
X mov es,_Es
! int 0x10 | make the BIOS call
X mov _Ax,ax | save results
X mov _Bx,bx
X mov _Cx,cx
***************
*** 105,110 ****
--- 106,139 ----
X pop ax
X ret
X
+ |*===========================================================================*
+ |* bios13 *
+ |*===========================================================================*
+ | PUBLIC void bios13();
+
+ _bios13: | make a BIOS 0x13 call for disk I/O
+ push ax | save the registers
+ push bx
+ push cx
+ push dx
+ push es
+ mov ax,_Ax | load parameters
+ mov bx,_Bx
+ mov cx,_Cx
+ mov dx,_Dx
+ mov es,_Es
+ int 0x13 | make the BIOS call
+ mov _Ax,ax | save results
+ mov _Bx,bx
+ mov _Cx,cx
+ mov _Dx,dx
+ pop es
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
X
X |*===========================================================================*
X |* build_sig *
SHAR_EOF
chmod 0600 grafx10/kernel/klib88.x.cdiff ||
echo 'restore of grafx10/kernel/klib88.x.cdiff failed'
Wc_c="`wc -c < 'grafx10/kernel/klib88.x.cdiff'`"
test 2335 -eq "$Wc_c" ||
echo 'grafx10/kernel/klib88.x.cdiff: original size 2335, current size' "$Wc_c"
fi
# ============= grafx10/lib/ioctl.c.cdiff ==============
if test ! -d 'grafx10/lib'; then
echo 'x - creating directory grafx10/lib'
mkdir 'grafx10/lib'
fi
if test -f 'grafx10/lib/ioctl.c.cdiff' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/lib/ioctl.c.cdiff (File already exists)'
else
echo 'x - extracting grafx10/lib/ioctl.c.cdiff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/lib/ioctl.c.cdiff' &&
*** ioctl.cc Wed Sep 11 16:09:15 1991
--- ioctl.c Wed Sep 25 15:19:52 1991
***************
*** 1,21 ****
X #include <lib.h>
X #include <minix/com.h>
X #include <sgtty.h>
!
! PUBLIC int ioctl(fd, request, argp)
! int fd;
! int request;
! struct sgttyb *argp;
X {
X int n;
X long erase, kill, intr, quit, xon, xoff, eof, brk, speed;
X struct tchars *argt;
X
X _M.TTY_REQUEST = request;
X _M.TTY_LINE = fd;
X
X switch(request) {
X case TIOCSETP:
X erase = argp->sg_erase & BYTE;
X kill = argp->sg_kill & BYTE;
X speed = ((argp->sg_ospeed & BYTE) << 8) | (argp->sg_ispeed & BYTE);
--- 1,26 ----
X #include <lib.h>
X #include <minix/com.h>
X #include <sgtty.h>
! #include <ggtty.h>
!
! PUBLIC int ioctl(fd, request, argm)
! int fd;
! int request;
! char *argm;
!
X {
X int n;
X long erase, kill, intr, quit, xon, xoff, eof, brk, speed;
X struct tchars *argt;
+ struct sgttyb *argp;
+ gmess *argg;
X
X _M.TTY_REQUEST = request;
X _M.TTY_LINE = fd;
X
X switch(request) {
X case TIOCSETP:
+ argp = (struct sgttyb * /* kludge */) argm;
X erase = argp->sg_erase & BYTE;
X kill = argp->sg_kill & BYTE;
X speed = ((argp->sg_ospeed & BYTE) << 8) | (argp->sg_ispeed & BYTE);
***************
*** 25,31 ****
X return(n);
X
X case TIOCSETC:
! argt = (struct tchars * /* kludge */) argp;
X intr = argt->t_intrc & BYTE;
X quit = argt->t_quitc & BYTE;
X xon = argt->t_startc & BYTE;
--- 30,36 ----
X return(n);
X
X case TIOCSETC:
! argt = (struct tchars * /* kludge */) argm;
X intr = argt->t_intrc & BYTE;
X quit = argt->t_quitc & BYTE;
X xon = argt->t_startc & BYTE;
***************
*** 39,44 ****
--- 44,50 ----
X
X case TIOCGETP:
X n = callx(FS, IOCTL);
+ argp = (struct sgttyb * /* kludge */) argm;
X argp->sg_erase = (_M.TTY_SPEK >> 8) & BYTE;
X argp->sg_kill = (_M.TTY_SPEK >> 0) & BYTE;
X argp->sg_flags = _M.TTY_FLAGS & 0xFFFFL;
***************
*** 49,55 ****
X
X case TIOCGETC:
X n = callx(FS, IOCTL);
! argt = (struct tchars *) argp;
X argt->t_intrc = (_M.TTY_SPEK >> 24) & BYTE;
X argt->t_quitc = (_M.TTY_SPEK >> 16) & BYTE;
X argt->t_startc = (_M.TTY_SPEK >> 8) & BYTE;
--- 55,61 ----
X
X case TIOCGETC:
X n = callx(FS, IOCTL);
! argt = (struct tchars *) argm;
X argt->t_intrc = (_M.TTY_SPEK >> 24) & BYTE;
X argt->t_quitc = (_M.TTY_SPEK >> 16) & BYTE;
X argt->t_startc = (_M.TTY_SPEK >> 8) & BYTE;
***************
*** 63,74 ****
X */
X
X case TIOCFLUSH:
! _M.TTY_FLAGS = (int /* kludge */) argp;
X return callx(FS, IOCTL);
X
X default:
! n = -1;
! errno = -(EINVAL);
X return(n);
X }
X }
--- 69,94 ----
X */
X
X case TIOCFLUSH:
! _M.TTY_FLAGS = (int /* kludge */) argm;
X return callx(FS, IOCTL);
X
X default:
! /* Patched by Dave Gardiner, to allow more fn calls to ioctl */
! /* passes arguments like they almost should */
!
! argg = (gmess *) argm;
!
! _M.TTY_SPEK = (argg->GRAFX_SPEK);
! _M.TTY_FLAGS = (argg->GRAFX_FLAGS);
! _M.ADDRESS = (argg->GRAFX_ADDRESS);
! /*
! printf("SPEK %lx\n",argg->GRAFX_SPEK);
! printf("FLAG %lx\n",argg->GRAFX_FLAGS);
! printf("ADDR %lx\n",argg->GRAFX_ADDRESS);
! printf("s %s\n",argg->GRAFX_ADDRESS);
! */
! n = callx(FS, IOCTL);
!
X return(n);
X }
X }
SHAR_EOF
chmod 0600 grafx10/lib/ioctl.c.cdiff ||
echo 'restore of grafx10/lib/ioctl.c.cdiff failed'
Wc_c="`wc -c < 'grafx10/lib/ioctl.c.cdiff'`"
test 3302 -eq "$Wc_c" ||
echo 'grafx10/lib/ioctl.c.cdiff: original size 3302, current size' "$Wc_c"
fi
# ============= grafx10/lib/ioctl.c.cdiff ==============
if test -f 'grafx10/lib/ioctl.c.cdiff' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/lib/ioctl.c.cdiff (File already exists)'
else
echo 'x - extracting grafx10/lib/ioctl.c.cdiff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/lib/ioctl.c.cdiff' &&
*** ioctl.cc Wed Sep 11 16:09:15 1991
--- ioctl.c Wed Sep 25 15:19:52 1991
***************
*** 1,21 ****
X #include <lib.h>
X #include <minix/com.h>
X #include <sgtty.h>
!
! PUBLIC int ioctl(fd, request, argp)
! int fd;
! int request;
! struct sgttyb *argp;
X {
X int n;
X long erase, kill, intr, quit, xon, xoff, eof, brk, speed;
X struct tchars *argt;
X
X _M.TTY_REQUEST = request;
X _M.TTY_LINE = fd;
X
X switch(request) {
X case TIOCSETP:
X erase = argp->sg_erase & BYTE;
X kill = argp->sg_kill & BYTE;
X speed = ((argp->sg_ospeed & BYTE) << 8) | (argp->sg_ispeed & BYTE);
--- 1,26 ----
X #include <lib.h>
X #include <minix/com.h>
X #include <sgtty.h>
! #include <ggtty.h>
!
! PUBLIC int ioctl(fd, request, argm)
! int fd;
! int request;
! char *argm;
!
X {
X int n;
X long erase, kill, intr, quit, xon, xoff, eof, brk, speed;
X struct tchars *argt;
+ struct sgttyb *argp;
+ gmess *argg;
X
X _M.TTY_REQUEST = request;
X _M.TTY_LINE = fd;
X
X switch(request) {
X case TIOCSETP:
+ argp = (struct sgttyb * /* kludge */) argm;
X erase = argp->sg_erase & BYTE;
X kill = argp->sg_kill & BYTE;
X speed = ((argp->sg_ospeed & BYTE) << 8) | (argp->sg_ispeed & BYTE);
***************
*** 25,31 ****
X return(n);
X
X case TIOCSETC:
! argt = (struct tchars * /* kludge */) argp;
X intr = argt->t_intrc & BYTE;
X quit = argt->t_quitc & BYTE;
X xon = argt->t_startc & BYTE;
--- 30,36 ----
X return(n);
X
X case TIOCSETC:
! argt = (struct tchars * /* kludge */) argm;
X intr = argt->t_intrc & BYTE;
X quit = argt->t_quitc & BYTE;
X xon = argt->t_startc & BYTE;
***************
*** 39,44 ****
--- 44,50 ----
X
X case TIOCGETP:
X n = callx(FS, IOCTL);
+ argp = (struct sgttyb * /* kludge */) argm;
X argp->sg_erase = (_M.TTY_SPEK >> 8) & BYTE;
X argp->sg_kill = (_M.TTY_SPEK >> 0) & BYTE;
X argp->sg_flags = _M.TTY_FLAGS & 0xFFFFL;
***************
*** 49,55 ****
X
X case TIOCGETC:
X n = callx(FS, IOCTL);
! argt = (struct tchars *) argp;
X argt->t_intrc = (_M.TTY_SPEK >> 24) & BYTE;
X argt->t_quitc = (_M.TTY_SPEK >> 16) & BYTE;
X argt->t_startc = (_M.TTY_SPEK >> 8) & BYTE;
--- 55,61 ----
X
X case TIOCGETC:
X n = callx(FS, IOCTL);
! argt = (struct tchars *) argm;
X argt->t_intrc = (_M.TTY_SPEK >> 24) & BYTE;
X argt->t_quitc = (_M.TTY_SPEK >> 16) & BYTE;
X argt->t_startc = (_M.TTY_SPEK >> 8) & BYTE;
***************
*** 63,74 ****
X */
X
X case TIOCFLUSH:
! _M.TTY_FLAGS = (int /* kludge */) argp;
X return callx(FS, IOCTL);
X
X default:
! n = -1;
! errno = -(EINVAL);
X return(n);
X }
X }
--- 69,94 ----
X */
X
X case TIOCFLUSH:
! _M.TTY_FLAGS = (int /* kludge */) argm;
X return callx(FS, IOCTL);
X
X default:
! /* Patched by Dave Gardiner, to allow more fn calls to ioctl */
! /* passes arguments like they almost should */
!
! argg = (gmess *) argm;
!
! _M.TTY_SPEK = (argg->GRAFX_SPEK);
! _M.TTY_FLAGS = (argg->GRAFX_FLAGS);
! _M.ADDRESS = (argg->GRAFX_ADDRESS);
! /*
! printf("SPEK %lx\n",argg->GRAFX_SPEK);
! printf("FLAG %lx\n",argg->GRAFX_FLAGS);
! printf("ADDR %lx\n",argg->GRAFX_ADDRESS);
! printf("s %s\n",argg->GRAFX_ADDRESS);
! */
! n = callx(FS, IOCTL);
!
X return(n);
X }
X }
SHAR_EOF
chmod 0600 grafx10/lib/ioctl.c.cdiff ||
echo 'restore of grafx10/lib/ioctl.c.cdiff failed'
Wc_c="`wc -c < 'grafx10/lib/ioctl.c.cdiff'`"
test 3302 -eq "$Wc_c" ||
echo 'grafx10/lib/ioctl.c.cdiff: original size 3302, current size' "$Wc_c"
fi
# ============= grafx10/libplot/Makefile ==============
if test ! -d 'grafx10/libplot'; then
echo 'x - creating directory grafx10/libplot'
mkdir 'grafx10/libplot'
fi
if test -f 'grafx10/libplot/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/Makefile (File already exists)'
else
echo 'x - extracting grafx10/libplot/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/Makefile' &&
# Makefile for libplot
# by David Gardiner
#
# Takes parameter of object file - file to make
#
# examples:
# make libplotibm.a - Make ibm library
# make libplot.a - Make independent library
X
CFLAGS = -c -LIB -F
LIBOBJS = openpl.s closepl.s line.s move.s point.s label.s cont.s erase.s \
X space.s arc.s colour.s linemod.s circle.s
X
libplotibm.a:
X $(MAKE) tmp.a DFLAGS=
X mv tmp.a libplotibm.a
X
libplot.a:
X $(MAKE) tmp.a DFLAGS=-DINDEP
X mv tmp.a libplot.a
X
tmp.a: $(LIBOBJS)
X ar cr tmp.a $(LIBOBJS)
X
.c.s:
X # If L is null, then we generate a device-independant library
X cc $(CFLAGS) $(DFLAGS) $(*).c
X
clean:
X @rm -r *.s
X
#End of makefile
SHAR_EOF
chmod 0600 grafx10/libplot/Makefile ||
echo 'restore of grafx10/libplot/Makefile failed'
Wc_c="`wc -c < 'grafx10/libplot/Makefile'`"
test 644 -eq "$Wc_c" ||
echo 'grafx10/libplot/Makefile: original size 644, current size' "$Wc_c"
fi
# ============= grafx10/libplot/arc.c ==============
if test -f 'grafx10/libplot/arc.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/arc.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/arc.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/arc.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw an arc, centre (x,y), start (x0,y0), end (x1,y1), anti-clockwise*/
X
#include "libplot.h"
X
void arc(x,y,x0,y0,x1,y1)
coord x,y,x0,y0,x1,y1;
{
#ifdef INDEP
X
X static struct {
X int a,b,c,d,e,f;
X } s;
X
X s.a = x;
X s.b = y;
X s.c = x0;
X s.d = y0;
X s.e = x1;
X s.f = y1;
X
X (void) printf("a");
X (void) fwrite(&s, sizeof(s), 1, stdout);
#else
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/arc.c ||
echo 'restore of grafx10/libplot/arc.c failed'
Wc_c="`wc -c < 'grafx10/libplot/arc.c'`"
test 606 -eq "$Wc_c" ||
echo 'grafx10/libplot/arc.c: original size 606, current size' "$Wc_c"
fi
# ============= grafx10/libplot/closepl.c ==============
if test -f 'grafx10/libplot/closepl.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/closepl.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/closepl.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/closepl.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Close graphics device */
X
#include "libplot.h"
X
void closepl()
{
#ifdef INDEP
X
#else
X
X ioctl(_plot_fd,GIOCRETURN,_plot_args);
X close(_plot_fd);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/closepl.c ||
echo 'restore of grafx10/libplot/closepl.c failed'
Wc_c="`wc -c < 'grafx10/libplot/closepl.c'`"
test 389 -eq "$Wc_c" ||
echo 'grafx10/libplot/closepl.c: original size 389, current size' "$Wc_c"
fi
# ============= grafx10/libplot/colour.c ==============
if test -f 'grafx10/libplot/colour.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/colour.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/colour.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/colour.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Set the current drawing colour to (c) */
X
#include "libplot.h"
X
void colour(c)
spectrum c;
{
#ifdef INDEP
X
X (void) printf("k");
X (void) fwrite(&c, sizeof(c), 1, stdout);
X
#else
X
X _plot_args->GRAFX_COLOUR = c;
X ioctl(_plot_fd,GIOCCOLOUR, _plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/colour.c ||
echo 'restore of grafx10/libplot/colour.c failed'
Wc_c="`wc -c < 'grafx10/libplot/colour.c'`"
test 501 -eq "$Wc_c" ||
echo 'grafx10/libplot/colour.c: original size 501, current size' "$Wc_c"
fi
# ============= grafx10/libplot/cont.c ==============
if test -f 'grafx10/libplot/cont.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/cont.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/cont.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/cont.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw a line from the current position, to (x,y).
X Update current position
*/
X
#include "libplot.h"
X
void cont(x,y)
coord x,y;
{
#ifdef INDEP
X
X static struct {
X int a,b;
X } s;
X
X s.a = x;
X s.b = y;
X
X (void) printf("n");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x;
X _plot_args->GRAFX_Y = y;
X ioctl(_plot_fd, GIOCCONT, _plot_args);
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/cont.c ||
echo 'restore of grafx10/libplot/cont.c failed'
Wc_c="`wc -c < 'grafx10/libplot/cont.c'`"
test 636 -eq "$Wc_c" ||
echo 'grafx10/libplot/cont.c: original size 636, current size' "$Wc_c"
fi
# ============= grafx10/libplot/erase.c ==============
if test -f 'grafx10/libplot/erase.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/erase.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/erase.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/erase.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Erase the display */
X
#include "libplot.h"
X
void erase()
{
#ifdef INDEP
X
X printf("e");
X
#else
X
X /* Rely on BIOS to clear screen when mode is switched */
X ioctl(_plot_fd, GIOCENTER, _plot_args);
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/erase.c ||
echo 'restore of grafx10/libplot/erase.c failed'
Wc_c="`wc -c < 'grafx10/libplot/erase.c'`"
test 443 -eq "$Wc_c" ||
echo 'grafx10/libplot/erase.c: original size 443, current size' "$Wc_c"
fi
# ============= grafx10/libplot/label.c ==============
if test -f 'grafx10/libplot/label.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/label.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/label.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/label.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Write text at the current position */
X
#include "libplot.h"
X
void label(s)
char s[];
{
#ifdef INDEP
X
X (void) printf("t%s\n",s); /* String, with newline at end */
X
#else
X int i;
X for (i = 0; s[i] != 0; i++) {
X _plot_args->GRAFX_CHAR = s[i];
X ioctl(_plot_fd, GIOCTEXT, _plot_args);
X }
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/label.c ||
echo 'restore of grafx10/libplot/label.c failed'
Wc_c="`wc -c < 'grafx10/libplot/label.c'`"
test 526 -eq "$Wc_c" ||
echo 'grafx10/libplot/label.c: original size 526, current size' "$Wc_c"
fi
# ============= grafx10/libplot/libplot.h ==============
if test -f 'grafx10/libplot/libplot.h' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/libplot.h (File already exists)'
else
echo 'x - extracting grafx10/libplot/libplot.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/libplot.h' &&
/* plot(3X) library header */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
#ifndef _libplot_h
#define _libplot_h
X
#include <stdio.h>
#include <ggtty.h>
X
extern int _plot_fd;
extern gmess *_plot_args;
X
#endif
SHAR_EOF
chmod 0600 grafx10/libplot/libplot.h ||
echo 'restore of grafx10/libplot/libplot.h failed'
Wc_c="`wc -c < 'grafx10/libplot/libplot.h'`"
test 359 -eq "$Wc_c" ||
echo 'grafx10/libplot/libplot.h: original size 359, current size' "$Wc_c"
fi
# ============= grafx10/libplot/line.c ==============
if test -f 'grafx10/libplot/line.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/line.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/line.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/line.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw a line from (x1,y1) to (x2,y2) */
X
#include "libplot.h"
X
void line(x1, y1, x2, y2)
coord x1,y1,x2,y2;
{
#ifdef INDEP
X
X static struct {
X int a,b,c,d;
X } s;
X
X s.a = x1;
X s.b = y1;
X s.c = x2;
X s.d = y2;
X
X printf("l");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x1;
X _plot_args->GRAFX_Y = y1;
X _plot_args->GRAFX_X2 = x2;
X _plot_args->GRAFX_Y2 = y2;
X ioctl(_plot_fd,GIOCLINE,_plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/line.c ||
echo 'restore of grafx10/libplot/line.c failed'
Wc_c="`wc -c < 'grafx10/libplot/line.c'`"
test 699 -eq "$Wc_c" ||
echo 'grafx10/libplot/line.c: original size 699, current size' "$Wc_c"
fi
# ============= grafx10/libplot/move.c ==============
if test -f 'grafx10/libplot/move.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/move.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/move.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/move.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Move current position to that of (x,y) */
X
#include "libplot.h"
X
void move(x, y)
coord x,y;
{
#ifdef INDEP
X
X static struct {
X int a,b;
X } s;
X
X s.a = x;
X s.b = y;
X
X (void) printf("m");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x;
X _plot_args->GRAFX_Y = y;
X ioctl(_plot_fd,GIOCMOVE,_plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/move.c ||
echo 'restore of grafx10/libplot/move.c failed'
Wc_c="`wc -c < 'grafx10/libplot/move.c'`"
test 597 -eq "$Wc_c" ||
echo 'grafx10/libplot/move.c: original size 597, current size' "$Wc_c"
fi
# ============= grafx10/libplot/openpl.c ==============
if test -f 'grafx10/libplot/openpl.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/openpl.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/openpl.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/openpl.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Open graphics device */
X
#include "libplot.h"
#include <fcntl.h>
X
/* The only place these are actually defined, elsewhere they are external */
int _plot_fd;
gmess *_plot_args;
X
void openpl()
{
#ifdef INDEP
X
#else
X
X if ((_plot_fd = open("/dev/grafx",O_RDWR)) == -1) {
X fprintf(stderr,"plot error: Could not open graphics device\n");
X exit(1);
X }
X
X _plot_args = (gmess *) malloc(sizeof(gmess));
X ioctl(_plot_fd, GIOCENTER, _plot_args);
X
X /* Set default colour to maximum colour - hopefully white */
X _plot_args->GRAFX_COLOUR = G_COLOURS;
X ioctl(_plot_fd, GIOCCOLOUR, _plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/openpl.c ||
echo 'restore of grafx10/libplot/openpl.c failed'
Wc_c="`wc -c < 'grafx10/libplot/openpl.c'`"
test 839 -eq "$Wc_c" ||
echo 'grafx10/libplot/openpl.c: original size 839, current size' "$Wc_c"
fi
# ============= grafx10/libplot/point.c ==============
if test -f 'grafx10/libplot/point.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/point.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/point.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/point.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Set pixel to current colour at (x,y) */
X
#include "libplot.h"
X
void point(x, y)
coord x,y;
{
#ifdef INDEP
X
X static struct {
X int a,b;
X } s;
X
X s.a = x;
X s.b = y;
X
X (void) printf("p");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x;
X _plot_args->GRAFX_Y = y;
X ioctl(_plot_fd,GIOCPLOT,_plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/point.c ||
echo 'restore of grafx10/libplot/point.c failed'
Wc_c="`wc -c < 'grafx10/libplot/point.c'`"
test 596 -eq "$Wc_c" ||
echo 'grafx10/libplot/point.c: original size 596, current size' "$Wc_c"
fi
# ============= grafx10/libplot/space.c ==============
if test -f 'grafx10/libplot/space.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/space.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/space.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/space.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Magnify or reduce the rectangle (x0,y0)-(x1,y1) to fit the screen */
X
#include "libplot.h"
X
void space(x0,y0,x1,y1)
coord x0,y0,x1,y1;
{
#ifdef INDEP
X
X static struct {
X int a,b,c,d;
X } s;
X
X s.a = x0;
X s.b = y0;
X s.c = x1;
X s.d = y1;
X
X (void) printf("s");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/space.c ||
echo 'restore of grafx10/libplot/space.c failed'
Wc_c="`wc -c < 'grafx10/libplot/space.c'`"
test 571 -eq "$Wc_c" ||
echo 'grafx10/libplot/space.c: original size 571, current size' "$Wc_c"
fi
# ============= grafx10/libplot/tst_lib.c ==============
if test -f 'grafx10/libplot/tst_lib.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/tst_lib.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/tst_lib.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/tst_lib.c' &&
/* Plot(3X) test 1 */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* This file must be linked to one of the plot libraries
X
examples:
X
cc tst_lib.c -o tst_lib -lplot -For device independence
cc tst_lib.c -o tst_lib -lplotibm -For use with IBM-PC
X
*/
X
#include <stdio.h>
#include <ggtty.h>
X
void main()
{
X coord x,y;
X int i;
X unsigned seed;
X
X srand(seed);
X
X openpl();
X
X colour(4);
X
X /* Test plotting - draw line */
X for (x = 0; x < G_MAX_X; x++)
X point(x,x);
X
X label("Neato dorito!");
X
X move(10,10);
X cont(150,50);
X
X erase();
X
#ifdef INFINITE
X while (1) {
#else
X for (i = 0; i < 100; i++) {
#endif
X colour(rand(G_COLOURS));
X line(rand(seed) % G_MAX_X, rand(seed) % G_MAX_Y,
X rand(seed) % G_MAX_X, rand(seed) % G_MAX_Y);
X }
X
X move(100,200);
X label("Press <Enter> to exit...");
X closepl();
}
SHAR_EOF
chmod 0600 grafx10/libplot/tst_lib.c ||
echo 'restore of grafx10/libplot/tst_lib.c failed'
Wc_c="`wc -c < 'grafx10/libplot/tst_lib.c'`"
test 955 -eq "$Wc_c" ||
echo 'grafx10/libplot/tst_lib.c: original size 955, current size' "$Wc_c"
fi
# ============= grafx10/libplot/circle.c ==============
if test -f 'grafx10/libplot/circle.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/circle.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/circle.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/circle.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw a circle with centre (x,y) and radius r */
X
#include "libplot.h"
X
void circle(x, y, r)
coord x,y,r;
{
#ifdef INDEP
X
X static struct {
X int a,b,c;
X } s;
X
X s.a = x;
X s.b = y;
X s.c = r;
X
X (void) printf("c");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/circle.c ||
echo 'restore of grafx10/libplot/circle.c failed'
Wc_c="`wc -c < 'grafx10/libplot/circle.c'`"
test 521 -eq "$Wc_c" ||
echo 'grafx10/libplot/circle.c: original size 521, current size' "$Wc_c"
fi
# ============= grafx10/libplot/linemod.c ==============
if test -f 'grafx10/libplot/linemod.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/linemod.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/linemod.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/linemod.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* The string (s) contains a text command as to how lines will be displayed.
X (s) can be one of (in lowercase):
X
X dotted
X solid
X longdashed
X shortdashed
X dotdashed
X
*/
X
#include "libplot.h"
X
void linemod(s)
char s[];
{
#ifdef INDEP
X
X printf("%s\n",s); /* string followed by newline */
X
#else
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/linemod.c ||
echo 'restore of grafx10/libplot/linemod.c failed'
Wc_c="`wc -c < 'grafx10/libplot/linemod.c'`"
test 570 -eq "$Wc_c" ||
echo 'grafx10/libplot/linemod.c: original size 570, current size' "$Wc_c"
fi
# ============= grafx10/libplot/Makefile ==============
if test -f 'grafx10/libplot/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/Makefile (File already exists)'
else
echo 'x - extracting grafx10/libplot/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/Makefile' &&
# Makefile for libplot
# by David Gardiner
#
# Takes parameter of object file - file to make
#
# examples:
# make libplotibm.a - Make ibm library
# make libplot.a - Make independent library
X
CFLAGS = -c -LIB -F
LIBOBJS = openpl.s closepl.s line.s move.s point.s label.s cont.s erase.s \
X space.s arc.s colour.s linemod.s circle.s
X
libplotibm.a:
X $(MAKE) tmp.a DFLAGS=
X mv tmp.a libplotibm.a
X
libplot.a:
X $(MAKE) tmp.a DFLAGS=-DINDEP
X mv tmp.a libplot.a
X
tmp.a: $(LIBOBJS)
X ar cr tmp.a $(LIBOBJS)
X
.c.s:
X # If L is null, then we generate a device-independant library
X cc $(CFLAGS) $(DFLAGS) $(*).c
X
clean:
X @rm -r *.s
X
#End of makefile
SHAR_EOF
chmod 0600 grafx10/libplot/Makefile ||
echo 'restore of grafx10/libplot/Makefile failed'
Wc_c="`wc -c < 'grafx10/libplot/Makefile'`"
test 644 -eq "$Wc_c" ||
echo 'grafx10/libplot/Makefile: original size 644, current size' "$Wc_c"
fi
# ============= grafx10/libplot/arc.c ==============
if test -f 'grafx10/libplot/arc.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/arc.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/arc.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/arc.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw an arc, centre (x,y), start (x0,y0), end (x1,y1), anti-clockwise*/
X
#include "libplot.h"
X
void arc(x,y,x0,y0,x1,y1)
coord x,y,x0,y0,x1,y1;
{
#ifdef INDEP
X
X static struct {
X int a,b,c,d,e,f;
X } s;
X
X s.a = x;
X s.b = y;
X s.c = x0;
X s.d = y0;
X s.e = x1;
X s.f = y1;
X
X (void) printf("a");
X (void) fwrite(&s, sizeof(s), 1, stdout);
#else
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/arc.c ||
echo 'restore of grafx10/libplot/arc.c failed'
Wc_c="`wc -c < 'grafx10/libplot/arc.c'`"
test 606 -eq "$Wc_c" ||
echo 'grafx10/libplot/arc.c: original size 606, current size' "$Wc_c"
fi
# ============= grafx10/libplot/closepl.c ==============
if test -f 'grafx10/libplot/closepl.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/closepl.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/closepl.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/closepl.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Close graphics device */
X
#include "libplot.h"
X
void closepl()
{
#ifdef INDEP
X
#else
X
X ioctl(_plot_fd,GIOCRETURN,_plot_args);
X close(_plot_fd);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/closepl.c ||
echo 'restore of grafx10/libplot/closepl.c failed'
Wc_c="`wc -c < 'grafx10/libplot/closepl.c'`"
test 389 -eq "$Wc_c" ||
echo 'grafx10/libplot/closepl.c: original size 389, current size' "$Wc_c"
fi
# ============= grafx10/libplot/colour.c ==============
if test -f 'grafx10/libplot/colour.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/colour.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/colour.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/colour.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Set the current drawing colour to (c) */
X
#include "libplot.h"
X
void colour(c)
spectrum c;
{
#ifdef INDEP
X
X (void) printf("k");
X (void) fwrite(&c, sizeof(c), 1, stdout);
X
#else
X
X _plot_args->GRAFX_COLOUR = c;
X ioctl(_plot_fd,GIOCCOLOUR, _plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/colour.c ||
echo 'restore of grafx10/libplot/colour.c failed'
Wc_c="`wc -c < 'grafx10/libplot/colour.c'`"
test 501 -eq "$Wc_c" ||
echo 'grafx10/libplot/colour.c: original size 501, current size' "$Wc_c"
fi
# ============= grafx10/libplot/cont.c ==============
if test -f 'grafx10/libplot/cont.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/cont.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/cont.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/cont.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw a line from the current position, to (x,y).
X Update current position
*/
X
#include "libplot.h"
X
void cont(x,y)
coord x,y;
{
#ifdef INDEP
X
X static struct {
X int a,b;
X } s;
X
X s.a = x;
X s.b = y;
X
X (void) printf("n");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x;
X _plot_args->GRAFX_Y = y;
X ioctl(_plot_fd, GIOCCONT, _plot_args);
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/cont.c ||
echo 'restore of grafx10/libplot/cont.c failed'
Wc_c="`wc -c < 'grafx10/libplot/cont.c'`"
test 636 -eq "$Wc_c" ||
echo 'grafx10/libplot/cont.c: original size 636, current size' "$Wc_c"
fi
# ============= grafx10/libplot/erase.c ==============
if test -f 'grafx10/libplot/erase.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/erase.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/erase.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/erase.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Erase the display */
X
#include "libplot.h"
X
void erase()
{
#ifdef INDEP
X
X printf("e");
X
#else
X
X /* Rely on BIOS to clear screen when mode is switched */
X ioctl(_plot_fd, GIOCENTER, _plot_args);
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/erase.c ||
echo 'restore of grafx10/libplot/erase.c failed'
Wc_c="`wc -c < 'grafx10/libplot/erase.c'`"
test 443 -eq "$Wc_c" ||
echo 'grafx10/libplot/erase.c: original size 443, current size' "$Wc_c"
fi
# ============= grafx10/libplot/label.c ==============
if test -f 'grafx10/libplot/label.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/label.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/label.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/label.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Write text at the current position */
X
#include "libplot.h"
X
void label(s)
char s[];
{
#ifdef INDEP
X
X (void) printf("t%s\n",s); /* String, with newline at end */
X
#else
X int i;
X for (i = 0; s[i] != 0; i++) {
X _plot_args->GRAFX_CHAR = s[i];
X ioctl(_plot_fd, GIOCTEXT, _plot_args);
X }
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/label.c ||
echo 'restore of grafx10/libplot/label.c failed'
Wc_c="`wc -c < 'grafx10/libplot/label.c'`"
test 526 -eq "$Wc_c" ||
echo 'grafx10/libplot/label.c: original size 526, current size' "$Wc_c"
fi
# ============= grafx10/libplot/libplot.h ==============
if test -f 'grafx10/libplot/libplot.h' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/libplot.h (File already exists)'
else
echo 'x - extracting grafx10/libplot/libplot.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/libplot.h' &&
/* plot(3X) library header */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
#ifndef _libplot_h
#define _libplot_h
X
#include <stdio.h>
#include <ggtty.h>
X
extern int _plot_fd;
extern gmess *_plot_args;
X
#endif
SHAR_EOF
chmod 0600 grafx10/libplot/libplot.h ||
echo 'restore of grafx10/libplot/libplot.h failed'
Wc_c="`wc -c < 'grafx10/libplot/libplot.h'`"
test 359 -eq "$Wc_c" ||
echo 'grafx10/libplot/libplot.h: original size 359, current size' "$Wc_c"
fi
# ============= grafx10/libplot/line.c ==============
if test -f 'grafx10/libplot/line.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/line.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/line.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/line.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw a line from (x1,y1) to (x2,y2) */
X
#include "libplot.h"
X
void line(x1, y1, x2, y2)
coord x1,y1,x2,y2;
{
#ifdef INDEP
X
X static struct {
X int a,b,c,d;
X } s;
X
X s.a = x1;
X s.b = y1;
X s.c = x2;
X s.d = y2;
X
X printf("l");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x1;
X _plot_args->GRAFX_Y = y1;
X _plot_args->GRAFX_X2 = x2;
X _plot_args->GRAFX_Y2 = y2;
X ioctl(_plot_fd,GIOCLINE,_plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/line.c ||
echo 'restore of grafx10/libplot/line.c failed'
Wc_c="`wc -c < 'grafx10/libplot/line.c'`"
test 699 -eq "$Wc_c" ||
echo 'grafx10/libplot/line.c: original size 699, current size' "$Wc_c"
fi
# ============= grafx10/libplot/move.c ==============
if test -f 'grafx10/libplot/move.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/move.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/move.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/move.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Move current position to that of (x,y) */
X
#include "libplot.h"
X
void move(x, y)
coord x,y;
{
#ifdef INDEP
X
X static struct {
X int a,b;
X } s;
X
X s.a = x;
X s.b = y;
X
X (void) printf("m");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x;
X _plot_args->GRAFX_Y = y;
X ioctl(_plot_fd,GIOCMOVE,_plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/move.c ||
echo 'restore of grafx10/libplot/move.c failed'
Wc_c="`wc -c < 'grafx10/libplot/move.c'`"
test 597 -eq "$Wc_c" ||
echo 'grafx10/libplot/move.c: original size 597, current size' "$Wc_c"
fi
# ============= grafx10/libplot/openpl.c ==============
if test -f 'grafx10/libplot/openpl.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/openpl.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/openpl.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/openpl.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Open graphics device */
X
#include "libplot.h"
#include <fcntl.h>
X
/* The only place these are actually defined, elsewhere they are external */
int _plot_fd;
gmess *_plot_args;
X
void openpl()
{
#ifdef INDEP
X
#else
X
X if ((_plot_fd = open("/dev/grafx",O_RDWR)) == -1) {
X fprintf(stderr,"plot error: Could not open graphics device\n");
X exit(1);
X }
X
X _plot_args = (gmess *) malloc(sizeof(gmess));
X ioctl(_plot_fd, GIOCENTER, _plot_args);
X
X /* Set default colour to maximum colour - hopefully white */
X _plot_args->GRAFX_COLOUR = G_COLOURS;
X ioctl(_plot_fd, GIOCCOLOUR, _plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/openpl.c ||
echo 'restore of grafx10/libplot/openpl.c failed'
Wc_c="`wc -c < 'grafx10/libplot/openpl.c'`"
test 839 -eq "$Wc_c" ||
echo 'grafx10/libplot/openpl.c: original size 839, current size' "$Wc_c"
fi
# ============= grafx10/libplot/point.c ==============
if test -f 'grafx10/libplot/point.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/point.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/point.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/point.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Set pixel to current colour at (x,y) */
X
#include "libplot.h"
X
void point(x, y)
coord x,y;
{
#ifdef INDEP
X
X static struct {
X int a,b;
X } s;
X
X s.a = x;
X s.b = y;
X
X (void) printf("p");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
X _plot_args->GRAFX_X = x;
X _plot_args->GRAFX_Y = y;
X ioctl(_plot_fd,GIOCPLOT,_plot_args);
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/point.c ||
echo 'restore of grafx10/libplot/point.c failed'
Wc_c="`wc -c < 'grafx10/libplot/point.c'`"
test 596 -eq "$Wc_c" ||
echo 'grafx10/libplot/point.c: original size 596, current size' "$Wc_c"
fi
# ============= grafx10/libplot/space.c ==============
if test -f 'grafx10/libplot/space.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/space.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/space.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/space.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Magnify or reduce the rectangle (x0,y0)-(x1,y1) to fit the screen */
X
#include "libplot.h"
X
void space(x0,y0,x1,y1)
coord x0,y0,x1,y1;
{
#ifdef INDEP
X
X static struct {
X int a,b,c,d;
X } s;
X
X s.a = x0;
X s.b = y0;
X s.c = x1;
X s.d = y1;
X
X (void) printf("s");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/space.c ||
echo 'restore of grafx10/libplot/space.c failed'
Wc_c="`wc -c < 'grafx10/libplot/space.c'`"
test 571 -eq "$Wc_c" ||
echo 'grafx10/libplot/space.c: original size 571, current size' "$Wc_c"
fi
# ============= grafx10/libplot/tst_lib.c ==============
if test -f 'grafx10/libplot/tst_lib.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/tst_lib.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/tst_lib.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/tst_lib.c' &&
/* Plot(3X) test 1 */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* This file must be linked to one of the plot libraries
X
examples:
X
cc tst_lib.c -o tst_lib -lplot -For device independence
cc tst_lib.c -o tst_lib -lplotibm -For use with IBM-PC
X
*/
X
#include <stdio.h>
#include <ggtty.h>
X
void main()
{
X coord x,y;
X int i;
X unsigned seed;
X
X srand(seed);
X
X openpl();
X
X colour(4);
X
X /* Test plotting - draw line */
X for (x = 0; x < G_MAX_X; x++)
X point(x,x);
X
X label("Neato dorito!");
X
X move(10,10);
X cont(150,50);
X
X erase();
X
#ifdef INFINITE
X while (1) {
#else
X for (i = 0; i < 100; i++) {
#endif
X colour(rand(G_COLOURS));
X line(rand(seed) % G_MAX_X, rand(seed) % G_MAX_Y,
X rand(seed) % G_MAX_X, rand(seed) % G_MAX_Y);
X }
X
X move(100,200);
X label("Press <Enter> to exit...");
X closepl();
}
SHAR_EOF
chmod 0600 grafx10/libplot/tst_lib.c ||
echo 'restore of grafx10/libplot/tst_lib.c failed'
Wc_c="`wc -c < 'grafx10/libplot/tst_lib.c'`"
test 955 -eq "$Wc_c" ||
echo 'grafx10/libplot/tst_lib.c: original size 955, current size' "$Wc_c"
fi
# ============= grafx10/libplot/circle.c ==============
if test -f 'grafx10/libplot/circle.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/circle.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/circle.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/circle.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* Draw a circle with centre (x,y) and radius r */
X
#include "libplot.h"
X
void circle(x, y, r)
coord x,y,r;
{
#ifdef INDEP
X
X static struct {
X int a,b,c;
X } s;
X
X s.a = x;
X s.b = y;
X s.c = r;
X
X (void) printf("c");
X (void) fwrite(&s, sizeof(s), 1, stdout);
X
#else
X
#endif
}
SHAR_EOF
chmod 0600 grafx10/libplot/circle.c ||
echo 'restore of grafx10/libplot/circle.c failed'
Wc_c="`wc -c < 'grafx10/libplot/circle.c'`"
test 521 -eq "$Wc_c" ||
echo 'grafx10/libplot/circle.c: original size 521, current size' "$Wc_c"
fi
# ============= grafx10/libplot/linemod.c ==============
if test -f 'grafx10/libplot/linemod.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/libplot/linemod.c (File already exists)'
else
echo 'x - extracting grafx10/libplot/linemod.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/libplot/linemod.c' &&
/* plot(3X) library function */
/* By David Gardiner */
/* University of South Australia, Levels Campus */
X
/* The string (s) contains a text command as to how lines will be displayed.
X (s) can be one of (in lowercase):
X
X dotted
X solid
X longdashed
X shortdashed
X dotdashed
X
*/
X
#include "libplot.h"
X
void linemod(s)
char s[];
{
#ifdef INDEP
X
X printf("%s\n",s); /* string followed by newline */
X
#else
X
#endif
}
X
SHAR_EOF
chmod 0600 grafx10/libplot/linemod.c ||
echo 'restore of grafx10/libplot/linemod.c failed'
Wc_c="`wc -c < 'grafx10/libplot/linemod.c'`"
test 570 -eq "$Wc_c" ||
echo 'grafx10/libplot/linemod.c: original size 570, current size' "$Wc_c"
fi
# ============= grafx10/plot/Makefile ==============
if test ! -d 'grafx10/plot'; then
echo 'x - creating directory grafx10/plot'
mkdir 'grafx10/plot'
fi
if test -f 'grafx10/plot/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/plot/Makefile (File already exists)'
else
echo 'x - extracting grafx10/plot/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/plot/Makefile' &&
# Makefile for plot(1G)
# by David Gardiner
X
# Set this to the plot library that drives the device for plot(1G)
GLIB = plotibm
X
plot: plot.c
X cc -o plot plot.c -l$(GLIB)
SHAR_EOF
chmod 0600 grafx10/plot/Makefile ||
echo 'restore of grafx10/plot/Makefile failed'
Wc_c="`wc -c < 'grafx10/plot/Makefile'`"
test 171 -eq "$Wc_c" ||
echo 'grafx10/plot/Makefile: original size 171, current size' "$Wc_c"
fi
# ============= grafx10/plot/plot.c ==============
if test -f 'grafx10/plot/plot.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/plot/plot.c (File already exists)'
else
echo 'x - extracting grafx10/plot/plot.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/plot/plot.c' &&
/* plot(1G) generic source */
/* By David Gardiner */
/* */
/* ma89...@lux.levels.unisa.edu.au */
/* University of South Australia, Levels Campus */
/* */
/* Version 1.0 */
/* History: */
/* 16/10/1991 - Prototyped with Turbo-C++ (C Mode) on MS-DOS */
/* 19/10/1991 - Added comments, colour, and formatting */
/* 5/11/1991 - Ported to Minix */
/* 14/11/1991 - Final fixes */
X
/* Notes:
X This file should be linked with the appropriate graphics library
X to allow it to process plot(5) files for that specific device.
X
X eg. for executable "ibm", link with "/lib/libplotibm.a"
*/
X
#include <stdio.h>
#include <ggtty.h>
X
int result = 0; /* result of execution of program */
int j;
X
int getline(s, lim)
char s[];
int lim;
{
X int c,i;
X for (i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
X s[i] = c;
X if (c == '\n') {
X s[i] = 0;
X i++;
X }
X if (c == EOF)
X result = 1;
X
X return i;
}
X
X
int main()
{
X int c;
X
X /* Initialise plot device */
X openpl();
X
X /* Process until nothing more to do */
X while ( (result == 0) && (feof(stdin) == 0) ) {
X
X /* Get graphics code */
X if ((c = getchar()) != EOF) {
X
X /* Find what code we got */
X switch (c) {
X
X /* Move */
X case 'm' : {
X struct {
X int x,y;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X move(s.x,s.y);
X break;
X }
X
X /* Cont */
X case 'n' : {
X struct {
X int x,y;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X cont(s.x,s.y);
X break;
X }
X
X /* Point */
X case 'p' : {
X
X struct {
X int px,py;
X } s;
X
X j = fread(&s,sizeof(s),1,stdin);
X
X point(s.px,s.py);
X break;
X }
X
X /* Line */
X case 'l' : {
X
X struct {
X int xt,yt,xb,yb;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X line(s.xt,s.yt,s.xb,s.yb);
X break;
X }
X
X /* Label */
X case 't' : {
X char s[255];
X char *t;
X int i;
X
X i = getline(s, sizeof(s));
X t = (char *) malloc(i);
X t = s;
X
X label(t);
X
X break;
X }
X
X /* Arc */
X case 'a' : {
X
X struct {
X int x,y,x0,y0,x1,y1;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X arc(s.x, s.y, s.x0, s.y0, s.x1, s.y1);
X break;
X }
X
X /* Circle */
X case 'c' : {
X
X struct {
X int x,y,r;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X circle(s.x,s.y,s.r);
X break;
X }
X
X /* Erase */
X case 'e' :
X
X erase();
X break;
X
X /* Linemod */
X case 'f' : {
X char *s;
X
X if (scanf("%s\n",s) != EOF)
X linemod(s);
X break;
X }
X
X /* Space */
X case 's' : {
X
X struct {
X int xt,yt,xb,yb;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X space(s.xt,s.yt,s.xb,s.yb);
X
X break;
X }
X
X /* Colour */
X case 'k' : {
X spectrum shade;
X
X (void) fread(&shade,sizeof(shade),1,stdin);
X colour(shade);
X break;
X }
X
X default:
X result = 2;
X }
X }
X else
X result = 1;
X
X } /* while */
X
X sleep(2);
X
X /* Tell plot device that we are done */
X closepl();
X
X if (result == 2)
X printf("plot: unknown command code %c (%d)\n",c,c);
X
X return (result);
}
X
/* End of plot.c */
SHAR_EOF
chmod 0600 grafx10/plot/plot.c ||
echo 'restore of grafx10/plot/plot.c failed'
Wc_c="`wc -c < 'grafx10/plot/plot.c'`"
test 4167 -eq "$Wc_c" ||
echo 'grafx10/plot/plot.c: original size 4167, current size' "$Wc_c"
fi
# ============= grafx10/plot/Makefile ==============
if test -f 'grafx10/plot/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/plot/Makefile (File already exists)'
else
echo 'x - extracting grafx10/plot/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/plot/Makefile' &&
# Makefile for plot(1G)
# by David Gardiner
X
# Set this to the plot library that drives the device for plot(1G)
GLIB = plotibm
X
plot: plot.c
X cc -o plot plot.c -l$(GLIB)
SHAR_EOF
chmod 0600 grafx10/plot/Makefile ||
echo 'restore of grafx10/plot/Makefile failed'
Wc_c="`wc -c < 'grafx10/plot/Makefile'`"
test 171 -eq "$Wc_c" ||
echo 'grafx10/plot/Makefile: original size 171, current size' "$Wc_c"
fi
# ============= grafx10/plot/plot.c ==============
if test -f 'grafx10/plot/plot.c' -a X"$1" != X"-c"; then
echo 'x - skipping grafx10/plot/plot.c (File already exists)'
else
echo 'x - extracting grafx10/plot/plot.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'grafx10/plot/plot.c' &&
/* plot(1G) generic source */
/* By David Gardiner */
/* */
/* ma89...@lux.levels.unisa.edu.au */
/* University of South Australia, Levels Campus */
/* */
/* Version 1.0 */
/* History: */
/* 16/10/1991 - Prototyped with Turbo-C++ (C Mode) on MS-DOS */
/* 19/10/1991 - Added comments, colour, and formatting */
/* 5/11/1991 - Ported to Minix */
/* 14/11/1991 - Final fixes */
X
/* Notes:
X This file should be linked with the appropriate graphics library
X to allow it to process plot(5) files for that specific device.
X
X eg. for executable "ibm", link with "/lib/libplotibm.a"
*/
X
#include <stdio.h>
#include <ggtty.h>
X
int result = 0; /* result of execution of program */
int j;
X
int getline(s, lim)
char s[];
int lim;
{
X int c,i;
X for (i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
X s[i] = c;
X if (c == '\n') {
X s[i] = 0;
X i++;
X }
X if (c == EOF)
X result = 1;
X
X return i;
}
X
X
int main()
{
X int c;
X
X /* Initialise plot device */
X openpl();
X
X /* Process until nothing more to do */
X while ( (result == 0) && (feof(stdin) == 0) ) {
X
X /* Get graphics code */
X if ((c = getchar()) != EOF) {
X
X /* Find what code we got */
X switch (c) {
X
X /* Move */
X case 'm' : {
X struct {
X int x,y;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X move(s.x,s.y);
X break;
X }
X
X /* Cont */
X case 'n' : {
X struct {
X int x,y;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X cont(s.x,s.y);
X break;
X }
X
X /* Point */
X case 'p' : {
X
X struct {
X int px,py;
X } s;
X
X j = fread(&s,sizeof(s),1,stdin);
X
X point(s.px,s.py);
X break;
X }
X
X /* Line */
X case 'l' : {
X
X struct {
X int xt,yt,xb,yb;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X line(s.xt,s.yt,s.xb,s.yb);
X break;
X }
X
X /* Label */
X case 't' : {
X char s[255];
X char *t;
X int i;
X
X i = getline(s, sizeof(s));
X t = (char *) malloc(i);
X t = s;
X
X label(t);
X
X break;
X }
X
X /* Arc */
X case 'a' : {
X
X struct {
X int x,y,x0,y0,x1,y1;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X arc(s.x, s.y, s.x0, s.y0, s.x1, s.y1);
X break;
X }
X
X /* Circle */
X case 'c' : {
X
X struct {
X int x,y,r;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X circle(s.x,s.y,s.r);
X break;
X }
X
X /* Erase */
X case 'e' :
X
X erase();
X break;
X
X /* Linemod */
X case 'f' : {
X char *s;
X
X if (scanf("%s\n",s) != EOF)
X linemod(s);
X break;
X }
X
X /* Space */
X case 's' : {
X
X struct {
X int xt,yt,xb,yb;
X } s;
X
X (void) fread(&s,sizeof(s),1,stdin);
X space(s.xt,s.yt,s.xb,s.yb);
X
X break;
X }
X
X /* Colour */
X case 'k' : {
X spectrum shade;
X
X (void) fread(&shade,sizeof(shade),1,stdin);
X colour(shade);
X break;
X }
X
X default:
X result = 2;
X }
X }
X else
X result = 1;
X
X } /* while */
X
X sleep(2);
X
X /* Tell plot device that we are done */
X closepl();
X
X if (result == 2)
X printf("plot: unknown command code %c (%d)\n",c,c);
X
X return (result);
}
X
/* End of plot.c */
SHAR_EOF
chmod 0600 grafx10/plot/plot.c ||
echo 'restore of grafx10/plot/plot.c failed'
Wc_c="`wc -c < 'grafx10/plot/plot.c'`"
test 4167 -eq "$Wc_c" ||
echo 'grafx10/plot/plot.c: original size 4167, current size' "$Wc_c"
fi
true || echo 'restore of grafx10/sysdoc.txt failed'
echo End of part 3, continue with part 4
exit 0
0 new messages