Browse Source

Clean up the way windows headers are included

Plus make inclusion order a little more consistent in general
v0.7.4-release
Bert Belder 14 years ago
parent
commit
e0f47be9d0
  1. 15
      src/node.cc
  2. 14
      src/node_buffer.cc
  3. 3
      src/node_child_process.h
  4. 12
      src/node_child_process_win32.cc
  5. 4
      src/node_constants.cc
  6. 2
      src/node_file.cc
  7. 22
      src/node_net.cc
  8. 16
      src/node_os.cc
  9. 8
      src/node_stdio_win32.cc
  10. 12
      src/platform_win32.cc
  11. 37
      src/platform_win32.h
  12. 6
      src/platform_win32_winsock.cc
  13. 9
      src/platform_win32_winsock.h

15
src/node.cc

@ -1,8 +1,10 @@
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org> // Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#include <node.h> #include <node.h>
#include <locale.h> #include <v8-debug.h>
#include <locale.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <strings.h>
@ -14,17 +16,18 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> /* setuid, getuid */ #include <unistd.h> /* setuid, getuid */
#include "platform.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
# include <platform_win32.h> /* winapi_perror() */ # include <platform_win32.h> /* winapi_perror() */
# include <platform_win32_winsock.h> /* wsa_init() */ # include <platform_win32_winsock.h> /* wsa_init() */
#else // __POSIX__ #endif
#ifdef __POSIX__
# include <dlfcn.h> /* dlopen(), dlsym() */ # include <dlfcn.h> /* dlopen(), dlsym() */
# include <pwd.h> /* getpwnam() */ # include <pwd.h> /* getpwnam() */
# include <grp.h> /* getgrnam() */ # include <grp.h> /* getgrnam() */
#endif #endif
#include <platform.h>
#include <node_buffer.h> #include <node_buffer.h>
#include <node_io_watcher.h> #include <node_io_watcher.h>
#include <node_net.h> #include <node_net.h>
@ -45,12 +48,10 @@
#include <node_javascript.h> #include <node_javascript.h>
#include <node_version.h> #include <node_version.h>
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
#include <node_crypto.h> # include <node_crypto.h>
#endif #endif
#include <node_script.h> #include <node_script.h>
#include <v8-debug.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
using namespace v8; using namespace v8;

14
src/node_buffer.cc

@ -1,18 +1,22 @@
#include <node.h>
#include <node_buffer.h> #include <node_buffer.h>
#include <assert.h>
#include <stdlib.h> // malloc, free
#include <v8.h> #include <v8.h>
#include <assert.h>
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy #include <string.h> // memcpy
#ifdef __MINGW32__ #ifdef __MINGW32__
# include <winsock2.h> // htons, htonl # include <platform.h>
#else // __POSIX__ # include <platform_win32_winsock.h> // htons, htonl
#endif
#ifdef __POSIX__
# include <arpa/inet.h> // htons, htonl # include <arpa/inet.h> // htons, htonl
#endif #endif
#include <node.h>
#define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b))

3
src/node_child_process.h

@ -4,11 +4,12 @@
#include <node.h> #include <node.h>
#include <node_object_wrap.h> #include <node_object_wrap.h>
#include <v8.h> #include <v8.h>
#include <ev.h> #include <ev.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
# include <windows.h> // HANDLE type # include <platform_win32.h> // HANDLE type
#endif #endif
// ChildProcess is a thin wrapper around ev_child. It has the extra // ChildProcess is a thin wrapper around ev_child. It has the extra

12
src/node_child_process_win32.cc

