1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22 */
23 
24 /*
25 **++
26 **  FACILITY:
27 **
28 **      User Interface Language Compiler (UIL)
29 **
30 **  ABSTRACT:
31 **
32 **      This include file defines the interface to the UIL source
33 **	management procedures in the UIL compiler.
34 **
35 **--
36 **/
37 
38 #ifndef UilSrcDef_h
39 #define UilSrcDef_h
40 
41 
42 /*
43 **  Interface to src_open_source
44 */
45 
46 #define src_k_open_normal   1	    /* open succeeded */
47 #define src_k_open_error    0	    /* open was unsuccessful */
48 
49 /*
50 ** Close return statuses
51 */
52 
53 #define src_k_close_normal	1	/* close succeeded */
54 #define src_k_close_error	0	/* close was unsuccessful */
55 
56 /*
57 **  Interface to src_get_source_line
58 */
59 
60 #define src_k_read_truncated	3   /* record truncated */
61 #define src_k_read_error    	2   /* error during read */
62 #define src_k_read_normal   	1   /* record read normally */
63 #define src_k_end_source    	0   /* end of source */
64 
65 /*
66 **  Source records describe the lines of the source program.  The are
67 **  used to retrieve the source file for the listing and diagnostics.
68 **  Diagnostics randomly access these data structures by maintaining
69 **  the address of the corresponding source record in tokens, the parse
70 **  stack and symbol table entries.  The listing file walks the source
71 **  records via the linked list provide by ar_next_source_record.
72 */
73 
74 
75 
76 
77 
78 
79 #define _src_null_access_key( _key ) (_key.l_key == EOF)
80 #define src_k_key_length 4
81 
82 typedef struct
83 {
84     unsigned long	l_key;
85 } z_key;
86 
87 typedef struct  _src_message_item_type
88 {
89     struct _src_message_item_type   *az_next_message;
90     status			    l_message_number;
91     unsigned char		    b_source_pos;
92     char			    c_text[ 1 ];
93 } src_message_item_type;
94 
95 #define src_message_item_type_size \
96     (sizeof(src_message_item_type) -\
97      sizeof( struct _src_message_item_type.c_text))
98 
99 typedef struct  _src_machine_code_type
100 {
101     struct _src_machine_code_type   *az_next_machine_code;
102     unsigned short int		    w_offset;
103     unsigned short int		    w_code_len;
104     union {
105       long			    q_longdata[1];  /* longword alias for data*/
106       char			    c_data[ 1 ];    /* byte alias for data */
107     } data;
108 } src_machine_code_type;
109 
110 #define src_machine_code_type_size \
111     (sizeof(src_machine_code_type) -\
112      sizeof( struct _src_machine_code_type.c_text))
113 
114 /*
115 **  Mask for bits in b_flags of the source record
116 */
117 
118 #define src_m_form_feed			(1<<0)
119 #define src_m_unprintable_chars		(1<<1)
120 
121 typedef struct  _src_source_record_type
122 {
123     struct _src_source_record_type  *az_next_source_record;
124     src_message_item_type	    *az_message_list;
125     unsigned short		    w_line_number;
126     unsigned char		    b_file_number;
127     unsigned char		    b_flags;
128     z_key			    z_access_key;
129     src_machine_code_type	    *az_machine_code_list;
130     unsigned short		    w_machine_code_cnt;
131 } src_source_record_type;
132 
133 /*
134 **  Source buffers describe the lines of the source program that are
135 **  currently being SCAN.  Include files and macros a can cause a program
136 **  to have more than 1 source buffer.  These buffers are managed as a
137 **  stack, implemented via a linked list.
138 */
139 
140 typedef struct	_src_source_buffer_type
141 {
142     struct _src_source_buffer_type  *az_prior_source_buffer;
143     unsigned short		    w_current_line_number;
144     unsigned short		    w_current_position;
145     char			    b_file_number;
146     char			    c_text[ src_k_max_source_line_length+1];
147 } src_source_buffer_type;
148 
149 #endif /* UilSrcDef_h */
150 /* DON'T ADD STUFF AFTER THIS #endif */
151