1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4    *                                                         *
 5    * Copyright (c) 1972 by Massachusetts Institute of        *
 6    * Technology and Honeywell Information Systems, Inc.      *
 7    *                                                         *
 8    *********************************************************** */
 9 
10 
11 get_imaginary:      proc(pt) returns(ptr);
12 
13 /* Modified: 25 Apr 1979 by PCK to implement 4-bit decimal */
14 
15 /* Produces a reference to the imaginary part of a complex variable.
16    Note that c_length refers to the length of the real and imaginary parts
17    combined.  */
18 
19 dcl       (p,pt,q,s) ptr;
20 
21 dcl       get_reference entry() returns(ptr);
22 
23 dcl       (divide,mod) builtin;
24 
25 %include reference;
26 %include boundary;
27 %include symbol;
28 
29           q = get_reference();
30           p = pt;
31           if ^ p -> reference.shared
32                then p -> reference.ref_count = p -> reference.ref_count + 1;
33           q -> reference.qualifier = p;
34           q -> reference.symbol = p -> reference.symbol;
35           q -> reference.c_length = p -> reference.c_length;
36 
37           s = p -> reference.symbol;
38           q -> reference.c_offset = divide(q -> reference.c_length,2,24,0);
39 
40           if s -> symbol.unaligned
41           then do;
42                     q -> reference.units = digit_;
43                     q -> reference.c_offset = q -> reference.c_offset + mod(q -> reference.c_offset,2);
44                end;
45           else q -> reference.units = character_;
46 
47           q -> reference.data_type = p -> reference.data_type;
48           q -> reference.defined_ref = "1"b;
49 
50           return(q);
51 
52 end;