1/*****************************************************************************
2* This is the mean header file for gtools.                                   *
3* @configure_input@
4*****************************************************************************/
5
6/* The parts between the ==== lines are modified by configure when
7creating gtools.h out of gtools-h.in.  If configure is not being
8used, it is necessary to check they are correct.
9====================================================================*/
10
11
12#define HAVE_ERRNO_H  @header_errno_h@      /* <errno.h> exists */
13#define HAVE_PERROR  @have_perror@          /* perror() exists */
14#define HAVE_PIPE  @have_pipe@          /* pipe() exists */
15#define HAVE_WAIT  @have_wait@          /* wait() exists */
16#define HAVE_POPEN  @have_popen@          /* popen() and pclose() exist */
17#define POPEN_DEC  @popen_dec@         /* popen() is declared in stdio.h */
18#define FTELL_DEC  @ftell_dec@         /* ftell() is declared in stdio.h */
19#define FDOPEN_DEC  @fdopen_dec@        /* fdopen() is declared in stdio.h */
20#define SORTPROG  "@sort_prog@"         /* name of sort program */
21#define HAVE_PID_T @have_pid_t@    /* pid_t is defined */
22
23/*==================================================================*/
24
25#ifndef MAXN
26#define MAXN  0
27#endif
28#define G6LEN(n)  (((n)*((n)-1)/2+5)/6+(n<=SMALLN?1:4))
29		/* Exact length of graph6 code except for \n\0 */
30
31#include "naututil.h"      /* which includes stdio.h */
32
33#if HAVE_ERRNO_H
34#include <errno.h>
35#else
36extern int errno;
37#endif
38
39#if HAVE_PERROR
40#define ABORT(msg) {if (errno != 0) perror(msg); exit(1);}
41#else
42#define ABORT(msg) {exit(1);}
43#endif
44
45#define BIAS6 63
46#define MAXBYTE 126
47#define SMALLN 62
48#define TOPBIT6 32
49#define C6MASK 63
50
51#define GRAPH6_HEADER ">>graph6<<"
52#define SPARSE6_HEADER ">>sparse6<<"
53
54#define GRAPH6         1
55#define SPARSE6        2
56#define UNKNOWN_TYPE 256
57#define HAS_HEADER   512
58
59#define ARG_OK 0
60#define ARG_MISSING 1
61#define ARG_TOOBIG 2
62#define ARG_ILLEGAL 3
63
64#define MAXARG 2000000000L
65#define NOLIMIT (MAXARG+31L)
66
67#define SWBOOLEAN(c,bool) if (sw==c) bool=TRUE;
68#define SWINT(c,bool,val,id) if (sw==c) \
69        {bool=TRUE;arg_int(&arg,&val,id);}
70#define SWLONG(c,bool,val,id) if (sw==c) \
71        {bool=TRUE;arg_long(&arg,&val,id);}
72#define SWRANGE(c,sep,bool,val1,val2,id) if (sw==c) \
73	{bool=TRUE;arg_range(&arg,sep,&val1,&val2,id);}
74
75#define HELP if (argc > 1 && (strcmp(argv[1],"-help")==0 \
76			   || strcmp(argv[1],"/?")==0 \
77			   || strcmp(argv[1],"--help")==0)) \
78       { printf("\nUsage: %s\n\n%s",USAGE,HELPTEXT); return 0;}
79#define GETHELP \
80fprintf(stderr,"   Use %s -help to see more detailed instructions.\n",argv[0])
81
82#define alloc_error gt_abort
83
84/************************************************************************/
85
86
87#ifdef __cplusplus
88extern "C" {
89#endif
90
91extern FILE *opengraphfile(char*,int*,boolean,long);
92extern void writeline(FILE*,char*);
93extern char *getline(FILE*);
94extern int graphsize(char*);
95extern void stringtograph(char*,graph*,int);
96extern graph *readg(FILE*,graph*,int,int*,int*);
97extern char *ntog6(graph*,int,int);
98extern char *ntos6(graph*,int,int);
99extern void writeg6(FILE*,graph*,int,int);
100extern void writes6(FILE*,graph*,int,int);
101extern void writelast(FILE*);
102extern int longval(char**,long*);
103extern void arg_int(char**,int*,char*);
104extern void arg_long(char**,long*,char*);
105extern void arg_range(char**,char*,long*,long*,char*);
106extern void writerange(FILE*,int,long,long);
107extern void gt_abort(char*);
108extern char *stringcopy(char*);
109extern boolean strhaschar(char*,int);
110
111extern void fcanonise(graph*,int,int,graph*,char*);
112extern void fcanonise_inv
113             (graph*,int,int,graph*,char*,void(*)(graph*,int*,int*,int,
114               int,int,permutation*,int,boolean,int,int),int,int,int);
115extern void fgroup(graph*,int,int,char*,int*,int*);
116extern void fgroup_inv
117	     (graph*,int,int,char*,int*,int*,void(*)(graph*,int*,int*,int,
118                int,int,permutation*,int,boolean,int,int),int,int,int);
119extern int istransitive(graph*,int,int,graph*);
120extern void tg_canonise(graph*,graph*,int,int);
121
122extern int readg_code;
123extern char *readg_line;
124extern long ogf_linelen;
125extern boolean is_pipe;
126
127#ifdef __cplusplus
128}
129#endif
130
131#ifdef CPUDEFS
132CPUDEFS
133#endif
134