scide: refactor ide/language handshake
[supercollider.git] / include / common / SC_Endian.h
blobbe3d47ab57eb8289af50369d0e7d086feeee81f8
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 /* NOTE: This file should declare/define the following functions/macros:
23 htonl
24 htons
25 ntohl
26 ntohs
28 either explicitly or implicitly by including system headers.
31 #ifndef SC_ENDIAN_H_INCLUDED
32 #define SC_ENDIAN_H_INCLUDED
34 #if defined(__APPLE__)
36 # include <machine/endian.h>
38 #elif defined(__FreeBSD__)
40 # include <machine/endian.h>
41 # include <netinet/in.h>
43 #elif defined(_WIN32)
45 # define LITTLE_ENDIAN 1234
46 # define BIG_ENDIAN 4321
47 # define BYTE_ORDER LITTLE_ENDIAN
48 # include <winsock2.h>
49 # undef IN
50 # undef OUT
52 #elif defined(__linux__)
54 # include <endian.h>
55 # include <netinet/in.h>
57 #else
59 # error cannot find endianess on this platform
61 #endif
63 #ifndef BYTE_ORDER
64 # error BYTE_ORDER undefined, check __FILE__
65 #endif // BYTE_ORDER
67 #ifndef BIG_ENDIAN
68 # error BIG_ENDIAN undefined, check __FILE__
69 #endif // BIG_ENDIAN
71 #ifndef LITTLE_ENDIAN
72 # error LITTLE_ENDIAN undefined, check __FILE__
73 #endif // LITTLE_ENDIAN
75 #endif // SC_ENDIAN_H_INCLUDED