1/* where.h -- Public #include File (module.h template V1.0)
2   Copyright (C) 1995 Free Software Foundation, Inc.
3   Contributed by James Craig Burley.
4
5This file is part of GNU Fortran.
6
7GNU Fortran is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU Fortran is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Fortran; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA.
21
22   Owning Modules:
23      where.c
24
25   Modifications:
26*/
27
28/* Allow multiple inclusion to work. */
29
30#ifndef _H_f_where
31#define _H_f_where
32
33/* Simple definitions and enumerations. */
34
35#define FFEWHERE_columnMAX UCHAR_MAX
36#define FFEWHERE_columnUNKNOWN 0
37#define FFEWHERE_indexMAX 36
38#define FFEWHERE_indexUNKNOWN UCHAR_MAX
39#define FFEWHERE_lineMAX ULONG_MAX
40#define FFEWHERE_lineUNKNOWN (&ffewhere_unknown_line_)
41#define FFEWHERE_filenameUNKNOWN ("(input file)")
42
43/* Typedefs. */
44
45typedef unsigned char ffewhereColumnNumber;	/* Change FFEWHERE_columnMAX
46						   too. */
47#define ffewhereColumnNumber_f ""
48typedef unsigned char ffewhereColumn;
49typedef struct _ffewhere_file_ *ffewhereFile;
50typedef unsigned short ffewhereLength_;
51#define ffewhereLength_f_ ""
52typedef unsigned long ffewhereLineNumber;	/* Change FFEWHERE_lineMAX
53						   too. */
54#define ffewhereLineNumber_f "l"
55typedef struct _ffewhere_line_ *ffewhereLine;
56typedef unsigned char ffewhereIndex;
57#define ffewhereIndex_f ""
58typedef ffewhereIndex ffewhereTrack[FFEWHERE_indexMAX * 2 - 2];
59typedef unsigned int ffewhereUses_;
60#define ffewhereUses_f_ ""
61
62/* Include files needed by this one. */
63
64#include "glimits.j"
65#include "top.h"
66
67/* Structure definitions. */
68
69struct _ffewhere_file_
70  {
71    size_t length;
72    char text[1];
73  };
74
75struct _ffewhere_line_
76  {
77    ffewhereLine next;
78    ffewhereLine previous;
79    ffewhereLineNumber line_num;
80    ffewhereUses_ uses;
81    ffewhereLength_ length;
82    char content[1];
83  };
84
85/* Global objects accessed by users of this module. */
86
87extern struct _ffewhere_line_ ffewhere_unknown_line_;
88
89/* Declare functions with prototypes. */
90
91void ffewhere_file_kill (ffewhereFile wf);
92ffewhereFile ffewhere_file_new (char *name, size_t length);
93void ffewhere_file_set (ffewhereFile wf, bool have_num, ffewhereLineNumber ln);
94void ffewhere_init_1 (void);
95char *ffewhere_line_content (ffewhereLine l);
96ffewhereFile ffewhere_line_file (ffewhereLine l);
97ffewhereLineNumber ffewhere_line_filelinenum (ffewhereLine l);
98void ffewhere_line_kill (ffewhereLine l);
99ffewhereLine ffewhere_line_new (ffewhereLineNumber ln);
100ffewhereLine ffewhere_line_use (ffewhereLine wl);
101void ffewhere_set_from_track (ffewhereLine *wol, ffewhereColumn *woc,
102		     ffewhereLine wrl, ffewhereColumn wrc, ffewhereTrack wt,
103			      ffewhereIndex i);
104void ffewhere_track (ffewhereLine *wl, ffewhereColumn *wc, ffewhereTrack wt,
105	   ffewhereIndex i, ffewhereLineNumber ln, ffewhereColumnNumber cn);
106void ffewhere_track_clear (ffewhereTrack wt, ffewhereIndex length);
107void ffewhere_track_copy (ffewhereTrack dwt, ffewhereTrack swt,
108			  ffewhereIndex start, ffewhereIndex length);
109void ffewhere_track_kill (ffewhereLine wrl, ffewhereColumn wrc, ffewhereTrack wt,
110			  ffewhereIndex length);
111
112/* Define macros. */
113
114#define ffewhere_column_is_unknown(c) (c == FFEWHERE_columnUNKNOWN)
115#define ffewhere_column_kill(c) ((void) 0)
116#define ffewhere_column_new(cn) (cn)
117#define ffewhere_column_number(c) (c)
118#define ffewhere_column_unknown() (FFEWHERE_columnUNKNOWN)
119#define ffewhere_column_use(c) (c)
120#define ffewhere_file_name(f) ((f)->text)
121#define ffewhere_file_namelen(f) ((f)->length)
122#define ffewhere_init_0()
123#define ffewhere_init_2()
124#define ffewhere_init_3()
125#define ffewhere_init_4()
126#define ffewhere_line_filename(l) (ffewhere_line_file(l)->text)
127#define ffewhere_line_is_unknown(l) (l == FFEWHERE_lineUNKNOWN)
128#define ffewhere_line_number(l) ((l)->line_num)
129#define ffewhere_line_unknown() (FFEWHERE_lineUNKNOWN)
130#define ffewhere_terminate_0()
131#define ffewhere_terminate_1()
132#define ffewhere_terminate_2()
133#define ffewhere_terminate_3()
134#define ffewhere_terminate_4()
135
136/* End of #include file. */
137
138#endif
139