summaryrefslogtreecommitdiff
path: root/amiga/os3support.h
blob: 4de39d82fc4e251089f3060a5e162271fa66118d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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
42
43
44
45
46
47
48
49
50
51
52
53
54
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * Copyright 2010 John-Mark Bell <jmb@netsurf-browser.org>
 *
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 *
 * NetSurf is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * NetSurf is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/** \file
 * Minimal compatibility header for AmigaOS 3
 */

#ifndef AMIGA_OS3SUPPORT_H_
#define AMIGA_OS3SUPPORT_H_

#ifndef __amigaos4__

#include <stdint.h>
#include <proto/exec.h>
#include <proto/dos.h>

/* Include prototypes for amigalib */
#include <clib/alib_protos.h>

#ifndef EXEC_MEMORY_H
#include <exec/memory.h>
#endif

/* Macros */
#define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0

/* Define extra memory type flags */
#define MEMF_PRIVATE	MEMF_ANY
#define MEMF_SHARED	MEMF_ANY

/* Ignore tags that aren't supported */
#define PDTA_PromoteMask	TAG_IGNORE

/* Renamed structures */
#define AnchorPathOld AnchorPath

/* Easy compat macros */
/* application */
#define Notify(...) (void)0

/* Exec */
/* AllocVecTagList with no tags */
#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY)
#define GetSucc(N) (N)->ln_Succ

/* diskfont */
/* Only used in one place we haven't ifdeffed, where it returns the charset name */
#define ObtainCharsetInfo(A,B,C) (const char *)"ISO-8859-1"

/* DOS */
#define FOpen(A,B,C) Open(A,B)
#define FClose(A) Close(A)

/* Intuition */
#define IDoMethod DoMethod
#define IDoMethodA DoMethodA
#define IDoSuperMethodA DoSuperMethodA
#define RefreshSetGadgetAttrs SetGadgetAttrs /*\todo This isn't quite right */
/* Utility */
#define SetMem memset

/* Integral type definitions */
typedef int8_t int8;
typedef uint8_t uint8;
typedef int16_t int16;
typedef uint16_t uint16;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;

/* TimeVal */
struct TimeVal {
	uint32 Seconds;
	uint32 Microseconds;
};

/* Compositing */
#define COMPFLAG_IgnoreDestAlpha 0
#define COMPFLAG_SrcAlphaOverride 0
#define COMPFLAG_SrcFilter 0

#define COMPOSITE_Src 0

#define COMPTAG_ScaleX 0
#define COMPTAG_ScaleY 0
#define COMPTAG_DestX 0
#define COMPTAG_DestY 0
#define COMPTAG_DestWidth 0
#define COMPTAG_DestHeight 0
#define COMPTAG_OffsetX 0
#define COMPTAG_OffsetY 0

#define CompositeTags(a, ...) ((void) (a))
#define COMP_FLOAT_TO_FIX(f) (f)

/* icon.library v51 (ie. AfA_OS version) */
#define ICONCTRLA_SetImageDataFormat        (ICONA_Dummy + 0x67) /*103*/
#define ICONCTRLA_GetImageDataFormat        (ICONA_Dummy + 0x68) /*104*/

#define IDFMT_BITMAPPED     (0)  /* Bitmapped icon (planar, legacy) */
#define IDFMT_PALETTEMAPPED (1)  /* Palette mapped icon (chunky, V44+) */
#define IDFMT_DIRECTMAPPED  (2)  /* Direct mapped icon (truecolor 0xAARRGGBB, V51+) */ 

/* Functions */
/* DOS */
int64 GetFileSize(BPTR fh);

/* Exec */
struct Node *GetHead(struct List *list);

/* Utility */
char *ASPrintf(const char *fmt, ...);

/* C */
char *strlwr(char *str);
#endif
#endif