ObjFW  Check-in [6dac4586ab]

Overview
Comment:Make linklib compile for MorphOS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | amiga-library
Files: files | file ages | folders
SHA3-256: 6dac4586ab8f2d31f2a0bcc80fcb7e88328a9173b860c4bead3280585f0a0bbe
User & Date: js on 2020-12-20 22:51:17
Other Links: branch diff | manifest | tags
Context
2020-12-22
21:42
Merge trunk into branch "amiga-library" check-in: a58aa8e069 user: js tags: amiga-library
2020-12-20
22:51
Make linklib compile for MorphOS check-in: 6dac4586ab user: js tags: amiga-library
21:36
Merge trunk into branch "amiga-library" check-in: 90637a4ecc user: js tags: amiga-library
Changes

Modified src/linklib/linklib.m from [d8c6cfcc82] to [46c5143434].

18
19
20
21
22
23
24


25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
#include "config.h"

#import "ObjFW.h"
#import "amiga-library.h"
#import "macros.h"

#include <proto/exec.h>



struct ObjFWBase;

#import "inline.h"

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


#if defined(OF_AMIGAOS_M68K)
# include <stabs.h>
# define SYM(name) __asm__("_" name)
#elif defined(OF_MORPHOS)
# include <constructor.h>
# define SYM(name) __asm__(name)







>
>









>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "config.h"

#import "ObjFW.h"
#import "amiga-library.h"
#import "macros.h"

#include <proto/exec.h>
#define USE_INLINE_STDARG
#include <proto/intuition.h>

struct ObjFWBase;

#import "inline.h"

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

#if defined(OF_AMIGAOS_M68K)
# include <stabs.h>
# define SYM(name) __asm__("_" name)
#elif defined(OF_MORPHOS)
# include <constructor.h>
# define SYM(name) __asm__(name)
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
		return;

	if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB, OBJFW_LIB_MINOR)) == NULL)
		error("Failed to open " OBJFW_AMIGA_LIB " version %lu!",
		    OBJFW_LIB_MINOR);

	if (!glue_of_init(1, &libc, __sF))
		error("Failed to initialize " OBJFWRT_AMIGA_LIB "!", 0);

	initialized = true;
}

static void __attribute__((__used__))
dtor(void)
{







|







365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
		return;

	if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB, OBJFW_LIB_MINOR)) == NULL)
		error("Failed to open " OBJFW_AMIGA_LIB " version %lu!",
		    OBJFW_LIB_MINOR);

	if (!glue_of_init(1, &libc, __sF))
		error("Failed to initialize " OBJFW_AMIGA_LIB "!", 0);

	initialized = true;
}

static void __attribute__((__used__))
dtor(void)
{
438
439
440
441
442
443
444
445
446
447
448
449
450
451










452

453
454
455
456
457
458
459

void
of_log(OFConstantString *format, ...)
{
	va_list arguments;

	va_start(arguments, format);
	glue_of_logv(format, arguments);
	va_end(arguments);
}

void
of_logv(OFConstantString *format, va_list arguments)
{










	glue_of_logv(format, arguments);

}

int
of_application_main(int *argc, char ***argv,
    id <OFApplicationDelegate> delegate)
{
	return glue_of_application_main(argc, argv, delegate);







|






>
>
>
>
>
>
>
>
>
>

>







441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473

void
of_log(OFConstantString *format, ...)
{
	va_list arguments;

	va_start(arguments, format);
	of_logv(format, arguments);
	va_end(arguments);
}

void
of_logv(OFConstantString *format, va_list arguments)
{
#ifdef OF_MORPHOS
	/* The generated code does not work with va_list, so do it manually. */
	__asm__ __volatile__ (
	    "mr		%%r12, %0"
	    :: "r"(ObjFWBase)
	);

	((void (*)(OFConstantString *, va_list))*(void **)(ObjFWBase - 76))(
	    format, arguments);
#else
	glue_of_logv(format, arguments);
#endif
}

int
of_application_main(int *argc, char ***argv,
    id <OFApplicationDelegate> delegate)
{
	return glue_of_application_main(argc, argv, delegate);

Modified src/morphos-clib.h from [26b7a0e0cb] to [3f0a43908f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* The following function is only for the linklib. */
bool glue_of_init(unsigned int version, struct of_libc *libc, FILE **sF);
void *glue_of_alloc(size_t count, size_t size);
void *glue_of_alloc_zeroed(size_t count, size_t size);
void *glue_of_realloc(void *pointer, size_t count, size_t size);
uint32_t *glue_of_hash_seed_ref(void);
OFStdIOStream **glue_of_stdin_ref(void);
OFStdIOStream **glue_of_stdout_ref(void);
OFStdIOStream **glue_of_stderr_ref(void);
void glue_of_logv(OFConstantString *format, va_list arguments);
int glue_of_application_main(int *argc, char ***argv, id <OFApplicationDelegate> delegate);
const char *glue_of_http_request_method_to_string(of_http_request_method_t method);
of_http_request_method_t glue_of_http_request_method_from_string(OFString *string);
OFString *glue_of_http_status_code_to_string(short code);
size_t glue_of_sizeof_type_encoding(const char *type);
size_t glue_of_alignof_type_encoding(const char *type);
of_string_encoding_t glue_of_string_parse_encoding(OFString *string);
OFString *glue_of_string_name_of_encoding(of_string_encoding_t encoding);










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* The following function is only for the linklib. */
bool glue_of_init(unsigned int version, struct of_libc *libc, FILE **sF);
void *glue_of_alloc(size_t count, size_t size);
void *glue_of_alloc_zeroed(size_t count, size_t size);
void *glue_of_realloc(void *pointer, size_t count, size_t size);
uint32_t *glue_of_hash_seed_ref(void);
OFStdIOStream **glue_of_stdin_ref(void);
OFStdIOStream **glue_of_stdout_ref(void);
OFStdIOStream **glue_of_stderr_ref(void);
void glue_of_logv(OFConstantString *format, va_list arguments);
int glue_of_application_main(int *argc, char ***argv, id delegate);
const char *glue_of_http_request_method_to_string(of_http_request_method_t method);
of_http_request_method_t glue_of_http_request_method_from_string(OFString *string);
OFString *glue_of_http_status_code_to_string(short code);
size_t glue_of_sizeof_type_encoding(const char *type);
size_t glue_of_alignof_type_encoding(const char *type);
of_string_encoding_t glue_of_string_parse_encoding(OFString *string);
OFString *glue_of_string_name_of_encoding(of_string_encoding_t encoding);

Modified src/runtime/linklib/linklib.m from [8918300072] to [2cbbd07269].

19
20
21
22
23
24
25

26
27
28
29
30
31
32

#import "ObjFWRT.h"
#import "amiga-library.h"
#import "macros.h"
#import "private.h"

#include <proto/exec.h>

#include <proto/intuition.h>

struct ObjFWRTBase;

#import "inline.h"

#include <stdio.h>







>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#import "ObjFWRT.h"
#import "amiga-library.h"
#import "macros.h"
#import "private.h"

#include <proto/exec.h>
#define USE_INLINE_STDARG
#include <proto/intuition.h>

struct ObjFWRTBase;

#import "inline.h"

#include <stdio.h>