forked from usnistgov/trec_eval
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sysfunc.h
62 lines (56 loc) · 1.58 KB
/
sysfunc.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
/*
Copyright (c) 2008 - Chris Buckley.
Permission is granted for use and modification of this file for
research, non-commercial purposes.
*/
#ifndef SYSFUNCH
#define SYSFUNCH
/* Declarations of major functions within standard C libraries */
/* Once all of the major systems get their act together (and I follow
suit!), this file should just include system header files from
/usr/include. Until then... */
#if defined(_WIN32) || defined(_WIN64)
#include "windows/unistd.h"
#else
#include <unistd.h>
#endif
#include <limits.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
#include <sys/stat.h>
#if defined(_WIN32) || defined(_WIN64)
#include "windows/mman.h"
#include "windows/ya_getopt.h"
#else
#include <sys/mman.h>
#include <getopt.h>
#endif
/* see http://stackoverflow.com/questions/33058014/trec-eval-make-error-using-cygwin/34927338 */
#ifdef __CYGWIN__
#undef log2
#endif
/* For time being, define Berkeley constructs in terms of SVR4 constructs*/
#ifndef bzero
#define bzero(dest,len) memset(dest,'\0',len)
#endif
#ifndef bcopy
#define bcopy(source,dest,len) memcpy(dest,source,len)
#endif
#define srandom(seed) srand(seed)
#define random() rand()
/* ANSI should give us an offsetof suitable for the implementation;
* otherwise, try a non-portable but commonly supported definition
*/
#ifdef __STDC__
#include <stddef.h>
#endif
#ifndef offsetof
#define offsetof(type, member) ((size_t) \
((char *)&((type*)0)->member - (char *)(type *)0))
#endif
#endif /* SYSFUNCH */