This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

dwarf2 ICE on mips-sgi-irix6.5



The -g is necessary to trigger this ICE:

franck:~/RKHS-surface:371> gcc -v -c -g config.i
Reading specs from /usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/cc1 config.i -quiet -g -version -o /var/tmp/ccCfSaKv.s
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release) (mips-sgi-irix6.5) compiled by GNU C version 2.8.1.
In file included from PES/config.c:2:
PES/config.h:14: warning: `struct PES_s' declared inside parameter list
PES/config.h:14: warning: its scope is only this definition or declaration,
PES/config.h:14: warning: which is probably not what you want.
PES/config.h:14: warning: `struct config_s' declared inside parameter list
dwarf2out.c:6343: Internal compiler error in function modified_type_die

-------------------- config.i ------------------------------------------
# 1 "PES/config.c"
# 1 "PES/../std.h" 1



# 1 "PES/../include/std_incl.h" 1



# 1 "/usr/include/stdlib.h" 1 3





#ident  "$Revision: 1.78 $"
 
















 
 

 
 
 

 


# 1 "/usr/include/standards.h" 1 3


 















#ident  "$Id: standards.h,v 1.19 1997/12/15 21:30:25 jph Exp $"

 





























 












 





















 

























 

















 













 












 









 















 












 





















 








 





# 34 "/usr/include/stdlib.h" 2 3

# 1 "/usr/include/sgidefs.h" 1 3
 

















#ident  "$Revision: 1.11 $"

 















 






 









 






		 


 









 



































 













 











typedef int __int32_t;
typedef unsigned  __uint32_t;








 



































	 
typedef long long __int64_t;
typedef unsigned long long  __uint64_t;

# 214 "/usr/include/sgidefs.h" 3





typedef __int32_t __psint_t;
typedef __uint32_t __psunsigned_t;







 











 
typedef __int32_t __scint_t;
typedef __uint32_t __scunsigned_t;










# 35 "/usr/include/stdlib.h" 2 3






 



 


# 64 "/usr/include/stdlib.h" 3



 






















typedef	struct {
	 int	quot;
	 int	rem;
	} div_t;

typedef struct {
	 long	quot;
	 long	rem;
	} ldiv_t;




typedef unsigned int	size_t;










typedef int	ssize_t;










typedef long wchar_t;







# 1 "/usr/include/locale_attr.h" 1 3
 



















#ident  "$Revision: 1.4 $"

 












 







typedef struct {

    unsigned int	_class [ 257 ];
    signed short	_lower [ 257 ];
    signed short	_upper [ 257 ];

    char		_cswidth [ 7 ];
    char		_fill [ 1 ];

     

} __ctype_t;

 
typedef int	(*__isset_func_t)(int);




	typedef long	wint_t;





 
typedef int	(*__iscodeset_func_t)(int, wint_t);

 
typedef struct __attr {

    __ctype_t *		_ctype_tbl;	 

    struct _csinfo {			 
	unsigned char	_eucwidth[3];	 
	unsigned char	_scrwidth[3];	 
	unsigned char	_mb_cur_max;	 
    } _csinfo;

    struct _euc_func {			 
	int		_is_euc;	 
	__isset_func_t	_isset2;	 
	__isset_func_t	_isset3;	 
	__iscodeset_func_t _iscodeset;	 
    } _euc_func;

    struct _collate_res {		 
	unsigned char	_coll_as_cmp;	 
    } _collate_res;

    void *		_fill[15];	 
} __attr_t;



 
extern __attr_t __libc_attr;





# 133 "/usr/include/stdlib.h" 2 3










 
extern double atof(const char *);
extern int atoi(const char *);
extern long int atol(const char *);
extern double strtod(const char *, char **);
extern long int strtol(const char *, char **, int);
extern unsigned long int strtoul(const char *, char **, int);
extern int rand(void);
extern void srand(unsigned int);
extern void *calloc(size_t, size_t);
extern void free(void *);
extern void *malloc(size_t);
extern void *realloc(void *, size_t);







extern void abort(void);
extern int atexit(void (*)(void));
extern void exit(int);




extern char *getenv(const char *);
extern int system(const char *);
extern void *bsearch(const void *, const void *, size_t, size_t,
	int (*)(const void *, const void *));
extern void qsort(void *, size_t, size_t,
	int (*)(const void *, const void *));







extern int abs(int);






extern div_t div(int, int);
extern long int labs(long);




extern ldiv_t ldiv(long, long);
extern int mbtowc(wchar_t *, const char *, size_t);
extern int mblen(const char *, size_t);
extern int wctomb(char *, wchar_t);
extern size_t mbstowcs(wchar_t *, const char *, size_t);
extern size_t wcstombs(char *, const wchar_t *, size_t);


	 
extern int putenv(const char *);
extern double	drand48(void);
extern double	erand48(unsigned short [3]);
extern long	lrand48(void);
extern long	nrand48(unsigned short [3]);
extern long	mrand48(void);
extern long	jrand48(unsigned short [3]);
extern void	srand48(long);
extern void	lcong48(unsigned short int [7]);
extern void     setkey(const char *);
extern unsigned short * seed48(unsigned short int [3]);



	 
extern long a64l(const char *);
extern char *ecvt(double, int, int *, int *);
extern char *fcvt(double, int, int *, int *);
extern char *gcvt(double, int, char *);
extern int getsubopt(char **, char * const *, char **);
extern int grantpt(int);
extern char *initstate(unsigned int, char *, size_t);
extern char *l64a(long);
extern char *mktemp(char *);
extern int mkstemp(char *);
extern char *ptsname(int);
extern long random(void);
extern char *realpath(const char *, char *);
extern char *setstate(const char *);
extern void srandom(unsigned);
extern int ttyslot(void);
extern int unlockpt(int);
extern void *valloc(size_t);







extern int rand_r(unsigned int *);



	 
# 1 "/usr/include/getopt.h" 1 3


#ident  "$Revision: 1.11 $"




 




















extern int	getopt(int, char *const *, const char *);

extern char	*optarg;
extern int	opterr;
extern int	optind;
extern int	optopt;




 





extern int	getsubopt(char **, char *const *, char **);
extern void	getoptreset(void);







# 250 "/usr/include/stdlib.h" 2 3

extern int atcheckpoint(void (*)(void));
extern int atrestart(void (*)(void));
extern int dup2(int, int);
extern int getpw(int, char *);
extern char *getcwd(char *, size_t);
extern char *getlogin(void);
extern char *getpass(const char *);
extern int isatty(int);
extern void l3tol(long *, const char *, int);
extern void ltol3(char *, const long *, int);
extern void *memalign(size_t, size_t);







	 

extern long double atold(const char *);
extern long double strtold(const char *nptr, char **endptr);
extern char *qecvt(long double, int, int *, int *);
extern char *qfcvt(long double, int, int *, int *);
extern char *qgcvt(long double, int, char *);
extern char *ecvtl(long double, int, int *, int *);
extern char *fcvtl(long double, int, int *, int *);
extern char *gcvtl(long double, int, char *);




 







typedef struct {
	 __int64_t	quot;
	 __int64_t	rem;
	} lldiv_t;

extern __int64_t atoll(const char *);
extern __int64_t strtoll(const char *, char **, int);
extern __uint64_t strtoull(const char *, char **, int);
extern __int64_t llabs(__int64_t);




extern lldiv_t lldiv(__int64_t, __int64_t);







extern char *ecvt_r(double, int, int *, int *, char *);
extern char *fcvt_r(double, int, int *, int *, char *);

extern char *qecvt_r(long double, int, int *, int *, char *);
extern char *qfcvt_r(long double, int, int *, int *, char *);
extern char *ecvtl_r(long double, int, int *, int *, char *);
extern char *fcvtl_r(long double, int, int *, int *, char *);









# 343 "/usr/include/stdlib.h" 3



# 4 "PES/../include/std_incl.h" 2

# 1 "/usr/include/stdio.h" 1 3





#ident  "$Revision: 1.75 $"
 
















 
 

 
 
 

 








# 48 "/usr/include/stdio.h" 3


# 59 "/usr/include/stdio.h" 3



typedef __int64_t	fpos_t;





 


 
typedef	__int64_t	off64_t;	 









typedef __int64_t	off_t;		 










 
typedef	__int64_t	fpos64_t;





 


typedef char *va_list;


























# 140 "/usr/include/stdio.h" 3

































typedef struct	 

 







__file_s

{

	int		_cnt;	 




	unsigned char	*_ptr;	 
	unsigned char	*_base;	 





	unsigned char	_flag;	 
	unsigned char	_o_file;	 
	unsigned short	_file;	 




} FILE;

extern FILE		__iob[100 ];	

extern FILE		*_lastbuf;
extern unsigned char 	*_bufendtab[];
extern unsigned char	 _sibuf[], _sobuf[];


extern int	remove(const char *);
extern int	rename(const char *, const char *);
extern FILE	*tmpfile(void);
extern char	*tmpnam(char *);
extern int	fclose(FILE *);
extern int	fflush(FILE *);
extern FILE	*fopen(const char *, const char *);
extern FILE	*freopen(const char *, const char *, FILE *);
extern void	setbuf(FILE *, char *);
extern int	setvbuf(FILE *, char *, int, size_t);
 
extern int	fprintf(FILE *, const char *, ...);
 
