rh

Check-in [74a2587607]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bring rest of changes into git
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:74a2587607d30dc45e3bbbdb774617e6e318aa819d05938b2fcefd0117e86c7c
User & Date: ajv-899-334-8894@vsta.org 2016-08-10 20:58:51
Context
2016-08-10
20:59
Simplify Makefile, too much hair. check-in: 9489e73bdd user: ajv-899-334-8894@vsta.org tags: master, trunk
20:58
Bring rest of changes into git check-in: 74a2587607 user: ajv-899-334-8894@vsta.org tags: master, trunk
2014-07-31
21:58
Fix up f*cked up time treatment; use system one check-in: c584edc078 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.

1
2
3
4
5
6
7
8
9
10
11
12
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# rcsid: $Id: Makefile,v 1.3 2011/12/31 02:41:07 vandys Exp vandys $

PROGRAM = rh

CFLAGS=-g
CC=gcc

# Possible C preprocessor flags:
#	-DBSD			    BSD directory handling
#	-DSUNOS_4		    compiling on SunOS 4.1.x
#	-DPOSIX_DIRECTORY_LIBRARY   POSIX directory handling
#
................................................................................
		DEBUG_CPPFLAGS="-DDEBUG" $(PROGRAM)

debug_p:
	$(MAKE) DEBUG_YFLAGS=-t DEBUG_LFLAGS=-d		\
		DEBUG_SRCS=dump.c DEBUG_OBJS=dump.o	\
		DEBUG_CPPFLAGS="-DDEBUG" purify

rhgram.c rhgram.h: rhgram.y
	$(YACC) $(DEBUG_YFLAGS) -d -p rh_ rhgram.y
	mv y.tab.c rhgram.c
	mv y.tab.h rhgram.h
	# $(YACC) $(DEBUG_YFLAGS) -d -B -p rh_ rhgram.y

getdate.c: getdate.y
	$(YACC) $(DEBUG_YFLAGS) -p gd_ getdate.y
	mv y.tab.c getdate.c
	# $(YACC) $(DEBUG_YFLAGS) B -p gd_ getdate.y

cc_src: $(SRCS)
	#load $(CPPFLAGS) $(SRCS)
	#link

clean:
	$(RM) *.o core *~ *.output
|



|







 







|
|
|
|
|
|
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# rcsid: $Id: Makefile,v 1.4 2012/01/10 00:03:46 vandys Exp vandys $

PROGRAM = rh

CFLAGS=-O
CC=gcc

# Possible C preprocessor flags:
#	-DBSD			    BSD directory handling
#	-DSUNOS_4		    compiling on SunOS 4.1.x
#	-DPOSIX_DIRECTORY_LIBRARY   POSIX directory handling
#
................................................................................
		DEBUG_CPPFLAGS="-DDEBUG" $(PROGRAM)

debug_p:
	$(MAKE) DEBUG_YFLAGS=-t DEBUG_LFLAGS=-d		\
		DEBUG_SRCS=dump.c DEBUG_OBJS=dump.o	\
		DEBUG_CPPFLAGS="-DDEBUG" purify

# rhgram.c rhgram.h: rhgram.y
# 	$(YACC) $(DEBUG_YFLAGS) -d -p rh_ rhgram.y
# 	mv y.tab.c rhgram.c
# 	mv y.tab.h rhgram.h
# 	# $(YACC) $(DEBUG_YFLAGS) -d -B -p rh_ rhgram.y
# 
# getdate.c: getdate.y
# 	$(YACC) $(DEBUG_YFLAGS) -p gd_ getdate.y
# 	mv y.tab.c getdate.c
# 	# $(YACC) $(DEBUG_YFLAGS) B -p gd_ getdate.y

cc_src: $(SRCS)
	#load $(CPPFLAGS) $(SRCS)
	#link

clean:
	$(RM) *.o core *~ *.output

Changes to README.

1
2
3
4
5
6
7
8
# rcsid: $Id: README,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $

An ANSI/ISO C compiler is required

If rhlex.c is deleted then you must have flex version 2.4.6 or higher
to create it.

If getdate.c, rhgram.c, or rhgram.h is deleted then you must have perl-byacc
|







1
2
3
4
5
6
7
8
# rcsid: $Id: README,v 1.2 2011/01/03 21:46:04 vandys Exp $

An ANSI/ISO C compiler is required

If rhlex.c is deleted then you must have flex version 2.4.6 or higher
to create it.

If getdate.c, rhgram.c, or rhgram.h is deleted then you must have perl-byacc

Changes to SCOPTIONS.

1
2
3
4
5
6
7
8
9
# rcsid: $Id: SCOPTIONS,v 1.1 1994/01/12 19:32:53 rick Exp $
MATH=68881
CPU=68030
ANSI
OPTIMIZE
STRINGSCONST
NOVERSION
STRICT
MEMORYSIZE=HUGE
|








1
2
3
4
5
6
7
8
9
# rcsid: $Id: SCOPTIONS,v 1.1 2008/12/27 00:56:03 vandys Exp $
MATH=68881
CPU=68030
ANSI
OPTIMIZE
STRINGSCONST
NOVERSION
STRICT
MEMORYSIZE=HUGE

Changes to TODO.

1
2
3
4
5
6
7
8
9
10
# rcsid: $Id: TODO,v 1.2 1994/01/26 01:54:18 rick Exp $
ino == inode

separate symbol table for parameters?

	b(c) { return c + 2; } a(b) { return b + 2; }
    parses wrong because b is a function

set static symbols value to instr_value?
	now->value becomes now->value.date_info.seconds ...
|









1
2
3
4
5
6
7
8
9
10
# rcsid: $Id: TODO,v 1.1 2008/12/27 00:56:03 vandys Exp $
ino == inode

separate symbol table for parameters?

	b(c) { return c + 2; } a(b) { return b + 2; }
    parses wrong because b is a function

set static symbols value to instr_value?
	now->value becomes now->value.date_info.seconds ...

Changes to alloc.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * This file contains functions related to dynamic memory allocation.
 *
 * Global Functions: allocate, reallocate, savestr
 */

#if !defined(lint)
static char rcsid[] = "$Id: alloc.c,v 1.1 1994/01/12 19:33:22 rick Exp $";
#endif

#include <stdlib.h>
#include <string.h>

#include "errmsg.h"
 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * This file contains functions related to dynamic memory allocation.
 *
 * Global Functions: allocate, reallocate, savestr
 */

#if !defined(lint)
static char rcsid[] = "$Id: alloc.c,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include <stdlib.h>
#include <string.h>

#include "errmsg.h"
 

Changes to alloc.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * alloc.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: alloc.h,v 1.1 1994/01/12 19:33:38 rick Exp $
 */

#if !defined(__ALLOC_H__)
#define __ALLOC_H__

#define ALLOCATE(n)	 allocate((n), __FILE__, __LINE__)
#define REALLOCATE(a, n) reallocate((a), (n), __FILE__, __LINE__)





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * alloc.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: alloc.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#if !defined(__ALLOC_H__)
#define __ALLOC_H__

#define ALLOCATE(n)	 allocate((n), __FILE__, __LINE__)
#define REALLOCATE(a, n) reallocate((a), (n), __FILE__, __LINE__)

Changes to dump.c.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 * This file contain data structures and functions to dump an rh
 * compiled program in a human readable form.
 *
 * Global Functions: dump_instr, dump_program
 */

#if !defined(lint)
static char rcsid[] = "$Id: dump.c,v 1.2 1994/01/26 01:46:21 rick Exp $";
#endif

#include <time.h>
#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"








|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 * This file contain data structures and functions to dump an rh
 * compiled program in a human readable form.
 *
 * Global Functions: dump_instr, dump_program
 */

#if !defined(lint)
static char rcsid[] = "$Id: dump.c,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include <time.h>
#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"

Changes to dump.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * dump.h
 *
 * WRITTEN BY:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: dump.h,v 1.1 1994/01/12 19:34:18 rick Exp $
 */

#if !defined(__DUMP_H__)
#define __DUMP_H__

extern void	dump_instr(int pc, const instruction *ip);
extern int	dump_program(int pc, int flag);

#endif	/* __DUMP_H__ */





|









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * dump.h
 *
 * WRITTEN BY:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: dump.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#if !defined(__DUMP_H__)
#define __DUMP_H__

extern void	dump_instr(int pc, const instruction *ip);
extern int	dump_program(int pc, int flag);

#endif	/* __DUMP_H__ */

Changes to errmsg.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Global Functions: error, warning
 *
 * Static Functions: percent_m, errmsg
 */

#if !defined(lint)
static char rcsid[] = "$Id: errmsg.c,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>








|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Global Functions: error, warning
 *
 * Static Functions: percent_m, errmsg
 */

#if !defined(lint)
static char rcsid[] = "$Id: errmsg.c,v 1.2 2010/04/22 03:02:46 vandys Exp $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>

Changes to errmsg.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * errmsg.h
 *
 * WRITTEN BY:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: errmsg.h,v 1.1 1994/01/12 19:35:00 rick Exp $
 */

