Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 5/3/83; site ukc.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!ukc!sk From: sk@ukc.UUCP (S.Kenyon) Newsgroups: net.sources Subject: jerq layers code (Part 2 of 4) Message-ID: <5038@ukc.UUCP> Date: Wed, 10-Apr-85 05:40:29 EST Article-I.D.: ukc.5038 Posted: Wed Apr 10 05:40:29 1985 Date-Received: Fri, 12-Apr-85 06:25:44 EST Organization: Computing Laboratory, U of Kent at Canterbury, UK Lines: 982 #!/bin/sh echo 'Start of jerq layers code, part 02 of 04:' echo 'x - plot/plot.c' sed 's/^X//' > plot/plot.c << '/' X X/* X * File: plot.c X * X * Sccs-id: @(#)plot.c 1.4 85/03/24 X * X * Description: This file contains the one function plot, which X * given a bitmap sb, a rectangle r and a scale factor size X * create a plot file suitable for the Printronix. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 83/10/03 Created. X * SCK 1.2 84/11/29 Made it work. X * SCK 1.3 85/02/22 Tidied up for release. X * SCK 1.4 85/03/24 Changed the include files around. X */ X X#include X X#include "../h/layers.h" X Xint bitptr; /* bit pointer into scan line being X constructed */ X X/* X * Name: plot X * X * Description: Given a bitmap sb, a rectangle r and a scale factor size X * create a plot file suitable for the Printronix. X * X * Synopsis: plot (sb, r, size) X * struct Bitmap *sb; X * struct Rectangle r; X * int size; X * X * Globals: bitptr (w) X * X * Calls: printf (libc) X * append (append.c) X * reformat (reformat.c) X * outline (outline.c) X * X * Called by: This is a top level function. X */ Xplot (sb, r, size) Xstruct Bitmap *sb; Xstruct Rectangle r; Xint size; X{ X int Index; X int Delta; X int sx; X int sy; X int dx; X int dy; X int w; X int h; X int startBits; X int endBits; X int start; X int end; X int word; X int nWords; X int scanline; X int linecount; X unsigned short srcWord; X X w = r.corner.x - r.origin.x; X h = r.corner.y - r.origin.y; X if ((w <= 0) || (h <= 0)) X return; X sx = r.origin.x; X sy = r.origin.y; X startBits = sx % WORDSIZE; X endBits = (sx + w - 1) % WORDSIZE; X if (w <= (WORDSIZE - startBits)) X nWords = 1; X else X nWords = (w - (WORDSIZE - startBits) - 1) / WORDSIZE + 2; X Index = (sy - sb -> rect.origin.y) * sb -> width + X (sx / WORDSIZE) - X (sb -> rect.origin.x / WORDSIZE); X Delta = sb -> width - nWords; X/* X * gunge at start of plotfile X */ X printf ("\n\n\n"); X for (scanline = 1; scanline <= h; scanline++) { X /* X * gunge at start of plot line X */ X bitptr = 0; X X start = startBits; X end = WORDSIZE - 1; X for (word = 1; word <= nWords; word++) { X srcWord = *(sb -> base + Index); X append (srcWord, start, end, size); X Index++; X if (word == (nWords - 1)) { X start = 0; X end = endBits; X } X else { X start = 0; X end = WORDSIZE - 1; X } X } X /* X * gunge at end of line X */ X append ((short) 0, 0, 15, 1); /* kludge (I'm sorry) */ X reformat (); X for (linecount = 0; linecount < size; linecount++) X outline (); X Index += Delta; X } X} / echo 'x - src/addobs.c' sed 's/^X//' > src/addobs.c << '/' X X/* X * File: addobs.c X * X * Sccs-id: @(#)addobs.c 1.4 85/03/24 X * X * Description: This file contains the one function addobs which X * adds obscured rectangle argr to obscured list op X * of layer lp, subdividing obscured portions X * of layers as necessary. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 83/10/03 Created. X * SCK 1.2 84/11/29 Made it work. X * SCK 1.3 85/02/27 Tidied up for release. X * SCK 1.4 85/03/24 Changed the include files around. X */ X X#include "../h/layers.h" X X/* X * Name: addobs X * X * Description: Add obscured rectangle argr to obscured list op X * of layer lp, subdividing obscured portions X * of layers as necessary. X * X * Synopsis: boolean addobs (op, argr, newr, lp) X * struct Obscured *op; X * struct Rectangle argr; X * struct Rectangle newr; X * struct Layer *lp; X * X * Globals: None. X * X * Calls: rectXrect (rectxrect.c) X * addobs (addobs.c) X * addrect (addrect.c) X * balloc (balloc.c) X * malloc (libc) X * bitblt (bitblt.c) X * X * Called by: newlayer (newlayer.c) X * addobs (addobs.c) X */ Xboolean addobs (op, argr, newr, lp) Xstruct Obscured *op; Xstruct Rectangle argr; /* struct Obscured rectangle */ Xstruct Rectangle newr; /* complete rectangle of new layer */ Xstruct Layer *lp; /* layer op belongs to */ X{ X struct Obscured *newop; X struct Rectangle r; X struct Bitmap *bp; X struct Rectangle temp; X X struct Bitmap *balloc (); X char *malloc (); X X r = argr; /* argr will be unchanged through X addobs() */ X if (rectXrect (r, newr)) { X /* X * this is much like layerop() X */ X if (r.origin.y < newr.origin.y) { X /* X * temp = piece of r below newr; X */ X temp = r; X temp.corner.y = newr.origin.y; X (void) addobs (op, temp, newr, lp); X r.origin.y = newr.origin.y; X } X if (r.corner.y > newr.corner.y) { X /* X * temp = piece of r above newr; X */ X temp = r; X temp.origin.y = newr.corner.y; X (void) addobs (op, temp, newr, lp); X r.corner.y = newr.corner.y; X } X if (r.origin.x < newr.origin.x) { X /* X * temp = piece of r to the left of newr; X */ X temp = r; X temp.corner.x = newr.origin.x; X (void) addobs (op, temp, newr, lp); X r.origin.x = newr.origin.x; X } X if (r.corner.x > newr.corner.x) { X /* X * temp = piece of r to the right of newr; X */ X temp = r; X temp.origin.x = newr.corner.x; X (void) addobs (op, temp, newr, lp); X r.corner.x = newr.corner.x; X } X /* X * r is now contained in rectangle of new layer X */ X if ((r.origin.x == argr.origin.x) &&/* no clip, just bookkeeping */ X (r.origin.y == argr.origin.y) && X (r.corner.x == argr.corner.x) && X (r.corner.y == argr.corner.y)) { X (void) addrect (r, op -> lobs); X return (FALSE); /* no subdivision */ X } X (void) addrect (r, op -> lobs); X } X bp = balloc (r); X /* X * newop = new struct Obscured X */ X newop = (struct Obscured *) malloc ((unsigned) sizeof (struct Obscured)); X /* X * copy the subdivided portion of the image X */ X (void) bitblt (op -> bmap, r, bp, bp -> rect.origin, NULL, S); X newop -> bmap = bp; X newop -> rect = r; X newop -> lobs = op -> lobs; X /* X * link newop into end of lp -> obs X */ X if (lp -> endobs != NULL) X lp -> endobs -> next = newop; X else X lp -> obs = newop; X newop -> prev = lp -> endobs; X newop -> next = NULL; X lp -> endobs = newop; X return (TRUE); /* subdivision */ X} / echo 'x - src/pass.c' sed 's/^X//' > src/pass.c << '/' X X/* X * File: pass.c X * X * Sccs-id: @(#)pass.c 1.4 85/03/24 X * X * Description: The file contains the one function Pass, which creates X * the rectangle/bitmap pair list which is used by lbitblt () X * to bitblt between two layers. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 83/10/03 Created. X * SCK 1.2 84/11/29 Made it work. X * SCK 1.3 85/02/21 Tidied up for release. X * SCK 1.4 85/03/24 Changed the include files around. X */ X X#include "../h/layers.h" X X/* X * Name: Pass X * X * Description: Create a rectangle/bitmap pair list. X * X * Synopsis: Pass (lp, r, sb, op, l, p2, p3, p4) X * struct Layer *lp; X * struct Rectangle r; X * struct Bitmap *sb; X * struct Obscured *op; X * struct ListElement **l; X * int *p2; X * int *p3; X * int *p4; X * X * Globals: None. X * X * Calls: lessthan (lessthan.c) X * malloc (libc) X * X * Called by: lbitblt (lbitblt.c) X */ XPass (lp, r, sb, op, l, p2, p3, p4) Xstruct Layer *lp; Xstruct Rectangle r; Xstruct Bitmap *sb; Xstruct Obscured *op; Xstruct ListElement **l; Xint *p2; /* unused */ Xint *p3; /* unused */ Xint *p4; /* unused */ X{ X struct ListElement *e; X struct ListElement *pe; X struct ListElement *newe; X X char *malloc (); X X pe = NULL; X for (e = *l; e != NULL; e = e -> next) {/* e = each element of l */ X if (!lessthan (r, e -> rect)) { X /* X * insert {sb,r} into l before e; X */ X newe = (struct ListElement *) X malloc ((unsigned) sizeof (struct ListElement)); X newe -> bp = sb; X newe -> rect = r; X newe -> next = e; X if (pe != NULL) X pe -> next = newe; X else X *l = newe; X return; X } X pe = e; X } X /* X * append {sb,r} to l; X */ X newe = (struct ListElement *) X malloc ((unsigned) sizeof (struct ListElement)); X newe -> bp = sb; X newe -> rect = r; X newe -> next = NULL; X if (pe != NULL) X pe -> next = newe; X else X *l = newe; X} / echo 'x - src/rlayerop.c' sed 's/^X//' > src/rlayerop.c << '/' X X/* X * File: rlayerop.c X * X * Sccs-id: @(#)rlayerop.c 1.4 85/03/24 X * X * Description: This file contains the one routine Rlayerop which X * given a layer lp, a rectangle r, a bitmap operator fn, X * and the obscured list of the layer op, recursively chain X * along the obscured list of the layer, performing the X * operation on the intersection of the argument rectangle X * and the obscured bitmap, and pass nonintersecting portions on X * to be intersected with other bitmaps on the obscured list. X * when the obscured list is empty, the rectangle must be drawn X * on the screen. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 83/10/03 Created. X * SCK 1.2 84/11/29 Made it work. X * SCK 1.3 85/03/04 Tidied up for release. X * SCK 1.4 85/03/24 Changed the include files around. X */ X X#include "../h/layers.h" X Xextern struct Bitmap *display; X X/* X * Name: Rlayerop X * X * Description: Given a layer lp, a rectangle r, a bitmap operator fn, X * and the obscured list of the layer op, recursively chain X * along the obscured list of the layer, performing the X * operation on the intersection of the argument rectangle X * and the obscured bitmap, and pass nonintersecting portions on X * to be intersected with other bitmaps on the obscured list. X * when the obscured list is empty, the rectangle must be drawn X * on the screen. X * X * Synopsis: Rlayerop (lp, fn, r, op, p1, p2, p3, p4) X * struct Layer *lp; X * int (*fn) (); X * struct Rectangle r; X * struct Obscured *op; X * int *p1; X * int *p2; X * int *p3; X * int *p4; X * X * Globals: display (r/w) X * X * Calls: (*fn) <=> addpiece (addpiece.c) by newlayer (newlayer.c) X * LBblt (lbblt.c) lblt (lblt.c) X * Pass (pass.c) lbitblt (lbitblt.c) X * rectXrect (rectxrect.c) X * Rlayerop (rlayerop.c) X * X * Called by: layerop (layerop.c) X * Rlayerop (rlayerop.c) X */ XRlayerop (lp, fn, r, op, p1, p2, p3, p4) Xstruct Layer *lp; Xint (*fn) (); Xstruct Rectangle r; Xstruct Obscured *op; /* element of obscured list with which X to intersect r */ Xint *p1; Xint *p2; Xint *p3; Xint *p4; X{ X struct Rectangle temp; X X /* X * recursively subdivide and intersect rectangle r X * with the obscured bitmaps in layer lp. X */ X if (op == NULL) /* this rectangle is not obscured */ X (void) (*fn) (lp, r, display, op, p1, p2, p3, p4);/* draw on screen */ X else X if (rectXrect (r, op -> rect) == FALSE)/* they miss */ X (void) Rlayerop (lp, fn, r, op -> next, p1, p2, p3, p4); X /* chain */ X else { /* they must intersect */ X if (r.origin.y < op -> rect.origin.y) { X /* X * temp = piece of r below op -> rect; X */ X temp = r; X temp.corner.y = op -> rect.origin.y; X (void) Rlayerop (lp, fn, temp, op -> next, p1, p2, p3, p4); X r.origin.y = op -> rect.origin.y; X } X if (r.corner.y > op -> rect.corner.y) { X /* X * temp = piece of r above op -> rect; X */ X temp = r; X temp.origin.y = op -> rect.corner.y; X (void) Rlayerop (lp, fn, temp, op -> next, p1, p2, p3, p4); X r.corner.y = op -> rect.corner.y; X } X if (r.origin.x < op -> rect.origin.x) { X /* X * temp = piece of r to the left of op -> rect; X */ X temp = r; X temp.corner.x = op -> rect.origin.x; X (void) Rlayerop (lp, fn, temp, op -> next, p1, p2, p3, p4); X r.origin.x = op -> rect.origin.x; X } X if (r.corner.x > op -> rect.corner.x) { X /* X * temp = piece of r right of op -> rect; X */ X temp = r; X temp.origin.x = op -> rect.corner.x; X (void) Rlayerop (lp, fn, temp, op -> next, p1, p2, p3, p4); X r.corner.x = op -> rect.corner.x; X } X /* X * what's left goes in this obscured bitmap X */ X (void) (*fn) (lp, r, op -> bmap, op, p1, p2, p3, p4); X } X} / echo 'x - src/upfront.c' sed 's/^X//' > src/upfront.c << '/' X X/* X * File: upfront.c X * X * Sccs-id: @(#)upfront.c 1.4 85/03/24 X * X * Description: This file contains the one routine upfront which X * pulls layer lp to the front of the screen. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 83/10/03 Created. X * SCK 1.2 84/11/29 Made it work. X * SCK 1.3 85/03/04 Tidied up for release. X * SCK 1.4 85/03/24 Changed the include files around. X */ X X#include "../h/layers.h" X Xextern struct Layer *TopLayer; Xextern struct Layer *BottomLayer; X X/* X * Name: upfront X * X * Description: Pull layer lp to the front of the screen. X * X * Synopsis: upfront (lp) X * struct Layer *lp; X * X * Globals: BottomLayer (r/w) X * TopLayer (r/w) X * X * Calls: screenswap (screenswap.c) X * rectXrect (rectxrect.c) X * X * Called by: This is a top level routine. X * dellayer (dellayer.c) X * newlayer (newlayer.c) X */ Xupfront (lp) Xstruct Layer *lp; X{ X struct Layer *fr; /* a layer in front of lp */ X struct Layer *beh; /* a layer behind lp */ X struct Obscured *op; X struct Obscured *nop; X X if (lp -> front == NULL) X return; /* lp is at the front already */ X for (fr = lp -> front; fr != NULL; fr = fr -> front) X /* fr = each layer in front of lp */ X for (op = lp -> obs; op != NULL;) { X /* op = each obscured portion of lp */ X nop = op; X op = op -> next; X if (nop -> lobs == fr) { /* fr obscures nop */ X (void) screenswap (nop -> bmap, nop -> bmap -> rect); X /* X * unlink nop from lp X */ X if (nop -> prev != NULL) X nop -> prev -> next = nop -> next; X else X lp -> obs = nop -> next; X if (nop -> next != NULL) X nop -> next -> prev = nop -> prev; X else X lp -> endobs = nop -> prev; X /* X * link nop into end of fr X */ X if (fr -> endobs != NULL) X fr -> endobs -> next = nop; X else X fr -> obs = nop; X nop -> prev = fr -> endobs; X nop -> next = NULL; X fr -> endobs = nop; X } X } X /* X * move lp to front of layer list by X * unlinking lp from layer list... X */ X if (lp -> back != NULL) X lp -> back -> front = lp -> front; X else X BottomLayer = lp -> front; X if (lp -> front != NULL) X lp -> front -> back = lp -> back; X else X TopLayer = lp -> back; X /* X * ...and linking lp in at head of list X */ X TopLayer -> front = lp; X lp -> front = NULL; X lp -> back = TopLayer; X TopLayer = lp; X for (beh = BottomLayer; beh != lp; beh = beh -> front) X /* beh = all other layers from back to X front */ X for (op = beh -> obs; op != NULL; op = op -> next) X /* op = each obscured portion of beh */ X if (rectXrect (lp -> rect, op -> rect)) X op -> lobs = lp; /* mark op obscured by lp */ X} / echo 'x - test/hilbert.c' sed 's/^X//' > test/hilbert.c << '/' X X/* X * File: hilbert.c X * X * Sccs-id: @(#)hilbert.c 1.3 85/03/24 X * X * Description: This file contains code to plot hilbert curves X * as described in X * Algorithms + Data Structures = Programs X * by N. Wirth. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 85/03/15 Created. X * SCK 1.2 85/03/22 Tidied up for release. X * SCK 1.3 85/03/24 Changed the include files around. X */ X X#include "../h/layers.h" X Xstruct Layer *drawP; X X/* X * Name: hilbert X * X * Description: Control routine for drawing hilbert curves. X * X * Synopsis: hilbert (depth, grid) X * int depth; X * int grid; X * X * Globals: None. X * X * Calls: a (hilbert.c) X * X * Called by: test (test.c) X */ Xhilbert (depth, grid) Xint depth; /* draw hilbert curves of orders 1 to X depth */ Xint grid; /* size to draw them */ X{ X struct Point home; X struct Point old; X struct Point cur; X int i; X int h; X X h = grid; X home.x = h / 2; X home.y = h / 2; X for (i = 1; i <= depth; i++) { X h = h / 2; X home.x += (h / 2); X home.y += (h / 2); X cur = old = home; X a (i, h, &old, &cur); X } X} X X/* X * Name: do_plot X * X * Description: Draw a line from old to cur. X * X * Synopsis: do_plot (old, cur) X * struct Point *old; X * struct Point *cur; X * X * Globals: drawP (r/w) X * X * Calls: lline (lline.c) X * X * Called by: test (test.c) X */ Xdo_plot (old, cur) Xstruct Point *old; Xstruct Point *cur; X{ X lline (drawP, *old, *cur, S); X *old = *cur; X} X X/* X * Name: a X * X * Description: Recursive procedure used to draw hilbert curves. X * X * Synopsis: a (i, h, old, cur) X * int i; X * int h; X * struct Point *cur; X * struct Point *old; X * X * Globals: None. X * X * Calls: d (hilbert.c) X * do_plot (hilbert.c) X * a (hilbert.c) X * b (hilbert.c) X * X * Called by: hilbert.c (hilbert.c) X * a (hilbert.c) X * b (hilbert.c) X * d (hilbert.c) X */ Xa (i, h, old, cur) Xint i; Xint h; Xstruct Point *cur; Xstruct Point *old; X{ X if (i > 0) { X d (i - 1, h, old, cur); X cur -> x -= h; X do_plot (old, cur); X a (i - 1, h, old, cur); X cur -> y -= h; X do_plot (old, cur); X a (i - 1, h, old, cur); X cur -> x += h; X do_plot (old, cur); X b (i - 1, h, old, cur); X } X} X X/* X * Name: b X * X * Description: Recursive procedure used to draw hilbert curves. X * X * Synopsis: b (i, h, old, cur) X * int i; X * int h; X * struct Point *cur; X * struct Point *old; X * X * Globals: None. X * X * Calls: c (hilbert.c) X * do_plot (hilbert.c) X * b (hilbert.c) X * a (hilbert.c) X * X * Called by: a (hilbert.c) X * b (hilbert.c) X * c (hilbert.c) X */ Xb (i, h, old, cur) Xint i; Xint h; Xstruct Point *cur; Xstruct Point *old; X{ X if (i > 0) { X c (i - 1, h, old, cur); X cur -> y += h; X do_plot (old, cur); X b (i - 1, h, old, cur); X cur -> x += h; X do_plot (old, cur); X b (i - 1, h, old, cur); X cur -> y -= h; X do_plot (old, cur); X a (i - 1, h, old, cur); X } X} X X/* X * Name: c X * X * Description: Recursive procedure used to draw hilbert curves. X * X * Synopsis: c (i, h, old, cur) X * int i; X * int h; X * struct Point *cur; X * struct Point *old; X * X * Globals: None. X * X * Calls: b (hilbert.c) X * do_plot (hilbert.c) X * c (hilbert.c) X * d (hilbert.c) X * X * Called by: b (hilbert.c) X * c (hilbert.c) X * d (hilbert.c) X */ Xc (i, h, old, cur) Xint i; Xint h; Xstruct Point *cur; Xstruct Point *old; X{ X if (i > 0) { X b (i - 1, h, old, cur); X cur -> x += h; X do_plot (old, cur); X c (i - 1, h, old, cur); X cur -> y += h; X do_plot (old, cur); X c (i - 1, h, old, cur); X cur -> x -= h; X do_plot (old, cur); X d (i - 1, h, old, cur); X } X} X X/* X * Name: d X * X * Description: Recursive procedure used to draw hilbert curves. X * X * Synopsis: d (i, h, old, cur) X * int i; X * int h; X * struct Point *cur; X * struct Point *old; X * X * Globals: None. X * X * Calls: a (hilbert.c) X * do_plot (hilbert.c) X * d (hilbert.c) X * c (hilbert.c) X * X * Called by: a (hilbert.c) X * c (hilbert.c) X * d (hilbert.c) X */ Xd (i, h, old, cur) Xint i; Xint h; Xstruct Point *cur; Xstruct Point *old; X{ X if (i > 0) { X a (i - 1, h, old, cur); X cur -> y -= h; X do_plot (old, cur); X d (i - 1, h, old, cur); X cur -> x -= h; X do_plot (old, cur); X d (i - 1, h, old, cur); X cur -> y += h; X do_plot (old, cur); X c (i - 1, h, old, cur); X } X} / echo 'x - test/jerq.c' sed 's/^X//' > test/jerq.c << '/' X X/* X * File: jerq.c X * X * Sccs-id: @(#)jerq.c 1.5 85/03/24 X * X * Description: This file contains the test harness for the layers code. X * X * Author: Simon Kenyon. X * X * History: SCK 1.1 83/10/04 Created. X * SCK 1.2 84/11/29 Made it work. X * SCK 1.3 85/03/21 Tidied up for release. X * SCK 1.4 85/03/22 Moved initialisation to layers.c. X * SCK 1.5 85/03/24 Changed the include files around. X */ X X#include X X#include "../h/layers.h" X X/* X * Name: main X * X * Description: Main line program to call the layers code test routine. X * X * Synopsis: main(argc, argv) X * int argc; X * char **argv; X * X * Globals: None. X * X * Calls: atoi (libc) X * freopen (libc) X * fprintf (libc) X * done (jerq.c) X * usage (jerq.c) X * layers (layers.c) X * test (test.c) X * X * Called by: Operating System. X */ Xmain (argc, argv) Xint argc; Xchar **argv; X{ X char *cp; X int pltsiz; X int testno; X X pltsiz = 1; X testno = 1; X for (; argc > 1; argc--) { X argv++; X if (**argv == '-') { X switch (*++*argv) { X case 'o': /* define output file */ X if (argc >= 2) { X /* X * open output file X */ X if (freopen (*++argv, "w", stdout) == NULL) { X fprintf (stderr, "jerq: cannot open %s\n", *argv); X done (1); X } X argc--; X } X continue; X case 's': /* plot size */ X pltsiz = atoi (++*argv); X continue; X case 't': /* test no. */ X testno = atoi (++*argv); X continue; X default: X fprintf (stderr, "jerq: unknown option %s\n", *argv); X usage (); X continue; X } X } X } X test (testno, pltsiz); /* test the "Layers" code */ X done (0); X} X X/* X * Name: usage X * X * Description: Print usage message on stderr and exit. X * X * Synopsis: usage () X * X * Globals: None. X * X * Calls: fprintf (libc) X * done (jerq.c) X * X * Called by: main (jerq.c) X */ Xusage () { X fprintf (stderr, "usage: jerq [-o plotfile] [-sn] [-tn]\n"); X done (1); X} X X/* X * Name: done X * X * Description: Exit with appropriate status. X * X * Synopsis: done (n) X * int n; X * X * Globals: None. X * X * Calls: exit (libc) X * X * Called by: main (jerq.c) X * usage (jerq.c) X */ Xdone (n) Xint n; X{ X exit (n); X} / echo 'Part 02 of jerq layers code complete.' exit