1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 2003-2013 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 <glenn.s.fowler@gmail.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 #define JCL_LIST	(JCL_LISTAUTOEDITS|JCL_LISTEXEC|JCL_LISTINPUTS|JCL_LISTJOBS|JCL_LISTOUTPUTS|JCL_LISTPROGRAMS|JCL_LISTSCRIPTS|JCL_LISTVARIABLES)
36 
37 struct Dir_s; typedef struct Dir_s Dir_t;
38 struct Dirlist_s; typedef struct Dirlist_s Dirlist_t;
39 struct Ie_s; typedef struct Ie_s Ie_t;
40 struct Include_s; typedef struct Include_s Include_t;
41 struct Redirect_s; typedef struct Redirect_s Redirect_t;
42 struct Rc_s; typedef struct Rc_s Rc_t;
43 
44 struct Dir_s				/* directory list element	*/
45 {
46 	Dir_t*		next;		/* next in list			*/
47 	unsigned long	flags;		/* {JCL_JOB,JCL_PGM,JCL_PROC}	*/
48 	char		dir[1];		/* directory path		*/
49 };
50 
51 struct Dirlist_s			/* directory list head/tail	*/
52 {
53 	Dir_t*		head;		/* directory list head		*/
54 	Dir_t*		tail;		/* directory list tail		*/
55 };
56 
57 struct Include_s
58 {
59 	Include_t*	prev;
60 	Sfio_t*		sp;
61 	long		line;
62 	char*		file;
63 	char		path[1];
64 };
65 
66 struct Rc_s
67 {
68 	Dtlink_t	link;
69 	int		rc;
70 	char		name[1];
71 };
72 
73 struct Redirect_s
74 {
75 	const char*	file;
76 	int		fd;
77 };
78 
79 struct Ie_s
80 {
81 	Ie_t*		prev;
82 	Ie_t*		next;
83 	int		flags;
84 	int		line;
85 };
86 
87 #define _JCL_PUSH_ \
88 	char*		data; \
89 	char*		peek; \
90 	char*		peekpeek; \
91 	char*		last;
92 
93 typedef struct Push_s
94 {
95 	_JCL_PUSH_
96 } Push_t;
97 
98 #define CARD		72
99 
100 #define DEFAULT		0x01
101 #define MUST		0x02
102 
103 #define _JCL_PRIVATE_ \
104 	Jcl_t*		scope; \
105 	Jcl_t*		main; \
106 	Jclstep_t	current; \
107 	Jcldd_t*	lastdd; \
108 	Sfio_t*		sp; \
109 	Sfio_t*		cp; \
110 	Sfio_t*		dp; \
111 	Sfio_t*		rp; \
112 	Sfio_t*		tp; \
113 	Sfio_t*		vp; \
114 	Sfio_t*		xp; \
115 	Vmalloc_t*	vs; \
116 	Vmalloc_t*	vx; \
117 	Dt_t*		ds; \
118 	Dt_t*		rcs; \
119 	Dt_t*		ss; \
120 	Dt_t*		outdir; \
121 	Dtdisc_t	rcdisc; \
122 	Dtdisc_t	dddisc; \
123 	Dtdisc_t	outputdisc; \
124 	Dtdisc_t	outdirdisc; \
125 	Dtdisc_t	symdisc; \
126 	Dtdisc_t	dirdisc; \
127 	Dirlist_t	dirs; \
128 	Include_t*	include; \
129 	char*		file; \
130 	char*		ofile; \
131 	int		oline; \
132 	char*		card; \
133 	char*		peekcard; \
134 	char*		record; \
135 	char*		end; \
136 	_JCL_PUSH_ \
137 	Push_t		push[2]; \
138 	int		pushed; \
139 	int		abend; \
140 	int		rc; \
141 	int		eof; \
142 	int		canon; \
143 	int		redirect[elementsof(redirect)]; \
144 	Ie_t*		ie; \
145 	Ie_t*		iefree;
146 
147 #define _JCLDD_PRIVATE_ \
148 	int		space; \
149 	Jclcat_t*	last;
150 
151 #define diff		_jcl_diff
152 #define expand		_jcl_expand
153 #define lookup		_jcl_lookup
154 #define mark		_jcl_mark
155 #define marked		_jcl_marked
156 #define matched		_jcl_matched
157 #define nospace		_jcl_nospace
158 #define redirect	_jcl_redirect
159 #define stash		_jcl_stash
160 #define suflen		_jcl_suflen
161 #define uniq		_jcl_uniq
162 
163 extern Redirect_t	redirect[2];
164 
165 #include "jcl.h"
166 
167 #include <ctype.h>
168 #include <debug.h>
169 
170 extern int		diff(const char*, const char*, Jcldisc_t*);
171 extern char*		expand(Jcl_t*, const char*, int);
172 extern char*		lookup(Jcl_t*, const char*, const char*, int, int);
173 extern char*		mark(const char*, int, size_t, Jcldisc_t*);
174 extern int		marked(const char*, Jcldd_t*, Jcldisc_t*);
175 extern char*		matched(int, size_t*, Jcldisc_t*);
176 extern void		nospace(Jcl_t*, Jcldisc_t*);
177 extern char*		stash(Jcl_t*, Vmalloc_t*, const char*, int);
178 extern int		suflen(const char*);
179 extern void		uniq(const char*, const char*, unsigned long, Jcldisc_t*);
180 
181 #endif
182