#if !defined(__ERRMSG_H__)
#define __ERRMSG_H__

extern const char *Program_name;

extern void error(const char *format, ...);
extern void warning(const char *format, ...);

#endif	/* __ERRMSG_H__ */





|











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * errmsg.h
 *
 * WRITTEN BY:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: errmsg.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#if !defined(__ERRMSG_H__)
#define __ERRMSG_H__

extern const char *Program_name;

extern void error(const char *format, ...);
extern void warning(const char *format, ...);

#endif	/* __ERRMSG_H__ */

Changes to getdate.c.

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	/*							*/
	/* 	Steven M. Bellovin (unc!smb)			*/
	/*	Dept. of Computer Science			*/
	/*	University of North Carolina at Chapel Hill	*/
	/*	@(#)getdate.y	2.13	9/16/86			*/

#if !defined(lint)
static char rcsid[] = "$Id: getdate.y,v 1.2 2013/03/14 22:40:31 vandys Exp vandys $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>







|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	/*							*/
	/* 	Steven M. Bellovin (unc!smb)			*/
	/*	Dept. of Computer Science			*/
	/*	University of North Carolina at Chapel Hill	*/
	/*	@(#)getdate.y	2.13	9/16/86			*/

#if !defined(lint)
static char rcsid[] = "$Id: getdate.c,v 1.4 2014/07/31 21:58:09 vandys Exp $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>

Changes to getdate.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * getdate.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * This file contains the structure returned by getdate().
 *
 * rcsid: $Id: getdate.h,v 1.1 1994/01/12 19:35:41 rick Exp $
 */

#if !defined(__GETDATE_H__)
#define __GETDATE_H__

