-
Notifications
You must be signed in to change notification settings - Fork 9
/
naututil.h
311 lines (281 loc) · 15.1 KB
/
naututil.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
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
/*****************************************************************************
* This is the header file for versions 2.7 of naututil.c and dreadnaut.c. *
* naututil.h. Generated from naututil-h.in by configure.
*****************************************************************************/
/* The parts between the ==== lines are modified by configure when
creating naututil.h out of naututil-h.in. If configure is not being
used, it is necessary to check they are correct.
====================================================================*/
/* Check whether various headers are available */
#define HAVE_ISATTY 1 /* if isatty() is available */
#define HAVE_TIMES 1 /* if times() is available */
#define HAVE_TIME 1 /* if time() is available */
#define HAVE_GETRUSAGE 1 /* if getrusage() is available */
#define HAVE_GETTIMEOFDAY 1 /* if gettimeofday() */
/*==================================================================*/
/*****************************************************************************
* *
* Copyright (1984-2018) Brendan McKay. All rights reserved. *
* Subject to the waivers and disclaimers in nauty.h. *
* *
* CHANGE HISTORY *
* 10-Nov-87 : final changes for version 1.2 *
* 5-Dec-87 : changes for version 1.3 : *
* - added declarations of readinteger() and readstring() *
* - added definition of DEFEXT : default file-name *
* extension for dreadnaut input files *
* 28-Sep-88 : changes for version 1.4 : *
* - added support for PC Turbo C *
* 29-Nov-88 : - added getc macro for AZTEC C on MAC *
* 23-Mar-89 : changes for version 1.5 : *
* - added DREADVERSION macro *
* - added optional ANSI function prototypes *
* - changed file name to naututil.h *
* - moved ALLOCS to nauty.h and defined DYNALLOC *
* 25-Mar-89 : - added declaration of twopaths() *
* 29-Mar-89 : - added declaration of putmapping() *
* 4-Apr-89 : - added declarations of triples, quadruples, adjtriang *
* - only define ERRFILE if not in nauty.h *
* 25-Apr-89 : - added declarations of cellquads,distances,getbigcells *
* 26-Apr-89 : - added declarations of indsets,cliques,cellquins *
* - removed declarations of ptncode and equitable *
* 27-Apr-89 : - added declaration of putquotient *
* 18-Aug-89 : - added new arg to putset, and changed mathon *
* 2-Mar-90 : - added declarations of celltrips, cellcliq, cellind *
* - changed declarations to use EXTPROC *
* 12-Mar-90 : - added changes for Cray version *
* 20-Mar-90 : - added changes for THINK version *
* 27-Mar-90 : - split SYS_MSDOS into SYS_PCMS4 and SYS_PCMS5 *
* 13-Oct-90 : changes for version 1.6 : *
* - changed CPUTIME to use HZ on Unix for times() *
* 14-Oct-90 : - added SYS_APOLLO variant *
* 19-Oct-90 : - changed CPUTIME defs for BSDUNIX to avoid conficting *
* declarations of size_t and ptrdiff_t in gcc *
* 27-Aug-92 : changes for version 1.7 : *
* - added SYS_IBMC variant *
* - removed workaround for bad gcc installation *
* 5-Jun-93 : changes for version 1.8 : *
* - changed CRAY version of CPUTIME to use CLK_TCK *
* if HZ could not be found (making 1.7+) *
* 30-Jul-93 : - added SYS_ALPHA variant *
* 17-Sep-93 : changes for version 1.9 : *
* - declared adjacencies() *
* 24-Feb-94 : changes for version 1.10 : *
* - added version SYS_AMIGAAZT (making 1.9+) *
* 19-Apr-95 : - added C++ prototype wrapper *
* 6-Mar-96 : - added SYS_ALPHA32 code *
* 23-Jul-96 : changes for version 2.0 : *
* - changed readstring() declaration *
* - removed DYNALLOC definition *
* - added sublabel() definition *
* 15-Aug-96 : - added sethash() definition *
* 30-Aug-96 : - added KRAN and D. Knuth routines *
* 16-Sep-96 : - fixed the above! *
* 7-Feb-96 : - declared nautinv_null() and setnbhd() *
* 4-Sep-97 : - arg of time() is type time_t*, was long* *
* 22-Sep-97 : - defined fileno() and time_t for SYS_PCTURBO *
* 10-Dec-97 : - revised KRAN for new rng.c from Knuth *
* 18-Feb-98 : - changed time() to time_t for Unix *
* 21-Oct-98 : - changed short to shortish as needed *
* 9-Jan-00 : - declared nautinv_check() and naututil_check() *
* 16-Nov-00 : - applied changes logged in nauty.h *
* 22-Apr-01 : changes for version 2.1 : *
* - prototypes for nautinv.c are now in nautinv.h *
* - CPUTIME for UNIX uses CLK_TCK (needs revision!) *
* 2-Jun-01 : - prototype for converse() *
* 18-Oct-01 : - complete revision; sysdeps in separate files *
* 28-Aug-02 : changes for version 2.2 : *
* - revised for autoconf *
* 17-Nov-02 : added explicit "extern" where it was implicit before *
* 11-Apr-02 : added rangraph2() *
* 10-Sep-07 : Define CPUTIME=0.0 for hosts that don't provide it *
* 4-Nov-09 : added readgraph_sg(), putgraph_sg(), putcanon_sg() *
* 10-Nov-09 : removed types shortish and permutation *
* 14-Nov-09 : added relabel_sg(), copy_sg(), putdegs_sg(), *
* sublabel_sg() *
* 19-Nov-09 : added individualise() *
* 20-Nov-09 : added hashgraph_sg(), listhash(), hashgraph() *
* 19-Dec-09 : added ranreg(), rangraph2_sg() *
* 5-Jun-10 : added mathon_sg() and converse_sg() *
* 10-Jun-10 : added putquotient_sg() and complement_sg() *
* 15-Jan-12 : added TLS_ATTR to static declarations *
* 3-Mar-12 : added putorbitsplus() and putset_firstbold() *
* 17-Mar-12 : include naurng.h and remove redundant lines *
* 1-Nov-15 : changes for version 2.6 : *
* - prototypes for putdegseq(), putdegseq_sg() *
* 17-Dec-15 : prototype for readgraph_swg() *
* 6-Apr-16 : prototype for countcells() *
* 27-Aug-16 : added REALTIMEDEFS and NAUTYREALTIME *
* *
* ++++++ This file is automatically generated, don't edit it by hand! ++++++
* *
*****************************************************************************/
#include "nauty.h" /* which includes stdio.h */
#include "nausparse.h"
#include "naurng.h"
/* At this point we can assume that <sys/types.h>, <unistd.h>, <stddef.h>,
<stdlib.h>, <string.h> or <strings.h> and <malloc.h> if necessary have
been included if they exist. */
#ifdef __cplusplus
extern "C" {
#endif
extern void complement(graph*,int,int);
extern void converse(graph*,int,int);
extern void converse_sg(sparsegraph*, sparsegraph*);
extern void copycomment(FILE*,FILE*,int);
extern void complement_sg(sparsegraph*, sparsegraph*);
extern int countcells(int*,int,int);
extern void flushline(FILE*);
extern void fixit(int*,int*,int*,int,int);
extern int getint(FILE*);
extern int getint_sl(FILE*);
extern long hash(set*,long,int);
extern long hashgraph(graph*,int,int,long);
extern long hashgraph_sg(sparsegraph*,long);
extern void individualise(int*,int*,int,int,int*,int*,int);
extern long listhash(int*,int,long);
extern void mathon(graph*,int,int,graph*,int,int);
extern void mathon_sg(sparsegraph*,sparsegraph*);
extern void naututil_check(int,int,int,int);
extern void naututil_freedyn(void);
extern void putcanon(FILE*,int*,graph*,int,int,int);
extern void putcanon_sg(FILE*,int*,sparsegraph*,int);
extern void putdegs(FILE*,graph*,int,int,int);
extern void putdegs_sg(FILE*,sparsegraph*,int);
extern void putdegseq(FILE*,graph*,int,int,int);
extern void putdegseq_sg(FILE*,sparsegraph*,int);
extern void putgraph(FILE*,graph*,int,int,int);
extern void putgraph_sg(FILE*,sparsegraph*,int);
extern void putmapping(FILE*,int*,int,int*,int,int,int);
extern void putorbits(FILE*,int*,int,int);
extern void putorbitsplus(FILE*,int*,int,int);
extern void putptn(FILE*,int*,int*,int,int,int);
extern void putquotient(FILE*,graph*,int*,int*,int,int,int,int);
extern void putquotient_sg(FILE*,sparsegraph*,int*,int*,int,int);
extern void putset(FILE*,set*,int*,int,int,boolean);
extern void putset_firstbold(FILE*,set*,int*,int,int,boolean);
extern void rangraph(graph*,boolean,int,int,int);
extern void rangraph2(graph*,boolean,int,int,int,int);
extern void rangraph2_sg(sparsegraph*,boolean,int,int,int);
extern void ranreg_sg(sparsegraph *sg, int degree, int n);
extern void ranperm(int*,int);
extern void readgraph(FILE*,graph*,boolean,boolean,boolean,int,int,int);
extern void readgraph_sg(FILE*,sparsegraph*,boolean,boolean,int,int);
extern void readgraph_swg(FILE*,sparsegraph*,boolean,boolean,int,int);
extern boolean readinteger(FILE*,int*);
extern boolean readinteger_sl(FILE*,int*);
extern void readperm(FILE*,int*,boolean,int);
extern void readptn(FILE*,int*,int*,int*,boolean,int);
extern void readvperm(FILE*,int*,boolean,int,int*);
extern boolean readstring(FILE*,char*,int);
extern void relabel(graph*,int*,int*,graph*,int,int);
extern void relabel_sg(sparsegraph*,int*,int*,sparsegraph*);
extern long sethash(set*,int,long,int);
extern int setinter(set*,set*,int);
extern int setsize(set*,int);
extern void sublabel(graph*,int*,int,graph*,int,int);
extern void sublabel_sg(sparsegraph*,int*,int,sparsegraph*);
extern int subpartition(int*,int*,int,int*,int);
extern void unitptn(int*,int*,int*,int);
#ifdef __cplusplus
}
#endif
#define MAXREG 8 /* Used to limit ranreg_sg() degree */
#define PROMPTFILE stdout /* where to write prompts */
#ifndef ERRFILE
#define ERRFILE stderr /* where to write error messages */
#endif
#define MAXIFILES 10 /* how many input files can be open at once */
#define EXIT exit(0) /* how to stop normally */
#define DEFEXT ".dre" /* extension for dreadnaut files */
/*************************************************************************
The following macros may represent differences between system. This
file contains the UNIX/POSIX editions. For other systems, a separate
file of definitions is read in first. That file should define the
variables NAUTY_*_DEFINED for sections that are to replace the UNIX
versions. See the provided examples for more details.
If your system does not have a predefined macro you can use to cause
a definitions file to be read, you have to make up one and arrange for
it to be defined when this file is read.
The system-dependent files can also redefine the macros just ahead of
this comment.
**************************************************************************/
#ifdef __weirdmachine__
#include "weird.h" /* Some weird machine (ILLUSTRATION ONLY) */
#endif
/*************************************************************************/
#ifndef NAUTY_PROMPT_DEFINED
#if HAVE_ISATTY
#define DOPROMPT(fp) (isatty(fileno(fp)) && isatty(fileno(PROMPTFILE)))
#else
#define DOPROMPT(fp) (curfile==0)
#endif
#endif /*NAUTY_PROMPT_DEFINED*/
/*************************************************************************/
#ifndef NAUTY_OPEN_DEFINED
#define OPENOUT(fp,name,append) fp = fopen(name,(append)?"a":"w")
#endif /*NAUTY_OPEN_DEFINED*/
/*************************************************************************/
#ifndef NAUTY_CPU_DEFINED
#if HAVE_TIMES
#include <sys/times.h>
#define CPUDEFS static TLS_ATTR struct tms timebuffer;
#ifndef CLK_TCK
#include <time.h>
#endif
#if !defined(CLK_TCK) && defined(_SC_CLK_TCK)
#define CLK_TCK sysconf(_SC_CLK_TCK)
#endif
#ifndef CLK_TCK
#define CLK_TCK 60
#endif
#define CPUTIME (times(&timebuffer),\
(double)(timebuffer.tms_utime + timebuffer.tms_stime) / CLK_TCK)
#else
#if HAVE_GETRUSAGE
#include <sys/time.h>
#include <sys/resource.h>
#define CPUDEFS struct rusage ruse;
#define CPUTIME (getrusage(RUSAGE_SELF,&ruse),\
ruse.ru_utime.tv_sec + ruse.ru_stime.tv_sec + \
1e-6 * (ruse.ru_utime.tv_usec + ruse.ru_stime.tv_usec))
#endif
#endif
#ifndef CPUTIME
#define CPUTIME 0.0
#endif
#endif /*NAUTY_CPU_DEFINED*/
/*************************************************************************/
#ifndef NAUTY_SEED_DEFINED
#if HAVE_GETTIMEOFDAY
#include <sys/time.h>
#define INITSEED \
{struct timeval nauty_tv; \
gettimeofday(&nauty_tv,NULL); \
seed = ((nauty_tv.tv_sec<<10) + (nauty_tv.tv_usec>>10)) & 0x7FFFFFFFL;}
#else
#if HAVE_TIME
#include <time.h>
#define INITSEED seed = ((time((time_t*)NULL)<<1) | 1) & 0x7FFFFFFFL
#endif
#endif
#endif /*NAUTY_SEED_DEFINED*/
/*************************************************************************/
#ifndef NAUTY_REALTIME_DEFINED
#if HAVE_GETTIMEOFDAY
#include <sys/time.h>
#define REALTIMEDEFS struct timeval nauty_rtv;
#define NAUTYREALTIME (gettimeofday(&nauty_rtv,NULL), \
(double)(nauty_rtv.tv_sec + 1e-6 * nauty_rtv.tv_usec))
#else
#if HAVE_TIME
#include <time.h>
#define REALTIMEDEFS
#define NAUTYREALTIME ((double)time(NULL))
#endif
#endif
#ifndef NAUTYREALTIME
#define NAUTYREALTIME 0.0
#endif
#endif /*NAUTY_REALTIME_DEFINED*/
/* ++++++ This file is automatically generated, don't edit it by hand! ++++++ */