ObjFW  Check-in [cb450cb1bd]

Overview
Comment:Include unistd.h on MorphOS + libnix

It turns out that including unistd.h does work when defining BOOL to
something else.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cb450cb1bd65c544c2f09a764db11bf058a461ee5c7e25389bb8ef28b3c78acb
User & Date: js on 2017-06-03 15:03:27
Other Links: manifest | tags
Context
2017-06-03
15:57
-[OFApplication environment] for MorphOS + libnix check-in: 6d0a185364 user: js tags: trunk
15:03
Include unistd.h on MorphOS + libnix check-in: cb450cb1bd user: js tags: trunk
14:37
OFFileManager: Mask modes to ensure safe modes check-in: 4175b93242 user: js tags: trunk
Changes

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

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
# define BOOL EXEC_BOOL
# include <exec/execbase.h>
# include <proto/dos.h>
# undef BOOL
# define getpid() ((int)SysBase->ThisTask)
extern struct ExecBase *SysBase;
#endif

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







|


<
<







37
38
39
40
41
42
43
44
45
46


47
48
49
50
51
52
53

#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)
{
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
# if !defined(OF_MORPHOS) || defined(OF_IXEMUL)
	of_stdin = [[OFStdIOStream alloc] of_initWithFileDescriptor: 0];
	of_stdout = [[OFStdIOStream alloc] of_initWithFileDescriptor: 1];
	of_stderr = [[OFStdIOStream alloc] of_initWithFileDescriptor: 2];
# else
	BPTR input = Input(), output = Output();
	BPTR error = ((struct Process *)SysBase->ThisTask)->pr_CES;
	bool inputClosable = false, outputClosable = false,
	    errorClosable = false;

	if (input == 0) {
		input = Open("*", MODE_OLDFILE);
		inputClosable = true;
	}







|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
# if !defined(OF_MORPHOS) || defined(OF_IXEMUL)
	of_stdin = [[OFStdIOStream alloc] of_initWithFileDescriptor: 0];
	of_stdout = [[OFStdIOStream alloc] of_initWithFileDescriptor: 1];
	of_stderr = [[OFStdIOStream alloc] of_initWithFileDescriptor: 2];
# else
	BPTR input = Input(), output = Output();
	BPTR error = ((struct Process *)FindTask(NULL))->pr_CES;
	bool inputClosable = false, outputClosable = false,
	    errorClosable = false;

	if (input == 0) {
		input = Open("*", MODE_OLDFILE);
		inputClosable = true;
	}

Modified src/unistd_wrapper.h from [892d1c3341] to [33a8d48723].

15
16
17
18
19
20
21






22
23
24
25
26
27
28
29
30

#include "config.h"

#include <stdlib.h>	/* Make sure we have any libc include */

#import "platform.h"







#if defined(HAVE_UNISTD_H) && (!defined(OF_MORPHOS) || defined(OF_IXEMUL))
# ifdef __GLIBC__
#  undef __USE_XOPEN	/* Needed to avoid old glibc using __block */
# endif
# include <unistd.h>
# ifdef __GLIBC__
#  define __USE_XOPEN 1
# endif
#endif







>
>
>
>
>
>
|








15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#include "config.h"

#include <stdlib.h>	/* Make sure we have any libc include */

#import "platform.h"

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

#if defined(HAVE_UNISTD_H)
# ifdef __GLIBC__
#  undef __USE_XOPEN	/* Needed to avoid old glibc using __block */
# endif
# include <unistd.h>
# ifdef __GLIBC__
#  define __USE_XOPEN 1
# endif
#endif