xref: /openbsd/gnu/usr.bin/gcc/gcc/f/lab.h (revision c87b03e5)
1 /* lab.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995 Free Software Foundation, Inc.
3    Contributed by James Craig Burley.
4 
5 This file is part of GNU Fortran.
6 
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 
22    Owning Modules:
23       lab.c
24 
25    Modifications:
26       22-Aug-89	 JCB  1.1
27 	 Change for new ffewhere interface.
28 */
29 
30 /* Allow multiple inclusion to work. */
31 
32 #ifndef GCC_F_LAB_H
33 #define GCC_F_LAB_H
34 
35 /* Simple definitions and enumerations. */
36 
37 typedef enum
38   {
39     FFELAB_typeUNKNOWN,		/* No info yet on label. */
40     FFELAB_typeANY,		/* Label valid for anything, no msgs. */
41     FFELAB_typeUSELESS,		/* No valid way to reference this label. */
42     FFELAB_typeASSIGNABLE,	/* Target of ASSIGN: so FORMAT or BRANCH. */
43     FFELAB_typeFORMAT,		/* FORMAT label. */
44     FFELAB_typeLOOPEND,		/* Target of a labeled DO statement. */
45     FFELAB_typeNOTLOOP,		/* Branch target statement not valid DO
46 				   target. */
47     FFELAB_typeENDIF,		/* END IF label. */
48     FFELAB_type
49   } ffelabType;
50 
51 #define FFELAB_valueNONE 0
52 #define FFELAB_valueMAX 99999
53 
54 /* Typedefs. */
55 
56 typedef struct _ffelab_ *ffelab;
57 typedef ffelab ffelabHandle;
58 typedef unsigned long ffelabNumber;	/* Count of new labels. */
59 #define ffelabNumber_f "l"
60 typedef unsigned long ffelabValue;
61 #define ffelabValue_f "l"
62 
63 /* Include files needed by this one. */
64 
65 #include "com.h"
66 #include "where.h"
67 
68 /* Structure definitions. */
69 
70 struct _ffelab_
71   {
72     ffelab next;
73 #ifdef FFECOM_labelHOOK
74     ffecomLabel hook;
75 #endif
76     ffelabValue value;		/* 1 through 99999, or 100000+ for temp
77 				   labels. */
78     unsigned long blocknum;	/* Managed entirely by user of module. */
79     ffewhereLine firstref_line;
80     ffewhereColumn firstref_col;
81     ffewhereLine doref_line;
82     ffewhereColumn doref_col;
83     ffewhereLine definition_line;	/* ffewhere_line_unknown() if not
84 					   defined. */
85     ffewhereColumn definition_col;
86     ffelabType type;
87   };
88 
89 /* Global objects accessed by users of this module. */
90 
91 extern ffelab ffelab_list_;
92 extern ffelabNumber ffelab_num_news_;
93 
94 /* Declare functions with prototypes. */
95 
96 ffelab ffelab_find (ffelabValue v);
97 void ffelab_finish (void);
98 void ffelab_init_3 (void);
99 ffelab ffelab_new (ffelabValue v);
100 
101 /* Define macros. */
102 
103 #define ffelab_blocknum(l) ((l)->blocknum)
104 #define ffelab_definition_column(l) ((l)->definition_col)
105 #define ffelab_definition_filename(l) \
106       ffewhere_line_filename((l)->definition_line)
107 #define ffelab_definition_filelinenum(l) \
108       ffewhere_line_filelinenum((l)->definition_line)
109 #define ffelab_definition_line(l) ((l)->definition_line)
110 #define ffelab_definition_line_number(l) \
111       ffewhere_line_number((l)->definition_line)
112 #define ffelab_doref_column(l) ((l)->doref_col)
113 #define ffelab_doref_filename(l) ffewhere_line_filename((l)->doref_line)
114 #define ffelab_doref_filelinenum(l) ffewhere_line_filelinenum((l)->doref_line)
115 #define ffelab_doref_line(l) ((l)->doref_line)
116 #define ffelab_doref_line_number(l) ffewhere_line_number((l)->doref_line)
117 #define ffelab_firstref_column(l) ((l)->firstref_col)
118 #define ffelab_firstref_filename(l) ffewhere_line_filename((l)->firstref_line)
119 #define ffelab_firstref_filelinenum(l) \
120       ffewhere_line_filelinenum((l)->firstref_line)
121 #define ffelab_firstref_line(l) ((l)->firstref_line)
122 #define ffelab_firstref_line_number(l) ffewhere_line_number((l)->firstref_line)
123 #define ffelab_handle_done(h)
124 #define ffelab_handle_first() ((ffelabHandle) ffelab_list_)
125 #define ffelab_handle_next(h) ((ffelabHandle) (((ffelab) h)->next))
126 #define ffelab_handle_target(h) ((ffelab) h)
127 #define ffelab_hook(l) ((l)->hook)
128 #define ffelab_init_0()
129 #define ffelab_init_1()
130 #define ffelab_init_2()
131 #define ffelab_init_4()
132 #define ffelab_kill(l) ffelab_set_value(l,FFELAB_valueNONE);
133 #define ffelab_new_generated() (ffelab_new(ffelab_generated_++))
134 #define ffelab_number() (ffelab_num_news_)
135 #define ffelab_set_blocknum(l,b) ((l)->blocknum = (b))
136 #define ffelab_set_definition_column(l,cn) ((l)->definition_col = (cn))
137 #define ffelab_set_definition_line(l,ln) ((l)->definition_line = (ln))
138 #define ffelab_set_doref_column(l,cn) ((l)->doref_col = (cn))
139 #define ffelab_set_doref_line(l,ln) ((l)->doref_line = (ln))
140 #define ffelab_set_firstref_column(l,cn) ((l)->firstref_col = (cn))
141 #define ffelab_set_firstref_line(l,ln) ((l)->firstref_line = (ln))
142 #define ffelab_set_hook(l,h) ((l)->hook = (h))
143 #define ffelab_set_type(l,t) ((l)->type = (t))
144 #define ffelab_terminate_0()
145 #define ffelab_terminate_1()
146 #define ffelab_terminate_2()
147 #define ffelab_terminate_3()
148 #define ffelab_terminate_4()
149 #define ffelab_type(l) ((l)->type)
150 #define ffelab_value(l) ((l)->value)
151 
152 /* End of #include file. */
153 
154 #endif /* ! GCC_F_LAB_H */
155