From 0c4f942c2da23c0456272dfe051d6ea564780499 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 17 Jan 2015 17:06:48 +0000 Subject: Attempt to fix some OS3 build errors in gui.c --- amiga/gui.c | 94 ++++++++++++++++++++++++++++++++++++------------------ amiga/os3support.c | 27 ++++++++++++++++ amiga/os3support.h | 71 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 155 insertions(+), 37 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index b24ae1c88..9bea295a6 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -35,24 +35,26 @@ #include #include #include +#ifdef __amigaos4__ #include +#endif #include #include /* Other OS includes */ #include #include +#include #ifdef __amigaos4__ #include +#include #include #include #endif -#include #include -#include -#include -#include #include +#include +#include /* ReAction libraries */ #include @@ -427,11 +429,15 @@ static bool ami_open_resources(void) static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) { LONG scrollerfillpen = FALSE; - +#ifdef __amigaos4__ GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); if(scrollerfillpen) return FILLPEN; 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_y, screen->Height); - +#ifdef __amigaos4__ /* 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_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(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, 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; return; } - +#ifdef __amigaos4__ if(IApplication) { if(argc == 0) @@ -1008,7 +1015,7 @@ static void gui_init2(int argc, char** argv) GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE); if(applibport) applibsig = (1L << applibport->mp_SigBit); } - +#endif if(!bw && (nsoption_bool(startup_no_window) == false)) { error = nsurl_create(nsoption_charp(homepage_url), &url); 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) { uint32 quals = 0; - +#ifdef __amigaos4__ GetAttr(WINDOW_Qualifier,gwin->objects[OID_MAIN],(uint32 *)&quals); - +#else +#warning qualifier needs fixing for OS3 +#endif gwin->key_state = 0; 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) { if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) { +#ifdef __amigaos4__ *bbox = AllocVecTagList(sizeof(struct IBox), NULL); if(*bbox == NULL) return NSERROR_NOMEM; GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox); +#endif } else { 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) { +#ifdef __amigaos4__ switch(gwin->drag_op) { case GDRAGGING_NONE: @@ -1446,6 +1458,7 @@ static void ami_gui_trap_mouse(struct gui_window_2 *gwin) } break; } +#endif } 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, ICA_TARGET, ICTARGET_IDCMP, ScrollerEnd; - +#ifdef __amigaos4__ IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD, gwin->win, gwin->objects[GID_HSCROLL], attrs); - +#else +#warning FIXME for OS3 - logically we should just permanently enable +#endif return true; } /* Remove the horizontal scroller, if present */ static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin) { +#ifdef __amigaos4__ if(gwin->objects[GID_HSCROLL] == NULL) return false; IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD, gwin->win, gwin->objects[GID_HSCROLL]); gwin->objects[GID_HSCROLL] = NULL; - +#endif return true; } @@ -1549,23 +1565,25 @@ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin) GA_RelVerify, TRUE, ICA_TARGET, ICTARGET_IDCMP, ScrollerEnd; - +#ifdef __amigaos4__ +#warning FIXME for OS3 IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_ADDCHILD, gwin->win, gwin->objects[GID_VSCROLL], attrs); - +#endif return true; } /* Remove the vertical scroller, if present */ static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin) { +#ifdef __amigaos4__ if(gwin->objects[GID_VSCROLL] == NULL) return false; IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_REMOVECHILD, gwin->win, gwin->objects[GID_VSCROLL]); gwin->objects[GID_VSCROLL] = NULL; - +#endif 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) { ULONG available_width; - +#ifdef __amigaos4__ if((sz_gad_width == 0) || (sz_gad_height == 0)) { struct DrawInfo *dri = GetScreenDrawInfo(scrn); GetGUIAttrs(NULL, dri, @@ -1701,7 +1719,7 @@ static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, TAG_DONE); FreeScreenDrawInfo(scrn, dri); } - +#endif available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width; *width = available_width; @@ -2025,7 +2043,7 @@ static void ami_handle_msg(void) gwin->prev_mouse_state = gwin->mouse_state; gwin->mouse_state=0; break; - +#ifdef __amigaos4__ case SIDEUP: ami_gui_history(gwin, true); break; @@ -2033,6 +2051,7 @@ static void ami_handle_msg(void) case EXTRAUP: ami_gui_history(gwin, false); break; +#endif } if(drag_save_data && !gwin->mouse_state) @@ -2413,7 +2432,7 @@ static void ami_handle_msg(void) case WMHI_CLOSEWINDOW: ami_close_all_tabs(gwin); break; - +#ifdef __amigaos4__ case WMHI_ICONIFY: { struct bitmap *bm; @@ -2431,7 +2450,7 @@ static void ami_handle_msg(void) cur_gw = NULL; } break; - +#endif case WMHI_INACTIVE: gwin->gw->c_h_temp = gwin->gw->c_h; gui_window_remove_caret(gwin->gw); @@ -2618,6 +2637,7 @@ static void ami_handle_appmsg(void) static void ami_handle_applib(void) { +#ifdef __amigaos4__ struct ApplicationMsg *applibmsg; struct browser_window *bw; nsurl *url; @@ -2697,6 +2717,7 @@ static void ami_handle_applib(void) } ReplyMsg((struct Message *)applibmsg); } +#endif } void ami_get_msg(void) @@ -2974,10 +2995,10 @@ static void gui_quit(void) ami_hotlist_free(nsoption_charp(hotlist_file)); ami_cookies_free(); ami_global_history_free(); - +#ifdef __amigaos4__ if(IApplication && ami_appid) UnregisterApplication(ami_appid, NULL); - +#endif ami_arexx_cleanup(); 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) { +#ifdef __amigaos4__ struct TagItem attrs[2]; 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); } +#else +#warning FIXME for OS3 +#endif } 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) { +#ifdef __amigaos4__ IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD, 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); ami_schedule_redraw(gwin, true); +#endif } 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; +#ifdef __amigaos4__ if(show) { struct TagItem attrs[3]; @@ -3295,6 +3323,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show) gwin->win, NULL, TRUE); if(gwin->gw && gwin->gw->bw) browser_window_update(gwin->gw->bw, false); +#endif } 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; - g = AllocVecTags(sizeof(struct gui_window), AVT_ClearWithValue, 0, TAG_DONE); + g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0); if(!g) { @@ -3510,7 +3539,7 @@ gui_window_create(struct browser_window *bw, 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) { @@ -3563,7 +3592,7 @@ gui_window_create(struct browser_window *bw, g->shared->tabs=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] = 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, const struct rect *rect) { +#ifdef __amigaos4__ g->shared->drag_op = type; 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; } } - +#endif return true; } @@ -5028,7 +5058,7 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg break; } break; - +#ifdef __amigaos4__ case IDCMP_EXTENDEDMOUSE: 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); } break; - +#endif case IDCMP_SIZEVERIFY: break; @@ -5287,8 +5317,9 @@ int main(int argc, char** argv) .llcache = amiga_filesystem_llcache_table, }; +#ifdef __amigaos4__ signal(SIGINT, SIG_IGN); - +#endif ret = netsurf_register(&amiga_table); if (ret != NSERROR_OK) { 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. */ popupmenu_lib_ok = FALSE; +#ifdef __amigaos4__ if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) { LOG(("popupmenu.library v%d.%d", PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision)); @@ -5320,7 +5352,7 @@ int main(int argc, char** argv) popupmenu_lib_ok = TRUE; CloseLibrary(PopupMenuBase); } - +#endif if (ami_open_resources() == false) { /* alloc message ports */ ami_misc_fatal_error("Unable to allocate resources"); return RETURN_FAIL; diff --git a/amiga/os3support.c b/amiga/os3support.c index 613701cc5..cc567f641 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -37,6 +37,16 @@ int64 GetFileSize(BPTR fh) return (int64)size; } +void FreeSysObject(ULONG type, APTR obj) +{ + switch(type) { + case ASOT_PORT: + DeleteMsgPort(obj); + break; + } +} + + /* Exec */ struct Node *GetHead(struct List *list) { @@ -49,6 +59,23 @@ struct Node *GetHead(struct List *list) 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 */ struct FormatContext { diff --git a/amiga/os3support.h b/amiga/os3support.h index 4de39d82f..805e1a137 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -1,5 +1,6 @@ /* * Copyright 2010 John-Mark Bell + * Copyright 2014 Chris Young * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -39,12 +40,54 @@ /* Macros */ #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 MEMF_PRIVATE 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 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 */ #define AnchorPathOld AnchorPath @@ -53,11 +96,6 @@ /* 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" @@ -65,12 +103,24 @@ /* DOS */ #define FOpen(A,B,C) Open(A,B) #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 */ #define IDoMethod DoMethod #define IDoMethodA DoMethodA #define IDoSuperMethodA DoSuperMethodA #define RefreshSetGadgetAttrs SetGadgetAttrs /*\todo This isn't quite right */ +#define ShowWindow(...) (void)0 + /* Utility */ #define SetMem memset @@ -117,13 +167,22 @@ struct TimeVal { #define IDFMT_PALETTEMAPPED (1) /* Palette mapped icon (chunky, V44+) */ #define IDFMT_DIRECTMAPPED (2) /* Direct mapped icon (truecolor 0xAARRGGBB, V51+) */ +/* Object types */ +enum { + ASOT_PORT = 1 +}; + /* Functions */ /* DOS */ int64 GetFileSize(BPTR fh); +void FreeSysObject(ULONG type, APTR obj); /* Exec */ struct Node *GetHead(struct List *list); +/* Intuition */ +uint32 GetAttrs(Object *obj, Tag tag1, ...); + /* Utility */ char *ASPrintf(const char *fmt, ...); -- cgit v1.2.3 From 6f9d96aedf44ac528d3b52ea89f6cd4e19286b8f Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 18:50:01 +0000 Subject: Fixup gui.c enough to make it compile for OS3 --- amiga/gui.c | 16 +++++++++++++--- amiga/os3support.h | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 9bea295a6..61904079e 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -1676,7 +1676,7 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon) warn_user("NoMemory", ""); return; } - +#ifdef __amigaos4__ BltBitMapTags(BLITA_SrcX, 0, BLITA_SrcY, 0, BLITA_DestX, bbox->Left, @@ -1690,7 +1690,11 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon) BLITA_Minterm, minterm, tag, tag_data, TAG_DONE); - +#else + /*\todo we are assuming we are always masking here, which might not be true */ + BltMaskBitMapRastPort(bm, 0, 0, g->shared->win->RPort, + bbox->Left, bbox->Top, 16, 16, tag_data, minterm); +#endif ami_gui_free_space_box(bbox); } } @@ -4319,7 +4323,7 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy, &clip, ctx)) { ami_clearclipreg(&browserglob); - +#ifdef __amigaos4__ BltBitMapTags(BLITA_SrcType, BLITT_BITMAP, BLITA_Source, browserglob.bm, BLITA_SrcX, 0, @@ -4331,6 +4335,12 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy, BLITA_Width, (int)(clip.x1), BLITA_Height, (int)(clip.y1), TAG_DONE); +#else + BltBitMapRastPort(browserglob.bm, 0, 0, gwin->win->RPort, + bbox->Left + (int)((x - sx) * gwin->gw->scale), + bbox->Top + (int)((y - sy) * gwin->gw->scale), + (int)(clip.x1), (int)(clip.y1), 0xC0); +#endif } } } diff --git a/amiga/os3support.h b/amiga/os3support.h index 805e1a137..d0979e063 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -48,7 +48,10 @@ #define MEMF_SHARED MEMF_ANY /* Ignore unsupported tags */ +#define ASO_NoTrack TAG_IGNORE #define BITMAP_DisabledSourceFile TAG_IGNORE +#define BLITA_UseSrcAlpha TAG_IGNORE +#define BLITA_MaskPlane TAG_IGNORE #define CLICKTAB_CloseImage TAG_IGNORE #define CLICKTAB_FlagImage TAG_IGNORE #define CLICKTAB_LabelTruncate TAG_IGNORE @@ -101,6 +104,7 @@ #define ObtainCharsetInfo(A,B,C) (const char *)"ISO-8859-1" /* DOS */ +#define AllocSysObjectTags(A,B,C,D) CreateMsgPort() /* Assume ASOT_PORT for now */ #define FOpen(A,B,C) Open(A,B) #define FClose(A) Close(A) #define CreateDirTree(D) CreateDir(D) /*\todo This isn't quite right */ -- cgit v1.2.3 From 69075f1c5744e77ac819d08821dffc90eb73b5d3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 18:53:41 +0000 Subject: Fixup gui_options.c for OS3 --- amiga/gui_options.c | 5 +++-- amiga/os3support.h | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/amiga/gui_options.c b/amiga/gui_options.c index d4a755e25..2187c30ab 100755 --- a/amiga/gui_options.c +++ b/amiga/gui_options.c @@ -491,8 +491,9 @@ void ami_gui_opts_open(void) scaledisabled = TRUE; scaleselected = FALSE; } - +#ifdef __amigaos4__ if(ApplicationBase->lib_Version < 53) +#endif { download_notify_disabled = TRUE; nsoption_set_bool(download_notify, FALSE); @@ -526,7 +527,7 @@ void ami_gui_opts_open(void) { ami_gui_opts_setup(); - gow = AllocVecTags(sizeof(struct ami_gui_opts_window), AVT_ClearWithValue, 0, TAG_DONE); + gow = ami_misc_allocvec_clear(sizeof(struct ami_gui_opts_window), 0); gow->objects[OID_MAIN] = WindowObject, WA_ScreenTitle, ami_gui_get_screen_title(), diff --git a/amiga/os3support.h b/amiga/os3support.h index d0979e063..5fb113466 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -56,6 +56,8 @@ #define CLICKTAB_FlagImage TAG_IGNORE #define CLICKTAB_LabelTruncate TAG_IGNORE #define CLICKTAB_NodeClosed TAG_IGNORE +#define GETFONT_OTagOnly TAG_IGNORE +#define GETFONT_ScalableOnly TAG_IGNORE #define PDTA_PromoteMask TAG_IGNORE #define RPTAG_APenColor TAG_IGNORE #define GA_HintInfo TAG_IGNORE @@ -95,6 +97,11 @@ /* Renamed structures */ #define AnchorPathOld AnchorPath +/* ReAction (ClassAct) macros */ +#define GetFileEnd End +#define GetFontEnd End +#define GetScreenModeEnd End + /* Easy compat macros */ /* application */ #define Notify(...) (void)0 -- cgit v1.2.3 From 0673ac5096f79bff53f4f976be86275cef51d711 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 18:55:23 +0000 Subject: Fixup history_local.c for OS3 --- amiga/history_local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amiga/history_local.c b/amiga/history_local.c index 2fb1ba677..c8c7b7263 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -112,7 +112,7 @@ void ami_history_open(struct gui_window *gw) if(!gw->hw) { - gw->hw = AllocVecTags(sizeof(struct history_window), AVT_ClearWithValue, 0, TAG_DONE); + gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0); ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height); -- cgit v1.2.3 From cc634dd70697116eec4f10f258cb638bf58ae726 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 20:07:15 +0000 Subject: Lower requested library versions --- amiga/libs.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/amiga/libs.c b/amiga/libs.c index cab02d265..ec41ee22e 100644 --- a/amiga/libs.c +++ b/amiga/libs.c @@ -93,12 +93,12 @@ bool ami_libs_open(void) AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false) AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true) AMINS_LIB_OPEN("datatypes.library", 37, DataTypes, "main", 1, true) - AMINS_LIB_OPEN("diskfont.library", 50, Diskfont, "main", 1, true) + AMINS_LIB_OPEN("diskfont.library", 40, Diskfont, "main", 1, true) AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true) - AMINS_LIB_OPEN("graphics.library", 50, Graphics, "main", 1, true) - AMINS_LIB_OPEN("icon.library", 50, Icon, "main", 1, true) + AMINS_LIB_OPEN("graphics.library", 40, Graphics, "main", 1, true) + AMINS_LIB_OPEN("icon.library", 44, Icon, "main", 1, true) AMINS_LIB_OPEN("iffparse.library", 37, IFFParse, "main", 1, true) - AMINS_LIB_OPEN("intuition.library", 37, Intuition, "main", 1, true) + AMINS_LIB_OPEN("intuition.library", 40, Intuition, "main", 1, true) AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1, true) AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1, true) AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1, true) @@ -121,26 +121,26 @@ bool ami_libs_open(void) * we may as well just open them normally for now. */ - AMINS_LIB_OPEN("classes/arexx.class", 50, ARexx, "main", 1, true) - AMINS_LIB_OPEN("images/bevel.image", 50, Bevel, "main", 1, true) - AMINS_LIB_OPEN("images/bitmap.image", 50, BitMap, "main", 1, true) - AMINS_LIB_OPEN("gadgets/checkbox.gadget", 50, CheckBox, "main", 1, true) - AMINS_LIB_OPEN("gadgets/chooser.gadget", 50, Chooser, "main", 1, true) - AMINS_LIB_OPEN("gadgets/clicktab.gadget", 50, ClickTab, "main", 1, true) - AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 50, FuelGauge, "main", 1, true) - AMINS_LIB_OPEN("gadgets/getfile.gadget", 50, GetFile, "main", 1, true) - AMINS_LIB_OPEN("gadgets/getfont.gadget", 50, GetFont, "main", 1, true) - AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 50, GetScreenMode, "main", 1, true) - AMINS_LIB_OPEN("gadgets/integer.gadget", 50, Integer, "main", 1, true) - AMINS_LIB_OPEN("images/label.image", 50, Label, "main", 1, true) - AMINS_LIB_OPEN("gadgets/layout.gadget", 50, Layout, "main", 1, true) - AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 50, ListBrowser, "main", 1, true) - AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 50, RadioButton, "main", 1, true) - AMINS_LIB_OPEN("gadgets/scroller.gadget", 50, Scroller, "main", 1, true) - AMINS_LIB_OPEN("gadgets/space.gadget", 50, Space, "main", 1, true) - AMINS_LIB_OPEN("gadgets/speedbar.gadget", 50, SpeedBar, "main", 1, true) - AMINS_LIB_OPEN("gadgets/string.gadget", 50, String, "main", 1, true) - AMINS_LIB_OPEN("classes/window.class", 50, Window, "main", 1, true) + AMINS_LIB_OPEN("classes/arexx.class", 44, ARexx, "main", 1, true) + AMINS_LIB_OPEN("images/bevel.image", 44, Bevel, "main", 1, true) + AMINS_LIB_OPEN("images/bitmap.image", 44, BitMap, "main", 1, true) + AMINS_LIB_OPEN("gadgets/checkbox.gadget", 44, CheckBox, "main", 1, true) + AMINS_LIB_OPEN("gadgets/chooser.gadget", 44, Chooser, "main", 1, true) + AMINS_LIB_OPEN("gadgets/clicktab.gadget", 44, ClickTab, "main", 1, true) + AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 44, FuelGauge, "main", 1, true) + AMINS_LIB_OPEN("gadgets/getfile.gadget", 44, GetFile, "main", 1, true) + AMINS_LIB_OPEN("gadgets/getfont.gadget", 44, GetFont, "main", 1, true) + AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 44, GetScreenMode, "main", 1, true) + AMINS_LIB_OPEN("gadgets/integer.gadget", 44, Integer, "main", 1, true) + AMINS_LIB_OPEN("images/label.image", 44, Label, "main", 1, true) + AMINS_LIB_OPEN("gadgets/layout.gadget", 44, Layout, "main", 1, true) + AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 44, ListBrowser, "main", 1, true) + AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 44, RadioButton, "main", 1, true) + AMINS_LIB_OPEN("gadgets/scroller.gadget", 44, Scroller, "main", 1, true) + AMINS_LIB_OPEN("gadgets/space.gadget", 44, Space, "main", 1, true) + AMINS_LIB_OPEN("gadgets/speedbar.gadget", 44, SpeedBar, "main", 1, true) + AMINS_LIB_OPEN("gadgets/string.gadget", 44, String, "main", 1, true) + AMINS_LIB_OPEN("classes/window.class", 44, Window, "main", 1, true) return true; } -- cgit v1.2.3 From d6052d3955ffa1aca81c3363b7c53aec51cb6208 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 20:11:33 +0000 Subject: Fixup icon.c for OS3 --- amiga/icon.c | 74 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/amiga/icon.c b/amiga/icon.c index 2745fcf0f..dfbf84c09 100644 --- a/amiga/icon.c +++ b/amiga/icon.c @@ -376,43 +376,41 @@ void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct TAG_DONE); if(format != IDFMT_DIRECTMAPPED) return; - { - if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) - { - bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL); - } +#ifdef __amigaos4__ + if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) { + bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL); + } - if(bm) - { - BltBitMapTags(BLITA_SrcX, 0, - BLITA_SrcY, 0, - BLITA_DestX, width - 16, - BLITA_DestY, height - 16, - BLITA_Width, 16, - BLITA_Height, 16, - BLITA_Source, bm, - BLITA_Dest, icondata1, - BLITA_SrcType, BLITT_BITMAP, - BLITA_DestType, BLITT_ARGB32, - BLITA_DestBytesPerRow, width * 4, - BLITA_UseSrcAlpha, TRUE, - TAG_DONE); + if(bm) { + BltBitMapTags(BLITA_SrcX, 0, + BLITA_SrcY, 0, + BLITA_DestX, width - 16, + BLITA_DestY, height - 16, + BLITA_Width, 16, + BLITA_Height, 16, + BLITA_Source, bm, + BLITA_Dest, icondata1, + BLITA_SrcType, BLITT_BITMAP, + BLITA_DestType, BLITT_ARGB32, + BLITA_DestBytesPerRow, width * 4, + BLITA_UseSrcAlpha, TRUE, + TAG_DONE); - BltBitMapTags(BLITA_SrcX, 0, - BLITA_SrcY, 0, - BLITA_DestX, width - 16, - BLITA_DestY, height - 16, - BLITA_Width, 16, - BLITA_Height, 16, - BLITA_Source, bm, - BLITA_Dest, icondata2, - BLITA_SrcType, BLITT_BITMAP, - BLITA_DestType, BLITT_ARGB32, - BLITA_DestBytesPerRow, width * 4, - BLITA_UseSrcAlpha, TRUE, - TAG_DONE); - } + BltBitMapTags(BLITA_SrcX, 0, + BLITA_SrcY, 0, + BLITA_DestX, width - 16, + BLITA_DestY, height - 16, + BLITA_Width, 16, + BLITA_Height, 16, + BLITA_Source, bm, + BLITA_Dest, icondata2, + BLITA_SrcType, BLITT_BITMAP, + BLITA_DestType, BLITT_ARGB32, + BLITA_DestBytesPerRow, width * 4, + BLITA_UseSrcAlpha, TRUE, + TAG_DONE); } +#endif } void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type) @@ -496,7 +494,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm) { struct DiskObject *dobj; struct BitMap *bitmap; - +#ifdef __amigaos4__ if(bm) { bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH, @@ -512,11 +510,11 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm) BLITA_Dest, bm->icondata, TAG_DONE); } - +#endif dobj = GetIconTags(NULL, ICONGETA_GetDefaultType, WBPROJECT, ICONGETA_GetDefaultName, "iconify", TAG_DONE); - +#ifdef __amigaos4__ if(bm) { IconControl(dobj, @@ -527,7 +525,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm) ICONCTRLA_SetImageData2, NULL, TAG_DONE); } - +#endif dobj->do_Gadget.UserData = bm; LayoutIconA(dobj, (struct Screen *)~0UL, NULL); -- cgit v1.2.3 From 2eb41ed77b2deb3a1c54c7b6b94a7c31fb603714 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 21:11:00 +0000 Subject: More OS3 fixes --- amiga/libs.c | 23 +++++++++++++++++++++++ amiga/login.c | 3 +-- amiga/menu.c | 24 +++++++++++++++++------- amiga/misc.c | 11 ++++++++--- amiga/object.c | 5 ++++- amiga/os3support.c | 11 +++++++++++ amiga/os3support.h | 15 +++++++++++++++ amiga/plotters.c | 23 +++++++++++++++++++---- 8 files changed, 98 insertions(+), 17 deletions(-) diff --git a/amiga/libs.c b/amiga/libs.c index ec41ee22e..7810fad6e 100644 --- a/amiga/libs.c +++ b/amiga/libs.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include "amiga/libs.h" #include "amiga/misc.h" #include "utils/utils.h" @@ -24,6 +26,7 @@ #include #include +#ifdef __amigaos4__ #define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \ LOG(("Opening %s v%d", LIB, LIBVER)); \ if((PREFIX##Base = OpenLibrary(LIB, LIBVER))) { \ @@ -48,6 +51,26 @@ #define AMINS_LIB_STRUCT(PREFIX) \ struct Library *PREFIX##Base; \ struct PREFIX##IFace *I##PREFIX; +#else +#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \ + LOG(("Opening %s v%d", LIB, LIBVER)); \ + if((PREFIX##Base = OpenLibrary(LIB, LIBVER))) { \ + } else { \ + LOG(("Failed to open %s v%d", LIB, LIBVER)); \ + if(FAIL == true) { \ + STRPTR error = ASPrintf("Unable to open %s v%d", LIB, LIBVER); \ + ami_misc_fatal_error(error); \ + FreeVec(error); \ + return false; \ + } \ + } + +#define AMINS_LIB_CLOSE(PREFIX) \ + if(PREFIX##Base) CloseLibrary(PREFIX##Base); + +#define AMINS_LIB_STRUCT(PREFIX) \ + struct Library *PREFIX##Base; +#endif #define GraphicsBase GfxBase /* graphics.library is a bit weird */ diff --git a/amiga/login.c b/amiga/login.c index e9e221bbc..fe476acc1 100755 --- a/amiga/login.c +++ b/amiga/login.c @@ -61,8 +61,7 @@ void gui_401login_open(nsurl *url, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw) { const char *auth; - struct gui_login_window *lw = AllocVecTags(sizeof(struct gui_login_window), - AVT_ClearWithValue, 0, TAG_DONE); + struct gui_login_window *lw = ami_misc_allocvec_clear(sizeof(struct gui_login_window), 0); lwc_string *host = nsurl_get_component(url, NSURL_HOST); assert(host != NULL); diff --git a/amiga/menu.c b/amiga/menu.c index 3eb8a9846..e5d35a974 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include @@ -196,7 +198,7 @@ static void ami_init_menulabs(struct gui_window_2 *gwin) { int i; - gwin->menutype = AllocVecTags(AMI_MENU_AREXX_MAX + 1, AVT_ClearWithValue, 0, TAG_DONE); + gwin->menutype = ami_misc_allocvec_clear(AMI_MENU_AREXX_MAX + 1, 0); for(i=0;i <= AMI_MENU_AREXX_MAX;i++) { @@ -333,6 +335,7 @@ void ami_menu_refresh(struct gui_window_2 *gwin) static void ami_menu_load_glyphs(struct DrawInfo *dri) { +#ifdef __amigaos4__ for(int i = 0; i < NSA_GLYPH_MAX; i++) menu_glyph[i] = NULL; @@ -350,10 +353,12 @@ static void ami_menu_load_glyphs(struct DrawInfo *dri) (ULONG *)&menu_glyph_width[NSA_GLYPH_AMIGAKEY]); menu_glyphs_loaded = true; +#endif } void ami_menu_free_glyphs(void) { +#ifdef __amigaos4__ int i; if(menu_glyphs_loaded == false) return; @@ -363,6 +368,7 @@ void ami_menu_free_glyphs(void) }; menu_glyphs_loaded = false; +#endif } static int ami_menu_calc_item_width(struct gui_window_2 *gwin, int j, struct RastPort *rp) @@ -413,7 +419,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin) j++; } while((gwin->menutype[j] != NM_TITLE) && (gwin->menutype[j] != 0)); } - +#ifdef __amigaos4__ if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 6)) { /* GadTools 53.6+ only. For now we will only create the menu using label.image if there's a bitmap associated with the item. */ @@ -495,7 +501,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin) if(gwin->menuobj[i]) gwin->menutype[i] |= MENU_IMAGE; } } - +#endif gwin->menu[i].nm_Type = gwin->menutype[i]; if(gwin->menuobj[i]) @@ -520,8 +526,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin) struct NewMenu *ami_create_menu(struct gui_window_2 *gwin) { - gwin->menu = AllocVecTags(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), - AVT_ClearWithValue, 0, TAG_DONE); + gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0); ami_init_menulabs(gwin); ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin); ami_menu_arexx_scan(gwin); @@ -835,7 +840,7 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I temp2 = ami_utf8_easy(temp); FreeVec(temp); - +#ifdef __amigaos4__ sel = TimedDosRequesterTags(TDR_ImageType,TDRIMAGE_INFO, TDR_TitleString, messages_get("NetSurf"), TDR_Window, gwin->win, @@ -844,7 +849,12 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I TDR_Arg1,netsurf_version, TDR_Arg2,verdate, TAG_DONE); - +#else + /*\todo proper requester for OS3 + * at the moment menus are disabled so won't get here anyway */ + printf("NetSurf %s\nBuild date %s\n", netsurf_version, verdate); + sel = 0; +#endif free(temp2); if(sel == 2) { diff --git a/amiga/misc.c b/amiga/misc.c index 0cd3baedd..73a87e78d 100755 --- a/amiga/misc.c +++ b/amiga/misc.c @@ -52,7 +52,7 @@ static LONG ami_misc_req(const char *message, uint32 type) LONG ret = 0; LOG(("%s", message)); - +#ifdef __amigaos4__ ret = TimedDosRequesterTags( TDR_TitleString, messages_get("NetSurf"), TDR_FormatString, message, @@ -60,7 +60,9 @@ static LONG ami_misc_req(const char *message, uint32 type) TDR_ImageType, type, TDR_Window, cur_gw ? cur_gw->shared->win : NULL, TAG_DONE); - +#else + printf("%s\n", message); +#endif return ret; } @@ -84,6 +86,7 @@ void warn_user(const char *warning, const char *detail) int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win) { int res = 0; +#ifdef __amigaos4__ char *utf8text = ami_utf8_easy(body); char *utf8gadget1 = ami_utf8_easy(messages_get(opt1)); char *utf8gadget2 = ami_utf8_easy(messages_get(opt2)); @@ -100,7 +103,9 @@ int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, if(utf8text) free(utf8text); if(utf8gadgets) FreeVec(utf8gadgets); - +#else +#warning write this for os3 +#endif return res; } diff --git a/amiga/object.c b/amiga/object.c index 0c848aa5f..99f359ad1 100755 --- a/amiga/object.c +++ b/amiga/object.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include @@ -24,6 +26,7 @@ #include "amiga/filetype.h" #include "amiga/font.h" +#include "amiga/misc.h" #include "amiga/object.h" struct MinList *NewObjList(void) @@ -43,7 +46,7 @@ struct nsObject *AddObject(struct MinList *objlist, ULONG otype) { struct nsObject *dtzo; - dtzo = (struct nsObject *)AllocVecTags(sizeof(struct nsObject), AVT_ClearWithValue, 0, TAG_DONE); + dtzo = (struct nsObject *)ami_misc_allocvec_clear(sizeof(struct nsObject), 0); AddTail((struct List *)objlist,(struct Node *)dtzo); diff --git a/amiga/os3support.c b/amiga/os3support.c index cc567f641..dda3df31e 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -23,6 +23,17 @@ #ifndef __amigaos4__ #include "os3support.h" +#include +#include +#include +#include +#include +#include + +#define SUCCESS (TRUE) +#define FAILURE (FALSE) +#define NO ! + /* DOS */ int64 GetFileSize(BPTR fh) { diff --git a/amiga/os3support.h b/amiga/os3support.h index 5fb113466..93bb0ba11 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -37,6 +37,14 @@ #include #endif +#ifndef ASM +#define ASM +#endif + +#ifndef REG +#define REG(reg,arg) arg __asm(#reg) +#endif + /* Macros */ #define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0 @@ -93,6 +101,7 @@ #define IDCMP_EXTENDEDMOUSE 0 #define WINDOW_BACKMOST 0 #define DN_FULLPATH 0 +#define BGBACKFILL JAM1 /* Renamed structures */ #define AnchorPathOld AnchorPath @@ -183,6 +192,12 @@ enum { ASOT_PORT = 1 }; +/* Requester types */ +enum { + TDRIMAGE_ERROR = 1, + TDRIMAGE_WARNING +}; + /* Functions */ /* DOS */ int64 GetFileSize(BPTR fh); diff --git a/amiga/plotters.c b/amiga/plotters.c index 855d10497..490d51955 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include #include @@ -46,7 +48,9 @@ #include "amiga/gui.h" #include "amiga/utf8.h" +#ifdef __amigaos4__ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct BackFillMessage *bfmsg); +#endif struct bfbitmap { struct BitMap *bm; @@ -138,7 +142,6 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) InitRastPort(gg->rp); gg->rp->BitMap = gg->bm; - /* Is all this safe to do to an existing window RastPort? */ SetDrMd(gg->rp,BGBACKFILL); gg->rp->Layer = CreateUpfrontLayer(gg->layerinfo,gg->rp->BitMap,0,0, @@ -232,9 +235,11 @@ void ami_plot_release_pens(struct MinList *shared_pens) static void ami_plot_setapen(ULONG colr) { if(palette_mapped == false) { +#ifdef __amigaos4__ SetRPAttrs(glob->rp, RPTAG_APenColor, ns_color_to_nscss(colr), TAG_DONE); +#endif } else { LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr); if(pen != -1) SetAPen(glob->rp, pen); @@ -244,9 +249,11 @@ static void ami_plot_setapen(ULONG colr) static void ami_plot_setopen(ULONG colr) { if(palette_mapped == false) { +#ifdef __amigaos4__ SetRPAttrs(glob->rp, RPTAG_OPenColor, ns_color_to_nscss(colr), TAG_DONE); +#endif } else { LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr); if(pen != -1) SetOPen(glob->rp, pen); @@ -521,7 +528,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma if((tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm))) minterm = (ABC|ABNC|ANBC); } - +#ifdef __amigaos4__ BltBitMapTags(BLITA_Width,width, BLITA_Height,height, BLITA_Source,tbm, @@ -533,6 +540,10 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma BLITA_Minterm, minterm, tag, tag_data, TAG_DONE); +#else + /* Assume mask is always required */ + BltMaskBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, tag_data, minterm); +#endif } if((bitmap->dto == NULL) && (tbm != bitmap->nativebm)) @@ -562,7 +573,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height, if(!(repeat_x || repeat_y)) return ami_bitmap(x, y, width, height, bitmap); - +#ifdef __amigaos4__ /* If it is a one pixel transparent image, we are wasting our time */ if((bitmap->opaque == false) && (bitmap->width == 1) && (bitmap->height == 1)) return true; @@ -641,10 +652,13 @@ bool ami_bitmap_tile(int x, int y, int width, int height, { p96FreeBitMap(tbm); } - +#else +#warning FIXME: bitmap tiling uses backfill hooks +#endif return true; } +#ifdef __amigaos4__ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct BackFillMessage *bfmsg) { int xf,yf; @@ -700,6 +714,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba } } } +#endif bool ami_group_start(const char *name) { -- cgit v1.2.3 From 201bc569a4f40b1b2e53660cceb183570534b557 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 23:13:32 +0000 Subject: More OS3 compilation fixes --- amiga/os3support.c | 3 +++ amiga/os3support.h | 11 ++++++++++- amiga/plugin_hack.c | 6 +++++- amiga/print.c | 16 ++++++++++++---- amiga/schedule.c | 8 ++++++-- amiga/search.c | 2 +- amiga/stringview/stringview.c | 4 ++-- amiga/stringview/urlhistory.c | 16 ++++++++-------- amiga/theme.c | 20 ++++++++++++++++---- amiga/tree.c | 29 +++++++++++++++++++++-------- 10 files changed, 84 insertions(+), 31 deletions(-) diff --git a/amiga/os3support.c b/amiga/os3support.c index dda3df31e..7eafc7db4 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -54,6 +54,9 @@ void FreeSysObject(ULONG type, APTR obj) case ASOT_PORT: DeleteMsgPort(obj); break; + case ASOT_IOREQUEST: + DeleteIORequest(obj); + break; } } diff --git a/amiga/os3support.h b/amiga/os3support.h index 93bb0ba11..e28985eaf 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -98,6 +98,7 @@ #define RAWKEY_END 0x71 /* Other constants */ +#define BVS_DISPLAY BVS_NONE #define IDCMP_EXTENDEDMOUSE 0 #define WINDOW_BACKMOST 0 #define DN_FULLPATH 0 @@ -143,6 +144,7 @@ /* Utility */ #define SetMem memset +#define SNPrintf snprintf /* Integral type definitions */ typedef int8_t int8; @@ -160,6 +162,12 @@ struct TimeVal { uint32 Microseconds; }; +/* TimeRequest */ +struct TimeRequest { + struct IORequest Request; + struct TimeVal Time; +}; + /* Compositing */ #define COMPFLAG_IgnoreDestAlpha 0 #define COMPFLAG_SrcAlphaOverride 0 @@ -189,7 +197,8 @@ struct TimeVal { /* Object types */ enum { - ASOT_PORT = 1 + ASOT_PORT = 1, + ASOT_IOREQUEST }; /* Requester types */ diff --git a/amiga/plugin_hack.c b/amiga/plugin_hack.c index 7982a6734..23f4d3454 100644 --- a/amiga/plugin_hack.c +++ b/amiga/plugin_hack.c @@ -17,9 +17,11 @@ */ /** \file - * DataTypes picture handler (implementation) + * Plugin=>external program handler (implementation) */ +#include "amiga/os3support.h" + #include "amiga/filetype.h" #include "amiga/plugin_hack.h" #include "content/content_protected.h" @@ -250,6 +252,7 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c) if(full_cmd) { +#ifdef __amigaos4__ LOG(("Attempting to execute %s", full_cmd)); in = Open("NIL:", MODE_OLDFILE); @@ -264,5 +267,6 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c) TAG_DONE); FreeVec(full_cmd); +#endif } } diff --git a/amiga/print.c b/amiga/print.c index 862e598c7..5c89705d3 100644 --- a/amiga/print.c +++ b/amiga/print.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include #include @@ -53,6 +55,7 @@ #include "amiga/plotters.h" #include "amiga/gui.h" +#include "amiga/misc.h" #include "amiga/print.h" #include "amiga/utf8.h" @@ -217,11 +220,11 @@ void ami_print_ui(struct hlcache_handle *c) char filename[30]; int i; - struct ami_print_window *pw = AllocVecTags(sizeof(struct ami_print_window), AVT_ClearWithValue, 0, TAG_DONE); + struct ami_print_window *pw = ami_misc_allocvec_clear(sizeof(struct ami_print_window), 0); pw->c = c; - printers[0] = AllocVecTags(50, AVT_ClearWithValue, 0, TAG_DONE); + printers[0] = ami_misc_allocvec_clear(50, 0); ami_print_readunit("ENV:Sys/printer.prefs", printers[0], 50, 0); strcpy(filename,"ENV:Sys/printerN.prefs"); @@ -385,13 +388,18 @@ void ami_print(struct hlcache_handle *c, int copies) if(ami_print_info.msgport == NULL) ami_print_init(); - +#ifdef __amigaos4__ if(!(ami_print_info.PReq = (struct IODRPTagsReq *)AllocSysObjectTags(ASOT_IOREQUEST, ASOIOR_Size, sizeof(struct IODRPTagsReq), ASOIOR_ReplyPort, ami_print_info.msgport, ASO_NoTrack, FALSE, TAG_DONE))) return; +#else + if(!(ami_print_info.PReq = + (struct IODRPTagsReq *)CreateIORequest(ami_print_info.msgport, + sizeof(struct IODRPTagsReq)))) return; +#endif if(OpenDevice("printer.device", nsoption_int(printer_unit), (struct IORequest *)ami_print_info.PReq, 0)) @@ -467,7 +475,7 @@ struct MsgPort *ami_print_get_msgport(void) bool ami_print_begin(struct print_settings *ps) { - ami_print_info.gg = AllocVecTags(sizeof(struct gui_globals), AVT_ClearWithValue, 0, TAG_DONE); + ami_print_info.gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0); if(!ami_print_info.gg) return false; ami_init_layers(ami_print_info.gg, diff --git a/amiga/schedule.c b/amiga/schedule.c index 93389a8d9..494b8b027 100755 --- a/amiga/schedule.c +++ b/amiga/schedule.c @@ -297,18 +297,22 @@ static struct MsgPort *ami_schedule_open_timer(struct MsgPort *msgport) ASO_NoTrack, FALSE, TAG_DONE); } - +#ifdef __amigaos4__ tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST, ASOIOR_Size,sizeof(struct TimeRequest), ASOIOR_ReplyPort,msgport, ASO_NoTrack,FALSE, TAG_DONE); +#else + tioreq = (struct TimeRequest *)CreateIORequest(msgport, sizeof(struct TimeRequest)); +#endif OpenDevice("timer.device", UNIT_WAITUNTIL, (struct IORequest *)tioreq, 0); TimerBase = (struct Device *)tioreq->Request.io_Device; +#ifdef __amigaos4__ ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL); - +#endif return msgport; } diff --git a/amiga/search.c b/amiga/search.c index ac061cbc3..ab32abbdf 100755 --- a/amiga/search.c +++ b/amiga/search.c @@ -103,7 +103,7 @@ void ami_search_open(struct gui_window *gwin) return; } - fwin = AllocVecTags(sizeof(struct find_window), AVT_ClearWithValue, 0, TAG_DONE); + fwin = ami_misc_allocvec_clear(sizeof(struct find_window), 0); fwin->objects[OID_MAIN] = WindowObject, WA_ScreenTitle, ami_gui_get_screen_title(), diff --git a/amiga/stringview/stringview.c b/amiga/stringview/stringview.c index daabe58e0..a009f228a 100755 --- a/amiga/stringview/stringview.c +++ b/amiga/stringview/stringview.c @@ -667,7 +667,7 @@ static uint32 myStringClass_GM_HandleInput( Class *cl, Object *obj, struct gpInp myStringHandleListview( cl, obj ); break; } - +#ifdef __amigaos4__ case IECLASS_MOUSEWHEEL: { struct InputEvent *ie = msg->gpi_IEvent; @@ -686,7 +686,7 @@ static uint32 myStringClass_GM_HandleInput( Class *cl, Object *obj, struct gpInp retval = GMR_MEACTIVE; break; } - +#endif default: { retval = IDoSuperMethodA( cl, obj, (APTR)msg ); diff --git a/amiga/stringview/urlhistory.c b/amiga/stringview/urlhistory.c index 6d134a4a5..d55a4b4b6 100644 --- a/amiga/stringview/urlhistory.c +++ b/amiga/stringview/urlhistory.c @@ -33,6 +33,12 @@ static struct List PageList; +#ifdef __amigaos4__ +#define ALLOCVEC_SHARED(N) AllocVecTags((N), AVT_Type, MEMF_SHARED, TAG_DONE); +#else +#define ALLOCVEC_SHARED(N) AllocVec((N), MEMF_SHARED); +#endif + void URLHistory_Init( void ) { // Initialise page list @@ -79,17 +85,11 @@ static bool URLHistoryFound(nsurl *url, const struct url_data *data) /* skip this URL if it is already in the list */ if(URLHistory_FindPage(nsurl_access(url))) return true; - node = AllocVecTags(sizeof(struct Node), - AVT_Type, MEMF_SHARED, - //AVT_ClearWithValue, 0, - TAG_DONE); + node = ALLOCVEC_SHARED(sizeof(struct Node)); if ( node ) { - STRPTR urladd = (STRPTR) AllocVecTags( strlen ( nsurl_access(url) ) + 1, - AVT_Type, MEMF_SHARED, - //AVT_ClearWithValue, 0, - TAG_DONE); + STRPTR urladd = (STRPTR) ALLOCVEC_SHARED( strlen ( nsurl_access(url) ) + 1); if ( urladd ) { diff --git a/amiga/theme.c b/amiga/theme.c index b7099e897..b75f6ed5c 100644 --- a/amiga/theme.c +++ b/amiga/theme.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include @@ -99,6 +101,7 @@ const char *ptrs32[AMI_LASTPOINTER+1] = { "ptr32_blank", "ptr32_drag"}; +#ifdef __amigaos4__ /* Mapping from NetSurf to AmigaOS mouse pointers */ int osmouseptr[AMI_LASTPOINTER+1] = { POINTERTYPE_NORMAL, @@ -122,7 +125,7 @@ int osmouseptr[AMI_LASTPOINTER+1] = { POINTERTYPE_PROGRESS, POINTERTYPE_NONE, POINTERTYPE_DRAGANDDROP}; - +#endif void ami_theme_init(void) { @@ -218,13 +221,15 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape) if(drag_save_data) return; if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) { +#ifdef __amigaos4__ BOOL ptr_delay = FALSE; if(shape == GUI_POINTER_WAIT) ptr_delay = TRUE; SetWindowPointer(win, WA_PointerType, osmouseptr[shape], WA_PointerDelay, ptr_delay, - TAG_DONE); + TAG_DONE); +#endif } else { if(nsoption_bool(os_mouse_pointers)) { @@ -408,12 +413,14 @@ void gui_window_start_throbber(struct gui_window *g) if(!g) return; if(nsoption_bool(kiosk_mode)) return; +#ifdef __amigaos4__ if(g->tab_node && (g->shared->tabs > 1)) { SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, TRUE, TAG_DONE); RefreshGadgets((APTR)g->shared->objects[GID_TABS], g->shared->win, NULL); } +#endif g->throbbing = true; if(g->shared->throbber_frame == 0) g->shared->throbber_frame = 1; @@ -427,12 +434,14 @@ void gui_window_stop_throbber(struct gui_window *g) if(!g) return; if(nsoption_bool(kiosk_mode)) return; +#ifdef __amigaos4__ if(g->tab_node && (g->shared->tabs > 1)) { SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, FALSE, TAG_DONE); RefreshGadgets((APTR)g->shared->objects[GID_TABS], g->shared->win, NULL); } +#endif if(g == g->shared->gw) { if(ami_gui_get_space_box(g->shared->objects[GID_THROBBER], &bbox) != NSERROR_OK) { @@ -471,7 +480,7 @@ static void ami_throbber_update(void *p) warn_user("NoMemory", ""); return; } - +#ifdef __amigaos4__ BltBitMapTags(BLITA_SrcX, throbber_width * frame, BLITA_SrcY, 0, BLITA_DestX, bbox->Left, @@ -484,7 +493,10 @@ static void ami_throbber_update(void *p) BLITA_DestType, BLITT_RASTPORT, // BLITA_UseSrcAlpha, TRUE, TAG_DONE); - +#else + BltBitMapRastPort(throbber, throbber_width * frame, 0, g->shared->win->RPort, + bbox->Left, bbox->Top, throbber_width, throbber_height, 0xC0); +#endif ami_gui_free_space_box(bbox); } diff --git a/amiga/tree.c b/amiga/tree.c index 75ba123ad..5d453b600 100644 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -42,7 +42,9 @@ #include #include #include +#ifdef __amigaos4__ #include +#endif #include #include @@ -62,6 +64,7 @@ #include "amiga/gui.h" #include "amiga/tree.h" #include "amiga/file.h" +#include "amiga/misc.h" #include "amiga/utf8.h" #include "amiga/sslcert.h" #include "amiga/drag.h" /* drag icon stuff */ @@ -315,7 +318,7 @@ static void ami_tree_redraw_req(void *p) tree_draw(twin->tree, - tile_x, - tile_y, tile_x, tile_y, tile_w, tile_h, &ctx); - +#ifdef __amigaos4__ BltBitMapTags(BLITA_SrcType, BLITT_BITMAP, BLITA_Source, twin->globals.bm, BLITA_SrcX, 0, @@ -327,6 +330,11 @@ static void ami_tree_redraw_req(void *p) BLITA_Width, tile_w, BLITA_Height, tile_h, TAG_DONE); +#else + BltBitMapRastPort(twin->globals.bm, 0, 0, + twin->win->RPort, bbox->Left + tile_x - pos_x, bbox->Top + tile_y - pos_y, + tile_w, tile_h, 0xC0); +#endif } } @@ -534,7 +542,7 @@ static void ami_tree_scroller_hook(struct Hook *hook,Object *object,struct Intui break; } break; - +#ifdef __amigaos4__ case IDCMP_EXTENDEDMOUSE: if(msg->Code == IMSGCODE_INTUIWHEELDATA) { @@ -543,6 +551,7 @@ static void ami_tree_scroller_hook(struct Hook *hook,Object *object,struct Intui ami_tree_scroll(twin, (wheel->WheelX * 20), (wheel->WheelY * 20)); } break; +#endif } } @@ -550,9 +559,7 @@ static void ami_tree_menu(struct treeview_window *twin) { if(twin->menu) return; - if((twin->menu = AllocVecTags(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, - AVT_ClearWithValue, 0, TAG_DONE))) - { + if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) { twin->menu[0].nm_Type = NM_TITLE; twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree")); twin->menu[0].nm_Label = twin->menu_name[0]; @@ -902,9 +909,11 @@ void ami_tree_close(struct treeview_window *twin) static void ami_tree_update_quals(struct treeview_window *twin) { uint32 quals = 0; - +#ifdef __amigaos4__ GetAttr(WINDOW_Qualifier, twin->objects[OID_MAIN], (uint32 *)&quals); - +#else +#warning FIXME not reading qualifiers on OS3 +#endif twin->key_state = 0; if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT)) @@ -976,7 +985,9 @@ BOOL ami_tree_event(struct treeview_window *twin) if((twin->type != AMI_TREE_SSLCERT) && (twin->rmbtrapped == FALSE)) { +#ifdef __amigaos4__ SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)TRUE, sizeof(BOOL)); +#endif twin->rmbtrapped = TRUE; } } @@ -984,7 +995,9 @@ BOOL ami_tree_event(struct treeview_window *twin) { if(twin->rmbtrapped == TRUE) { +#ifdef __amigaos4__ SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)FALSE, sizeof(BOOL)); +#endif twin->rmbtrapped = FALSE; } } @@ -1455,7 +1468,7 @@ struct treeview_window *ami_tree_create(int flags, { struct treeview_window *twin; - twin = AllocVecTags(sizeof(struct treeview_window), AVT_ClearWithValue, 0, TAG_DONE); + twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0); if(!twin) { -- cgit v1.2.3 From 392fa2ea4cfc5df5a86b6cde0e05c909da26f1e5 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 23:29:49 +0000 Subject: Fix some easy OS3 linker errors --- amiga/Makefile.defaults | 6 +++++- amiga/Makefile.target | 2 +- amiga/help.c | 2 ++ amiga/libs.c | 17 ++++++++++++++++- amiga/os3support.h | 3 ++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults index 2134e8373..243e44b38 100644 --- a/amiga/Makefile.defaults +++ b/amiga/Makefile.defaults @@ -4,7 +4,11 @@ # Force using glibc internal iconv implementation instead of external libiconv # Valid options: YES, NO -NETSURF_USE_LIBICONV_PLUG := YES +ifneq ($(SUBTARGET),os3) + NETSURF_USE_LIBICONV_PLUG := YES +else + NETSURF_USE_LIBICONV_PLUG := NO +endif # Enable NetSurf's use of librosprite for displaying RISC OS Sprites # Valid options: YES, NO, AUTO diff --git a/amiga/Makefile.target b/amiga/Makefile.target index d29e7aa17..ec478260d 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -53,7 +53,7 @@ else LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib ifeq ($(SUBTARGET),os3) - LDFLAGS += -lpbl -liconv + LDFLAGS += -lpbl -liconv -lamiga else LDFLAGS += -lpbl -liconv endif diff --git a/amiga/help.c b/amiga/help.c index 76dd1bd86..64b338426 100755 --- a/amiga/help.c +++ b/amiga/help.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include "amiga/help.h" /* AmigaGuide class */ diff --git a/amiga/libs.c b/amiga/libs.c index 7810fad6e..0f5131df8 100644 --- a/amiga/libs.c +++ b/amiga/libs.c @@ -74,7 +74,11 @@ #define GraphicsBase GfxBase /* graphics.library is a bit weird */ +#ifdef __amigaos4__ AMINS_LIB_STRUCT(Application); +#else +struct UtilityBase *UtilityBase; /* AMINS_LIB_STRUCT(Utility) */ +#endif AMINS_LIB_STRUCT(Asl); AMINS_LIB_STRUCT(DataTypes); AMINS_LIB_STRUCT(Diskfont); @@ -113,7 +117,14 @@ AMINS_LIB_STRUCT(Window); bool ami_libs_open(void) { +#ifdef __amigaos4__ + /* Libraries only needed on OS4 */ AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false) +#else + /* Libraries we get automatically on OS4 but not OS3 */ + AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true) +#endif + /* Standard libraries for both versions */ AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true) AMINS_LIB_OPEN("datatypes.library", 37, DataTypes, "main", 1, true) AMINS_LIB_OPEN("diskfont.library", 40, Diskfont, "main", 1, true) @@ -191,7 +202,6 @@ void ami_libs_close(void) AMINS_LIB_CLOSE(String) AMINS_LIB_CLOSE(Window) - AMINS_LIB_CLOSE(Application) AMINS_LIB_CLOSE(Asl) AMINS_LIB_CLOSE(DataTypes) AMINS_LIB_CLOSE(Diskfont) @@ -205,5 +215,10 @@ void ami_libs_close(void) AMINS_LIB_CLOSE(Locale) AMINS_LIB_CLOSE(P96) AMINS_LIB_CLOSE(Workbench) +#ifdef __amigaos4__ + AMINS_LIB_CLOSE(Application) +#else + AMINS_LIB_CLOSE(Utility) +#endif } diff --git a/amiga/os3support.h b/amiga/os3support.h index e28985eaf..4b5deb251 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -47,9 +47,9 @@ /* Macros */ #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 EAD_IS_FILE(E) ((E)->ed_Type<0) /* Define extra memory type flags */ #define MEMF_PRIVATE MEMF_ANY @@ -136,6 +136,7 @@ #define SetRPAttrs(...) (void)0 /*\todo Probably need to emulate this */ /* Intuition */ +#define ICoerceMethod CoerceMethod #define IDoMethod DoMethod #define IDoMethodA DoMethodA #define IDoSuperMethodA DoSuperMethodA -- cgit v1.2.3 From 73b158d27d95615439334b400c05bc1a9b8453db Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 18 Jan 2015 23:54:21 +0000 Subject: Fix remaining linker errors --- amiga/launch.c | 13 ++++++++++--- amiga/os3support.c | 14 ++++++++++++++ amiga/os3support.h | 7 +++++++ amiga/thumbnail.c | 2 ++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/amiga/launch.c b/amiga/launch.c index c3f993b28..5f22bdc23 100755 --- a/amiga/launch.c +++ b/amiga/launch.c @@ -124,8 +124,11 @@ static BOOL ami_openurl_check_list(struct MinList *list, nsurl *url) void ami_openurl_open(void) { if(nsoption_bool(use_openurl_lib)) { - if((OpenURLBase = OpenLibrary("openurl.library",0))) + if((OpenURLBase = OpenLibrary("openurl.library",0))) { +#ifdef __amigaos4__ IOpenURL = (struct OpenURLIFace *)GetInterface(OpenURLBase,"main",1,NULL); +#endif + } } NewMinList(&ami_unsupportedprotocols); @@ -133,7 +136,9 @@ void ami_openurl_open(void) void ami_openurl_close(void) { +#ifdef __amigaos4__ if(IOpenURL) DropInterface((struct Interface *)IOpenURL); +#endif if(OpenURLBase) CloseLibrary(OpenURLBase); ami_openurl_free_list(&ami_unsupportedprotocols); @@ -141,7 +146,9 @@ void ami_openurl_close(void) nserror gui_launch_url(struct nsurl *url) { +#ifdef __amigaos4__ APTR procwin = SetProcWindow((APTR)-1L); +#endif char *launchurl = NULL; if(ami_openurl_check_list(&ami_unsupportedprotocols, url) == FALSE) @@ -162,8 +169,8 @@ nserror gui_launch_url(struct nsurl *url) } } } - +#ifdef __amigaos4__ SetProcWindow(procwin); - +#endif return NSERROR_OK; } diff --git a/amiga/os3support.c b/amiga/os3support.c index 7eafc7db4..724ac2079 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -212,5 +212,19 @@ char *strlwr(char *str) return str; } + +int scandir(const char *dir, struct dirent ***namelist, + int (*filter)(const struct dirent *), + int (*compar)(const struct dirent **, const struct dirent **)) +{ + /*\todo stub function, needs writing, preferably into clib2 */ + return 0; +} + +long long int strtoll(const char *nptr, char **endptr, int base) +{ + return (long long int)strtol(nptr, endptr, base); +} + #endif diff --git a/amiga/os3support.h b/amiga/os3support.h index 4b5deb251..df88cd5a5 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -27,6 +27,7 @@ #ifndef __amigaos4__ #include + #include #include @@ -37,6 +38,7 @@ #include #endif +/* C macros */ #ifndef ASM #define ASM #endif @@ -45,6 +47,8 @@ #define REG(reg,arg) arg __asm(#reg) #endif +#define MIN(a,b) (((a)<(b))?(a):(b)) + /* Macros */ #define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0 #define LIB_IS_AT_LEAST(B,V,R) ((B)->lib_Version>(V)) || \ @@ -116,6 +120,9 @@ /* application */ #define Notify(...) (void)0 +/* DataTypes */ +#define SaveDTObjectA(O,W,R,F,M,I,A) DoDTMethod(O,W,R,DTM_WRITE,F,M,NULL) + /* 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" diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c index ea681d269..7b3c156eb 100755 --- a/amiga/thumbnail.c +++ b/amiga/thumbnail.c @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include #include -- cgit v1.2.3 From 15537aa2af2dd52afdccafcbda1ce3bfd1f1657e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 19 Jan 2015 00:22:22 +0000 Subject: The OS3 build doesn't appear to like non-specific layout groups --- amiga/gui.c | 2 +- amiga/os3support.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index 61904079e..28921197d 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -5155,7 +5155,7 @@ Object *ami_gui_splash_open(void) WINDOW_Position, WPOS_CENTERSCREEN, WINDOW_LockWidth, TRUE, WINDOW_LockHeight, TRUE, - WINDOW_ParentGroup, LayoutObject, + WINDOW_ParentGroup, VGroupObject, LAYOUT_AddImage, bm_obj = BitMapObject, BITMAP_SourceFile, "PROGDIR:Resources/splash.png", BITMAP_Screen, wbscreen, diff --git a/amiga/os3support.c b/amiga/os3support.c index 724ac2079..f69df1508 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -79,15 +79,18 @@ uint32 GetAttrs(Object *obj, Tag tag1, ...) va_list ap; Tag tag = tag1; ULONG data = 0; + int i = 0; va_start(ap, tag1); while(tag != TAG_DONE) { data = va_arg(ap, ULONG); - GetAttr(tag, obj, (void *)data); + i += GetAttr(tag, obj, (void *)data); tag = va_arg(ap, Tag); } va_end(ap); + + return i; } /* Utility */ -- cgit v1.2.3 From 989a5da334aeb97177a1b1aeb300cf8b601f9b7c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 19 Jan 2015 19:15:48 +0000 Subject: Cast timeval.usec calculations to int as AmigaOS3 has some conflicting headers which means it can be treated as an unsigned value. This ensures the log time is always correct. --- utils/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/log.c b/utils/log.c index 8ec42c1f7..0be8ea264 100644 --- a/utils/log.c +++ b/utils/log.c @@ -70,12 +70,12 @@ timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { - int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; + int nsec = (int)(y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } - if (x->tv_usec - y->tv_usec > 1000000) { - int nsec = (x->tv_usec - y->tv_usec) / 1000000; + if ((int)(x->tv_usec - y->tv_usec) > 1000000) { + int nsec = (int)(x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; } -- cgit v1.2.3 From e07bbbaaff19dfecbba3121616ac4a5b798cbc58 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 19 Jan 2015 20:08:45 +0000 Subject: Take out some more code which won't work on OS3 --- amiga/gui.c | 9 +++++++++ amiga/libs.c | 2 +- amiga/menu.c | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/amiga/gui.c b/amiga/gui.c index 28921197d..c533c7f65 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3701,6 +3701,8 @@ gui_window_create(struct browser_window *bw, BitMapEnd; } + LOG(("Creating window object")); + g->shared->objects[OID_MAIN] = WindowObject, WA_ScreenTitle, ami_gui_get_screen_title(), WA_Activate, TRUE, @@ -3955,8 +3957,12 @@ gui_window_create(struct browser_window *bw, EndWindow; } + LOG(("Opening window")); + g->shared->win = (struct Window *)RA_OpenWindow(g->shared->objects[OID_MAIN]); + LOG(("Window opened, adding border gadgets")); + if(!g->shared->win) { warn_user("NoMemory",""); @@ -5390,7 +5396,10 @@ int main(int argc, char** argv) ami_mime_init("PROGDIR:Resources/mimetypes"); sprintf(temp, "%s/mimetypes.user", current_user_dir); ami_mime_init(temp); + +#ifdef __amigaos4__ amiga_plugin_hack_init(); +#endif ret = amiga_datatypes_init(); /* user options setup */ diff --git a/amiga/libs.c b/amiga/libs.c index 0f5131df8..4278d1aee 100644 --- a/amiga/libs.c +++ b/amiga/libs.c @@ -120,6 +120,7 @@ bool ami_libs_open(void) #ifdef __amigaos4__ /* Libraries only needed on OS4 */ AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false) + AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true) #else /* Libraries we get automatically on OS4 but not OS3 */ AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true) @@ -136,7 +137,6 @@ bool ami_libs_open(void) AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1, true) AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1, true) AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1, true) - AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true) AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1, true) /* NB: timer.device is opened in schedule.c (ultimately by the scheduler process). diff --git a/amiga/menu.c b/amiga/menu.c index e5d35a974..1fef12baf 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -42,6 +42,7 @@ #include "utils/nsoption.h" #include "utils/messages.h" + #include "desktop/hotlist.h" #include "desktop/browser.h" #include "desktop/mouse.h" -- cgit v1.2.3 From 0c526662b33697f2ebb132b5018494ec699da27f Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 19 Jan 2015 20:50:06 +0000 Subject: Minor OS3 fixes --- amiga/gui.c | 12 +++++++++++- amiga/plotters.c | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/amiga/gui.c b/amiga/gui.c index c533c7f65..534637bc4 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -3704,6 +3704,10 @@ gui_window_create(struct browser_window *bw, LOG(("Creating window object")); g->shared->objects[OID_MAIN] = WindowObject, +#ifndef __amigaos4__ + WA_Width, 100, + WA_Height, 100, +#endif WA_ScreenTitle, ami_gui_get_screen_title(), WA_Activate, TRUE, WA_DepthGadget, TRUE, @@ -5155,8 +5159,13 @@ Object *ami_gui_splash_open(void) struct TextFont *tfont; win_obj = WindowObject, - WA_Borderless, TRUE, +#ifdef __amigaos4__ WA_ToolBox, TRUE, +#else + WA_Width, 100, + WA_Height, 100, +#endif + WA_Borderless, TRUE, WA_BusyPointer, TRUE, WINDOW_Position, WPOS_CENTERSCREEN, WINDOW_LockWidth, TRUE, @@ -5381,6 +5390,7 @@ int main(int argc, char** argv) user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY); current_user = ASPrintf("%s", (user == -1) ? "Default" : temp); + LOG(("User: %s", current_user)); current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user); if((lock = CreateDirTree(current_user_dir))) diff --git a/amiga/plotters.c b/amiga/plotters.c index 490d51955..f672e7a7b 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -118,7 +118,9 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) } else { palette_mapped = false; } - +#ifndef __amigaos4__ + palette_mapped = true; /* only supporting palette mapped screens on OS3 for now */ +#endif if(!width) width = nsoption_int(redraw_tile_size_x); if(!height) height = nsoption_int(redraw_tile_size_y); -- cgit v1.2.3 From f3cf042184a6a4ff8bda7d3693e1a33bb2111023 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 20 Jan 2015 00:06:08 +0000 Subject: RefreshSetGadgetAttrs replacement for OS3 --- amiga/os3support.c | 30 ++++++++++++++++++++++++++++++ amiga/os3support.h | 3 ++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/amiga/os3support.c b/amiga/os3support.c index f69df1508..3b42685a5 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -26,9 +26,13 @@ #include #include #include + #include #include #include +#include + +#include #define SUCCESS (TRUE) #define FAILURE (FALSE) @@ -93,6 +97,32 @@ uint32 GetAttrs(Object *obj, Tag tag1, ...) return i; } +ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags) +{ + ULONG retval; + BOOL changedisabled = FALSE; + BOOL disabled; + + if (w) { + if (FindTagItem(GA_Disabled,tags)) { + changedisabled = TRUE; + disabled = g->Flags & GFLG_DISABLED; + } + } + retval = SetGadgetAttrsA(g,w,r,tags); + if (w && (retval || (changedisabled && disabled != (g->Flags & GFLG_DISABLED)))) { + RefreshGList(g,w,r,1); + retval = 1; + } + return retval; +} + +ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1, ...) +{ + return RefreshSetGadgetAttrsA(g,w,r,(struct TagItem *) &tag1); +} + + /* Utility */ struct FormatContext { diff --git a/amiga/os3support.h b/amiga/os3support.h index df88cd5a5..ecb6f4a9a 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -147,7 +147,6 @@ #define IDoMethod DoMethod #define IDoMethodA DoMethodA #define IDoSuperMethodA DoSuperMethodA -#define RefreshSetGadgetAttrs SetGadgetAttrs /*\todo This isn't quite right */ #define ShowWindow(...) (void)0 /* Utility */ @@ -225,6 +224,8 @@ struct Node *GetHead(struct List *list); /* Intuition */ uint32 GetAttrs(Object *obj, Tag tag1, ...); +ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1, ...); +ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags); /* Utility */ char *ASPrintf(const char *fmt, ...); -- cgit v1.2.3 From 4cf9d888ff901dbfbaee0d3460068300e014e724 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 20 Jan 2015 00:11:51 +0000 Subject: Fix classes paths --- amiga/libs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amiga/libs.c b/amiga/libs.c index 4278d1aee..4deb88a97 100644 --- a/amiga/libs.c +++ b/amiga/libs.c @@ -155,7 +155,7 @@ bool ami_libs_open(void) * we may as well just open them normally for now. */ - AMINS_LIB_OPEN("classes/arexx.class", 44, ARexx, "main", 1, true) + AMINS_LIB_OPEN("arexx.class", 44, ARexx, "main", 1, true) AMINS_LIB_OPEN("images/bevel.image", 44, Bevel, "main", 1, true) AMINS_LIB_OPEN("images/bitmap.image", 44, BitMap, "main", 1, true) AMINS_LIB_OPEN("gadgets/checkbox.gadget", 44, CheckBox, "main", 1, true) @@ -174,7 +174,7 @@ bool ami_libs_open(void) AMINS_LIB_OPEN("gadgets/space.gadget", 44, Space, "main", 1, true) AMINS_LIB_OPEN("gadgets/speedbar.gadget", 44, SpeedBar, "main", 1, true) AMINS_LIB_OPEN("gadgets/string.gadget", 44, String, "main", 1, true) - AMINS_LIB_OPEN("classes/window.class", 44, Window, "main", 1, true) + AMINS_LIB_OPEN("window.class", 44, Window, "main", 1, true) return true; } -- cgit v1.2.3 From 2b9df1b2cd30e394ebb4e9be721b7d219c4e418c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 20 Jan 2015 00:39:32 +0000 Subject: Remove some p96 usage --- amiga/bitmap.c | 5 ++++- amiga/gui.c | 7 ++++++- amiga/libs.c | 4 ++-- amiga/os3support.h | 5 +++++ amiga/plotters.c | 2 ++ amiga/thumbnail.c | 2 ++ 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/amiga/bitmap.c b/amiga/bitmap.c index e7bd72ce4..b7eb129db 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -19,8 +19,8 @@ #include "amiga/os3support.h" #include -#include #ifdef __amigaos4__ +#include #include #include #endif @@ -388,6 +388,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename) static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm) { +#ifdef __amigaos4__ struct RenderInfo ri; struct BitMap *tbm = NULL; struct RastPort trp; @@ -495,6 +496,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width, } return tbm; +#endif } PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, @@ -581,3 +583,4 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap, return ami_bitmap_get_truecolour(bitmap, width, height, friendbm); } } + diff --git a/amiga/gui.c b/amiga/gui.c index 534637bc4..bede04836 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -34,8 +34,8 @@ #include #include #include -#include #ifdef __amigaos4__ +#include #include #endif #include @@ -5174,6 +5174,11 @@ Object *ami_gui_splash_open(void) LAYOUT_AddImage, bm_obj = BitMapObject, BITMAP_SourceFile, "PROGDIR:Resources/splash.png", BITMAP_Screen, wbscreen, + BITMAP_Precision, PRECISION_IMAGE, +#ifndef __amigaos4__ + BITMAP_Width, 400, + BITMAP_Height, 250, +#endif BitMapEnd, LayoutEnd, EndWindow; diff --git a/amiga/libs.c b/amiga/libs.c index 4deb88a97..9ac9589c3 100644 --- a/amiga/libs.c +++ b/amiga/libs.c @@ -76,6 +76,7 @@ #ifdef __amigaos4__ AMINS_LIB_STRUCT(Application); +AMINS_LIB_STRUCT(P96); #else struct UtilityBase *UtilityBase; /* AMINS_LIB_STRUCT(Utility) */ #endif @@ -90,7 +91,6 @@ AMINS_LIB_STRUCT(Intuition); AMINS_LIB_STRUCT(Keymap); AMINS_LIB_STRUCT(Layers); AMINS_LIB_STRUCT(Locale); -AMINS_LIB_STRUCT(P96); AMINS_LIB_STRUCT(Workbench); AMINS_LIB_STRUCT(ARexx); @@ -213,10 +213,10 @@ void ami_libs_close(void) AMINS_LIB_CLOSE(Keymap) AMINS_LIB_CLOSE(Layers) AMINS_LIB_CLOSE(Locale) - AMINS_LIB_CLOSE(P96) AMINS_LIB_CLOSE(Workbench) #ifdef __amigaos4__ AMINS_LIB_CLOSE(Application) + AMINS_LIB_CLOSE(P96) #else AMINS_LIB_CLOSE(Utility) #endif diff --git a/amiga/os3support.h b/amiga/os3support.h index ecb6f4a9a..a8c5abad2 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -149,6 +149,11 @@ #define IDoSuperMethodA DoSuperMethodA #define ShowWindow(...) (void)0 +/* P96 */ +#define p96FreeBitMap(B) FreeBitMap(B) +#define p96AllocBitMap(W,H,D,FL,FR,FM) AllocBitMap(W,H,D,FL,FR) +#define p96RectFill(RP,X,Y,XW,YH,C) RectFill(RP,X,Y,XW,YH) /* Needs pen */ + /* Utility */ #define SetMem memset #define SNPrintf snprintf diff --git a/amiga/plotters.c b/amiga/plotters.c index f672e7a7b..eaf775183 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -18,7 +18,9 @@ #include "amiga/os3support.h" +#ifdef __amigaos4__ #include +#endif #include #include diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c index 7b3c156eb..5333b4ce1 100755 --- a/amiga/thumbnail.c +++ b/amiga/thumbnail.c @@ -19,7 +19,9 @@ #include "amiga/os3support.h" #include +#ifdef __amigaos4__ #include +#endif #include #ifdef __amigaos4__ #include -- cgit v1.2.3