ObjFW  Diff

Differences From Artifact [d8c6cfcc82]:

To Artifact [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);