extern int	fscanf(FILE *, const char *, ...);
 
extern int	printf(const char *, ...);
 
extern int	scanf(const char *, ...);

 
extern int	snprintf(char *, ssize_t, const char *, ...);

 
extern int	sprintf(char *, const char *, ...);
 
extern int	sscanf(const char *, const char *, ...);
extern int	vfprintf(FILE *, const char *,   char *);
extern int	vprintf(const char *,   char *);

extern int	vsnprintf(char *, ssize_t, const char *,   char *);

extern int	vsprintf(char *, const char *,   char *);
# 256 "/usr/include/stdio.h" 3

extern int	fgetc(FILE *);
extern char	*fgets(char *, int, FILE *); 
extern int	fputc(int, FILE *);
extern int	fputs(const char *, FILE *);
extern int	getc(FILE *);
extern int	getchar(void);
extern char	*gets(char *);
extern int	putc(int, FILE *);
extern int	putchar(int);
extern int	puts(const char *);
extern int	ungetc(int, FILE *);
extern size_t	fread(void *, size_t, size_t, FILE *);
#pragma int_to_unsigned fread
extern size_t	fwrite(const void *, size_t, size_t, FILE *);
#pragma int_to_unsigned fwrite
extern int	fgetpos(FILE *, fpos_t *);
extern int	fseek(FILE *, long, int);
extern int	fsetpos(FILE *, const fpos_t *);
extern long	ftell(FILE *);
extern void	rewind(FILE *);
extern void	clearerr(FILE *);
extern int	feof(FILE *);
extern int	ferror(FILE *);
extern void	perror(const char *);

extern int	__filbuf(FILE *);	
extern int	__flsbuf(int, FILE *);	


	 
extern FILE    *fdopen(int, const char *);
extern int	fileno(FILE *);



	 
extern void	flockfile(FILE *);
extern int	ftrylockfile(FILE *);
extern void	funlockfile(FILE *);
extern int	getc_unlocked(FILE *);
extern int	putc_unlocked(int, FILE *);
extern int	getchar_unlocked(void);
extern int	putchar_unlocked(int);



extern FILE	*popen(const char *, const char *);
extern int	pclose(FILE *);


	 

extern char	*ctermid(char *);
extern char	*cuserid(char *);
extern char	*tempnam(const char *, const char *);
extern int	getw(FILE *);
extern int	putw(int, FILE *);




	 
extern char	*mktemp(char *);
extern int	mkstemp(char *);
extern int	setbuffer(FILE *, char *, int);
extern int	setlinebuf(FILE *);
extern int	system(const char *);



	 
extern off_t	ftello(FILE *);
extern int	fseeko(FILE *, off_t, int);



	 
extern int	fgetpos64(FILE *, fpos64_t *);
extern FILE	*fopen64(const char *, const char *);
extern FILE	*freopen64(const char *, const char *, FILE *);
extern int	fseek64(FILE *, __int64_t, int);
extern int	fseeko64(FILE *, off64_t, int);
extern int	fsetpos64(FILE *, const fpos64_t *);
extern __int64_t ftell64(FILE *);
extern off64_t	ftello64(FILE *);
extern FILE	*tmpfile64(void);



extern int	__semputc(int, FILE *);
extern int	__semgetc(FILE *);
extern int	__us_rsthread_stdio;



extern char	*ctermid_r(char *);





 










 





 




 












 










# 447 "/usr/include/stdio.h" 3










# 5 "PES/../include/std_incl.h" 2

# 1 "/usr/include/unistd.h" 1 3





#ident  "$Revision: 1.137 $"
 
















 
 

 
 
 



 






















 




 







 




 















































 




 


































































 




























































 













 




 


# 1 "/usr/include/sys/types.h" 1 3
 















 
 

 
 
 




#ident 	"$Revision: 3.138 $"




 
typedef unsigned char   uchar_t;
typedef unsigned short  ushort_t;
typedef unsigned int    uint_t;
typedef unsigned long   ulong_t;

 

# 1 "/usr/include/sys/pthread.h" 1 3







 


typedef unsigned int 		pthread_t;		 


typedef struct { long __D[5]; } pthread_attr_t;		 
typedef struct { long __D[8]; } pthread_mutex_t;	 
typedef struct { long __D[2]; } pthread_mutexattr_t;	 
typedef struct { long __D[8]; } pthread_cond_t;		 
typedef struct { long __D[2]; } pthread_condattr_t;	 
typedef struct { long __D[16]; } pthread_rwlock_t;	 
typedef struct { long __D[4]; } pthread_rwlockattr_t;	 
typedef int			pthread_key_t;		 
typedef int			pthread_once_t;		 








# 40 "/usr/include/sys/types.h" 2 3



 
typedef	char *		addr_t;		 
typedef	char *		caddr_t;	 

typedef	__int64_t	daddr_t;	 



typedef	long		pgno_t;		 
typedef	__uint32_t	pfn_t;		 
typedef	short		cnt_t;		 
typedef unsigned long	basictime_t;
typedef __int64_t	micro_t;
 



typedef __int32_t	pgcnt_t;	 

typedef enum { B_FALSE, B_TRUE } boolean_t;


 








typedef long			id_t;	 
					 
					 
					 
					 





 


typedef ulong_t	major_t;	 
typedef ulong_t	minor_t;	 






 










typedef	ushort_t o_mode_t;		 
typedef short	o_dev_t;		 
typedef	ushort_t o_uid_t;		 
typedef	o_uid_t	o_gid_t;		 
typedef	short	o_nlink_t;		 
typedef short	o_pid_t;		 
typedef __uint32_t o_ino_t;		 


typedef	unsigned long	mode_t;		 
typedef	unsigned long	dev_t;		 
typedef	long		uid_t;
typedef	long		gid_t;
typedef unsigned long	nlink_t;	 
typedef long		pid_t;		 










typedef int tid_t;                       

typedef dev_t	vertex_hdl_t;		 


typedef	__uint64_t	ino_t;		 



typedef __uint64_t	ino64_t;	 

# 153 "/usr/include/sys/types.h" 3







typedef __scint_t	__scoff_t;	 

typedef __scoff_t	scoff_t;	 



	 
typedef	__int64_t	blkcnt64_t;
typedef	__uint64_t	fsblkcnt64_t;
typedef	__uint64_t	fsfilcnt64_t;



typedef	__int64_t	blkcnt_t;	 
typedef	__uint64_t	fsblkcnt_t;	 
typedef	__uint64_t	fsfilcnt_t;	 






typedef	long		swblk_t;
typedef	unsigned long	paddr_t;	 
typedef	unsigned long	iopaddr_t;	 
typedef	int		key_t;		 
typedef	unsigned char	use_t;		 
typedef	long		sysid_t;
typedef	short		index_t;

typedef signed short	nasid_t;         
typedef signed short	cnodeid_t;	 
typedef	signed char  	partid_t;	 
typedef signed short 	moduleid_t;	 
typedef signed short 	cmoduleid_t;	 

typedef unsigned int 	lock_t;		 
typedef	signed short	cpuid_t;	 
typedef	unsigned char	pri_t;		 
typedef __uint64_t	accum_t;	 
typedef __int64_t	prid_t;		 
typedef __int64_t	ash_t;		 
typedef short		cell_t;		 
typedef int		credid_t;	 

# 213 "/usr/include/sys/types.h" 3


# 223 "/usr/include/sys/types.h" 3





typedef	long		time_t;		 









typedef	long		clock_t;  






# 253 "/usr/include/sys/types.h" 3




typedef int             clockid_t;



typedef int		timer_t;



 




typedef	unsigned int	useconds_t;


 



typedef __scunsigned_t	bitnum_t;	 
typedef __scunsigned_t	bitlen_t;	 


typedef int processorid_t;		 
typedef int toid_t;			 
typedef	long *qaddr_t;		       
typedef __uint32_t inst_t;		 

 






typedef __uint64_t machreg_t;


 






typedef __uint64_t fpreg_t;


 







typedef signed char             int8_t;
typedef unsigned char           uint8_t;
typedef signed short            int16_t;
typedef unsigned short          uint16_t;
typedef signed int              int32_t;
typedef unsigned int            uint32_t;
typedef __int64_t 		int64_t;
typedef __uint64_t		uint64_t;
typedef __int64_t 		intmax_t;
typedef __uint64_t		uintmax_t;
typedef signed long int         intptr_t;
typedef unsigned long int       uintptr_t;


 



typedef	unsigned char	u_int8_t;
typedef	unsigned short	u_int16_t;
typedef	__uint32_t	u_int32_t;


 















 



typedef	long	hostid_t;

 








 



# 1 "/usr/include/sys/bsd_types.h" 1 3
 



















#ident 	"$Revision: 1.2 $"

 




typedef	struct { int r[1]; } *	physadr;
typedef	unsigned char	unchar;
typedef	unsigned char	u_char;
typedef	unsigned short	ushort;
typedef	unsigned short	u_short;
typedef	unsigned int	uint;
typedef	unsigned int	u_int;
typedef	unsigned long	ulong;
typedef	unsigned long	u_long;
typedef	struct	_quad { long val[2]; } quad;






# 1 "/usr/include/sys/select.h" 1 3
 















 
 
 

 
 
 
 




#ident 	"$Revision: 1.17 $"







 






 










typedef	long	fd_mask_t;
typedef	unsigned long	ufd_mask_t;










