Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / comp / desig.h
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  *
5  * Author: Ceriel J.H. Jacobs
6  */
7
8 /* D E S I G N A T O R   D E S C R I P T I O N S */
9
10 /* $Id: desig.h,v 1.8 1994/06/24 12:40:39 ceriel Exp $ */
11
12 /* Generating code for designators is not particularly easy, especially if
13    you don't know wether you want the address or the value.
14    The next structure is used to generate code for designators.
15    It contains information on how to find the designator, after generation
16    of the code that is common to both address and value computations.
17 */
18
19 struct desig {
20         short   dsg_kind;
21 #define DSG_INIT        0       /* don't know anything yet */
22 #define DSG_LOADED      1       /* designator loaded  on top of the stack */
23 #define DSG_PLOADED     2       /* designator accessible through pointer on
24                                    stack, possibly with an offset
25                                 */
26 #define DSG_FIXED       3       /* designator directly accessible */
27 #define DSG_PFIXED      4       /* designator accessible through directly
28                                    accessible pointer
29                                 */
30 #define DSG_INDEXED     5       /* designator accessible through array
31                                    operation. Address of array descriptor on
32                                    top of the stack, index beneath that, and
33                                    base address beneath that
34                                 */
35         arith   dsg_offset;     /* contains an offset for PLOADED,
36                                    or for FIXED or PFIXED it contains an
37                                    offset from dsg_name, if it exists,
38                                    or from the current Local Base
39                                 */
40         char    *dsg_name;      /* name of global variable, used for
41                                    FIXED and PFIXED
42                                 */
43         struct def *dsg_def;    /* def structure associated with this
44                                    designator, or 0
45                                 */
46 };
47
48 typedef struct desig    t_desig;
49
50 /* The next structure describes the designator in a with-statement.
51    We have a linked list of them, as with-statements may be nested.
52 */
53
54 struct withdesig {
55         struct withdesig *w_next;
56         int w_flags;            /* D_USED|D_DEFINED */
57         struct scope *w_scope;  /* scope in which fields of this record
58                                    reside
59                                 */
60         t_desig w_desig;        /* a desig structure for this particular
61                                    designator
62                                 */
63 };
64
65 extern struct withdesig *WithDesigs;
66
67 #define NO_LABEL        ((label) 0)