ObjFW  Check-in [a68265627e]

Overview
Comment:Fix compilation for AmigaOS 4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a68265627eb65ec4c61a93d993bf1d14f40dcf30918334c082a562d5483e6510
User & Date: js on 2020-12-20 14:04:58
Other Links: manifest | tags
Context
2020-12-20
15:07
runtime: Fix missing _Nonnull check-in: d70b6cca02 user: js tags: trunk
14:04
Fix compilation for AmigaOS 4 check-in: a68265627e user: js tags: trunk
13:49
Clean up a few defines check-in: d3fb77eb9c user: js tags: trunk
Changes

Modified src/OFFileURLHandler.m from [9e0a7e3741] to [529682cb40].

714
715
716
717
718
719
720




721
722

723
724
725
726
727
728
729
	modificationTime -= locale->loc_GMTOffset * 60.0;
	CloseLocale(locale);

	date.ds_Days = modificationTime / 86400;
	date.ds_Minute = ((LONG)modificationTime % 86400) / 60;
	date.ds_Tick = fmod(modificationTime, 60) * TICKS_PER_SECOND;





	if (!SetFileDate([path cStringWithEncoding: [OFLocale encoding]],
	    &date) != 0) {

		setErrno();

		@throw [OFSetItemAttributesFailedException
		    exceptionWithURL: URL
			  attributes: attributes
		     failedAttribute: attributeKey
			       errNo: errno];







>
>
>
>


>







714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
	modificationTime -= locale->loc_GMTOffset * 60.0;
	CloseLocale(locale);

	date.ds_Days = modificationTime / 86400;
	date.ds_Minute = ((LONG)modificationTime % 86400) / 60;
	date.ds_Tick = fmod(modificationTime, 60) * TICKS_PER_SECOND;

# ifdef OF_AMIGAOS4
	if (!SetDate([path cStringWithEncoding: [OFLocale encoding]],
	    &date) != 0) {
# else
	if (!SetFileDate([path cStringWithEncoding: [OFLocale encoding]],
	    &date) != 0) {
# endif
		setErrno();

		@throw [OFSetItemAttributesFailedException
		    exceptionWithURL: URL
			  attributes: attributes
		     failedAttribute: attributeKey
			       errNo: errno];

Modified src/runtime/linklib/linklib.m from [9c6b8d5e96] to [aa40a4a4c1].

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
	struct Library *IntuitionBase = OpenLibrary("intuition.library", 0);

	if (IntuitionBase != NULL) {
		struct EasyStruct easy = {
			.es_StructSize = sizeof(easy),
			.es_Flags = 0,
			.es_Title = (UBYTE *)NULL,
			.es_TextFormat = (UBYTE *)string,
			(UBYTE *)"OK"
		};

		EasyRequest(NULL, &easy, NULL, arg);

		CloseLibrary(IntuitionBase);
	}








|
|
|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
	struct Library *IntuitionBase = OpenLibrary("intuition.library", 0);

	if (IntuitionBase != NULL) {
		struct EasyStruct easy = {
			.es_StructSize = sizeof(easy),
			.es_Flags = 0,
			.es_Title = (void *)NULL,
			.es_TextFormat = (void *)string,
			(void *)"OK"
		};

		EasyRequest(NULL, &easy, NULL, arg);

		CloseLibrary(IntuitionBase);
	}

Modified src/runtime/misc.m from [aa8c7fb972] to [0d3ef3173e].

13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30

31

32
33
34
35
36
37
38
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"


#include <stdio.h>
#include <stdlib.h>

#include "ObjFWRT.h"
#include "private.h"

#ifdef OF_AMIGAOS
# define USE_INLINE_STDARG
# include <proto/exec.h>
# include <clib/debug_protos.h>
# define __NOLIBBASE__

# include <proto/intuition.h>

# undef __NOLIBBASE__
#endif

static objc_enumeration_mutation_handler_t enumerationMutationHandler = NULL;

void
objc_enumerationMutation(id object)







>











>

>







13
14
15
16
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
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

#include "ObjFWRT.h"
#include "private.h"

#ifdef OF_AMIGAOS
# define USE_INLINE_STDARG
# include <proto/exec.h>
# include <clib/debug_protos.h>
# define __NOLIBBASE__
# define Class IntuitionClass
# include <proto/intuition.h>
# undef Class
# undef __NOLIBBASE__
#endif

static objc_enumeration_mutation_handler_t enumerationMutationHandler = NULL;

void
objc_enumerationMutation(id object)
55
56
57
58
59
60
61




62
63
64
65
66
67
68
69
70
71
72

73

74
75

76





77
78
79
80
81
82
83
84
85
86

87

88

89
90
91
92
93
94
95
#ifdef OF_AMIGAOS
# define BUF_LEN 256
	char title[BUF_LEN];
	char message[BUF_LEN];
	int status;
	va_list args;
	struct Library *IntuitionBase;





	status = snprintf(title, BUF_LEN, "ObjFWRT @ %s:%u", file, line);
	if (status <= 0 || status >= BUF_LEN)
		title[0] = '\0';

	va_start(args, format);
	status = vsnprintf(message, BUF_LEN, format, args);
	if (status <= 0 || status >= BUF_LEN)
		message[0] = '\0';
	va_end(args);


	kprintf("[%s] %s\n", title, message);


	IntuitionBase = OpenLibrary("intuition.library", 0);

	if (IntuitionBase != NULL) {





		struct EasyStruct easy = {
			.es_StructSize = sizeof(easy),
			.es_Flags = 0,
			.es_Title = (UBYTE *)title,
			.es_TextFormat = (UBYTE *)"%s",
			(UBYTE *)"OK"
		};

		EasyRequest(NULL, &easy, NULL, (ULONG)message);


		CloseLibrary(IntuitionBase);

	}


	exit(EXIT_FAILURE);
# undef BUF_LEN
#else
	va_list args;

	va_start(args, format);







>
>
>
>











>

>

|
>
|
>
>
>
>
>
|
|
|
|
|
|
<

|

>
|
>
|
>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifdef OF_AMIGAOS
# define BUF_LEN 256
	char title[BUF_LEN];
	char message[BUF_LEN];
	int status;
	va_list args;
	struct Library *IntuitionBase;
# ifdef OF_AMIGAOS4
	struct IntuitionIFace *IIntuition;
# endif
	struct EasyStruct easy;

	status = snprintf(title, BUF_LEN, "ObjFWRT @ %s:%u", file, line);
	if (status <= 0 || status >= BUF_LEN)
		title[0] = '\0';

	va_start(args, format);
	status = vsnprintf(message, BUF_LEN, format, args);
	if (status <= 0 || status >= BUF_LEN)
		message[0] = '\0';
	va_end(args);

# ifndef OF_AMIGAOS4
	kprintf("[%s] %s\n", title, message);
# endif

	if ((IntuitionBase = OpenLibrary("intuition.library", 0)) == NULL)
		exit(EXIT_FAILURE);

# ifdef OF_AMIGAOS4
	if ((IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase,
	    "main", 1, NULL)) == NULL)
		exit(EXIT_FAILURE);
# endif

	easy.es_StructSize = sizeof(easy);
	easy.es_Flags = 0;
	easy.es_Title = (void *)title;
	easy.es_TextFormat = (void *)"%s";
	easy.es_GadgetFormat = (void *)"OK";


	EasyRequest(NULL, &easy, NULL, (ULONG)message);

# ifdef OF_AMIGAOS4
	DropInterface((struct Interface *)IIntuition);
# endif

	CloseLibrary(IntuitionBase);

	exit(EXIT_FAILURE);
# undef BUF_LEN
#else
	va_list args;

	va_start(args, format);