typedef struct fd_set {



	fd_mask_t	fds_bits[((( 1024  )+((  (int)(sizeof(fd_mask_t) * 8 )  )-1))/(  (int)(sizeof(fd_mask_t) * 8 )  )) ];
} fd_set;







# 1 "/usr/include/string.h" 1 3





#ident  "$Revision: 1.41 $"
 
















 
 
 

 
 
 
 

 






# 48 "/usr/include/string.h" 3
















 


extern void *memcpy(void *, const void *, size_t);
extern void *memmove(void *, const void *, size_t);
extern char *strcpy(char *, const char *);
extern char *strncpy(char *, const char *, size_t);
extern char *strcat(char *, const char *);
extern char *strncat(char *, const char *, size_t);
extern void *memccpy(void *, const void *, int, size_t);
extern int memcmp(const void *, const void *, size_t);
extern int strcmp(const char *, const char *);
extern int strcoll(const char *, const char *);
extern int strncmp(const char *, const char *, size_t);
extern size_t strxfrm(char *, const char *, size_t);

extern void *memchr(const void *, int, size_t);
extern char *strchr(const char *, int);

extern size_t strcspn(const char *, const char *);
#pragma int_to_unsigned strcspn

extern char *strpbrk(const char *, const char *);
extern char *strrchr(const char *, int);

extern size_t strspn(const char *, const char *);
#pragma int_to_unsigned strspn

extern char *strstr(const char *, const char *);

extern char *strtok(char *, const char *);
extern void *memset(void *, int, size_t);
extern char *strerror(int);
extern size_t strlen(const char *);
#pragma int_to_unsigned strlen


extern int ffs(int);
 
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t);



extern char *strdup(const char *);



extern char *strtok_r(char *, const char *, char **);


# 132 "/usr/include/string.h" 3






# 205 "/usr/include/string.h" 3




# 80 "/usr/include/sys/select.h" 2 3



# 91 "/usr/include/sys/select.h" 3












 













typedef	long	fd_mask;











# 44 "/usr/include/sys/bsd_types.h" 2 3



# 372 "/usr/include/sys/types.h" 2 3




typedef __uint64_t k_sigset_t;	 









# 497 "/usr/include/sys/types.h" 3



# 277 "/usr/include/unistd.h" 2 3

# 1 "/usr/include/sys/unistd.h" 1 3
 
 

 
 
 

 








 















































 





 

























 
 
















 



 






 

 



					 

					 



					 





 







 
















# 189 "/usr/include/sys/unistd.h" 3



# 278 "/usr/include/unistd.h" 2 3


 


extern int access(const char *, int);
extern unsigned alarm(unsigned);
extern int chdir(const char *);
extern int chown(const char *, uid_t, gid_t);
extern int close(int);
extern char *ctermid(char *);
extern char *cuserid(char *);
extern int dup(int);
extern int dup2(int, int);
extern int execl(const char *, const char *, ...);
extern int execle(const char *, const char *, ...);
extern int execlp(const char *, const char *, ...);
extern int execv(const char *, char *const *);
extern int execve(const char *, char *const *, char *const *);
extern int execvp(const char *, char *const *);
extern void _exit(int);
extern pid_t fork(void);
extern long fpathconf(int, int);

extern char *getcwd(char *, size_t);     
extern gid_t getegid(void);
extern uid_t geteuid(void);
extern gid_t getgid(void);



extern int getgroups(int, gid_t *);

extern char *getlogin(void);



extern pid_t getpgrp(void);

extern pid_t getpid(void);
extern pid_t getppid(void);
extern uid_t getuid(void);
extern int isatty(int);

extern int link(const char *, const char *);
extern int linkfollow(const char *, const char *);
# 334 "/usr/include/unistd.h" 3

extern off_t lseek(int, off_t, int);
extern long pathconf(const char *, int);
extern int pause(void);
extern int pipe(int *);
extern ssize_t read(int, void *, size_t);
extern int rmdir(const char *);
extern int setgid(gid_t);
extern int setpgid(pid_t, pid_t);
extern pid_t setsid(void);
extern int setuid(uid_t);
extern unsigned sleep(unsigned);
extern long sysconf(int);
extern pid_t tcgetpgrp(int);
extern int tcsetpgrp(int, pid_t);
extern char *ttyname(int);
extern int unlink(const char *);
extern ssize_t write(int, const void *, size_t);


 


extern int fdatasync(int);



 


extern int fsync(int);



 


extern int ftruncate(int, off_t);	



 


extern int getlogin_r(char *, size_t);
extern int ttyname_r(int, char *, size_t);
extern int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));



 



extern size_t   confstr(int, char *, size_t);



 


extern int chroot(const char *);
extern int nice(int);
extern char     *crypt(const char *, const char *);
extern void     encrypt(char *, int);
extern char     *getpass(const char *);
extern void     swab(const void *, void *, ssize_t);



 


extern int brk(void *);
extern int fchown(int, uid_t, gid_t);
extern int fchdir(int);
extern int getdtablesize(void);
extern long gethostid(void);
extern int gethostname(char *, size_t);
extern int getpagesize(void);
extern pid_t getpgid(pid_t);
extern pid_t getsid(pid_t);
extern char *getwd(char *);
extern int lchown(const char *, uid_t, gid_t);
extern int lockf(int, int, off_t);
extern int readlink(const char *, char *, size_t);
extern void *sbrk(ssize_t);



extern pid_t setpgrp(void);



extern int setregid(gid_t, gid_t);
# 439 "/usr/include/unistd.h" 3

extern int setreuid(uid_t, uid_t);
extern int symlink(const char *, const char *);
extern void sync(void);
extern int truncate(const char *, off_t);
extern useconds_t ualarm(useconds_t, useconds_t);
extern int usleep(useconds_t);














extern ssize_t pread(int, void *, size_t, off_t);
extern ssize_t pwrite(int, const void *, size_t, off_t);


 




 


struct timeval;
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);


 



# 1 "/usr/include/sys/uio.h" 1 3
 
 
 

 
 
 
 



#ident 	"@(#)uts-3b2:io/uio.h	1.2"
#ident 	"$Revision: 1.22 $"





 










typedef struct iovec {
        void *iov_base;
        size_t  iov_len;
} iovec_t;



extern ssize_t readv(int, const struct iovec *, int);
extern ssize_t writev(int, const struct iovec *, int);


# 87 "/usr/include/sys/uio.h" 3






# 480 "/usr/include/unistd.h" 2 3

# 1 "/usr/include/utime.h" 1 3





#ident  "$Revision: 1.9 $"
 
















 
 
 

 
 
 
 


# 1 "/usr/include/sys/utime.h" 1 3
 
 
 

 
 
 
 




 



struct utimbuf {
	time_t actime;		 
	time_t modtime;		 
};


# 34 "/usr/include/utime.h" 2 3


extern int utime(const char *, const struct utimbuf *);





# 481 "/usr/include/unistd.h" 2 3

# 1 "/usr/include/re_comp.h" 1 3





#ident  "$Revision: 1.1 $"
 

















extern char *re_comp(const char *);
extern int re_exec(const char *);





# 482 "/usr/include/unistd.h" 2 3

extern int acct(const char *);
extern void exit(int);
extern char *gettxt(const char *, const char *);
extern int profil(unsigned short *, unsigned int, unsigned int, unsigned int);
extern int ptrace(int, pid_t, int, int);
extern int rename(const char *, const char *);	 
extern int seteuid(uid_t);
extern int setegid(gid_t);
extern int stime(const time_t *);
extern off_t tell(int);



struct acct_spi;	 
extern int atfork_child(void (*func)(void));
extern int atfork_child_prepend(void (*func)(void));
extern int atfork_parent(void (*func)(int, int));
extern int atfork_pre(void (*func)(void));
extern int atsproc_child(void (*func)(void));
extern int atsproc_parent(void (*func)(int, int));
extern int atsproc_pre(void (*func)(unsigned int));
extern void bset(char *, bitnum_t);
extern void bclr(char *, bitnum_t);
extern int btst(char *, bitnum_t);
extern void bfset(char *, bitnum_t, bitlen_t);
extern void bfclr(char *, bitnum_t, bitlen_t);
extern bitlen_t bftstset(char *, bitnum_t, bitlen_t);
extern bitlen_t bftstclr(char *, bitnum_t, bitlen_t);
extern int BSDchown(const char *, uid_t, gid_t);
extern int BSDdup2(int, int);
extern int BSDfchown(int, uid_t, gid_t);
extern int BSDgetpgrp(int);
extern int BSDsetpgrp(int, int);
extern int BSDsetgroups(int, int *);
extern int BSDgetgroups(int, int *);
extern int _daemonize(int, int, int, int);
extern ash_t getash(void);
extern int getdtablehi(void);
extern int getdomainname(char *, int);
extern prid_t getprid(void);
extern char *_getpty(int *, int, mode_t, int);
extern int getspinfo(struct acct_spi *);
extern int mincore(caddr_t, size_t, char *);
extern int mpin(void *, size_t);
extern int munpin(void *, size_t);
extern int newarraysess(void);
extern pid_t pcreatel(const char *, const char *, ...);
extern pid_t pcreatelp(const char *, const char *, ...);
extern pid_t pcreatev(const char *, char *const *);
extern pid_t pcreateve(const char *, char *const *, char *const *);
extern pid_t pcreatevp(const char *, char *const *);

