* expr.c (expand_expr) [MULT_EXPR]: Do not apply distributive law
[official-gcc.git] / gcc / f / lab.c
bloba870a7fe9c0285c4a07b175ad51c5bb0118ec7c5
1 /* lab.c -- Implementation File (module.c template V1.0)
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
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.
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.
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.
22 Related Modules:
24 Description:
25 Complex data abstraction for Fortran labels. Maintains a single master
26 list for all labels; it is expected initialization and termination of
27 this list will occur on program-unit boundaries.
29 Modifications:
30 22-Aug-89 JCB 1.1
31 Change ffelab_new for new ffewhere interface.
34 /* Include files. */
36 #include "proj.h"
37 #include "lab.h"
38 #include "malloc.h"
40 /* Externals defined here. */
42 ffelab ffelab_list_;
43 ffelabNumber ffelab_num_news_;
45 /* Simple definitions and enumerations. */
48 /* Internal typedefs. */
51 /* Private include files. */
54 /* Internal structure definitions. */
57 /* Static objects accessed by functions in this module. */
60 /* Static functions (internal). */
63 /* Internal macros. */
66 /* ffelab_find -- Find the ffelab object having the desired label value
68 ffelab l;
69 ffelabValue v;
70 l = ffelab_find(v);
72 If the desired ffelab object doesn't exist, returns NULL.
74 Straightforward search of list of ffelabs. */
76 ffelab
77 ffelab_find (ffelabValue v)
79 ffelab l;
81 for (l = ffelab_list_; (l != NULL) && (ffelab_value (l) != v); l = l->next)
84 return l;
87 /* ffelab_finish -- Shut down label management
89 ffelab_finish();
91 At the end of processing a program unit, call this routine to shut down
92 label management.
94 Kill all the labels on the list. */
96 void
97 ffelab_finish ()
99 ffelab l;
100 ffelab pl;
102 for (pl = NULL, l = ffelab_list_; l != NULL; pl = l, l = l->next)
103 if (pl != NULL)
104 malloc_kill_ks (ffe_pool_any_unit (), pl, sizeof (*pl));
106 if (pl != NULL)
107 malloc_kill_ks (ffe_pool_any_unit (), pl, sizeof (*pl));
110 /* ffelab_init_3 -- Initialize label management system
112 ffelab_init_3();
114 Initialize the label management system. Do this before a new program
115 unit is going to be processed. */
117 void
118 ffelab_init_3 ()
120 ffelab_list_ = NULL;
121 ffelab_num_news_ = 0;
124 /* ffelab_new -- Create an ffelab object.
126 ffelab l;
127 ffelabValue v;
128 l = ffelab_new(v);
130 Create a label having a given value. If the value isn't known, pass
131 FFELAB_valueNONE, and set it later with ffelab_set_value.
133 Allocate, initialize, and stick at top of label list.
135 22-Aug-89 JCB 1.1
136 Change for new ffewhere interface. */
138 ffelab
139 ffelab_new (ffelabValue v)
141 ffelab l;
143 ++ffelab_num_news_;
144 l = (ffelab) malloc_new_ks (ffe_pool_any_unit (), "FFELAB label", sizeof (*l));
145 l->next = ffelab_list_;
146 #ifdef FFECOM_labelHOOK
147 l->hook = FFECOM_labelNULL;
148 #endif
149 l->value = v;
150 l->firstref_line = ffewhere_line_unknown ();
151 l->firstref_col = ffewhere_column_unknown ();
152 l->doref_line = ffewhere_line_unknown ();
153 l->doref_col = ffewhere_column_unknown ();
154 l->definition_line = ffewhere_line_unknown ();
155 l->definition_col = ffewhere_column_unknown ();
156 l->type = FFELAB_typeUNKNOWN;
157 ffelab_list_ = l;
158 return l;