1: /* Copyright (c) 1979 Regents of the University of California */
2:
3: static char sccsid[] = "@(#)UNPACK.c 1.3 6/10/81";
4:
5:
6: /*
7: * unpack(z,a,i)
8: *
9: * with: z and a as in pack
10: *
11: * semantics: for j := u to v do
12: * a[j-u+i] := z[j]
13: */
14:
15: UNPACK(i, a, z, size_a, lb_a, ub_a, size_z)
16:
17: long i; /* subscript into a to begin packing */
18: char *a; /* pointer to structure a */
19: char *z; /* pointer to structure z */
20: long size_a; /* sizeof(a_type) */
21: long lb_a; /* lower bound of structure a */
22: long ub_a; /* (upper bound of a) - (lb_a + sizeof(z_type)) */
23: long size_z; /* sizeof(z_type) */
24: {
25: int subscr;
26: register char *cp;
27: register char *zp = z;
28: register char *limit;
29:
30: subscr = i - lb_a;
31: if (subscr < 0 || subscr > ub_a) {
32: ERROR("i = %D: Bad i to unpack(z,a,i)\n", i);
33: return;
34: }
35: cp = &a[subscr * size_a];
36: limit = cp + size_z;
37: do {
38: *cp++ = *zp++;
39: } while (cp < limit);
40: }
Defined functions
Defined variables
sccsid
defined in line
3;
never used