extern ssize_t pread64(int, void *, size_t, off64_t);
extern ssize_t pwrite64(int, const void *, size_t, off64_t);

extern int rexecl(cell_t, const char *, const char *, ...);
extern int rexecle(cell_t, const char *, const char *, ...);
extern int rexeclp(cell_t, const char *, const char *, ...);
extern int rexecv(cell_t, const char *, char *const *);
extern int rexecve(cell_t, const char *, char *const *, char *const *);
extern int rexecvp(cell_t, const char *, char *const *);
extern float _sqrt_s(float);
extern double _sqrt_d(double);
extern int setash(ash_t);
extern int setdomainname(const char *, int);



extern int setgroups(int, const gid_t *);

extern int sethostid(int);
extern int sethostname(const char *, int);
extern int setprid(prid_t);
extern int setrgid(gid_t);
extern int setruid(uid_t);
extern int setspinfo(struct acct_spi *);
extern int sgikopt(const char *, char *, int);
extern long sginap(long);
extern off64_t tell64(int);
extern int vhangup(void);

 



extern int fattach(int, const char *);
extern int fdetach(const char *);
extern int ioctl(int, int, ...);




	 
extern int ftruncate64(int, off64_t);
extern int lockf64(int, int, off64_t);
extern off64_t lseek64(int, off64_t, int);
extern int truncate64(const char *, off64_t);








# 6 "PES/../include/std_incl.h" 2

# 1 "/usr/include/values.h" 1 3
 
 















 

 
 

 
 
 








 


 



 







 







 


































































# 7 "PES/../include/std_incl.h" 2

# 1 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/limits.h" 1 3
 


 





 
# 1 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/syslimits.h" 1 3
 
















 
 

 
 
 



#ident  "$Revision: 7.41 $"






 



 





































 




















 














 































 



 









































 















 



















































 

















 
















				 




				 











typedef union _h_val {

        unsigned long i[2];




        double d;
} _h_val;

extern const _h_val __huge_val;









# 11 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/limits.h" 2 3





 



 



 




 





 



 












 

 




 



 








 



 













 




 








 






 









# 8 "PES/../include/std_incl.h" 2

# 1 "/usr/include/ctype.h" 1 3





#ident  "$Revision: 1.29 $"
 
















 
 

 
 
 

 

































