Attempt to fix some OS3 build errors in gui.c

This commit is contained in:
Chris Young 2015-01-17 17:06:48 +00:00
parent bf14b2ddb1
commit 0c4f942c2d
3 changed files with 155 additions and 37 deletions

View File

@ -35,24 +35,26 @@
#include <proto/keymap.h> #include <proto/keymap.h>
#include <proto/locale.h> #include <proto/locale.h>
#include <proto/Picasso96API.h> #include <proto/Picasso96API.h>
#ifdef __amigaos4__
#include <proto/popupmenu.h> #include <proto/popupmenu.h>
#endif
#include <proto/utility.h> #include <proto/utility.h>
#include <proto/wb.h> #include <proto/wb.h>
/* Other OS includes */ /* Other OS includes */
#include <datatypes/textclass.h> #include <datatypes/textclass.h>
#include <devices/inputevent.h> #include <devices/inputevent.h>
#include <graphics/rpattr.h>
#ifdef __amigaos4__ #ifdef __amigaos4__
#include <graphics/blitattr.h> #include <graphics/blitattr.h>
#include <intuition/gui.h>
#include <libraries/application.h> #include <libraries/application.h>
#include <libraries/keymap.h> #include <libraries/keymap.h>
#endif #endif
#include <libraries/gadtools.h>
#include <intuition/icclass.h> #include <intuition/icclass.h>
#include <graphics/rpattr.h>
#include <workbench/workbench.h>
#include <intuition/gui.h>
#include <intuition/screens.h> #include <intuition/screens.h>
#include <libraries/gadtools.h>
#include <workbench/workbench.h>
/* ReAction libraries */ /* ReAction libraries */
#include <proto/bevel.h> #include <proto/bevel.h>
@ -427,11 +429,15 @@ static bool ami_open_resources(void)
static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo)
{ {
LONG scrollerfillpen = FALSE; LONG scrollerfillpen = FALSE;
#ifdef __amigaos4__
GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE);
if(scrollerfillpen) return FILLPEN; if(scrollerfillpen) return FILLPEN;
else return FOREGROUNDPEN; else return FOREGROUNDPEN;
#else
return FILLPEN;
#endif
} }
/** /**
@ -498,7 +504,7 @@ static void ami_set_screen_defaults(struct Screen *screen)
nsoption_default_set_int(redraw_tile_size_x, screen->Width); nsoption_default_set_int(redraw_tile_size_x, screen->Width);
nsoption_default_set_int(redraw_tile_size_y, screen->Height); nsoption_default_set_int(redraw_tile_size_y, screen->Height);
#ifdef __amigaos4__
/* set system colours for amiga ui */ /* set system colours for amiga ui */
colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveBorder, screen, 0x00000000); colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveBorder, screen, 0x00000000);
colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveCaption, screen, 0x00dddddd); colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveCaption, screen, 0x00dddddd);
@ -528,6 +534,7 @@ static void ami_set_screen_defaults(struct Screen *screen)
colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Window, screen, 0x00aaaaaa); colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Window, screen, 0x00aaaaaa);
colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, screen, 0x00000000); colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, screen, 0x00000000);
colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_WindowText, screen, 0x00000000); colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_WindowText, screen, 0x00000000);
#endif
} }
@ -971,7 +978,7 @@ static void gui_init2(int argc, char** argv)
ami_quit=true; ami_quit=true;
return; return;
} }
#ifdef __amigaos4__
if(IApplication) if(IApplication)
{ {
if(argc == 0) if(argc == 0)
@ -1008,7 +1015,7 @@ static void gui_init2(int argc, char** argv)
GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE); GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE);
if(applibport) applibsig = (1L << applibport->mp_SigBit); if(applibport) applibsig = (1L << applibport->mp_SigBit);
} }
#endif
if(!bw && (nsoption_bool(startup_no_window) == false)) { if(!bw && (nsoption_bool(startup_no_window) == false)) {
error = nsurl_create(nsoption_charp(homepage_url), &url); error = nsurl_create(nsoption_charp(homepage_url), &url);
if (error == NSERROR_OK) { if (error == NSERROR_OK) {
@ -1233,9 +1240,11 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie)
static void ami_update_quals(struct gui_window_2 *gwin) static void ami_update_quals(struct gui_window_2 *gwin)
{ {
uint32 quals = 0; uint32 quals = 0;
#ifdef __amigaos4__
GetAttr(WINDOW_Qualifier,gwin->objects[OID_MAIN],(uint32 *)&quals); GetAttr(WINDOW_Qualifier,gwin->objects[OID_MAIN],(uint32 *)&quals);
#else
#warning qualifier needs fixing for OS3
#endif
gwin->key_state = 0; gwin->key_state = 0;
if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT)) if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT))
@ -1258,9 +1267,11 @@ static void ami_update_quals(struct gui_window_2 *gwin)
nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox) nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox)
{ {
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) { if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
#ifdef __amigaos4__
*bbox = AllocVecTagList(sizeof(struct IBox), NULL); *bbox = AllocVecTagList(sizeof(struct IBox), NULL);
if(*bbox == NULL) return NSERROR_NOMEM; if(*bbox == NULL) return NSERROR_NOMEM;
GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox); GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox);
#endif
} else { } else {
GetAttr(SPACE_AreaBox, obj, (ULONG *)bbox); GetAttr(SPACE_AreaBox, obj, (ULONG *)bbox);
} }
@ -1431,6 +1442,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
static void ami_gui_trap_mouse(struct gui_window_2 *gwin) static void ami_gui_trap_mouse(struct gui_window_2 *gwin)
{ {
#ifdef __amigaos4__
switch(gwin->drag_op) switch(gwin->drag_op)
{ {
case GDRAGGING_NONE: case GDRAGGING_NONE:
@ -1446,6 +1458,7 @@ static void ami_gui_trap_mouse(struct gui_window_2 *gwin)
} }
break; break;
} }
#endif
} }
static void ami_gui_menu_update_all(void) static void ami_gui_menu_update_all(void)
@ -1511,23 +1524,26 @@ static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
SCROLLER_Orientation, SORIENT_HORIZ, SCROLLER_Orientation, SORIENT_HORIZ,
ICA_TARGET, ICTARGET_IDCMP, ICA_TARGET, ICTARGET_IDCMP,
ScrollerEnd; ScrollerEnd;
#ifdef __amigaos4__
IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD, IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD,
gwin->win, gwin->objects[GID_HSCROLL], attrs); gwin->win, gwin->objects[GID_HSCROLL], attrs);
#else
#warning FIXME for OS3 - logically we should just permanently enable
#endif
return true; return true;
} }
/* Remove the horizontal scroller, if present */ /* Remove the horizontal scroller, if present */
static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin) static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin)
{ {
#ifdef __amigaos4__
if(gwin->objects[GID_HSCROLL] == NULL) return false; if(gwin->objects[GID_HSCROLL] == NULL) return false;
IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD, IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_HSCROLL]); gwin->win, gwin->objects[GID_HSCROLL]);
gwin->objects[GID_HSCROLL] = NULL; gwin->objects[GID_HSCROLL] = NULL;
#endif
return true; return true;
} }
@ -1549,23 +1565,25 @@ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
GA_RelVerify, TRUE, GA_RelVerify, TRUE,
ICA_TARGET, ICTARGET_IDCMP, ICA_TARGET, ICTARGET_IDCMP,
ScrollerEnd; ScrollerEnd;
#ifdef __amigaos4__
#warning FIXME for OS3
IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_ADDCHILD, IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_ADDCHILD,
gwin->win, gwin->objects[GID_VSCROLL], attrs); gwin->win, gwin->objects[GID_VSCROLL], attrs);
#endif
return true; return true;
} }
/* Remove the vertical scroller, if present */ /* Remove the vertical scroller, if present */
static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin) static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin)
{ {
#ifdef __amigaos4__
if(gwin->objects[GID_VSCROLL] == NULL) return false; if(gwin->objects[GID_VSCROLL] == NULL) return false;
IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_REMOVECHILD, IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_VSCROLL]); gwin->win, gwin->objects[GID_VSCROLL]);
gwin->objects[GID_VSCROLL] = NULL; gwin->objects[GID_VSCROLL] = NULL;
#endif
return true; return true;
} }
@ -1692,7 +1710,7 @@ static void ami_gui_refresh_favicon(void *p)
static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height) static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height)
{ {
ULONG available_width; ULONG available_width;
#ifdef __amigaos4__
if((sz_gad_width == 0) || (sz_gad_height == 0)) { if((sz_gad_width == 0) || (sz_gad_height == 0)) {
struct DrawInfo *dri = GetScreenDrawInfo(scrn); struct DrawInfo *dri = GetScreenDrawInfo(scrn);
GetGUIAttrs(NULL, dri, GetGUIAttrs(NULL, dri,
@ -1701,7 +1719,7 @@ static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width,
TAG_DONE); TAG_DONE);
FreeScreenDrawInfo(scrn, dri); FreeScreenDrawInfo(scrn, dri);
} }
#endif
available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width; available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width;
*width = available_width; *width = available_width;
@ -2025,7 +2043,7 @@ static void ami_handle_msg(void)
gwin->prev_mouse_state = gwin->mouse_state; gwin->prev_mouse_state = gwin->mouse_state;
gwin->mouse_state=0; gwin->mouse_state=0;
break; break;
#ifdef __amigaos4__
case SIDEUP: case SIDEUP:
ami_gui_history(gwin, true); ami_gui_history(gwin, true);
break; break;
@ -2033,6 +2051,7 @@ static void ami_handle_msg(void)
case EXTRAUP: case EXTRAUP:
ami_gui_history(gwin, false); ami_gui_history(gwin, false);
break; break;
#endif
} }
if(drag_save_data && !gwin->mouse_state) if(drag_save_data && !gwin->mouse_state)
@ -2413,7 +2432,7 @@ static void ami_handle_msg(void)
case WMHI_CLOSEWINDOW: case WMHI_CLOSEWINDOW:
ami_close_all_tabs(gwin); ami_close_all_tabs(gwin);
break; break;
#ifdef __amigaos4__
case WMHI_ICONIFY: case WMHI_ICONIFY:
{ {
struct bitmap *bm; struct bitmap *bm;
@ -2431,7 +2450,7 @@ static void ami_handle_msg(void)
cur_gw = NULL; cur_gw = NULL;
} }
break; break;
#endif
case WMHI_INACTIVE: case WMHI_INACTIVE:
gwin->gw->c_h_temp = gwin->gw->c_h; gwin->gw->c_h_temp = gwin->gw->c_h;
gui_window_remove_caret(gwin->gw); gui_window_remove_caret(gwin->gw);
@ -2618,6 +2637,7 @@ static void ami_handle_appmsg(void)
static void ami_handle_applib(void) static void ami_handle_applib(void)
{ {
#ifdef __amigaos4__
struct ApplicationMsg *applibmsg; struct ApplicationMsg *applibmsg;
struct browser_window *bw; struct browser_window *bw;
nsurl *url; nsurl *url;
@ -2697,6 +2717,7 @@ static void ami_handle_applib(void)
} }
ReplyMsg((struct Message *)applibmsg); ReplyMsg((struct Message *)applibmsg);
} }
#endif
} }
void ami_get_msg(void) void ami_get_msg(void)
@ -2974,10 +2995,10 @@ static void gui_quit(void)
ami_hotlist_free(nsoption_charp(hotlist_file)); ami_hotlist_free(nsoption_charp(hotlist_file));
ami_cookies_free(); ami_cookies_free();
ami_global_history_free(); ami_global_history_free();
#ifdef __amigaos4__
if(IApplication && ami_appid) if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL); UnregisterApplication(ami_appid, NULL);
#endif
ami_arexx_cleanup(); ami_arexx_cleanup();
ami_free_layers(&browserglob); ami_free_layers(&browserglob);
@ -3108,6 +3129,7 @@ static int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_lis
static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
{ {
#ifdef __amigaos4__
struct TagItem attrs[2]; struct TagItem attrs[2];
attrs[0].ti_Tag = CHILD_MinWidth; attrs[0].ti_Tag = CHILD_MinWidth;
@ -3145,6 +3167,9 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
ami_schedule_redraw(gwin, true); ami_schedule_redraw(gwin, true);
} }
#else
#warning FIXME for OS3
#endif
} }
static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List *speed_button_list) static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List *speed_button_list)
@ -3174,6 +3199,7 @@ static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List
static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin) static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin)
{ {
#ifdef __amigaos4__
IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD, IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_HOTLIST]); gwin->win, gwin->objects[GID_HOTLIST]);
@ -3186,6 +3212,7 @@ static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin)
gwin->win, NULL, TRUE); gwin->win, NULL, TRUE);
ami_schedule_redraw(gwin, true); ami_schedule_redraw(gwin, true);
#endif
} }
static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin) static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin)
@ -3242,6 +3269,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
{ {
if(ClickTabBase->lib_Version < 53) return; if(ClickTabBase->lib_Version < 53) return;
#ifdef __amigaos4__
if(show) if(show)
{ {
struct TagItem attrs[3]; struct TagItem attrs[3];
@ -3295,6 +3323,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
gwin->win, NULL, TRUE); gwin->win, NULL, TRUE);
if(gwin->gw && gwin->gw->bw) browser_window_update(gwin->gw->bw, false); if(gwin->gw && gwin->gw->bw) browser_window_update(gwin->gw->bw, false);
#endif
} }
void ami_gui_tabs_toggle_all(void) void ami_gui_tabs_toggle_all(void)
@ -3438,7 +3467,7 @@ gui_window_create(struct browser_window *bw,
if(curh > (scrn->Height - cury)) curh = scrn->Height - cury; if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
g = AllocVecTags(sizeof(struct gui_window), AVT_ClearWithValue, 0, TAG_DONE); g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0);
if(!g) if(!g)
{ {
@ -3510,7 +3539,7 @@ gui_window_create(struct browser_window *bw,
return g; return g;
} }
g->shared = AllocVecTags(sizeof(struct gui_window_2), AVT_ClearWithValue, 0, TAG_DONE); g->shared = ami_misc_allocvec_clear(sizeof(struct gui_window_2), 0);
if(!g->shared) if(!g->shared)
{ {
@ -3563,7 +3592,7 @@ gui_window_create(struct browser_window *bw,
g->shared->tabs=1; g->shared->tabs=1;
g->shared->next_tab=1; g->shared->next_tab=1;
g->shared->svbuffer = AllocVecTags(2000, AVT_ClearWithValue, 0, TAG_DONE); g->shared->svbuffer = ami_misc_allocvec_clear(2000, 0);
g->shared->helphints[GID_BACK] = g->shared->helphints[GID_BACK] =
translate_escape_chars(messages_get("HelpToolbarBack")); translate_escape_chars(messages_get("HelpToolbarBack"));
@ -4963,6 +4992,7 @@ static void gui_window_new_content(struct gui_window *g)
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
const struct rect *rect) const struct rect *rect)
{ {
#ifdef __amigaos4__
g->shared->drag_op = type; g->shared->drag_op = type;
if(rect) g->shared->ptr_lock = ami_ns_rect_to_ibox(g->shared, rect); if(rect) g->shared->ptr_lock = ami_ns_rect_to_ibox(g->shared, rect);
@ -4977,7 +5007,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
g->shared->ptr_lock = NULL; g->shared->ptr_lock = NULL;
} }
} }
#endif
return true; return true;
} }
@ -5028,7 +5058,7 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
break; break;
} }
break; break;
#ifdef __amigaos4__
case IDCMP_EXTENDEDMOUSE: case IDCMP_EXTENDEDMOUSE:
if(msg->Code == IMSGCODE_INTUIWHEELDATA) if(msg->Code == IMSGCODE_INTUIWHEELDATA)
{ {
@ -5037,7 +5067,7 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
ami_gui_scroll_internal(gwin, wheel->WheelX * 50, wheel->WheelY * 50); ami_gui_scroll_internal(gwin, wheel->WheelX * 50, wheel->WheelY * 50);
} }
break; break;
#endif
case IDCMP_SIZEVERIFY: case IDCMP_SIZEVERIFY:
break; break;
@ -5287,8 +5317,9 @@ int main(int argc, char** argv)
.llcache = amiga_filesystem_llcache_table, .llcache = amiga_filesystem_llcache_table,
}; };
#ifdef __amigaos4__
signal(SIGINT, SIG_IGN); signal(SIGINT, SIG_IGN);
#endif
ret = netsurf_register(&amiga_table); ret = netsurf_register(&amiga_table);
if (ret != NSERROR_OK) { if (ret != NSERROR_OK) {
ami_misc_fatal_error("NetSurf operation table failed registration"); ami_misc_fatal_error("NetSurf operation table failed registration");
@ -5313,6 +5344,7 @@ int main(int argc, char** argv)
* forcibly disable context menus if these are in use. * forcibly disable context menus if these are in use.
*/ */
popupmenu_lib_ok = FALSE; popupmenu_lib_ok = FALSE;
#ifdef __amigaos4__
if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) { if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) {
LOG(("popupmenu.library v%d.%d", LOG(("popupmenu.library v%d.%d",
PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision)); PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision));
@ -5320,7 +5352,7 @@ int main(int argc, char** argv)
popupmenu_lib_ok = TRUE; popupmenu_lib_ok = TRUE;
CloseLibrary(PopupMenuBase); CloseLibrary(PopupMenuBase);
} }
#endif
if (ami_open_resources() == false) { /* alloc message ports */ if (ami_open_resources() == false) { /* alloc message ports */
ami_misc_fatal_error("Unable to allocate resources"); ami_misc_fatal_error("Unable to allocate resources");
return RETURN_FAIL; return RETURN_FAIL;

View File

@ -37,6 +37,16 @@ int64 GetFileSize(BPTR fh)
return (int64)size; return (int64)size;
} }
void FreeSysObject(ULONG type, APTR obj)
{
switch(type) {
case ASOT_PORT:
DeleteMsgPort(obj);
break;
}
}
/* Exec */ /* Exec */
struct Node *GetHead(struct List *list) struct Node *GetHead(struct List *list)
{ {
@ -49,6 +59,23 @@ struct Node *GetHead(struct List *list)
return res; return res;
} }
/* Intuition */
uint32 GetAttrs(Object *obj, Tag tag1, ...)
{
va_list ap;
Tag tag = tag1;
ULONG data = 0;
va_start(ap, tag1);
while(tag != TAG_DONE) {
data = va_arg(ap, ULONG);
GetAttr(tag, obj, (void *)data);
tag = va_arg(ap, Tag);
}
va_end(ap);
}
/* Utility */ /* Utility */
struct FormatContext struct FormatContext
{ {

View File

@ -1,5 +1,6 @@
/* /*
* Copyright 2010 John-Mark Bell <jmb@netsurf-browser.org> * Copyright 2010 John-Mark Bell <jmb@netsurf-browser.org>
* Copyright 2014 Chris Young <chris@unsatisfactorsysoftware.co.uk>
* *
* This file is part of NetSurf, http://www.netsurf-browser.org/ * This file is part of NetSurf, http://www.netsurf-browser.org/
* *
@ -39,12 +40,54 @@
/* Macros */ /* Macros */
#define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0 #define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0
#define LIB_IS_AT_LEAST(B,V,R) ((B)->lib_Version>(V)) || \
((B)->lib_Version==(V) && (B)->lib_Revision>=(R))
/* Define extra memory type flags */ /* Define extra memory type flags */
#define MEMF_PRIVATE MEMF_ANY #define MEMF_PRIVATE MEMF_ANY
#define MEMF_SHARED MEMF_ANY #define MEMF_SHARED MEMF_ANY
/* Ignore tags that aren't supported */ /* Ignore unsupported tags */
#define BITMAP_DisabledSourceFile TAG_IGNORE
#define CLICKTAB_CloseImage TAG_IGNORE
#define CLICKTAB_FlagImage TAG_IGNORE
#define CLICKTAB_LabelTruncate TAG_IGNORE
#define CLICKTAB_NodeClosed TAG_IGNORE
#define PDTA_PromoteMask TAG_IGNORE #define PDTA_PromoteMask TAG_IGNORE
#define RPTAG_APenColor TAG_IGNORE
#define GA_HintInfo TAG_IGNORE
#define GAUGEIA_Level TAG_IGNORE
#define IA_InBorder TAG_IGNORE
#define IA_Label TAG_IGNORE
#define SA_Compositing TAG_IGNORE
#define SBNA_Text TAG_IGNORE
#define TNA_CloseGadget TAG_IGNORE
#define TNA_HintInfo TAG_IGNORE
#define WA_ToolBox TAG_IGNORE
#define WINDOW_BuiltInScroll TAG_IGNORE
#define WINDOW_NewMenu TAG_IGNORE
#define WINDOW_NewPrefsHook TAG_IGNORE
/* raw keycodes */
#define RAWKEY_BACKSPACE 0x41
#define RAWKEY_TAB 0x42
#define RAWKEY_ESC 0x45
#define RAWKEY_DEL 0x46
#define RAWKEY_PAGEUP 0x48
#define RAWKEY_PAGEDOWN 0x49
#define RAWKEY_CRSRUP 0x4C
#define RAWKEY_CRSRDOWN 0x4D
#define RAWKEY_CRSRRIGHT 0x4E
#define RAWKEY_CRSRLEFT 0x4F
#define RAWKEY_F5 0x54
#define RAWKEY_HELP 0x5F
#define RAWKEY_HOME 0x70
#define RAWKEY_END 0x71
/* Other constants */
#define IDCMP_EXTENDEDMOUSE 0
#define WINDOW_BACKMOST 0
#define DN_FULLPATH 0
/* Renamed structures */ /* Renamed structures */
#define AnchorPathOld AnchorPath #define AnchorPathOld AnchorPath
@ -53,11 +96,6 @@
/* application */ /* application */
#define Notify(...) (void)0 #define Notify(...) (void)0
/* Exec */
/* AllocVecTagList with no tags */
#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY)
#define GetSucc(N) (N)->ln_Succ
/* diskfont */ /* diskfont */
/* Only used in one place we haven't ifdeffed, where it returns the charset name */ /* 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" #define ObtainCharsetInfo(A,B,C) (const char *)"ISO-8859-1"
@ -65,12 +103,24 @@
/* DOS */ /* DOS */
#define FOpen(A,B,C) Open(A,B) #define FOpen(A,B,C) Open(A,B)
#define FClose(A) Close(A) #define FClose(A) Close(A)
#define CreateDirTree(D) CreateDir(D) /*\todo This isn't quite right */
#define DevNameFromLock(A,B,C,D) NameFromLock(A,B,C)
/* Exec */
#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
#define GetPred(N) (N)->ln_Pred
#define GetSucc(N) (N)->ln_Succ
/* Gfx */
#define SetRPAttrs(...) (void)0 /*\todo Probably need to emulate this */
/* Intuition */ /* Intuition */
#define IDoMethod DoMethod #define IDoMethod DoMethod
#define IDoMethodA DoMethodA #define IDoMethodA DoMethodA
#define IDoSuperMethodA DoSuperMethodA #define IDoSuperMethodA DoSuperMethodA
#define RefreshSetGadgetAttrs SetGadgetAttrs /*\todo This isn't quite right */ #define RefreshSetGadgetAttrs SetGadgetAttrs /*\todo This isn't quite right */
#define ShowWindow(...) (void)0
/* Utility */ /* Utility */
#define SetMem memset #define SetMem memset
@ -117,13 +167,22 @@ struct TimeVal {
#define IDFMT_PALETTEMAPPED (1) /* Palette mapped icon (chunky, V44+) */ #define IDFMT_PALETTEMAPPED (1) /* Palette mapped icon (chunky, V44+) */
#define IDFMT_DIRECTMAPPED (2) /* Direct mapped icon (truecolor 0xAARRGGBB, V51+) */ #define IDFMT_DIRECTMAPPED (2) /* Direct mapped icon (truecolor 0xAARRGGBB, V51+) */
/* Object types */
enum {
ASOT_PORT = 1
};
/* Functions */ /* Functions */
/* DOS */ /* DOS */
int64 GetFileSize(BPTR fh); int64 GetFileSize(BPTR fh);
void FreeSysObject(ULONG type, APTR obj);
/* Exec */ /* Exec */
struct Node *GetHead(struct List *list); struct Node *GetHead(struct List *list);
/* Intuition */
uint32 GetAttrs(Object *obj, Tag tag1, ...);
/* Utility */ /* Utility */
char *ASPrintf(const char *fmt, ...); char *ASPrintf(const char *fmt, ...);