typedef struct {
    time_t		seconds;







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * getdate.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * This file contains the structure returned by getdate().
 *
 * rcsid: $Id: getdate.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#if !defined(__GETDATE_H__)
#define __GETDATE_H__

typedef struct {
    time_t		seconds;

Changes to getdate.y.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
	/*							*/
	/* 	Steven M. Bellovin (unc!smb)			*/
	/*	Dept. of Computer Science			*/
	/*	University of North Carolina at Chapel Hill	*/
	/*	@(#)getdate.y	2.13	9/16/86			*/

#if !defined(lint)
static char rcsid[] = "$Id: getdate.y,v 1.2 2013/03/14 22:40:31 vandys Exp vandys $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>







|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
	/*							*/
	/* 	Steven M. Bellovin (unc!smb)			*/
	/*	Dept. of Computer Science			*/
	/*	University of North Carolina at Chapel Hill	*/
	/*	@(#)getdate.y	2.13	9/16/86			*/

#if !defined(lint)
static char rcsid[] = "$Id: getdate.y,v 1.3 2014/07/31 21:58:09 vandys Exp $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>

Changes to makedep.

1
2
3
4
5
6
7
8
9
10
#!/usr/local/bin/perl --
#
# rcsid: $Id: makedep,v 1.1 1994/01/12 19:36:03 rick Exp $
#
#*********************************************************************#
#                                                                      
#  PERL SCRIPT:  makedep
#  AUTHOR:       Rick Ohnemus
#  ABSTRACT:
#


|







1
2
3
4
5
6
7
8
9
10
#!/usr/local/bin/perl --
#
# rcsid: $Id: makedep,v 1.1 2008/12/27 00:56:28 vandys Exp $
#
#*********************************************************************#
#                                                                      
#  PERL SCRIPT:  makedep
#  AUTHOR:       Rick Ohnemus
#  ABSTRACT:
#

Changes to resname.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 * separated list of directories to search and a file name.
 * The resolved name is returned in allocated memory.
 *
 * Global Functions: resolve_name
 */

#if !defined(lint)
static char rcsid[] = "$Id: resname.c,v 1.2 1994/01/25 22:29:11 rick Exp $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>








|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 * separated list of directories to search and a file name.
 * The resolved name is returned in allocated memory.
 *
 * Global Functions: resolve_name
 */

#if !defined(lint)
static char rcsid[] = "$Id: resname.c,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>

Changes to rh.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
 * rh.h
 *
 * Written by:	Ken Stauffer
 *		Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: rh.h,v 1.1 1994/01/12 19:37:16 rick Exp $
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
 * rh.h
 *
 * Written by:	Ken Stauffer
 *		Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: rh.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>

Changes to rhcmds.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * These functions are simple, and behave like RPN operators, that is
 * they use the last two values on the stack, apply an operator
 * and push the result. Similarly for unary ops.
 *
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhcmds.c,v 1.2 2010/04/22 03:03:16 vandys Exp vandys $";
#endif

#include "rh.h"
#include "rhdata.h"
#include "sysinfo.h"

void c_or(instr_value *v)







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * These functions are simple, and behave like RPN operators, that is
 * they use the last two values on the stack, apply an operator
 * and push the result. Similarly for unary ops.
 *
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhcmds.c,v 1.3 2011/12/31 02:41:07 vandys Exp $";
#endif

#include "rh.h"
#include "rhdata.h"
#include "sysinfo.h"

void c_or(instr_value *v)

Changes to rhcmds.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * rhcmds.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: rhcmds.h,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $
 */

#if !defined(__RHCMDS_H__)
#define __RHCMDS_H__

extern void c_and(instr_value *);
extern void c_atime(instr_value *);





|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * rhcmds.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: rhcmds.h,v 1.2 2010/04/22 03:03:16 vandys Exp $
 */

#if !defined(__RHCMDS_H__)
#define __RHCMDS_H__

extern void c_and(instr_value *);
extern void c_atime(instr_value *);

Changes to rhdata.c.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 * Written by:	Ken Stauffer
 *		Rick Ohnemus	(rick@sterling.com)
 *
 * Global Functions: rhfinish, rhinit
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhdata.c,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhgram.h"

#if !defined(S_IREAD)







|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 * Written by:	Ken Stauffer
 *		Rick Ohnemus	(rick@sterling.com)
 *
 * Global Functions: rhfinish, rhinit
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhdata.c,v 1.2 2010/04/22 03:03:16 vandys Exp $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhgram.h"

#if !defined(S_IREAD)

Changes to rhdata.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * rhdata.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: rhdata.h,v 1.1 1994/01/12 19:38:51 rick Exp $
 */

#if !defined(__RHDATA_H__)
#define __RHDATA_H__

extern int	Issue_warnings;






|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * rhdata.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: rhdata.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#if !defined(__RHDATA_H__)
#define __RHDATA_H__

extern int	Issue_warnings;

Changes to rhgram.c.

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * rhgram.y
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhgram.y,v 1.3 1994/01/26 16:17:54 rick Exp $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"
#include "alloc.h"
#include "errmsg.h"







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * rhgram.y
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhgram.c,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"
#include "alloc.h"
#include "errmsg.h"

Changes to rhgram.y.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * rhgram.y
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhgram.y,v 1.3 1994/01/26 16:17:54 rick Exp $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"
#include "alloc.h"
#include "errmsg.h"







|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * rhgram.y
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhgram.y,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"
#include "alloc.h"
#include "errmsg.h"

Changes to rhrc.1.

1
2
3
4
5
6
7
8
// rcsid: $Id: rhrc.1,v 1.1 1994/01/12 19:39:50 rick Exp $

dir() {
	return( (mode & IFMT) == IFDIR );
}

plain()
{
|







1
2
3
4
5
6
7
8
// rcsid: $Id: rhrc.1,v 1.1 2008/12/27 00:56:28 vandys Exp $

dir() {
	return( (mode & IFMT) == IFDIR );
}

plain()
{

Changes to rhrc.2.

1
2
3
4
5
6
7
8
// rcsid: $Id: rhrc.2,v 1.1 1994/01/12 19:39:55 rick Exp $

megs { return KK<<10; }

recursion(n)
{
	return (n>0) ? recursion(n-1) : 0;
}
|







1
2
3
4
5
6
7
8
// rcsid: $Id: rhrc.2,v 1.1 2008/12/27 00:56:28 vandys Exp $

megs { return KK<<10; }

recursion(n)
{
	return (n>0) ? recursion(n-1) : 0;
}

Changes to strtol.c.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

#if !defined(lint)
static char rcsid[] = "$Header: /home/vandys/src/sim/N810/ports/rh-3.0-beta/RCS/strtol.c,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $ SPRITE (Berkeley)";
#endif /* not lint */

#include <ctype.h>

 
/*
 *----------------------------------------------------------------------







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

#if !defined(lint)
static char rcsid[] = "$Header: /home/vandys/src/utils/rh-3.0-beta/RCS/strtol.c,v 1.2 2011/12/31 02:41:07 vandys Exp $ SPRITE (Berkeley)";
#endif /* not lint */

#include <ctype.h>

 
/*
 *----------------------------------------------------------------------

Changes to strtoul.c.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

#if !defined(lint)
static char rcsid[] = "$Header: /home/vandys/src/sim/N810/ports/rh-3.0-beta/RCS/strtoul.c,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $ SPRITE (Berkeley)";
#endif /* not lint */

#include <ctype.h>

/*
 * The table below is used to convert from ASCII digits to a
 * numerical equivalent.  It maps from '0' through 'z' to integers







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

#if !defined(lint)
static char rcsid[] = "$Header: /home/vandys/src/utils/rh-3.0-beta/RCS/strtoul.c,v 1.2 2011/12/31 02:41:07 vandys Exp $ SPRITE (Berkeley)";
#endif /* not lint */

#include <ctype.h>

/*
 * The table below is used to convert from ASCII digits to a
 * numerical equivalent.  It maps from '0' through 'z' to integers

Changes to sysinfo.c.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * Global Functions: getfidev, getgigid, getginam, getuinam,
 *		     getuiuid, mounted_fstype
 *
 * Static Functions: init_file_systems,
 */

#if !defined(lint)
static char rcsid[] = "$Id: sysinfo.c,v 1.1 1994/01/12 19:40:33 rick Exp $";
#endif

#include <sys/types.h>
#include <string.h>
#include <grp.h>
#include <pwd.h>
#if defined(sun)







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * Global Functions: getfidev, getgigid, getginam, getuinam,
 *		     getuiuid, mounted_fstype
 *
 * Static Functions: init_file_systems,
 */

#if !defined(lint)
static char rcsid[] = "$Id: sysinfo.c,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include <sys/types.h>
#include <string.h>
#include <grp.h>
#include <pwd.h>
#if defined(sun)

Changes to sysinfo.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * sysinfo.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: sysinfo.h,v 1.1 1994/01/12 19:40:52 rick Exp $
 */

#if !defined(__SYSINFO_H__)
#define __SYSINFO_H__

typedef struct _group_info group_info;






|







1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * sysinfo.h
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 *
 * rcsid: $Id: sysinfo.h,v 1.1 2008/12/27 00:56:03 vandys Exp $
 */

#if !defined(__SYSINFO_H__)
#define __SYSINFO_H__

typedef struct _group_info group_info;

Changes to tests.dat.

1
2
3
4
5
6
7
8
// rcsid: $Id: tests.dat,v 1.1 1994/01/12 19:41:22 rick Exp $

a(b,c) { return 6; }

d() { return a(1 + 2, 3 * 4); }

e() { return "xyz" }

|







1
2
3
4
5
6
7
8
// rcsid: $Id: tests.dat,v 1.1 2008/12/27 00:56:28 vandys Exp $

a(b,c) { return 6; }

d() { return a(1 + 2, 3 * 4); }

e() { return "xyz" }

Changes to wildmat.c.

1
2
3
4
5
6
7
8
9
10
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
** wildmat.c
**  $Revision: 1.1 $
**
**  Do shell-style pattern matching for ?, \, [], and * characters.
**  Might not be robust in face of malformed patterns; e.g., "foo[a-"
**  could cause a segmentation violation.  It is 8bit clean.
**
**  Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
**  Rich $alz is now <rsalz@osf.org>.
................................................................................
**  loss of clarity (and the ABORT stuff seems to be unclear enough by
**  itself).  I think it would be unwise to try to get this into a
**  released version unless you have a good test data base to try it out
**  on.
*/

#if !defined(lint)
static char rcsid[] = "$Id: wildmat.c,v 1.1 2008/12/27 00:56:03 vandys Exp vandys $";
#endif

#define TRUE			1
#define FALSE			0
#define ABORT			-1




|







 







|







1
2
3
4
5
6
7
8
9
10
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
** wildmat.c
**  $Revision: 1.2 $
**
**  Do shell-style pattern matching for ?, \, [], and * characters.
**  Might not be robust in face of malformed patterns; e.g., "foo[a-"
**  could cause a segmentation violation.  It is 8bit clean.
**
**  Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
**  Rich $alz is now <rsalz@osf.org>.
................................................................................
**  loss of clarity (and the ABORT stuff seems to be unclear enough by
**  itself).  I think it would be unwise to try to get this into a
**  released version unless you have a good test data base to try it out
**  on.
*/

#if !defined(lint)
static char rcsid[] = "$Id: wildmat.c,v 1.2 2011/12/31 02:41:07 vandys Exp $";
#endif

#define TRUE			1
#define FALSE			0
#define ABORT			-1


Added y.tab.c.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
#ifndef lint
static const char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
#endif

#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYPATCH 20120115

#define YYEMPTY        (-1)
#define yyclearin      (yychar = YYEMPTY)
#define yyerrok        (yyerrflag = 0)
#define YYRECOVERING() (yyerrflag != 0)


#ifndef yyparse
#define yyparse    rh_parse
#endif /* yyparse */

#ifndef yylex
#define yylex      rh_lex
#endif /* yylex */

#ifndef yyerror
#define yyerror    rh_error
#endif /* yyerror */

#ifndef yychar
#define yychar     rh_char
#endif /* yychar */

#ifndef yyval
#define yyval      rh_val
#endif /* yyval */

#ifndef yylval
#define yylval     rh_lval
#endif /* yylval */

#ifndef yydebug
#define yydebug    rh_debug
#endif /* yydebug */

#ifndef yynerrs
#define yynerrs    rh_nerrs
#endif /* yynerrs */

#ifndef yyerrflag
#define yyerrflag  rh_errflag
#endif /* yyerrflag */

#ifndef yylhs
#define yylhs      rh_lhs
#endif /* yylhs */

#ifndef yylen
#define yylen      rh_len
#endif /* yylen */

#ifndef yydefred
#define yydefred   rh_defred
#endif /* yydefred */

#ifndef yydgoto
#define yydgoto    rh_dgoto
#endif /* yydgoto */

#ifndef yysindex
#define yysindex   rh_sindex
#endif /* yysindex */

#ifndef yyrindex
#define yyrindex   rh_rindex
#endif /* yyrindex */

#ifndef yygindex
#define yygindex   rh_gindex
#endif /* yygindex */

#ifndef yytable
#define yytable    rh_table
#endif /* yytable */

#ifndef yycheck
#define yycheck    rh_check
#endif /* yycheck */

#ifndef yyname
#define yyname     rh_name
#endif /* yyname */

#ifndef yyrule
#define yyrule     rh_rule
#endif /* yyrule */
#define YYPREFIX "rh_"

#define YYPURE 0

#line 2 "rhgram.y"

/*
 * rhgram.y
 *
 * Written by:	Rick Ohnemus	(rick@sterling.com)
 */

#if !defined(lint)
static char rcsid[] = "$Id: rhgram.y,v 1.1 2008/12/27 00:56:03 vandys Exp $";
#endif

#include "rh.h"
#include "rhcmds.h"
#include "rhdata.h"
#include "alloc.h"
#include "errmsg.h"

extern char *	Line;		/* line being parsed */
extern int	Line_num;	/* line number */
extern int	Line_pos;	/* position in line */

static node *	copy_tree(node *);	/* copy a tree */
extern void	free_tree(node *);	/* free expression tree memory */ 
static node *	make_node(void (*)(), instr_value *);	/* make a tree node */
static int	pattern(const char *);	/* is string a shell fn pattern? */
extern void	rh_error(const char *);	/* output an error message and exit */
extern int	rh_lex(void);		/* lexer */
extern void	rh_lex_finish(void);	/* lexer clean-up */

static instr_value	value;

#line 35 "rhgram.y"
#ifdef YYSTYPE
#undef  YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
#endif
#ifndef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
typedef union {
    char *              str;
    symbol *		sym;
    node *		tree;
    long                value;
    void	      (*func)(instr_value *);
    date_info *		di;
    struct {
	char *	line;
	int	line_num;
	int	line_pos;
    } line_info;
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
#line 152 "y.tab.c"

/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
# ifdef YYPARSE_PARAM_TYPE
#  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
# else
#  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
# endif
#else
# define YYPARSE_DECL() yyparse(void)
#endif

/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
# define YYLEX yylex(YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(void)
# define YYLEX yylex()
#endif

/* Parameters sent to yyerror. */
#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(const char *s)
#endif
#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(msg)
#endif

extern int YYPARSE_DECL();

#define BLTIN 257
#define DATESPEC 258
#define EQ 259
#define FIELD 260
#define FILENAME_PATTERN 261
#define FILETIME_FIELD 262
#define FSTYPE 263
#define FUNCTION 264
#define GE 265
#define IDENTIFIER 266
#define LE 267
#define LOGAND 268
#define LOGOR 269
#define LSHIFT 270
#define NE 271
#define NUMBER 272
#define PARAM 273
#define RETURN 274
#define RSHIFT 275
#define SYSTEM_CALL 276
#define TIME_FIELD 277
#define UNIMINUS 278
#define YYERRCODE 256
static const short rh_lhs[] = {                          -1,
    0,    0,    0,    7,    7,    9,    8,   10,   11,    8,
    8,    5,    5,    5,    5,    4,    4,   12,   12,    1,
    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    1,    1,   13,    3,   14,    3,    3,    3,    3,    3,
    3,    3,    3,    3,    3,    3,    3,    6,    6,    2,
    2,    2,
};
static const short rh_len[] = {                           2,
    1,    2,    3,    0,    2,    0,    3,    0,    0,    7,
    1,    0,    1,    3,    1,    5,    4,    0,    1,    1,
    5,    3,    3,    3,    3,    3,    3,    3,    3,    3,
    3,    3,    3,    3,    3,    3,    3,    3,    3,    2,
    2,    2,    0,    3,    0,    3,    3,    1,    1,    1,
    1,    1,    1,    1,    1,    1,    1,    0,    3,    0,
    1,    3,
};
static const short rh_defred[] = {                        4,
    0,    0,   11,   51,   55,   52,   49,   56,   50,   43,
    0,   48,   53,   45,   57,    0,    0,    0,    0,    0,
   20,    5,    0,    0,    0,    0,   54,   42,   41,   40,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    3,    0,   44,    0,    7,    0,   46,   47,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   37,   38,   39,    0,    0,   19,
    0,   15,   13,    0,    0,   59,    0,    0,    9,    0,
    0,    0,    0,   17,    0,   14,   16,   10,
};
static const short rh_dgoto[] = {                         1,
   20,   79,   21,   55,   84,   53,    2,   22,   24,   25,
   95,   81,   23,   26,
};
static const short rh_sindex[] = {                        0,
    0,  -21,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  312,  312,  312,  312,  648,
    0,    0,  -38, -116,  -29,  -38,    0,    0,    0,    0,
  677,  312,  312,  312,  312,  312,  312,  312,  312,  312,
  312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
    0,  312,    0, -258,    0, -253,    0,    0,  803,  -22,
  -22,  761,  747,  -37,  803,  -37,  706,  602,  775,  789,
  -22,  -22,  -33,  -33,    0,    0,    0,  720,  -15,    0,
  312,    0,    0,  -14,  312,    0,  312,  458,    0, -249,
  720,  720, -107,    0, -116,    0,    0,    0,
};
static const short rh_rindex[] = {                        0,
    0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
   28,    0,    0,    0,    0,    0,    0,    0,    0,   47,
    0,    0,    1,    0,    0,    1,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,  -10,    0,  355,    0,   -9,    0,    0,  383,  138,
  164,  261,  148,   96,  399,  109,    0,  420,  408,  410,
  291,  331,   41,   69,    0,    0,    0,   -8,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  360,   -4,    0,    0,    0,    0,    0,    0,
};
static const short rh_gindex[] = {                        0,
 1058,    0,    0,  -46,    0,   24,    0,    0,    0,    0,
    0,    0,    0,    0,
};
#define YYTABLESIZE 1145
static const short rh_table[] = {                        50,
   58,   52,   82,   50,   48,   46,   54,   47,   48,   49,
   56,   17,   83,   49,   50,   80,   96,   97,   19,   48,
   46,    1,   47,   16,   49,   86,   89,   54,   87,   90,
   60,   12,   61,   60,   12,   61,   62,   58,   58,   62,
   35,   58,   58,   58,   58,   58,    2,   58,   98,   57,
    0,    0,    0,    0,    0,    0,    0,    0,   58,   58,
   58,    0,   58,   58,   54,   54,    0,    8,   36,   54,
   54,    0,   54,    0,   54,    0,    0,    0,   35,    0,
    0,   35,    0,   35,   35,   35,   54,   54,    0,   54,
   54,    0,    0,    0,   58,   34,    0,    0,   35,   35,
   35,    0,   35,   35,   18,    0,   36,    0,   33,   36,
    0,   36,   36,   36,    0,    0,    0,    0,    0,    0,
    0,   54,    0,    0,   58,   58,   36,   36,   36,    0,
   36,   36,    0,   34,   35,    0,   34,   32,    0,   34,
    0,    0,    0,    0,    0,    0,   33,   22,    0,   33,
    6,   54,   33,   34,   34,   34,    0,   34,   34,    0,
    0,    0,   36,   31,   35,   35,   33,   33,   33,    0,
   33,   33,    0,    0,    0,   32,    0,    0,   32,    0,
    0,   32,    0,    0,    0,    0,    0,    0,   22,   34,
    0,   22,   36,   36,    0,   32,   32,   32,    0,   32,
   32,   31,   33,    0,   31,   22,   22,   31,    0,    0,
   22,    0,    0,    0,    0,    0,    0,    0,    0,   34,
   34,   31,   31,   31,    0,   31,   31,    0,    0,    0,
    0,   32,   33,   33,    3,    4,    5,    0,    6,    7,
    8,    9,   10,    0,   11,    0,    0,   37,    0,    0,
   12,   13,   39,    0,   14,   15,    0,   31,    0,   58,
   23,   32,   32,    0,    0,   58,    0,   58,   58,   58,
   58,   58,   22,    0,    0,   58,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,   54,   31,   31,    0,
   29,    0,   54,    0,   54,   54,   54,   54,   54,   35,
    0,   23,   54,    0,   23,   35,    0,   35,   35,   35,
   35,   35,    0,    0,    0,   35,    0,    0,   23,   23,
    0,    0,    0,   23,    0,    0,    0,   36,   29,    0,
   30,   29,    0,   36,   29,   36,   36,   36,   36,   36,
    0,    0,    0,   36,   17,    0,    0,    0,   29,   29,
   29,   19,   29,   29,   34,    0,   16,    0,    0,   21,
   34,    0,   34,   34,   34,   34,   34,   33,   30,    0,
   34,   30,    0,   33,   30,   33,   33,   33,   33,   33,
    0,    0,   27,   33,   29,   23,    0,   18,   30,   30,
   30,    0,   30,   30,   18,    0,   32,    0,   28,   18,
   21,    0,   32,   21,   32,   32,   32,   25,   32,   26,
    0,    0,    0,    0,   29,   29,   22,   21,   21,   24,
   27,    0,   31,   27,   30,    0,   27,    0,   31,    0,
   31,   31,   31,    0,   31,    0,   28,   18,    0,   28,
   27,   27,   28,    0,    0,   27,    0,   26,   25,    0,
   26,   25,    0,   26,   30,   30,   28,   28,    0,    0,
   24,   28,    0,   24,    0,   25,   25,   26,   26,    0,
   25,    0,   26,    0,    0,    0,   27,   24,   24,    0,
   18,    0,   24,    0,   21,    0,    0,    0,    0,    0,
    0,    0,   28,    0,   50,   43,    0,    0,    0,   48,
   46,   25,   47,   26,   49,    0,   27,   27,    0,    0,
    0,    0,    0,    0,    0,    0,   93,   44,    0,   45,
   40,    0,   28,   28,    0,    0,    0,    0,   23,   23,
    0,   25,   25,   26,   26,    0,    0,    0,    0,    0,
    0,    0,    0,   24,   24,    0,    0,    0,    0,   29,
    0,   42,    0,    0,    0,   29,    0,   29,   29,   29,
    0,   29,    0,    0,    0,    0,    0,    0,    4,    5,
    0,    6,    7,    8,    9,   10,    0,   27,    0,    0,
    0,   41,   94,   12,   13,    0,    0,   14,   15,   30,
    0,    0,    0,    0,    0,   30,    0,   30,   30,   30,
    0,   30,    0,    0,    0,    0,    0,    0,    0,    0,
    0,   18,   18,    0,   18,   18,   18,   18,   18,    0,
   18,    0,    0,    0,    0,    0,   18,   18,    0,    0,
   18,   18,    0,    0,    0,    0,    0,    0,   50,   43,
    0,   27,    0,   48,   46,    0,   47,    0,   49,    0,
   27,   27,    0,   27,    0,    0,    0,   28,    0,    0,
    0,   44,    0,   45,    0,    0,   28,   28,    0,   28,
    0,    0,    0,    0,    0,   25,   25,   26,   26,    0,
    0,    0,    0,    0,   50,   43,    0,   24,   24,   48,
   46,    0,   47,    0,   49,   42,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,   51,   44,    0,   45,
   40,    0,    0,   50,   43,    0,   32,   58,   48,   46,
    0,   47,   33,   49,   34,   35,   36,   37,   38,    0,
    0,    0,   39,    0,    0,    0,   44,    0,   45,   40,
    0,   42,   50,   43,    0,    0,    0,   48,   46,    0,
   47,    0,   49,    0,    0,    0,   50,   43,    0,    0,
    0,   48,   46,   85,   47,   44,   49,   45,   40,    0,
   42,   41,    0,    0,    0,    0,    0,    0,    0,   44,
    0,   45,   40,   50,   43,    0,    0,    0,   48,   46,
    0,   47,    0,   49,    0,    0,    0,   50,   43,   42,
   41,    0,   48,   46,    0,   47,   44,   49,   45,    0,
    0,   50,   43,   42,    0,    0,   48,   46,    0,   47,
   44,   49,   45,    0,    0,   50,    0,    0,    0,   41,
   48,   46,    0,   47,   44,   49,   45,    0,    0,   50,
   42,    0,    0,   41,   48,   46,    0,   47,   44,   49,
   45,    0,    0,    0,   42,    0,    0,    0,    0,    0,
   32,    0,   44,    0,   45,    0,   33,    0,   34,    0,
   41,   37,   38,    0,    0,    0,   39,    0,    0,    0,
    0,    0,    0,    0,   41,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,   32,    0,    0,    0,
    0,    0,   33,    0,   34,   35,   36,   37,   38,    0,
    0,    0,   39,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   32,    0,    0,    0,    0,
    0,   33,    0,   34,   35,   36,   37,   38,    0,    0,
    0,   39,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   32,    0,    0,    0,    0,    0,
   33,    0,   34,   35,   36,   37,   38,    0,   32,    0,
   39,    0,    0,    0,   33,    0,   34,   35,   36,   37,
   38,    0,    0,    0,   39,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   32,    0,    0,    0,    0,
    0,   33,    0,   34,   35,    0,   37,   38,    0,   32,
    0,   39,    0,    0,    0,   33,    0,   34,    0,    0,
   37,   38,    0,   32,    0,   39,    0,    0,    0,   33,
    0,   34,    0,    0,   37,   38,    0,   32,    0,   39,
    0,    0,    0,   33,    0,   34,    0,    0,   37,   38,
    0,    0,    0,   39,    0,    0,    0,   33,    0,   34,
    0,    0,   37,   28,   29,   30,   31,   39,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,   59,
   60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
   70,   71,   72,   73,   74,   75,   76,   77,    0,   78,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   88,    0,
    0,    0,   91,    0,   92,
};
static const short rh_check[] = {                        37,
    0,   40,  256,   37,   42,   43,  123,   45,   42,   47,
   40,   33,  266,   47,   37,  274,  266,  125,   40,   42,
   43,    0,   45,   45,   47,   41,   41,    0,   44,   44,
   41,   41,   41,   44,   44,   44,   41,   37,   38,   44,
    0,   41,   42,   43,   44,   45,    0,   47,   95,   26,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   59,
   60,   -1,   62,   63,   37,   38,   -1,   40,    0,   42,
   43,   -1,   45,   -1,   47,   -1,   -1,   -1,   38,   -1,
   -1,   41,   -1,   43,   44,   45,   59,   60,   -1,   62,
   63,   -1,   -1,   -1,   94,    0,   -1,   -1,   58,   59,
   60,   -1,   62,   63,  126,   -1,   38,   -1,    0,   41,
   -1,   43,   44,   45,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   94,   -1,   -1,  124,  125,   58,   59,   60,   -1,
   62,   63,   -1,   38,   94,   -1,   41,    0,   -1,   44,
   -1,   -1,   -1,   -1,   -1,   -1,   38,    0,   -1,   41,
  123,  124,   44,   58,   59,   60,   -1,   62,   63,   -1,
   -1,   -1,   94,    0,  124,  125,   58,   59,   60,   -1,
   62,   63,   -1,   -1,   -1,   38,   -1,   -1,   41,   -1,
   -1,   44,   -1,   -1,   -1,   -1,   -1,   -1,   41,   94,
   -1,   44,  124,  125,   -1,   58,   59,   60,   -1,   62,
   63,   38,   94,   -1,   41,   58,   59,   44,   -1,   -1,
   63,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  124,
  125,   58,   59,   60,   -1,   62,   63,   -1,   -1,   -1,
   -1,   94,  124,  125,  256,  257,  258,   -1,  260,  261,
  262,  263,  264,   -1,  266,   -1,   -1,  270,   -1,   -1,
  272,  273,  275,   -1,  276,  277,   -1,   94,   -1,  259,
    0,  124,  125,   -1,   -1,  265,   -1,  267,  268,  269,
  270,  271,  125,   -1,   -1,  275,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,  259,  124,  125,   -1,
    0,   -1,  265,   -1,  267,  268,  269,  270,  271,  259,
   -1,   41,  275,   -1,   44,  265,   -1,  267,  268,  269,
  270,  271,   -1,   -1,   -1,  275,   -1,   -1,   58,   59,
   -1,   -1,   -1,   63,   -1,   -1,   -1,  259,   38,   -1,
    0,   41,   -1,  265,   44,  267,  268,  269,  270,  271,
   -1,   -1,   -1,  275,   33,   -1,   -1,   -1,   58,   59,
   60,   40,   62,   63,  259,   -1,   45,   -1,   -1,    0,
  265,   -1,  267,  268,  269,  270,  271,  259,   38,   -1,
  275,   41,   -1,  265,   44,  267,  268,  269,  270,  271,
   -1,   -1,    0,  275,   94,  125,   -1,   33,   58,   59,
   60,   -1,   62,   63,   40,   -1,  259,   -1,    0,   45,
   41,   -1,  265,   44,  267,  268,  269,    0,  271,    0,
   -1,   -1,   -1,   -1,  124,  125,  269,   58,   59,    0,
   38,   -1,  259,   41,   94,   -1,   44,   -1,  265,   -1,
  267,  268,  269,   -1,  271,   -1,   38,  126,   -1,   41,
   58,   59,   44,   -1,   -1,   63,   -1,   38,   41,   -1,
   41,   44,   -1,   44,  124,  125,   58,   59,   -1,   -1,
   41,   63,   -1,   44,   -1,   58,   59,   58,   59,   -1,
   63,   -1,   63,   -1,   -1,   -1,   94,   58,   59,   -1,
  126,   -1,   63,   -1,  125,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   94,   -1,   37,   38,   -1,   -1,   -1,   42,
   43,   94,   45,   94,   47,   -1,  124,  125,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   59,   60,   -1,   62,
   63,   -1,  124,  125,   -1,   -1,   -1,   -1,  268,  269,
   -1,  124,  125,  124,  125,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,  124,  125,   -1,   -1,   -1,   -1,  259,
   -1,   94,   -1,   -1,   -1,  265,   -1,  267,  268,  269,
   -1,  271,   -1,   -1,   -1,   -1,   -1,   -1,  257,  258,
   -1,  260,  261,  262,  263,  264,   -1,  266,   -1,   -1,
   -1,  124,  125,  272,  273,   -1,   -1,  276,  277,  259,
   -1,   -1,   -1,   -1,   -1,  265,   -1,  267,  268,  269,
   -1,  271,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,  257,  258,   -1,  260,  261,  262,  263,  264,   -1,
  266,   -1,   -1,   -1,   -1,   -1,  272,  273,   -1,   -1,
  276,  277,   -1,   -1,   -1,   -1,   -1,   -1,   37,   38,
   -1,  259,   -1,   42,   43,   -1,   45,   -1,   47,   -1,
  268,  269,   -1,  271,   -1,   -1,   -1,  259,   -1,   -1,
   -1,   60,   -1,   62,   -1,   -1,  268,  269,   -1,  271,
   -1,   -1,   -1,   -1,   -1,  268,  269,  268,  269,   -1,
   -1,   -1,   -1,   -1,   37,   38,   -1,  268,  269,   42,
   43,   -1,   45,   -1,   47,   94,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   59,   60,   -1,   62,
   63,   -1,   -1,   37,   38,   -1,  259,   41,   42,   43,
   -1,   45,  265,   47,  267,  268,  269,  270,  271,   -1,
   -1,   -1,  275,   -1,   -1,   -1,   60,   -1,   62,   63,
   -1,   94,   37,   38,   -1,   -1,   -1,   42,   43,   -1,
   45,   -1,   47,   -1,   -1,   -1,   37,   38,   -1,   -1,
   -1,   42,   43,   58,   45,   60,   47,   62,   63,   -1,
   94,  124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   60,
   -1,   62,   63,   37,   38,   -1,   -1,   -1,   42,   43,
   -1,   45,   -1,   47,   -1,   -1,   -1,   37,   38,   94,
  124,   -1,   42,   43,   -1,   45,   60,   47,   62,   -1,
   -1,   37,   38,   94,   -1,   -1,   42,   43,   -1,   45,
   60,   47,   62,   -1,   -1,   37,   -1,   -1,   -1,  124,
   42,   43,   -1,   45,   60,   47,   62,   -1,   -1,   37,
   94,   -1,   -1,  124,   42,   43,   -1,   45,   60,   47,
   62,   -1,   -1,   -1,   94,   -1,   -1,   -1,   -1,   -1,
  259,   -1,   60,   -1,   62,   -1,  265,   -1,  267,   -1,
  124,  270,  271,   -1,   -1,   -1,  275,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,  259,   -1,   -1,   -1,
   -1,   -1,  265,   -1,  267,  268,  269,  270,  271,   -1,
   -1,   -1,  275,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  259,   -1,   -1,   -1,   -1,
   -1,  265,   -1,  267,  268,  269,  270,  271,   -1,   -1,
   -1,  275,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,  259,   -1,   -1,   -1,   -1,   -1,
  265,   -1,  267,  268,  269,  270,  271,   -1,  259,   -1,
  275,   -1,   -1,   -1,  265,   -1,  267,  268,  269,  270,
  271,   -1,   -1,   -1,  275,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  259,   -1,   -1,   -1,   -1,
   -1,  265,   -1,  267,  268,   -1,  270,  271,   -1,  259,
   -1,  275,   -1,   -1,   -1,  265,   -1,  267,   -1,   -1,
  270,  271,   -1,  259,   -1,  275,   -1,   -1,   -1,  265,
   -1,  267,   -1,   -1,  270,  271,   -1,  259,   -1,  275,
   -1,   -1,   -1,  265,   -1,  267,   -1,   -1,  270,  271,
   -1,   -1,   -1,  275,   -1,   -1,   -1,  265,   -1,  267,
   -1,   -1,  270,   16,   17,   18,   19,  275,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   32,
   33,   34,   35,   36,   37,   38,   39,   40,   41,   42,
   43,   44,   45,   46,   47,   48,   49,   50,   -1,   52,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   81,   -1,
   -1,   -1,   85,   -1,   87,
};
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 278
#if YYDEBUG
static const char *yyname[] = {

"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,
0,0,0,0,0,"':'","';'","'<'",0,"'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,"'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,"'{'","'|'","'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"BLTIN","DATESPEC","EQ","FIELD",
"FILENAME_PATTERN","FILETIME_FIELD","FSTYPE","FUNCTION","GE","IDENTIFIER","LE",
"LOGAND","LOGOR","LSHIFT","NE","NUMBER","PARAM","RETURN","RSHIFT","SYSTEM_CALL",
"TIME_FIELD","UNIMINUS",
};
static const char *yyrule[] = {
"$accept : program",
"program : functions",
"program : functions expression",
"program : functions expression ';'",
"functions :",
"functions : functions function",
"$$1 :",
"function : IDENTIFIER $$1 function_body",
"$$2 :",
"$$3 :",
"function : IDENTIFIER $$2 '(' idlist ')' $$3 function_body",
"function : error",
"idlist :",
"idlist : IDENTIFIER",
"idlist : idlist ',' IDENTIFIER",
"idlist : error",
"function_body : '{' return expression ';' '}'",
"function_body : '{' return expression '}'",
"return :",
"return : RETURN",
"expression : factor",
"expression : expression '?' expression ':' expression",
"expression : expression LOGOR expression",
"expression : expression LOGAND expression",
"expression : expression '|' expression",
"expression : expression '^' expression",
"expression : expression '&' expression",
"expression : expression EQ expression",
"expression : expression NE expression",
"expression : expression '<' expression",
"expression : expression '>' expression",
"expression : expression LE expression",
"expression : expression GE expression",
"expression : expression RSHIFT expression",
"expression : expression LSHIFT expression",
"expression : expression '+' expression",
"expression : expression '-' expression",
"expression : expression '*' expression",
"expression : expression '/' expression",
"expression : expression '%' expression",
"expression : '~' expression",
"expression : '!' expression",
"expression : '-' expression",
"$$4 :",
"factor : FUNCTION $$4 paramlist",
"$$5 :",
"factor : SYSTEM_CALL $$5 paramlist",
"factor : '(' expression ')'",
"factor : NUMBER",
"factor : FILENAME_PATTERN",
"factor : FSTYPE",
"factor : BLTIN",
"factor : FIELD",
"factor : PARAM",
"factor : IDENTIFIER",
"factor : DATESPEC",
"factor : FILETIME_FIELD",
"factor : TIME_FIELD",
"paramlist :",
"paramlist : '(' exprlist ')'",
"exprlist :",
"exprlist : expression",
"exprlist : exprlist ',' expression",

};
#endif

int      yydebug;
int      yynerrs;

int      yyerrflag;
int      yychar;
YYSTYPE  yyval;
YYSTYPE  yylval;

/* define the initial stack-sizes */
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH  YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 500
#define YYMAXDEPTH  500
#endif
#endif

#define YYINITSTACKSIZE 500

typedef struct {
    unsigned stacksize;
    short    *s_base;
    short    *s_mark;
    short    *s_last;
    YYSTYPE  *l_base;
    YYSTYPE  *l_mark;
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
#line 726 "rhgram.y"
 
void rh_error(const char *msg)
{
    extern const int		yyleng;
    extern const char * const	yytext;

#if defined(DEBUG2)
    (void) fprintf(stderr, "yyleng = %d, yytext = '%s'\n", yyleng, yytext);
#endif

    if (yyleng) {
	if (Line_num < 0) {
	    (void) fprintf(stderr, "%s: %s: %d: %s\n",
			   Program_name, Input_name, -Line_num, msg);
	}
	else {
	    (void) fprintf(stderr, "%s: %s: %d: %s at '%s'\n",
			   Program_name, Input_name, Line_num, msg, yytext);
	}
	(void) fprintf(stderr, " Line: %s\nError: %*s\n",
		       Line, Line_pos - (yyleng - 1), "^");
    }
    else {
	(void) fprintf(stderr, "%s: %s: %s\n", Program_name, Input_name, msg);
	(void) fprintf(stderr, "%s: unexpected end of file after line %d\n",
		       Program_name, Line_num);
	(void) fprintf(stderr, "Last Line: %s\n", Line);
    }
    exit(1);
    /*NOTREACHED*/
}
 
static node *make_node(void	      (*func)(),
		       instr_value *	value)
{
    node *	new_node;

    new_node = ALLOCATE(sizeof(node));
    new_node->code.func = func;
    new_node->code.value = *value;
    new_node->left = new_node->right = (node *) NULL;
    new_node->middle = (node *) NULL;
    new_node->count = -1;
    new_node->trees = (node **) NULL;

    return new_node;
}
 
node *copy_tree(node *tree)
{
    node *	new_tree;


    if (tree == (node *) NULL) {
	return tree;
    }

    new_tree = ALLOCATE(sizeof(node));

    new_tree->code.func = tree->code.func;
    if (new_tree->code.func == c_date) {
	new_tree->code.value.di = ALLOCATE(sizeof(date_info));
	*(new_tree->code.value.di) = *tree->code.value.di;
    }
    else if (new_tree->code.func == c_pattern
	     || new_tree->code.func == c_fncase
	     || new_tree->code.func == c_fnigncase) {
	new_tree->code.value.pattern = SAVESTR(tree->code.value.pattern);
    }
    else {
	new_tree->code.value = tree->code.value;
    }
    
    new_tree->left = copy_tree(tree->left);
    new_tree->right = copy_tree(tree->right);
    new_tree->middle = copy_tree(tree->middle);
    
    new_tree->count = tree->count;
    if (new_tree->count <= 0) {
	new_tree->trees = (node **) NULL;
    }
    else {
	int	i;
	
	new_tree->trees = ALLOCATE(sizeof(node *) * new_tree->count);
	for (i = 0; i < new_tree->count; i++) {
	    new_tree->trees[i] = copy_tree(tree->trees[i]);
	}
    }
    
    return new_tree;
}
 
void free_tree(node *tree)
{
    if (tree != (node *) NULL) {
	free_tree(tree->left);
	free_tree(tree->right);
	free_tree(tree->middle);
	if (tree->code.func == c_date) {
	    free((char *) tree->code.value.di);
	}
	else if (tree->code.func == c_fstype) {
	    free(tree->code.value.fstype);
	}
	else if (tree->code.func == c_pattern
		 || tree->code.func == c_fncase
		 || tree->code.func == c_fnigncase) {
	    free(tree->code.value.pattern);
	}
	else if (tree->code.func == UNRES_FUNC && tree->count > 0) {
	    int i;
	    
	    for (i = 0; i < tree->count; i++) {
		free_tree(tree->trees[i]);
	    }
	    free((char *) tree->trees);
	}
	free((char *) tree);
    }

    return;
}
 
static int pattern(const char *p)
{
    for (/*void*/ ; *p != '\0' ; ++p) {
	if (*p == '\\') {
	    if (*++p == '\0') {
		break;
	    }
	}
	else if (*p == '?' || *p == '*' || *p == '[') {
	    return 1;
	}
    }
    return 0;
}
#line 765 "y.tab.c"

#if YYDEBUG
#include <stdio.h>		/* needed for printf */
#endif

#include <stdlib.h>	/* needed for malloc, etc */
#include <string.h>	/* needed for memset */

/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack(YYSTACKDATA *data)
{
    int i;
    unsigned newsize;
    short *newss;
    YYSTYPE *newvs;

    if ((newsize = data->stacksize) == 0)
        newsize = YYINITSTACKSIZE;
    else if (newsize >= YYMAXDEPTH)
        return -1;
    else if ((newsize *= 2) > YYMAXDEPTH)
        newsize = YYMAXDEPTH;

    i = data->s_mark - data->s_base;
    newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
    if (newss == 0)
        return -1;

    data->s_base = newss;
    data->s_mark = newss + i;

    newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
    if (newvs == 0)
        return -1;

    data->l_base = newvs;
    data->l_mark = newvs + i;

    data->stacksize = newsize;
    data->s_last = data->s_base + newsize - 1;
    return 0;
}

#if YYPURE || defined(YY_NO_LEAKS)
static void yyfreestack(YYSTACKDATA *data)
{
    free(data->s_base);
    free(data->l_base);
    memset(data, 0, sizeof(*data));
}
#else
#define yyfreestack(data) /* nothing */
#endif

#define YYABORT  goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR  goto yyerrlab

int
YYPARSE_DECL()
{
    int yym, yyn, yystate;
#if YYDEBUG
    const char *yys;

    if ((yys = getenv("YYDEBUG")) != 0)
    {
        yyn = *yys;
        if (yyn >= '0' && yyn <= '9')
            yydebug = yyn - '0';
    }
#endif

    yynerrs = 0;
    yyerrflag = 0;
    yychar = YYEMPTY;
    yystate = 0;

#if YYPURE
    memset(&yystack, 0, sizeof(yystack));
#endif

    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
    yystack.s_mark = yystack.s_base;
    yystack.l_mark = yystack.l_base;
    yystate = 0;
    *yystack.s_mark = 0;

yyloop:
    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
    if (yychar < 0)
    {
        if ((yychar = YYLEX) < 0) yychar = 0;
#if YYDEBUG
        if (yydebug)
        {
            yys = 0;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (!yys) yys = "illegal-symbol";
            printf("%sdebug: state %d, reading %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
    }
    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: state %d, shifting to state %d\n",
                    YYPREFIX, yystate, yytable[yyn]);
#endif
        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
        {
            goto yyoverflow;
        }
        yystate = yytable[yyn];
        *++yystack.s_mark = yytable[yyn];
        *++yystack.l_mark = yylval;
        yychar = YYEMPTY;
        if (yyerrflag > 0)  --yyerrflag;
        goto yyloop;
    }
    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
        yyn = yytable[yyn];
        goto yyreduce;
    }
    if (yyerrflag) goto yyinrecovery;

    yyerror("syntax error");

    goto yyerrlab;

yyerrlab:
    ++yynerrs;

yyinrecovery:
    if (yyerrflag < 3)
    {
        yyerrflag = 3;
        for (;;)
        {
            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: state %d, error recovery shifting\
 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
#endif
                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
                {
                    goto yyoverflow;
                }
                yystate = yytable[yyn];
                *++yystack.s_mark = yytable[yyn];
                *++yystack.l_mark = yylval;
                goto yyloop;
            }
            else
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: error recovery discarding state %d\n",
                            YYPREFIX, *yystack.s_mark);
#endif
                if (yystack.s_mark <= yystack.s_base) goto yyabort;
                --yystack.s_mark;
                --yystack.l_mark;
            }
        }
    }
    else
    {
        if (yychar == 0) goto yyabort;
#if YYDEBUG
        if (yydebug)
        {
            yys = 0;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (!yys) yys = "illegal-symbol";
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
        yychar = YYEMPTY;
        goto yyloop;
    }

yyreduce:
#if YYDEBUG
    if (yydebug)
        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
                YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
    yym = yylen[yyn];
    if (yym)
        yyval = yystack.l_mark[1-yym];
    else
        memset(&yyval, 0, sizeof yyval);
    switch (yyn)
    {
case 1:
#line 96 "rhgram.y"
	{
			    rh_lex_finish();
			}
break;
case 2:
#line 100 "rhgram.y"
	{
			    rh_lex_finish();
			    if (Start_expr == (node *) NULL) {
				Start_expr = yystack.l_mark[0].tree;
			    }
			    else {
				error("too many start expressions specified");
			    }
			}
break;
case 3:
#line 110 "rhgram.y"
	{
			    rh_lex_finish();
			    if (Start_expr == (node *) NULL) {
				Start_expr = yystack.l_mark[-1].tree;
			    }
			    else {
				error("too many start expressions specified");
			    }
			}
break;
case 6:
#line 126 "rhgram.y"
	{
			    yystack.l_mark[0].sym->type = FUNCTION;
			    yystack.l_mark[0].sym->func = c_func;
			    yystack.l_mark[0].sym->value = -1;
			    yystack.l_mark[0].sym->tree = (node *) NULL;
			}
break;
case 7:
#line 133 "rhgram.y"
	{
			    yystack.l_mark[-2].sym->tree = yystack.l_mark[0].tree;
			    yystack.l_mark[-2].sym->num_params = 0;
			}
break;
case 8:
#line 138 "rhgram.y"
	{
			    yystack.l_mark[0].sym->type = FUNCTION;
			    yystack.l_mark[0].sym->func = c_func;
			    yystack.l_mark[0].sym->value = -1;
			    yystack.l_mark[0].sym->tree = (node *) NULL;
			}
break;
case 9:
#line 145 "rhgram.y"
	{
			    yystack.l_mark[-4].sym->num_params = yystack.l_mark[-1].value;
			}
break;
case 10:
#line 149 "rhgram.y"
	{
			    symbol *sym;

			    yystack.l_mark[-6].sym->tree = yystack.l_mark[0].tree;

			    while (Symbol_table->type == PARAM) {
				if (Symbol_table->ref_count == 0
				    && Issue_warnings) {
				    warning("warning: function '%s' parameter '%s' is not referenced",
					    yystack.l_mark[-6].sym->name, Symbol_table->name);
				}
				sym = Symbol_table;
				Symbol_table = Symbol_table->next;
				free(sym->name);
				free((char *) sym);
			    }
			}
break;
case 11:
#line 167 "rhgram.y"
	{
			    rh_error("expected function definition");
			}
break;
case 12:
#line 173 "rhgram.y"
	{
			    yyval.value = 0;
			}
break;
case 13:
#line 177 "rhgram.y"
	{
			    yystack.l_mark[0].sym->type = PARAM;
			    yystack.l_mark[0].sym->func = c_param;
			    yystack.l_mark[0].sym->value = 0;
			    yystack.l_mark[0].sym->ref_count = 0;
			    yyval.value = 1;
			}
break;
case 14:
#line 185 "rhgram.y"
	{
			    yystack.l_mark[0].sym->type = PARAM;
			    yystack.l_mark[0].sym->func = c_param;
			    yystack.l_mark[0].sym->value = yystack.l_mark[-2].value;
			    yystack.l_mark[0].sym->ref_count = 0;
			    yyval.value = yystack.l_mark[-2].value + 1;
			}
break;
case 15:
#line 193 "rhgram.y"
	{
			    rh_error("expected identifier");
			}
break;
case 16:
#line 199 "rhgram.y"
	{ yyval.tree = yystack.l_mark[-2].tree; }
break;
case 17:
#line 201 "rhgram.y"
	{ yyval.tree = yystack.l_mark[-1].tree; }
break;
case 20:
#line 209 "rhgram.y"
	{ yyval.tree = yystack.l_mark[0].tree; }
break;
case 21:
#line 211 "rhgram.y"
	{
			    if (yystack.l_mark[-4].tree->code.func == c_number
				&& yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-4].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-4].tree->code.value.l ? yystack.l_mark[-2].tree->code.value.l : yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[-2].tree);
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(TERTIARY, &value);
				yyval.tree->left = yystack.l_mark[-4].tree;
				yyval.tree->middle = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 22:
#line 230 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l || yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_or, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 23:
#line 246 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l && yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_and, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 24:
#line 262 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l | yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_bor, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 25:
#line 278 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l ^ yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_bxor, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 26:
#line 294 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l & yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_band, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 27:
#line 310 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l == yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_eq, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 28:
#line 326 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l != yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_ne, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 29:
#line 342 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l < yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_lt, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 30:
#line 358 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l > yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_gt, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 31:
#line 374 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l <= yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_le, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 32:
#line 390 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l >= yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_ge, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 33:
#line 406 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l >> yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_rshift, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 34:
#line 422 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l << yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L; 
				yyval.tree = make_node(c_lshift, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 35:
#line 438 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l + yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_plus, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 36:
#line 454 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l - yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_minus, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 37:
#line 470 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l * yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_mul, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 38:
#line 486 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l / yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_div, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 39:
#line 502 "rhgram.y"
	{
			    if (yystack.l_mark[-2].tree->code.func == c_number
				&& yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[-2].tree;
				yyval.tree->code.value.l =
				    yystack.l_mark[-2].tree->code.value.l % yystack.l_mark[0].tree->code.value.l;
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_mod, &value);
				yyval.tree->left = yystack.l_mark[-2].tree;
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 40:
#line 518 "rhgram.y"
	{
			    if (yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[0].tree;
				yyval.tree->code.value.l = ~ yyval.tree->code.value.l;
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_bnot, &value);
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 41:
#line 530 "rhgram.y"
	{
			    if (yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[0].tree;
				yyval.tree->code.value.l = ! yyval.tree->code.value.l;
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_not, &value);
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 42:
#line 542 "rhgram.y"
	{
			    if (yystack.l_mark[0].tree->code.func == c_number) {
				yyval.tree = yystack.l_mark[0].tree;
				yyval.tree->code.value.l = - yyval.tree->code.value.l;
			    }
			    else {
				value.l = 0L;
				yyval.tree = make_node(c_uniminus, &value);
				yyval.tree->right = yystack.l_mark[0].tree;
			    }
			}
break;
case 43:
#line 556 "rhgram.y"
	{
			    yyval.line_info.line = SAVESTR(Line);
			    yyval.line_info.line_num = Line_num;
			    yyval.line_info.line_pos = Line_pos - strlen(yystack.l_mark[0].sym->name);
			}
break;
case 44:
#line 562 "rhgram.y"
	{
			    if (yystack.l_mark[-2].sym->num_params != yystack.l_mark[0].tree->count) {
				free(Line);
				Line = yystack.l_mark[-1].line_info.line;
				Line_num = -(yystack.l_mark[-1].line_info.line_num);
				Line_pos = yystack.l_mark[-1].line_info.line_pos;
				rh_error("function called with wrong number of arguments");
			    }
			    if (yystack.l_mark[-2].sym->tree != (node *) NULL
				&& yystack.l_mark[-2].sym->tree->left == (node *) NULL
				&& yystack.l_mark[-2].sym->tree->right == (node *) NULL) {
				int i;
				
				if (yystack.l_mark[-2].sym->tree->code.func == c_param) {
				    for (i = 0; i < yystack.l_mark[0].tree->count; i++) {
					if (i == yystack.l_mark[-2].sym->tree->code.value.param) {
					    yyval.tree = yystack.l_mark[0].tree->trees[i];
					}
					else {
					    free_tree(yystack.l_mark[0].tree->trees[i]);
					}
				    }
				}
				else {
				    yyval.tree = copy_tree(yystack.l_mark[-2].sym->tree);
				    for (i = 0; i < yystack.l_mark[0].tree->count; i++) {
					free_tree(yystack.l_mark[0].tree->trees[i]);
				    }
				}
				if (yystack.l_mark[0].tree->trees != (node **) NULL) {
				    free((char *) yystack.l_mark[0].tree->trees);
				}
				free((char *) yystack.l_mark[0].tree);
			    }
			    else {
				yyval.tree = yystack.l_mark[0].tree;
				yyval.tree->code.func = UNRES_FUNC;
				yyval.tree->code.value.func_name = yystack.l_mark[-2].sym->name;
			    }
			    free(yystack.l_mark[-1].line_info.line);
			}
break;
case 45:
#line 604 "rhgram.y"
	{
			    yyval.line_info.line = SAVESTR(Line);
			    yyval.line_info.line_num = Line_num;
			    yyval.line_info.line_pos = Line_pos - strlen(yystack.l_mark[0].sym->name);
			}
break;
case 46:
#line 610 "rhgram.y"
	{
			    if (yystack.l_mark[-2].sym->num_params != yystack.l_mark[0].tree->count) {
				free(Line);
				Line = yystack.l_mark[-1].line_info.line;
				Line_num = -(yystack.l_mark[-1].line_info.line_num);
				Line_pos = yystack.l_mark[-1].line_info.line_pos;
				rh_error("function called with wrong number of arguments");
			    }
			    yyval.tree = yystack.l_mark[0].tree;
			    yyval.tree->code.func = c_syscall;
			    yyval.tree->code.value.sym = yystack.l_mark[-2].sym;
			    free(yystack.l_mark[-1].line_info.line);
			}
break;
case 47:
#line 624 "rhgram.y"
	{ yyval.tree = yystack.l_mark[-1].tree; }
break;
case 48:
#line 626 "rhgram.y"
	{
			    value.l = yystack.l_mark[0].value;
			    yyval.tree = make_node(c_number, &value);
			}
break;
case 49:
#line 631 "rhgram.y"
	{
			    if (attr.dot_special && strcmp(yystack.l_mark[0].str, "*") == 0) {
				value.l = 1L;
				yyval.tree = make_node(c_number, &value);
			    }
			    else {
				value.pattern = yystack.l_mark[0].str;
				if (pattern(yystack.l_mark[0].str)) {
				    yyval.tree = make_node(c_pattern, &value);
				}
				else if (attr.ignore_case) {
				    yyval.tree = make_node(c_fnigncase, &value);
				}
				else {
				    yyval.tree = make_node(c_fncase, &value);
				}
			    }
			}
break;
case 50:
#line 650 "rhgram.y"
	{
			    value.fstype = yystack.l_mark[0].str;
			    yyval.tree = make_node(c_fstype, &value);
			}
break;
case 51:
#line 655 "rhgram.y"
	{
			    value.l = yystack.l_mark[0].sym->value;
			    yyval.tree = make_node(yystack.l_mark[0].sym->func, &value);
			}
break;
case 52:
#line 660 "rhgram.y"
	{
			    value.l = yystack.l_mark[0].sym->value;
			    yyval.tree = make_node(yystack.l_mark[0].sym->func, &value);
			}
break;
case 53:
#line 665 "rhgram.y"
	{
			    value.param = yystack.l_mark[0].sym->value;
			    yyval.tree = make_node(c_param, &value);
			    yystack.l_mark[0].sym->ref_count++;
			}
break;
case 54:
#line 671 "rhgram.y"
	{ rh_error("undefined identifier"); }
break;
case 55:
#line 673 "rhgram.y"
	{
			    value.di = yystack.l_mark[0].di;
			    yyval.tree = make_node(c_date, &value);
			}
break;
case 56:
#line 678 "rhgram.y"
	{
			    value.di = yystack.l_mark[0].di;
			    yyval.tree = make_node(c_date, &value);
			}
break;
case 57:
#line 683 "rhgram.y"
	{
			    value.l = yystack.l_mark[0].sym->value;
			    yyval.tree = make_node(yystack.l_mark[0].sym->func, &value);
			}
break;
case 58:
#line 690 "rhgram.y"
	{
			    value.l = 0L;
			    yyval.tree = make_node(EXPR_LIST, &value);
			    yyval.tree->count = 0;
			    yyval.tree->trees = (node **) NULL;
			}
break;
case 59:
#line 697 "rhgram.y"
	{ yyval.tree = yystack.l_mark[-1].tree; }
break;
case 60:
#line 700 "rhgram.y"
	{
			    value.l = 0L;
			    yyval.tree = make_node(EXPR_LIST, &value);
			    yyval.tree->count = 0;
			    yyval.tree->trees = (node **) NULL;
			}
break;
case 61:
#line 707 "rhgram.y"
	{
			    value.l = 0L;
			    yyval.tree = make_node(EXPR_LIST, &value);
			    yyval.tree->count = 1;
			    yyval.tree->trees = ALLOCATE(sizeof(node *));
			    yyval.tree->trees[0] = yystack.l_mark[0].tree;
			}
break;
case 62:
#line 715 "rhgram.y"
	{
			    yyval.tree = yystack.l_mark[-2].tree;
			    yyval.tree->count++;
			    yyval.tree->trees =
				REALLOCATE(yyval.tree->trees,
					   (sizeof(node *)) * yyval.tree->count);
			    yyval.tree->trees[yyval.tree->count - 1] = yystack.l_mark[0].tree;
			}
break;
#line 1694 "y.tab.c"
    }
    yystack.s_mark -= yym;
    yystate = *yystack.s_mark;
    yystack.l_mark -= yym;
    yym = yylhs[yyn];
    if (yystate == 0 && yym == 0)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: after reduction, shifting from state 0 to\
 state %d\n", YYPREFIX, YYFINAL);
#endif
        yystate = YYFINAL;
        *++yystack.s_mark = YYFINAL;
        *++yystack.l_mark = yyval;
        if (yychar < 0)
        {
            if ((yychar = YYLEX) < 0) yychar = 0;
#if YYDEBUG
            if (yydebug)
            {
                yys = 0;
                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                if (!yys) yys = "illegal-symbol";
                printf("%sdebug: state %d, reading %d (%s)\n",
                        YYPREFIX, YYFINAL, yychar, yys);
            }
#endif
        }
        if (yychar == 0) goto yyaccept;
        goto yyloop;
    }
    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
        yystate = yytable[yyn];
    else
        yystate = yydgoto[yym];
#if YYDEBUG
    if (yydebug)
        printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
#endif
    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
    {
        goto yyoverflow;
    }
    *++yystack.s_mark = (short) yystate;
    *++yystack.l_mark = yyval;
    goto yyloop;

yyoverflow:
    yyerror("yacc stack overflow");

yyabort:
    yyfreestack(&yystack);
    return (1);

yyaccept:
    yyfreestack(&yystack);
    return (0);
}

Added y.tab.h.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#define BLTIN 257
#define DATESPEC 258
#define EQ 259
#define FIELD 260
#define FILENAME_PATTERN 261
#define FILETIME_FIELD 262
#define FSTYPE 263
#define FUNCTION 264
#define GE 265
#define IDENTIFIER 266
#define LE 267
#define LOGAND 268
#define LOGOR 269
#define LSHIFT 270
#define NE 271
#define NUMBER 272
#define PARAM 273
#define RETURN 274
#define RSHIFT 275
#define SYSTEM_CALL 276
#define TIME_FIELD 277
#define UNIMINUS 278
#ifdef YYSTYPE
#undef  YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
#endif
#ifndef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
typedef union {
    char *              str;
    symbol *		sym;
    node *		tree;
    long                value;
    void	      (*func)(instr_value *);
    date_info *		di;
    struct {
	char *	line;
	int	line_num;
	int	line_pos;
    } line_info;
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
extern YYSTYPE rh_lval;