Line | |
---|
1 | /* $Header: /cvsup/minix/src/lib/ack/libp/pac.c,v 1.1 2005/10/10 15:27:47 beng Exp $ */
|
---|
2 | /*
|
---|
3 | * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
---|
4 | *
|
---|
5 | * This product is part of the Amsterdam Compiler Kit.
|
---|
6 | *
|
---|
7 | * Permission to use, sell, duplicate or disclose this software must be
|
---|
8 | * obtained in writing. Requests for such permissions may be sent to
|
---|
9 | *
|
---|
10 | * Dr. Andrew S. Tanenbaum
|
---|
11 | * Wiskundig Seminarium
|
---|
12 | * Vrije Universiteit
|
---|
13 | * Postbox 7161
|
---|
14 | * 1007 MC Amsterdam
|
---|
15 | * The Netherlands
|
---|
16 | *
|
---|
17 | */
|
---|
18 |
|
---|
19 | /* Author: J.W. Stevenson */
|
---|
20 |
|
---|
21 | #include <pc_err.h>
|
---|
22 |
|
---|
23 | extern _trp();
|
---|
24 |
|
---|
25 | #define assert(x) /* nothing */
|
---|
26 |
|
---|
27 | #ifndef EM_WSIZE
|
---|
28 | #define EM_WSIZE _EM_WSIZE
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | struct descr {
|
---|
32 | int low;
|
---|
33 | int diff;
|
---|
34 | int size;
|
---|
35 | };
|
---|
36 |
|
---|
37 | _pac(ad,zd,zp,i,ap) int i; struct descr *ad,*zd; char *zp,*ap; {
|
---|
38 |
|
---|
39 | if (zd->diff > ad->diff ||
|
---|
40 | (i -= ad->low) < 0 ||
|
---|
41 | (i+zd->diff) > ad->diff)
|
---|
42 | _trp(EPACK);
|
---|
43 | ap += (i * ad->size);
|
---|
44 | i = (zd->diff + 1) * zd->size;
|
---|
45 | if (zd->size == 1) {
|
---|
46 | int *aptmp = (int *)ap;
|
---|
47 | assert(ad->size == EM_WSIZE);
|
---|
48 | while (--i >= 0)
|
---|
49 | *zp++ = *aptmp++;
|
---|
50 | #if EM_WSIZE > 2
|
---|
51 | } else if (zd->size == 2) {
|
---|
52 | int *aptmp = (int *)ap;
|
---|
53 | short *zptmp = (short *) zp;
|
---|
54 | assert(ad->size == EM_WSIZE);
|
---|
55 | while (--i >= 0)
|
---|
56 | *zptmp++ = *aptmp++;
|
---|
57 | #endif
|
---|
58 | } else {
|
---|
59 | assert(ad->size == zd->size);
|
---|
60 | while (--i >= 0)
|
---|
61 | *zp++ = *ap++;
|
---|
62 | }
|
---|
63 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.