ObjFW  Check-in [3cba61d694]

Overview
Comment:Make sockets work on MorphOS + libnix
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3cba61d6947d893874ce6041cb0178e8a78af1cee988388c6e96fbbbea731f5a
User & Date: js on 2017-06-03 16:58:46
Other Links: manifest | tags
Context
2017-06-03
18:37
Properly check for sys/types.h check-in: 4ec0948b1b user: js tags: trunk
16:58
Make sockets work on MorphOS + libnix check-in: 3cba61d694 user: js tags: trunk
16:19
configure: Force-enable files on MorphOS + libnix check-in: a497302c08 user: js tags: trunk
Changes

Modified src/OFFile.h from [770e6d77e6] to [ff0fc01320].

15
16
17
18
19
20
21


22
23
24
25
26
27
28
29
 */

#import "OFSeekableStream.h"

OF_ASSUME_NONNULL_BEGIN

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)


typedef long BPTR;
#endif

/*!
 * @class OFFile OFFile.h ObjFW/OFFile.h
 *
 * @brief A class which provides methods to read and write files.
 */







>
>
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 */

#import "OFSeekableStream.h"

OF_ASSUME_NONNULL_BEGIN

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
#endif

/*!
 * @class OFFile OFFile.h ObjFW/OFFile.h
 *
 * @brief A class which provides methods to read and write files.
 */

Modified src/OFFile.m from [bdbdd5f20c] to [c22a9c9657].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#import "OFSeekFailedException.h"
#import "OFWriteFailedException.h"

#ifdef OF_WINDOWS
# include <windows.h>
#endif

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
#endif

#ifdef OF_WII
# define BOOL OGC_BOOL
# include <fat.h>
# undef BOOL
#endif

#ifdef OF_NINTENDO_DS







<
<
<
<
<
<







39
40
41
42
43
44
45






46
47
48
49
50
51
52
#import "OFSeekFailedException.h"
#import "OFWriteFailedException.h"

#ifdef OF_WINDOWS
# include <windows.h>
#endif







#ifdef OF_WII
# define BOOL OGC_BOOL
# include <fat.h>
# undef BOOL
#endif

#ifdef OF_NINTENDO_DS

Modified src/OFStdIOStream.h from [20df83b805] to [d62ed4da32].

15
16
17
18
19
20
21


22
23
24
25
26
27
28
29
 */

#import "OFStream.h"

OF_ASSUME_NONNULL_BEGIN

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)


typedef long BPTR;
#endif

/*!
 * @class OFStdIOStream OFStdIOStream.h ObjFW/OFStdIOStream.h
 *
 * @brief A class for providing standard input, output and error as OFStream.
 *







>
>
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 */

#import "OFStream.h"

OF_ASSUME_NONNULL_BEGIN

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <proto/dos.h>
# undef BOOL
#endif

/*!
 * @class OFStdIOStream OFStdIOStream.h ObjFW/OFStdIOStream.h
 *
 * @brief A class for providing standard input, output and error as OFStream.
 *

Modified src/OFStdIOStream.m from [26c295bea1] to [ac607c5f45].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <proto/exec.h>
# include <proto/dos.h>
# undef BOOL
#endif

/* References for static linking */
#ifdef OF_WINDOWS
void
_reference_to_OFStdIOStream_Win32Console(void)







<







38
39
40
41
42
43
44

45
46
47
48
49
50
51
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <proto/exec.h>

# undef BOOL
#endif

/* References for static linking */
#ifdef OF_WINDOWS
void
_reference_to_OFStdIOStream_Win32Console(void)

Modified src/socket.h from [40a01b9a4a] to [a30a66785b].

17
18
19
20
21
22
23
24


25



26



27
28
29
30
31
32
33
#include "objfw-defs.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

#include <stdbool.h>



#ifdef OF_HAVE_SYS_SOCKET_H



# include <sys/socket.h>



#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif








>
>

>
>
>

>
>
>







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
#include "objfw-defs.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

#include <stdbool.h>

#import "platform.h"

#ifdef OF_HAVE_SYS_SOCKET_H
# if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
#  define BOOL EXEC_BOOL
# endif
# include <sys/socket.h>
# if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
#  undef BOOL
# endif
#endif
#ifdef OF_HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
42
43
44
45
46
47
48



49

50
51
52
53
54
55
56
#  endif
# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif

#ifdef OF_MORPHOS



typedef int socklen_t;


struct sockaddr_storage {
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif







>
>
>

>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#  endif
# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif

#ifdef OF_MORPHOS
# ifndef OF_IXEMUL
typedef long socklen_t;
# else
typedef int socklen_t;
#endif

struct sockaddr_storage {
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif

Modified src/socket_helpers.h from [7463dbdf6e] to [f90819336c].

57
58
59
60
61
62
63



64
65
66
67
68
69
70
#endif

#if !defined(OF_WINDOWS) && !defined(OF_WII)
# define closesocket(sock) close(sock)
#endif

#ifdef OF_MORPHOS



typedef uint32_t in_addr_t;
#endif

#ifdef OF_WII
# define accept(sock, addr, addrlen) net_accept(sock, addr, addrlen)
# define bind(sock, addr, addrlen) net_bind(sock, addr, addrlen)
# define closesocket(sock) net_close(sock)







>
>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#endif

#if !defined(OF_WINDOWS) && !defined(OF_WII)
# define closesocket(sock) close(sock)
#endif

#ifdef OF_MORPHOS
# ifndef OF_IXEMUL
#  define hstrerror(err) "unknown (no hstrerror)"
# endif
typedef uint32_t in_addr_t;
#endif

#ifdef OF_WII
# define accept(sock, addr, addrlen) net_accept(sock, addr, addrlen)
# define bind(sock, addr, addrlen) net_bind(sock, addr, addrlen)
# define closesocket(sock) net_close(sock)