1 #include "portable_macros.h"
7 #include <proto/exec.h>
8 #include <proto/utility.h>
10 #include <proto/graphics.h>
11 #include <proto/datatypes.h>
12 #include <proto/dos.h>
13 #include <proto/icon.h>
14 #include <proto/locale.h>
15 #include <proto/layers.h>
16 #include <proto/diskfont.h>
17 #include <proto/asl.h>
18 #include <proto/keymap.h>
19 #include <proto/iffparse.h>
20 #include <exec/memory.h>
21 #include <graphics/rastport.h>
22 #include <intuition/pointerclass.h>
24 #if defined(__AMIGA__) && !defined(__PPC__)
25 #define NO_INLINE_STDARG
27 #include <proto/intuition.h>
28 #include <proto/muimaster.h>
34 #define D(x) if (DEBUG) x
36 #define bug DebugPrintF
47 Object
* VARARGS68K
DoSuperNew(struct IClass
*cl
, Object
*obj
, ...)
54 rc
= (Object
*)DoSuperMethod(cl
, obj
, OM_NEW
, VA_ARG(args
, IPTR
), NULL
);
62 Object
*VARARGS68K
DoSuperNewTags(struct IClass
*cl
, Object
*obj
, void *dummy
, ...)
67 VA_START(argptr
, dummy
);
69 rc
= (Object
*)DoSuperMethod(cl
,obj
,OM_NEW
,VA_ARG(argptr
, IPTR
),dummy
);
76 STRPTR
StrDup (CONST_STRPTR str
)
81 if (str
== NULL
) return NULL
;
84 dup
= AllocVec(len
+ 1, MEMF_PUBLIC
);
85 if (dup
!= NULL
) CopyMem(str
, dup
, len
+ 1);
92 struct RastPort
*CreateRastPort(void)
94 struct RastPort
*newrp
= AllocMem(sizeof(*newrp
), MEMF_PUBLIC
);
104 struct RastPort
*CloneRastPort(struct RastPort
*rp
)
106 struct RastPort
*newrp
= NULL
;
110 newrp
= AllocMem(sizeof(*newrp
), MEMF_PUBLIC
);
115 memcpy(newrp
,rp
,sizeof(struct RastPort
));
122 void FreeRastPort(struct RastPort
*rp
)
124 FreeMem(rp
, sizeof(*rp
));
128 BOOL
AndRectRect(struct Rectangle
*rect1
, struct Rectangle
*rect2
, struct Rectangle
*intersect
)
130 if (!(((LONG
)rect1
> 1024) && TypeOfMem((APTR
)rect1
)))
131 D(bug("\x07, %ld: bad pointer: %s = $%lx\n", __LINE__
, rect1
, (APTR
)(rect1
)) );
133 if (!(((LONG
)(rect2
) > 1024) && TypeOfMem((APTR
)(rect2
))))
134 D(bug("\x07, %ld: bad pointer: %s = $%lx\n", __LINE__
, rect2
, (APTR
)(rect2
)) );
136 if (!((((APTR
)(intersect
)) == NULL
) || (((LONG
)(intersect
) > 1024) && TypeOfMem((APTR
)(intersect
)))))
137 D(bug("\x07:%ld: bad pointer: %s = $%lx\n", __LINE__
, intersect
, (APTR
)(intersect
)));
140 return _AndRectRect(rect1
, rect2
, intersect
);
142 return overlap(*rect1
, *rect2
);
146 #if defined(__AMIGA__) && !defined(__PPC__)
147 APTR
AllocVecPooled(APTR pool
, ULONG size
)
152 if (pool
== NULL
) return NULL
;
154 size
+= sizeof(IPTR
);
155 memory
= AllocPooled(pool
, size
);
163 } /* AllocVecPooled() */
166 void FreeVecPooled(APTR pool
, APTR memory
)
170 IPTR
*real
= (IPTR
*) memory
;
173 FreePooled(pool
, real
, size
);
175 } /* FreeVecPooled() */