extern int isalnum(int);
extern int isalpha(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int __isblank(int);
extern int isupper(int);
extern int isxdigit(int);
extern int tolower(int);
extern int toupper(int);

 
extern int isascii(int);        
extern int toascii(int);        

extern int _tolower(int);
extern int _toupper(int);





























# 143 "/usr/include/ctype.h" 3






# 9 "PES/../include/std_incl.h" 2


      


# 1 "/usr/include/math.h" 1 3










 
 
 
 
 
 
 
 

 

 













 














 






 


# 85 "/usr/include/math.h" 3


# 95 "/usr/include/math.h" 3


 



extern double	acos(double);




extern float	acosf(float);




extern double	asin(double);




extern float	asinf(float);




extern double	atan(double);




extern float	atanf(float);




# 139 "/usr/include/math.h" 3


extern double	atan2(double, double);




extern float	atan2f(float, float);




extern double	cos(double);




extern float	cosf(float);




extern double	sin(double);




extern float	sinf(float);




extern double	tan(double);




extern float	tanf(float);




# 189 "/usr/include/math.h" 3


extern double	cosh(double);




extern float	coshf(float);




extern double	sinh(double);




extern float	sinhf(float);




extern double	tanh(double);




extern float	tanhf(float);




extern double	exp(double);




extern float	expf(float);










extern double	frexp(double, int *);






extern double	ldexp(double, int);






extern double	log(double);




extern float	logf(float);




extern double	log10(double);




extern float	log10f(float);












extern double	modf(double, double *);

 

extern float	modff(float, float *); 

extern double	pow(double, double);




 
extern float	powf(float, float);




extern double	sqrt(double);




extern float	sqrtf(float);




extern double	ceil(double);




extern float	ceilf(float);




extern double	fabs(double);




 

extern float	fabsf(float);




extern double	floor(double);




extern float	floorf(float);




extern double	fmod(double, double);




 

extern float	fmodf(float, float);





 


 














extern int signgam;

extern double	gamma(double);
extern double	lgamma(double);

extern int	isnan(double);











extern double	erf(double);




extern double	erfc(double);




extern double	hypot(double, double);




extern double	j0(double);




extern double	j1(double);




extern double	jn(int, double);




extern double	y0(double);




extern double	y1(double);




extern double	yn(int, double);












# 503 "/usr/include/math.h" 3


# 655 "/usr/include/math.h" 3


# 952 "/usr/include/math.h" 3


# 972 "/usr/include/math.h" 3






 




# 996 "/usr/include/math.h" 3


# 1210 "/usr/include/math.h" 3




# 14 "PES/../include/std_incl.h" 2




# 1 "/usr/include/time.h" 1 3





#ident  "$Revision: 1.50 $"

 
















 
 

 
 
 

 



		




# 49 "/usr/include/time.h" 3


# 59 "/usr/include/time.h" 3


# 69 "/usr/include/time.h" 3





# 1 "/usr/include/sys/ptimers.h" 1 3
 




















#ident  "$Id: ptimers.h,v 1.4 1997/01/15 04:44:41 jwag Exp $"

 



# 1 "/usr/include/sys/timespec.h" 1 3
 

















#ident 	"$Revision: 1.5 $"





 
















 



typedef struct timespec  {



	time_t  tv_sec;		 




	long    tv_nsec;

} timespec_t;






# 28 "/usr/include/sys/ptimers.h" 2 3


typedef struct itimerspec {
	timespec_t it_interval;	 
	timespec_t it_value;	 
} itimerspec_t;
 



 


 




# 62 "/usr/include/sys/ptimers.h" 3






# 74 "/usr/include/time.h" 2 3






















 









struct	tm {	 
	int	tm_sec;
	int	tm_min;
	int	tm_hour;
	int	tm_mday;
	int	tm_mon;
	int	tm_year;
	int	tm_wday;
	int	tm_yday;
	int	tm_isdst;
};

 


extern clock_t clock(void);			
extern double difftime(time_t, time_t);		
extern time_t mktime(struct tm *);		
extern time_t time(time_t *);			
extern char *asctime(const struct tm *);		
extern char *ctime (const time_t *);		
extern struct tm *gmtime(const time_t *);		
extern struct tm *localtime(const time_t *);	
extern size_t strftime(char *, size_t, const char *, const struct tm *);


 


extern void tzset(void);
extern char *tzname[2];









 



struct sigevent;
extern int clock_settime(clockid_t, const timespec_t *);
extern int clock_gettime(clockid_t, timespec_t *);
extern int clock_getres(clockid_t, timespec_t *);
extern int nanosleep(const timespec_t *, timespec_t *);
extern int timer_create(clockid_t, struct sigevent *, timer_t *);
extern int timer_delete(timer_t);
extern int timer_settime(timer_t, int, const struct itimerspec *, struct itimerspec *);
extern int timer_gettime(timer_t, struct itimerspec *);
extern int timer_getoverrun(timer_t);



 


extern time_t timezone;
extern int daylight;
extern char *strptime(const char *, const char *, struct tm *);



 


extern struct tm *getdate(const char *);
extern int getdate_err;



extern int cftime(char *, char *, const time_t *);
extern int ascftime(char *, const char *, const struct tm *);
extern time_t altzone;



 


extern char *asctime_r(const struct tm *, char *);
extern char *ctime_r(const time_t *, char *);
extern struct tm *gmtime_r(const time_t *, struct tm *);
extern struct tm *localtime_r(const time_t *, struct tm *);






# 18 "PES/../include/std_incl.h" 2


# 1 "/usr/include/signal.h" 1 3





#ident  "$Revision: 1.57 $"
 
















 
 

 
 
 

 









# 108 "/usr/include/signal.h" 3

# 1 "/usr/include/sys/signal.h" 1 3
 










 
 

 
 
 









#ident 	"$Revision: 3.144 $"

 



 








































 


 





 








 








 
typedef void 	(*SIG_PF) ( );








 


# 1 "/usr/include/sys/sigevent.h" 1 3
 


















#ident 	"$Revision: 1.8 $"





 











typedef union sigval {
	int	sival_int;
	void	*sival_ptr;
} sigval_t;













typedef union notifyinfo  {
	int	nisigno ;			 
	void	(* nifunc ) (sigval_t);	 	 
} notifyinfo_t;

typedef struct sigevent {
	int			sigev_notify;
	notifyinfo_t		sigev_notifyinfo;
	sigval_t		sigev_value;
	void 			(*sigev_notify_function) (sigval_t);
        pthread_attr_t 		*sigev_notify_attributes;
	unsigned long		sigev_reserved[11];
	unsigned long		sigev_pad[6];
} sigevent_t;













# 114 "/usr/include/sys/signal.h" 2 3




 


# 1 "/usr/include/sys/siginfo.h" 1 3
 










 
 
 

 
 
 
 




#ident  "$Revision: 1.26 $"









 






 













 



typedef struct __siginfo {
	int	si_signo;		 
	int 	si_code;		 
	int	si_errno;		 
	union {

		int	si_pad[((128  / sizeof(__int32_t)) - 3) ];	 

		struct {			 
			pid_t	__pid;		 
			union {
				struct {
					uid_t	__uid;
				} __kill;
				struct {
					clock_t __utime;
					int __status;
					clock_t __stime;
					int __swap;
				} __cld;
			} __pdata;
		} __proc;			

		struct {	 
			void 	*__addr;	 
		} __fault;

		struct {			 
		 
			int	__fd;	 
			long	__band;
		} __file;

		union sigval	__value;



	} __data;

} siginfo_t;











 







 







 














 














 








 









 








 












 












 














# 121 "/usr/include/sys/signal.h" 2 3



 




typedef struct {                 
        __uint32_t __sigbits[4];
} sigset_t;


 
typedef union __sighandler {
    	void  (*sa_handler1)( );  

    	void (*sa_sigaction1)(int, siginfo_t *, void *);

} __sighandler_t;





typedef struct sigaction {
	int sa_flags;			 
    	__sighandler_t sa_sighandler;	 
	sigset_t sa_mask;		 
					 
	int sa_resv[2];
} sigaction_t;
 







 













 
 







 


					 

 

					 
					 


 


struct sigstack {
	void	*ss_sp;			 
	int	ss_onstack;		 
};

 



 




 



# 1 "/usr/include/sys/ucontext.h" 1 3
 










 













#ident  "$Revision: 1.36 $"

































typedef struct _sigaltstack {
	void	*ss_sp;
	size_t	ss_size;
	int	ss_flags;
} stack_t;









 


# 119 "/usr/include/sys/ucontext.h" 3


 








typedef machreg_t greg_t;


 

typedef greg_t gregset_t[37 ];




typedef struct __fpregset {
	union {
		double		__fp_dregs[32];

		struct {
			__uint32_t	_fp_fill;
			float		_fp_fregs;
		} __fp_fregs[32];






		machreg_t	__fp_regs[32];
	} __fp_r;
	__uint32_t 	__fp_csr;
	__uint32_t	__fp_pad;
} fpregset_t;

typedef struct {
	gregset_t	__gregs;	 
	fpregset_t 	__fpregs;	 
} mcontext_t;

typedef struct __ucontext {
	unsigned long	uc_flags;
	struct __ucontext *uc_link;
	sigset_t   	uc_sigmask;
	stack_t 	uc_stack;
	mcontext_t 	uc_mcontext;
	long		uc_filler[49];
} ucontext_t;











 













 















# 223 "/usr/include/sys/ucontext.h" 3
































 

























































# 328 "/usr/include/sys/ucontext.h" 3



























# 216 "/usr/include/sys/signal.h" 2 3



# 265 "/usr/include/sys/signal.h" 3




 



extern void	(*bsd_signal(int, void (*)(int)))(int);
extern int	killpg(pid_t, int);
extern int	sigstack(struct sigstack *, struct sigstack *);





extern void 	(*signal(int,void  (*)( )))( );



 













 





typedef struct sigcontext {
	__uint32_t	sc_regmask;	 
	__uint32_t	sc_status;	 
	__uint64_t	sc_pc;		 
	 


	__uint64_t	sc_regs[32];	 
	 


	__uint64_t	sc_fpregs[32];	 
	__uint32_t	sc_ownedfp;	 
	__uint32_t	sc_fpc_csr;	 
	__uint32_t	sc_fpc_eir;	 
					 
	__uint32_t	sc_ssflags;	 
	__uint64_t	sc_mdhi;	 
	__uint64_t	sc_mdlo;
	 


	__uint64_t	sc_cause;	 
	__uint64_t	sc_badvaddr;	 
	__uint64_t	sc_triggersave;	 
	sigset_t	sc_sigset;	 
	__uint64_t	sc_fp_rounded_result;	 
	__uint64_t	sc_pad[31];
} sigcontext_t;

 




 


 














# 366 "/usr/include/sys/signal.h" 3






























# 109 "/usr/include/signal.h" 2 3



 
typedef int 	sig_atomic_t;
extern int raise(int);




extern int kill(pid_t, int);

extern int sigaction(int, const struct sigaction *, struct sigaction *);
extern int sigpending(sigset_t *);
extern int sigprocmask(int, const sigset_t *, sigset_t *);
extern int sigsuspend(const sigset_t *);
extern int sigaddset(sigset_t *, int);
extern int sigdelset(sigset_t *, int);
extern int sigemptyset(sigset_t *);
extern int sigfillset(sigset_t *);
extern int sigismember(const sigset_t *, int);



 




extern int sigqueue(pid_t , int, const union sigval);
extern int sigwaitinfo(const sigset_t *, siginfo_t *);
extern int sigtimedwait(const sigset_t *, siginfo_t *, const timespec_t *);
extern int sigwait(const sigset_t *, int *);




extern int pthread_kill(pthread_t, int);
extern int pthread_sigmask(int, const sigset_t *, sigset_t *);



 



extern int sigpause(int);

extern void  (*sigset(int,void  (*)( )))( );

extern int sighold(int);
extern int sigrelse(int);
extern int sigignore(int);
extern int siginterrupt(int, int);

extern int _sigaltstack (const stack_t *, stack_t *);











extern char *_sys_siglist[];
extern int _sys_nsig;


# 1 "/usr/include/sys/procset.h" 1 3
 










 
 

 
 
 







#ident  "$Revision: 1.11 $"



 










 





typedef enum idtype {



	P_PID,		 
	P_PPID,		 
	P_PGID,		 
			 
	P_SID,		 
	P_CID,		 
	P_UID,		 
	P_GID,		 
	P_ALL		 
} idtype_t;



 



typedef enum idop {
	POP_DIFF,	 
			 
			 
	POP_AND,	 
			 
			 
	POP_OR,		 
			 
			 
	POP_XOR		 
			 
			 
} idop_t;

 



typedef struct procset {
	idop_t		p_op;	 
				 
				 
				 

	idtype_t	p_lidtype;
				 
				 
	id_t		p_lid;	 

	idtype_t	p_ridtype;
				 
				 
	id_t		p_rid;	 
} procset_t;

 


























# 180 "/usr/include/signal.h" 2 3

extern int (*ssignal(int, int (*)(int)))(int);
extern int gsignal(int);
extern int sigsend(idtype_t, id_t, int);
extern int sigsendset(const procset_t *, int);

 






 





extern int sgi_altersigs(int, sigset_t *, int[]);
extern int sgi_sigffset(sigset_t *, int);
extern int sgi_dumpset(sigset_t *);










# 20 "PES/../include/std_incl.h" 2

# 1 "/usr/include/errno.h" 1 3





#ident  "$Revision: 1.28 $"
 
















 
 

 
 
 


 



# 1 "/usr/include/sys/errno.h" 1 3
 
 
 

 
 
 
 




#ident 	"$Revision: 3.42 $"

 




























 



















































 










 






















 















 
	 














	 










 



















 


 


 








 
 
 



















 

















	






 









 







 



# 36 "/usr/include/errno.h" 2 3





extern char *   sys_errlist[];
extern int      sys_nerr;

extern int      oserror(void);
extern int      setoserror(int);
extern int      goserror(void);


 










extern int errno;







# 21 "PES/../include/std_incl.h" 2

# 1 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/stdarg.h" 1 3
 

























# 1 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/va-mips.h" 1 3
 
 
 
 
 
 
 


 

 



# 27 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/va-mips.h" 3


typedef char * __gnuc_va_list;




 





enum {
  __no_type_class = -1,
  __void_type_class,
  __integer_type_class,
  __char_type_class,
  __enumeral_type_class,
  __boolean_type_class,
  __pointer_type_class,
  __reference_type_class,
  __offset_type_class,
  __real_type_class,
  __complex_type_class,
  __function_type_class,
  __method_type_class,
  __record_type_class,
  __union_type_class,
  __array_type_class,
  __string_type_class,
  __set_type_class,
  __file_type_class,
  __lang_type_class
};


 






















 





# 119 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/va-mips.h" 3




# 165 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/va-mips.h" 3



void va_end (__gnuc_va_list);		 



# 232 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/va-mips.h" 3


 

 
















# 271 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/va-mips.h" 3



 



# 27 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/stdarg.h" 2 3

# 129 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/stdarg.h" 3







 
 













# 168 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/stdarg.h" 3


 



# 198 "/usr/O2/lib/gcc-lib/mips-sgi-irix6.5/egcs-2.91.66/include/stdarg.h" 3








# 22 "PES/../include/std_incl.h" 2



# 4 "PES/../std.h" 2

# 1 "PES/../include/alloc.h" 1









# 5 "PES/../std.h" 2

# 1 "PES/../include/debug.h" 1



# 1 "PES/../include/debug_macro.h" 1



extern int debug_level;

void debug_level_set(char *);
void debug_level_clear(char *);











# 4 "PES/../include/debug.h" 2







# 6 "PES/../std.h" 2



# 1 "PES/config.c" 2

# 1 "PES/config.h" 1



# 1 "PES/../rkhs/q.h" 1



 








typedef struct {
    double domain_low, domain_high;






    int num_12;
    double  *p[2];
    double  (**f[2])(double );

} q_function_t;

 
double  qfunc(q_function_t *qf, double  x, double  xp);

 








q_function_t *new_ang_qfunc(int n, int mu, int exp, int num_d);
q_function_t *new_rad_qfunc(int n, int mu, int num_d);
q_function_t *new_legendre_qfunc(int n, int num_d);
q_function_t *new_constrained_legendre_qfunc(int n, int num_d);
q_function_t *new_chebyshev_qfunc(int n, int num_d);
q_function_t *new_constrained_chebyshev_qfunc(int n, int num_d);
q_function_t *new_custom_rad_func(int);
q_function_t *new_scaled_ang_qfunc(int n, int mu, int exp, 
				   double  range, int num_d);

void free_qfunc(q_function_t*, int);
q_function_t *q_rad_202();
q_function_t *q_ang_2102();
q_function_t *q_ang_2112();


# 4 "PES/config.h" 2

# 1 "PES/../file/datafile.h" 1



typedef struct {
    int dim;
    int ntot;
    int *num;
    double  *values;
    double  **grid;
} file_t;

file_t *data_file_open(char *);
void data_file_close(file_t *);

void add_point(file_t *f, double  x, double  y);

void subtract_constant(file_t *, double );
void delete_range(file_t *, int, double , double );
void subtract_function(file_t *, double  (*func)(void *, double ), void *);
void transform(file_t *, double  (*func)(void *, double  *, double ), void *);

void filter(file_t *, int (*func)(double  *, double ));
void extract1D(file_t *, void (*func)(double  *, double  *, double  *, double , void *), void *);
void data_file_expand(file_t *, int);

int check_griddedness(file_t *);
void pick_columns(file_t *f, int *cols, int ncol);


# 5 "PES/config.h" 2

# 1 "PES/../coordinates/coordinates.h" 1



typedef enum {
# 1 "PES/../coordinates/auto_coords.h" 1
 coord_any,
 coord_internuclear,
 coord_jacobi,
 coord_halfjacobi,
 coord_jbsba,
 coord_ab2symm,
 coord_jsintheta,
# 5 "PES/../coordinates/coordinates.h" 2

} coord_e;

char *coord_name(coord_e);
coord_e parse_coord(char *);


# 6 "PES/config.h" 2

# 1 "PES/configuration.h" 1






typedef struct {
    coord_e coord_system;
    double x[3];
} configuration_t;

typedef configuration_t (*conversion_func)(configuration_t);

configuration_t internuclear_configuration(double, double, double);
void print_configuration(configuration_t, coord_e);
configuration_t convert_coords(configuration_t, coord_e);
conversion_func get_conversion(coord_e, coord_e);


# 7 "PES/config.h" 2


enum { EXISTS = 1 };

typedef struct {
    int present;
    void (*data_hook)(file_t *);
    void (*automatic)(struct config_s *, struct PES_s *);
    double asymptote;
    q_function_t *qf;
    char *data_fname;
    int *columns;
} config_two_body_t;

typedef struct {
    void (*data_hook)(file_t *);
    double asymptote;
    coord_e data_coords, coords;
    q_function_t *qf[3];
    char *data_fname;
    char *savefile;
    int has_cutoff;
    double cutoff;
    int *columns;
} config_three_body_t;

typedef struct config_s {
    char atom_name[3][9];
    double one_body;
    config_two_body_t two_body[3];
    config_three_body_t three_body;
    void (*additional)();
} config_t;

config_t *process_config_file(char *);
char *get_tb_name(config_t *cf, int i);
void change_to_config_dir(char *fname);


# 2 "PES/config.c" 2

# 1 "PES/../coordinates/jbsba.h" 1





configuration_t JacobiToJBSBA(configuration_t);
configuration_t JacobiToJBSBA2(configuration_t);
configuration_t JBSBAToJacobi(configuration_t c);
configuration_t JBSBAToInternuclear(configuration_t);
configuration_t JBSBA2ToInternuclear(configuration_t);
configuration_t InternuclearToJBSBA(configuration_t);
configuration_t InternuclearToJBSBA2(configuration_t);

void ConvertJBSBADerivatives(configuration_t,
			     double, double, double,
			     double *, double *, double *);
void ConvertJBSBADerivatives2(configuration_t,
			      double, double, double,
			      double, double, double,
			      double, double, double,
			      double, double, double,
			      double *, double *, double *,
			      double *, double *, double *,
			      double *, double *, double *);
void JBSBA_params(double, double);


# 3 "PES/config.c" 2

# 1 "PES/data_hooks.h" 1




# 1 "PES/../PES/PES.h" 1





# 1 "PES/../PES/../methods/svd.h" 1



typedef struct {
    int num;
    double  *w;
    double  **u;
    double  **v;
    double condition_number;
} svd_data_t;

extern double svd_truncation_value;

svd_data_t *svd_decompose(char *, double  **, int);
void svd_truncate(svd_data_t *, double truncation);
double  *svd_linear_solve(svd_data_t *, double  *);
void svd_free(svd_data_t *);


# 6 "PES/../PES/PES.h" 2

# 1 "PES/../PES/../rkhs/fast.h" 1






 


typedef struct {
    double  le, gr;
} le_and_gr_t;

 




typedef struct {
    int num;
    double  *x;
    q_function_t *qf;
} dim_info_t;

 
typedef struct {
    int num;
    int cached_z;  
    double  *points;
    q_function_t *qf;
} dimension_t;

 
typedef struct {
    dimension_t dim;
    le_and_gr_t *sigma_12;



} fast1_info_t;

 
typedef struct {
    dimension_t *dims;
    void **sigma;
    double  *coeffs;
    int **idx;  

} fastn_info_t;

 
fast1_info_t *fastq1c(int, double  *, double  *, q_function_t *);
fastn_info_t *fastqnc(int, dim_info_t *, double  *);

 
void fast1_free(fast1_info_t *);
void fastn_free(fastn_info_t *, int);

 
void check3dsums(fastn_info_t *, dim_info_t *, double  *);

 
double  fastq4(fastn_info_t*, double , double , double , double );
double  fastq3(fastn_info_t*, double , double , double );
double  fastq3new(fastn_info_t*, double , double , double );
double  fastq2(fastn_info_t*, double , double );
double  fastq1(fast1_info_t*, double );

 
double  fastqn(int num_dim, fastn_info_t*, double *);

 
double  dfastq3(fastn_info_t*, int, int, int, double , double , double );
double  dfastq1(fast1_info_t*, int, double );


# 7 "PES/../PES/PES.h" 2



typedef struct {
    int num;
    double  *points;
    double  *values, *cf;
    q_function_t *qf;
    svd_data_t *svd;
    fast1_info_t *fi;
} PES_two_body_t;


typedef struct ptb_s {
    int ntot;
    unsigned long nvirt;
    dim_info_t dims[3];
    double  *grid[3];
    double  *values;
    double  *cf;
    double  *virt_cf;
    svd_data_t *big_svd;
    fastn_info_t *fi;
    coord_e coords;
    double  (*eval_fn)(struct ptb_s *, configuration_t);
} PES_three_body_t;

typedef struct PES_additional_s {
    void *data;
    double  (*eval_fn)(void *, configuration_t);
} PES_additional_t;

typedef struct PES_s {
    double  one_body;
    PES_two_body_t two_body[3];
    PES_three_body_t three_body;
    PES_additional_t additional;
} PES_t;

PES_t *construct_PES(char *config_fname);
void subtract_two_body(file_t *f, PES_t *ret, config_t *cf);


# 5 "PES/data_hooks.h" 2



void h2o_smooth(file_t *);
void remove_nh2_cusp(file_t *);

void nh2_damped_cusp(PES_additional_t *, config_t *, PES_t *);


# 4 "PES/config.c" 2

# 1 "PES/../output/output.h" 1



# 1 "PES/../output/control.h" 1



# 1 "PES/../output/../misc/options.h" 1





typedef enum {
    opt_string,
    opt_double,
    opt_int,
    opt_bool,
    opt_special
} opttype_e;

typedef struct option_s {
    struct option_s *next;

    char *name;
    char opt;
    char *long_opt;
    opttype_e type;
    char *def;
    void (*special)(char *, void *);
    void *value;
    int flags;
} option_t;

typedef struct {
    option_t *head, *tail;
} option_list_t;

typedef struct command_line_entry_s {
    struct command_line_entry_s *next;
    char c;
    char *flag;
    char *arg;
    int used;
} command_line_entry_t;

typedef struct {
    command_line_entry_t *head, *tail;
} command_line_t;

option_list_t *new_option_list();
option_t *add_special_option(option_list_t *, char *, 
			     void (*f)(char *, void *), void *);
option_t *add_option(option_list_t *, char *, opttype_e, void *);
void add_option_flags(option_t *, char, char *);
void add_option_default(option_t *, char *);

command_line_t *process_command_line(int, char **);
int use_command_line(option_list_t *, command_line_t *);
int use_defaults(option_list_t *);
void use_user_input(option_list_t *);
void syntax(option_list_t *, command_line_t *);
int options_remain(option_list_t *);
int command_line_empty(command_line_t *);

option_t *find_option_by_name(option_list_t *, char *);
char *get_argument(command_line_t *cmds);



# 4 "PES/../output/control.h" 2


typedef enum {
    warnings,
    errors,
    transform_info,
    gridded_info,
    progress,
    debug,
    svd,
    NCHANNELS
} channels_e;

extern char *names[];
extern int active, verbose;

typedef struct choice_s {
    struct choice_s *next;
    
    char *name;
    int state;
} choice_t;

extern choice_t *choices[NCHANNELS];

void output_init(option_list_t *);


# 4 "PES/../output/output.h" 2


void output(int channel, char *name, char *fmt, ...);
void output_with_arg(int channel, char *name, char *arg, char *fmt, ...);


# 5 "PES/config.c" 2


int isalunum(unsigned char c) {
    return ((__libc_attr._ctype_tbl->_class+1)[ c ] & (0x00000001  | 0x00000002  | 0x00004000 ) )  || ((__libc_attr._ctype_tbl->_class+1)[ c ] & (0x00000004 ) )  || c == '_';
}

void change_to_config_dir(char *fname) {
    char *last_slash;
    int res;

    last_slash = strrchr(fname, '/');
    if (last_slash) {
	*last_slash = 0;
	res = chdir(fname);
	if (res == -1) {
	    char buf[8192];
	    
	    sprintf(buf, "chdir: %s", fname);
	    perror(buf);
	    exit(1);
	}
    }
}

static config_t *new_config() {
    config_t *cf = ( config_t  *)malloc(sizeof( config_t )) ;

    memset(cf, 0, sizeof(config_t));

    return cf;
}

static char *parse_name;
static void (*parse_state)(unsigned char *, config_t *);
static int parse_lineno;
static int parse_which;

static void syntax_error(char *fmt, ...) {
    char buf[8192];
    va_list v;

    sprintf(buf, "%s:%i: ", parse_name, parse_lineno);
    
    ( v  = (__gnuc_va_list) __builtin_next_arg (  fmt )) ;
    vsprintf(buf + strlen(buf), fmt, v);
    strcat(buf, "\n");
    ((void)0) ;

    output(errors, "syntax-error", buf);
    exit(1);
}

static void expect(unsigned char **p, char c) {
    while (((__libc_attr._ctype_tbl->_class+1)[ **p ] & (0x00000008  | 0x80000000 ) ) ) (*p)++;
    if (**p == 0)
	syntax_error("Expected '%c', found '<end of line>'", c);
    if (**p != c)
	syntax_error("Expected '%c', found '%c'", c, **p);
    (*p)++;
}

typedef struct {
    char *name;
    void (*hook)(file_t *);
} data_hook_list_t;



data_hook_list_t data_hooks[] = {
    { "h2o_smooth",  h2o_smooth  } ,
    { "remove_nh2_cusp",  remove_nh2_cusp  } ,
};



void (*handle_data_hook(char *arg))(file_t *) {
    int i;
    
    for (i = 0; i < sizeof(data_hooks)/sizeof(data_hooks[0]); i++) {
	if (strcmp(arg, data_hooks[i].name) == 0)
	    return data_hooks[i].hook;
    }

    return 0;
}

typedef struct {
    char *name;
    void (*func)(PES_additional_t *, config_t *, PES_t *);
} additional_list_t;



additional_list_t additionals[] = {
    { "nh2_damped_cusp",  nh2_damped_cusp  } 
};



void (*handle_additional(char *arg))(PES_additional_t *, config_t *, PES_t *) {
    int i;
    
    for (i = 0; i < sizeof(additionals)/sizeof(additionals[0]); i++) {
	if (strcmp(arg, additionals[i].name) == 0)
	    return additionals[i].func;
    }

    return 0;
}

void handle_atoms(unsigned char *p, config_t *cf) {
    expect(&p, ':');

    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
    
    if (sscanf((char *)p, "%8s %8s %8s", 
	       cf->atom_name[0], cf->atom_name[1], cf->atom_name[2]) != 3) {
	syntax_error("Expected three atom names");
    }
}

void two_body__data(config_t *cf, unsigned char *p) {
    if (cf->two_body[parse_which].data_fname)
	syntax_error("data file name already specified");
    cf->two_body[parse_which].data_fname = strdup((char *)p);
}

void two_body__data_hook(config_t *cf, unsigned char *p) {
    if (cf->two_body[parse_which].data_hook != 0)
	syntax_error("data hook already specified");
    cf->two_body[parse_which].data_hook = handle_data_hook((char *)p);
    if (cf->two_body[parse_which].data_hook == 0) 
	syntax_error("unrecognized data_hook '%s'", p);
}

void two_body__asymptote(config_t *cf, unsigned char *p) {
    double v;
    char *ep;
    
    v = strtod((char *)p, &ep);
    while (((__libc_attr._ctype_tbl->_class+1)[ *(unsigned char *)ep ] & (0x00000008  | 0x80000000 ) ) ) ep++;
    if (*ep)
	syntax_error("unrecognizable number '%s'", p);

    cf->two_body[parse_which].asymptote = v;
}

q_function_t *parse_qfunc(char *name, unsigned char **extra) {
    if (strcmp(name, "radial") == 0) {
	int n, m, d, z;
	    
	expect(extra, '(');
	if (sscanf((char *)*extra, "%d, %d, %d%n", &n, &m, &d, &z) != 3)
	    syntax_error("expected <order>, <m>, <number of derivatives>");
	(*extra) += z;
	expect(extra, ')');

	return new_rad_qfunc(n, m, d);
    } else
    if (strcmp(name, "angular") == 0) {
	int n, m, d, z;
	    
	expect(extra, '(');
	if (sscanf((char *)*extra, "%d, %d, %d%n", &n, &m, &d, &z) != 3)
	    syntax_error("expected <order>, <m>, <number of derivatives>");
	(*extra) += z;
	expect(extra, ')');

	return new_ang_qfunc(n, m, 0, d);
    } else
    if (strcmp(name, "scaled") == 0) {
	int n, m, d, z;
	double r;
	
	expect(extra, '(');
	if (sscanf((char *)*extra, "%lf, %d, %d, %d%n", &r, &n, &m, &d, &z) != 4)
	    syntax_error("expected <range>, <order>, <m>, <number of derivatives>");
	(*extra) += z;
	expect(extra, ')');

	return new_scaled_ang_qfunc(n, m, 1, r, d);
    } else 
    if (strcmp(name, "angular2") == 0) {
	int n, m, d, z;
	    
	expect(extra, '(');
	if (sscanf((char *)*extra, "%d, %d, %d%n", &n, &m, &d, &z) != 3)
	    syntax_error("expected <order>, <m>, <number of derivatives>");
	(*extra) += z;
	expect(extra, ')');

	return new_ang_qfunc(n, m, 1, d);
    } else
    if (strcmp(name, "c_legendre") == 0) {
	int n, d, z;
	    
	expect(extra, '(');
	if (sscanf((char *)*extra, "%d, %d%n", &n, &d, &z) != 2)
	    syntax_error("expected <order>, <number of derivatives>");
	(*extra) += z;
	expect(extra, ')');

	return new_constrained_legendre_qfunc(n, d);
    } else
    if (strcmp(name, "custom_rad_func") == 0) {
	int d, z;
	
	expect(extra, '(');
	if (sscanf((char *)*extra, "%d%n", &d, &z) != 1)
	    syntax_error("expected <number of derivatives>");
	(*extra) += z;
	expect(extra, ')');
	
	return new_custom_rad_func(d);
    } else {
	syntax_error("unrecognized qfunc '%s'", name);
	return 0; 
    }
}

void two_body__qfunc(config_t *cf, unsigned char *p) {
    char name[256];
    char *q = name;
    q_function_t *qf;
    
    while (isalunum(*p)) *q++ = *p++;
    *q = 0;
    
    qf = parse_qfunc(name, &p);
    
    if (cf->two_body[parse_which].qf)
	syntax_error("qfunc already specified");
    cf->two_body[parse_which].qf = qf;
}

void two_body__columns(config_t *cf, unsigned char *p) {
    int *cols;
    int i;
    
    cols = cf->two_body[parse_which].columns = (  int  *)malloc(( 2 )*sizeof(  int )) ;
    for (i = 0; i < 2; i++) {
	char *end;
	
	while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
	if (*p == 0)
	    syntax_error("missing column number.  2 integers required.");
	cols[i] = strtol((char *)p, &end, 10) - 1;
	if ((unsigned char *)end == p)
	    syntax_error("unrecognizable number '%s'");
	p = (unsigned char *)end;
    }
}

void two_body__automatic(config_t *cf, unsigned char *p) {
    if (strcmp((char *)p, "zz")) {
	cf->two_body[parse_which].automatic = 0;
    } else {
	syntax_error("unrecognized automatic function %s\n", p);
    }
}

struct { char *key; void (*action)(config_t *, unsigned char *); }
two_body_options[] =
{
    { "data", two_body__data },
    { "data_hook", two_body__data_hook },
    { "asymptote", two_body__asymptote },
    { "qfunc", two_body__qfunc },
    { "columns", two_body__columns },
    { "automatic", two_body__automatic },
};

void handle_two_body2_extra(unsigned char *p, config_t *cf) {
    char key[8192];
    char *q;
    int i;
    
    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
    if (*p == 0) {
	parse_state = 0;
	return;
    }

    q = key;
    while (isalunum(*p)) *q++ = *p++;
    *q = 0;

    for (i = 0; i < sizeof(two_body_options)/sizeof(two_body_options[0]); i++) {
	if (strcmp(key, two_body_options[i].key) == 0) {
	    expect(&p, '=');
	    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;

	    (*two_body_options[i].action)(cf, p);
	    return;
	}
    }
    syntax_error("unrecognized two_body option '%s'", key);
}

void handle_two_body_extra(unsigned char *p, config_t *cf) {
    char key[8192];
    char *q;
    int i, j;
    
    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
    if (*p == 0) {
	parse_state = 0;
	return;
    }

    q = key;
    while (isalunum(*p)) *q++ = *p++;
    *q = 0;

    for (i = 0; i < sizeof(two_body_options)/sizeof(two_body_options[0]); i++) {
	if (strcmp(key, two_body_options[i].key) == 0) {
	    expect(&p, '=');
	    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;

	    for (j = 0; j < 3; j++) {
		parse_which = j;
		(*two_body_options[i].action)(cf, p);
	    }
	    return;
	}
    }
    syntax_error("unrecognized two_body option '%s'", key);
}

void handle_three_body_extra(unsigned char *p, config_t *cf) {
    char key[8192];
    char *q;
    int i;
    
    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
    if (*p == 0) {
	parse_state = 0;
	return;
    }

    q = key;
    while (isalunum(*p)) *q++ = *p++;
    *q = 0;
    expect(&p, '=');
    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;

    if (strcmp(key, "JBSBA") == 0) {
	double a, b;
	
	if (sscanf((char *)p, "%lf, %lf", &a, &b) != 2)
	    syntax_error("expected <a>, <b>");
	
	JBSBA_params(a, b);
    } else
    if (strcmp(key, "data_hook") == 0) {
	if (cf->three_body.data_hook != 0)
	    syntax_error("data hook already specified");
	cf->three_body.data_hook = handle_data_hook((char *)p);
	if (cf->three_body.data_hook == 0)
	    syntax_error("unrecognized data_hook '%s'", p);
    } else
    if (strcmp(key, "coeff_savefile") == 0) {
	cf->three_body.savefile = strdup((char *)p);
    } else
    if (strcmp(key, "asymptote") == 0) {
	double v;
	char *ep;
	
	v = strtod((char *)p, &ep);
	while (((__libc_attr._ctype_tbl->_class+1)[ *(unsigned char *)ep ] & (0x00000008  | 0x80000000 ) ) ) ep++;
	if (*ep)
	    syntax_error("unrecognizable number '%s'", p);

	cf->three_body.asymptote = v;
    } else
    if (strcmp(key, "data") == 0) {
	if (cf->three_body.data_fname)
	    syntax_error("data file name already specified");
	cf->three_body.data_fname = strdup((char *)p);
    } else
    if (strcmp(key, "data_coordinates") == 0) {
	if (cf->three_body.data_coords != coord_any)
	    syntax_error("data coordinates already specified");

	cf->three_body.data_coords = parse_coord((char *)p);
	
	if (cf->three_body.data_coords == coord_any)
	    syntax_error("Coordinate system '%s' unrecognized", p);
    } else
    if (strcmp(key, "columns") == 0) {
	cf->three_body.columns = (  int  *)malloc(( 4 )*sizeof(  int )) ;
	for (i = 0; i < 4; i++) {
	    char *end;
	    
	    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
	    if (*p == 0)
		syntax_error("missing column number.  4 integers required.");
	    cf->three_body.columns[i] = strtol((char *)p, &end, 10) - 1;
	    if ((unsigned char *)end == p)
		syntax_error("unrecognizable number '%s'");
	    p = (unsigned char *)end;
	}
    } else 
    if (strcmp(key, "cutoff") == 0) {
	cf->three_body.has_cutoff = 1;
	cf->three_body.cutoff = strtod((char *)p, 0);
    } else
    if (strcmp(key, "additional") == 0) {
	cf->additional = handle_additional((char *)p);
	if (cf->additional == 0)
	    syntax_error("Unrecognized additional '%s'", p);
    } else
    if (strcmp(key, "coordinates") == 0) {
	if (cf->three_body.coords != coord_any)
	    syntax_error("coordinates already specified");

	cf->three_body.coords = parse_coord((char *)p);
	
	if (cf->three_body.coords == coord_any)
	    syntax_error("Coordinate system '%s' unrecognized", p);
    } else
    if (strcmp(key, "qfunc") == 0) {
	if (cf->three_body.qf[0])
	    syntax_error("qfunc already specified");
	for (i = 0; i < 3; i++) {
	    char name[256];
	    char *q = name;

	    while (isalunum(*p)) *q++ = *p++;
	    *q = 0;

	    cf->three_body.qf[i] = parse_qfunc(name, &p);
	    if (i != 2) 
		expect(&p, ',');
	    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
	}
    } else
    if (strcmp(key, "one_body") == 0) {
	double v;
	char *ep;
	
	v = strtod((char *)p, &ep);
	while (((__libc_attr._ctype_tbl->_class+1)[ *(unsigned char *)ep ] & (0x00000008  | 0x80000000 ) ) ) ep++;
	if (*ep)
	    syntax_error("unrecognizable number '%s'", p);

	cf->one_body = v;
    } else {
	syntax_error("unrecognized three_body option '%s'", key);
    }
}

void handle_two_body(unsigned char *p, config_t *cf) {
    int i;
    
    if (*p == '(') {
	char b1[9], b2[9];
	int a1 = -1, a2 = -1, z;
	p++;
	
	if (sscanf((char *)p, "%8[^,], %8[^)]%n", b1, b2, &z) != 2)
	    syntax_error("expected <atom name>, <atom name>");
	p += z;
	expect(&p, ')');
	expect(&p, ':');
	for (i = 0; i < 3; i++) {
	    if (strcmp(b1, cf->atom_name[i]) == 0)
		a1 = i;
	    if (strcmp(b2, cf->atom_name[i]) == 0)
		a2 = i;
	}

	if (a1 == -1) syntax_error("unrecognized atom '%s'", b1);
	if (a2 == -1) syntax_error("unrecognized atom '%s'", b2);

	parse_which = (a1 + a2 - 1);

	parse_state = handle_two_body2_extra;
	cf->two_body[parse_which].present = EXISTS;
    } else {
	expect(&p, ':');
	parse_state = handle_two_body_extra;
	for (i = 0; i < 3; i++)
	    cf->two_body[i].present = EXISTS;
    }
}

void handle_three_body(unsigned char *p, config_t *cf) {
    expect(&p, ':');
    parse_state = handle_three_body_extra;
}

struct keyword { char *keyword; void (*func)(unsigned char *, config_t *); };



static struct keyword keywords[] = {
    { "atoms", handle_atoms  } ,
    { "two_body", handle_two_body  } ,
    { "three_body", handle_three_body  } 
};

int parse_line(char *buf, config_t *cf) {
    char cmd[8192];
    unsigned char *p;
    char *q;
    int i;

    p = (unsigned char *)buf;
    while (((__libc_attr._ctype_tbl->_class+1)[ *p ] & (0x00000008  | 0x80000000 ) ) ) p++;
    q = cmd;
    
    while (isalunum(*p))
	*q++ = *p++;

    *q = 0;
    
    for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); i++) {
	if (strcmp(cmd, keywords[i].keyword) == 0) {
	    keywords[i].func(p, cf);
	    break;
	}
    }

    return (i < sizeof(keywords)/sizeof(keywords[0]));
}

