ReactOS  0.4.12-dev-432-g3463b2d
reactos_support_code.h
Go to the documentation of this file.
1 #ifndef _REACTOS_SUPPORT_CODE_H
2 #define _REACTOS_SUPPORT_CODE_H
3 
4 #include <stdarg.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 
9 #ifdef _WIN32
10 #include <malloc.h>
11 #include <windows.h>
12 #else
13 #include <alloca.h>
14 #include <unistd.h>
15 #endif
16 
17 // isotypes.h would provide these, but it's not available on MSVC < 2013.
18 typedef unsigned char uint8_t;
19 typedef unsigned short uint16_t;
20 typedef unsigned int uint32_t;
21 typedef unsigned long long uint64_t;
22 
23 void isohybrid_error(int eval, const char* fmt, ...);
24 void isohybrid_warning(const char* fmt, ...);
25 
26 #define err(...) isohybrid_error(__VA_ARGS__)
27 #define errx(...) isohybrid_error(__VA_ARGS__)
28 #define warn(...) isohybrid_warning(__VA_ARGS__)
29 #define warnx(...) isohybrid_warning(__VA_ARGS__)
30 
31 
33 // getopt code from mingw-w64
35 extern int optopt; /* single option character, as parsed */
36 extern char *optarg; /* pointer to argument of current option */
37 
38 struct option /* specification for a long form option... */
39 {
40  const char *name; /* option name, without leading hyphens */
41  int has_arg; /* does it take an argument? */
42  int *flag; /* where to save its status, or NULL */
43  int val; /* its associated status value */
44 };
45 
46 enum /* permitted values for its `has_arg' field... */
47 {
48  no_argument = 0, /* option never takes an argument */
49  required_argument, /* option always requires an argument */
50  optional_argument /* option may take an argument */
51 };
52 
53 int getopt_long_only(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx);
55 
56 #ifdef _WIN32
57 int fsync(int fd);
58 int getppid(void);
59 #endif
60 
61 #ifdef _MSC_VER
62 #define fseeko _fseeki64
63 #define ftruncate _chsize
64 #endif
65 
66 #endif
unsigned long long uint64_t
int val
Definition: getopt.h:115
void isohybrid_warning(const char *fmt,...)
unsigned int uint32_t
int * flag
Definition: getopt.h:114
unsigned char uint8_t
void isohybrid_error(int eval, const char *fmt,...)
static int fd
Definition: io.c:51
int getopt_long_only(int nargc, char *const *nargv, const char *options, const struct option *long_options, int *idx)
static const struct option long_options[]
Definition: widl.c:174
WCHAR * name
Definition: getopt.h:110
unsigned int idx
Definition: utils.c:41
Definition: getopt.h:108
unsigned short uint16_t
int optopt
Definition: getopt.c:47
char * optarg
Definition: getopt.c:49
int has_arg
Definition: getopt.h:113
Definition: dsound.c:943