@ -1,16 +1,6 @@
// RegisterWaitForSingleObject requires Windows 2000,
// GetProcessId requires windows XP SP1
#define _WIN32_WINNT 0x0501
#include <node.h> #include <node.h>
#include <node_child_process.h> #include <node_child_process.h>
#include <platform_win32.h>
#include <platform_win32_winsock.h>
#include <windows.h>
#include <winsock.h>
#include <v8.h> #include <v8.h>
#include <ev.h> #include <ev.h>
@ -23,6 +13,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <platform_win32.h>
#include <platform_win32_winsock.h>
namespace node { namespace node {

4
src/node_constants.cc

@ -1,6 +1,8 @@
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org> // Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#include <node_constants.h> #include <node_constants.h>
#include <ev.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@ -8,8 +10,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ev.h>
namespace node { namespace node {
using namespace v8; using namespace v8;

2
src/node_file.cc

@ -16,7 +16,7 @@
#include <limits.h> #include <limits.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#include <windows.h> # include <platform_win32.h>
#endif #endif
/* used for readlink, AIX doesn't provide it */ /* used for readlink, AIX doesn't provide it */

22
src/node_net.cc

@ -1,9 +1,11 @@
#include <node_net.h>
#include <v8.h>
#include <node.h> #include <node.h>
#include <node_buffer.h> #include <node_buffer.h>
#include <node_net.h>
#include <v8.h>
#include <errno.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -12,16 +14,15 @@
#include <fcntl.h> #include <fcntl.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
# include <winsock2.h> # include <platform_win32.h>
# include <ws2tcpip.h> # include <platform_win32_winsock.h>
#endif
#else // __POSIX__ #ifdef __POSIX__
# include <sys/ioctl.h> # include <sys/ioctl.h>
# include <sys/socket.h> # include <sys/socket.h>
# include <sys/un.h> # include <sys/un.h>
# include <arpa/inet.h> /* inet_pton */ # include <arpa/inet.h> /* inet_pton */
# include <netdb.h> # include <netdb.h>
# include <netinet/in.h> # include <netinet/in.h>
# include <netinet/tcp.h> # include <netinet/tcp.h>
@ -30,15 +31,14 @@
#ifdef __linux__ #ifdef __linux__
# include <linux/sockios.h> /* For the SIOCINQ / FIONREAD ioctl */ # include <linux/sockios.h> /* For the SIOCINQ / FIONREAD ioctl */
#endif #endif
/* Non-linux platforms like OS X define this ioctl elsewhere */ /* Non-linux platforms like OS X define this ioctl elsewhere */
#ifndef FIONREAD #ifndef FIONREAD
#include <sys/filio.h> # include <sys/filio.h>
#endif #endif
#include <errno.h>
#ifdef __OpenBSD__ #ifdef __OpenBSD__
#include <sys/uio.h> # include <sys/uio.h>
#endif #endif
/* /*

16
src/node_os.cc

@ -1,20 +1,22 @@
#include <node_os.h>
#include <node.h> #include <node.h>
#include <v8.h> #include <node_os.h>
#include <platform.h>
#include "platform.h" #include <v8.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#ifdef __MINGW32__
# include <platform_win32.h>
# include <platform_win32_winsock.h>
#endif
#ifdef __POSIX__ #ifdef __POSIX__
# include <unistd.h> // gethostname, sysconf # include <unistd.h> // gethostname, sysconf
# include <sys/utsname.h> # include <sys/utsname.h>
#else // __MINGW32__ #endif
# include <windows.h> // GetVersionEx
# include <winsock2.h> // gethostname
#endif // __MINGW32__
namespace node { namespace node {

8
src/node_stdio_win32.cc

@ -1,9 +1,13 @@
#include <io.h>
#include <node.h> #include <node.h>
#include <node_stdio.h> #include <node_stdio.h>
#include <platform_win32.h>
#include <v8.h> #include <v8.h>
#include <errno.h>
#include <io.h>
#include <platform_win32.h>
using namespace v8; using namespace v8;
namespace node { namespace node {

12
src/platform_win32.cc

@ -1,15 +1,17 @@
#include "node.h"
#include "platform.h" #include <node.h>
#include "platform_win32.h" #include <platform.h>
#include <v8.h> #include <v8.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include <sys/param.h> // for MAXPATHLEN #include <sys/param.h> // for MAXPATHLEN
#include <unistd.h> // getpagesize #include <unistd.h> // getpagesize
#include <windows.h>
#include "platform_win32_winsock.cc" #include <platform_win32.h>
#include <platform_win32_winsock.cc>
namespace node { namespace node {

37
src/platform_win32.h

@ -1,9 +1,41 @@
#ifndef NODE_PLATFORM_WIN32_H_ #ifndef NODE_PLATFORM_WIN32_H_
#define NODE_PLATFORM_WIN32_H_ #define NODE_PLATFORM_WIN32_H_
#include <windows.h> // Require at least Windows XP SP1
// (GetProcessId requires it)
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0501
#endif
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN // implies NOCRYPT and NOGDI.
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
#ifndef NOKERNEL
# define NOKERNEL
#endif
#ifndef NOUSER
# define NOUSER
#endif
#ifndef NOSERVICE
# define NOSERVICE
#endif
#ifndef NOSOUND
# define NOSOUND
#endif
#ifndef NOMCX
# define NOMCX
#endif
#include <windows.h>
namespace node { namespace node {
@ -14,4 +46,5 @@ void winapi_perror(const char* prefix);
} }
#endif // NODE_PLATFORM_WIN32_H_ #endif // NODE_PLATFORM_WIN32_H_

6
src/platform_win32_winsock.cc

@ -7,14 +7,8 @@
*/ */
#include <windows.h>
#include <winsock2.h>
#include <mswsock.h>
#include <ws2tcpip.h>
#include <ws2spi.h>
#include <platform_win32_winsock.h> #include <platform_win32_winsock.h>
namespace node { namespace node {

9
src/platform_win32_winsock.h

@ -1,11 +1,14 @@
#ifndef NODE_PLATFORM_WIN32_WINSOCK_H_ #ifndef NODE_PLATFORM_WIN32_WINSOCK_H_
#define NODE_PLATFORM_WIN32_WINSOCK_H_ #define NODE_PLATFORM_WIN32_WINSOCK_H_
#include <windows.h> #include <platform_win32.h>
#include <winsock.h>
namespace node { #include <winsock2.h>
#include <mswsock.h>
#include <ws2tcpip.h>
#include <ws2spi.h>
namespace node {
void wsa_init(); void wsa_init();

Loading…
Cancel
Save