char *get_tb_name(config_t *cf, int i) {
    int a1, a2;
    static char buf[32];

    a1 = (i == 2);
    a2 = 1 + (i != 0);

    sprintf(buf, "%s-%s", cf->atom_name[a1], cf->atom_name[a2]);

    return buf;
}

void validate(config_t *cf) {
    int i;

    if (cf->atom_name[0][0] == 0)
	syntax_error("must specify atom names");
    if (cf->three_body.data_coords == coord_any) 
	syntax_error("must specify data coordinates");
    if (cf->three_body.coords == coord_any) 
	syntax_error("must specify internal coordinates");
    if (cf->three_body.qf[0] == 0)
	syntax_error("must specify three_body qfuncs");
    if (cf->three_body.data_fname == 0)
	syntax_error("must specify data_fname for three_body");
    
    for (i = 0; i < 3; i++) {
	config_two_body_t *c = &cf->two_body[i];
	char *tb_name;

	if (c->present == 0) continue;

	tb_name = get_tb_name(cf, i);

	if (c->qf == 0)
	    syntax_error("must specify qfunc for %s", tb_name);
	if (c->data_fname == 0)
	    syntax_error("must specify data_fname for %s", tb_name);
    }
}

config_t *process_config_file(char *config_fname) {
    FILE *f = fopen(config_fname, "r");
    char buf[8192];
    config_t *cf;
    
    if (f == 0) {
	output(errors, "config-not-found", 
	       "could not open '%s'\n", config_fname);
	exit(1);
    }

    cf = new_config();
    parse_name = config_fname;
    parse_lineno = 1;
    parse_state = 0;
    
    while (fgets(buf, 8192, f)) {
	if (buf[strlen(buf)-1] == '\n')
	    buf[strlen(buf)-1] = 0;
	
	if (buf[0] != '#') {
	    if (parse_state)
		(*parse_state)((unsigned char *)buf, cf);
	    else if (buf[0] != 0 && !parse_line(buf, cf))
		syntax_error("Unrecognized config line: %s\n", buf);
	}
	
	parse_lineno++;
    }
    if (parse_state)
	(*parse_state)("", cf);

    validate(cf);
    
    return cf;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]