1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 2003-2011 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                 Eclipse Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *          http://www.eclipse.org/org/documents/epl-v10.html           *
11 *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 
22 /*
23  * jcl interface definitions
24  */
25 
26 #ifndef _JCLLIB_H
27 #define _JCLLIB_H	1
28 
29 #include <ast.h>
30 #include <dt.h>
31 
32 #define IE_KEEP		01
33 #define IE_SKIP		02
34 
35 struct Dir_s; typedef struct Dir_s Dir_t;
36 struct Dirlist_s; typedef struct Dirlist_s Dirlist_t;
37 struct Ie_s; typedef struct Ie_s Ie_t;
38 struct Include_s; typedef struct Include_s Include_t;
39 struct Redirect_s; typedef struct Redirect_s Redirect_t;
40 struct Rc_s; typedef struct Rc_s Rc_t;
41 
42 struct Dir_s				/* directory list element	*/
43 {
44 	Dir_t*		next;		/* next in list			*/
45 	unsigned long	flags;		/* {JCL_JOB,JCL_PGM,JCL_PROC}	*/
46 	char		dir[1];		/* directory path		*/
47 };
48 
49 struct Dirlist_s			/* directory list head/tail	*/
50 {
51 	Dir_t*		head;		/* directory list head		*/
52 	Dir_t*		tail;		/* directory list tail		*/
53 };
54 
55 struct Include_s
56 {
57 	Include_t*	prev;
58 	Sfio_t*		sp;
59 	long		line;
60 	char*		file;
61 	char		path[1];
62 };
63 
64 struct Rc_s
65 {
66 	Dtlink_t	link;
67 	int		rc;
68 	char		name[1];
69 };
70 
71 struct Redirect_s
72 {
73 	const char*	file;
74 	int		fd;
75 };
76 
77 struct Ie_s
78 {
79 	Ie_t*		prev;
80 	Ie_t*		next;
81 	int		flags;
82 	int		line;
83 };
84 
85 #define _JCL_PUSH_ \
86 	char*		data; \
87 	char*		peek; \
88 	char*		peekpeek; \
89 	char*		last;
90 
91 typedef struct Push_s
92 {
93 	_JCL_PUSH_
94 } Push_t;
95 
96 #define CARD		72
97 
98 #define DEFAULT		0x01
99 #define MUST		0x02
100 
101 #define _JCL_PRIVATE_ \
102 	Jcl_t*		scope; \
103 	Jclstep_t	current; \
104 	Jcldd_t*	lastdd; \
105 	Sfio_t*		sp; \
106 	Sfio_t*		cp; \
107 	Sfio_t*		dp; \
108 	Sfio_t*		rp; \
109 	Sfio_t*		tp; \
110 	Sfio_t*		vp; \
111 	Sfio_t*		xp; \
112 	Vmalloc_t*	vs; \
113 	Vmalloc_t*	vx; \
114 	Dt_t*		ds; \
115 	Dt_t*		rcs; \
116 	Dt_t*		ss; \
117 	Dt_t*		outdir; \
118 	Dtdisc_t	rcdisc; \
119 	Dtdisc_t	dddisc; \
120 	Dtdisc_t	outputdisc; \
121 	Dtdisc_t	outdirdisc; \
122 	Dtdisc_t	symdisc; \
123 	Dtdisc_t	dirdisc; \
124 	Dirlist_t	dirs; \
125 	Include_t*	include; \
126 	char*		file; \
127 	char*		ofile; \
128 	int		oline; \
129 	char*		card; \
130 	char*		peekcard; \
131 	char*		record; \
132 	char*		end; \
133 	_JCL_PUSH_ \
134 	Push_t		push[2]; \
135 	int		pushed; \
136 	int		abend; \
137 	int		rc; \
138 	int		eof; \
139 	int		canon; \
140 	int		redirect[elementsof(redirect)]; \
141 	Ie_t*		ie; \
142 	Ie_t*		iefree;
143 
144 #define _JCLDD_PRIVATE_ \
145 	int		space; \
146 	Jclcat_t*	last;
147 
148 #define diff		_jcl_diff
149 #define expand		_jcl_expand
150 #define lookup		_jcl_lookup
151 #define mark		_jcl_mark
152 #define marked		_jcl_marked
153 #define matched		_jcl_matched
154 #define nospace		_jcl_nospace
155 #define redirect	_jcl_redirect
156 #define stash		_jcl_stash
157 #define suflen		_jcl_suflen
158 #define uniq		_jcl_uniq
159 
160 extern Redirect_t	redirect[2];
161 
162 #include "jcl.h"
163 
164 #include <ctype.h>
165 #include <debug.h>
166 
167 extern int		diff(const char*, const char*, Jcldisc_t*);
168 extern char*		expand(Jcl_t*, const char*, int);
169 extern char*		lookup(Jcl_t*, const char*, const char*, int, int);
170 extern char*		mark(const char*, int, size_t, Jcldisc_t*);
171 extern int		marked(const char*, Jcldd_t*, Jcldisc_t*);
172 extern char*		matched(int, size_t*, Jcldisc_t*);
173 extern void		nospace(Jcl_t*, Jcldisc_t*);
174 extern char*		stash(Jcl_t*, Vmalloc_t*, const char*, int);
175 extern int		suflen(const char*);
176 extern void		uniq(const char*, const char*, unsigned long, Jcldisc_t*);
177 
178 #endif
179