From 23f70d0c533bfc80eac8a77b51c2bb4fbb03005b Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Thu, 13 Jan 2005 15:39:39 +0000 Subject: [PATCH] - Lost some more code that is not required for AmigaOS 4.x and can be handled conveniently through conditional compilation. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14802 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/changes | 3 ++ library/stdlib_main.c | 44 +++++++++++++------------- library/stdlib_showerror.c | 64 +++++++++++++++++++------------------- 3 files changed, 56 insertions(+), 55 deletions(-) diff --git a/library/changes b/library/changes index 7016032..d265d4d 100644 --- a/library/changes +++ b/library/changes @@ -48,6 +48,9 @@ is now determined at initialization time. The I/O mode is restored before the program exits. Previously, any changes to the I/O mode would persist. +- Lost some more code that is not required for AmigaOS 4.x and can be + handled conveniently through conditional compilation. + c.lib 1.185 (2.1.2005) diff --git a/library/stdlib_main.c b/library/stdlib_main.c index 4e3431b..ccfb3f2 100644 --- a/library/stdlib_main.c +++ b/library/stdlib_main.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_main.c,v 1.9 2005-01-02 09:07:18 obarthel Exp $ + * $Id: stdlib_main.c,v 1.10 2005-01-13 15:39:39 obarthel Exp $ * * :ts=4 * @@ -250,34 +250,32 @@ detach_cleanup(REG(d0, LONG UNUSED unused_return_code),REG(d1, BPTR segment_list { if(__IUtility != NULL) DropInterface((struct Interface *)__IUtility); + + if(IDOS != NULL) + DropInterface((struct Interface *)IDOS); + } + #else + { + /* The following trick is necessary only under dos.library V40 and below. */ + if(((struct Library *)DOSBase)->lib_Version < 50) + { + /* Now for the slightly shady part. We need to unload the segment + list this program was originally loaded with. We have to close + dos.library, though, which means that either we can close the + library or unload the code, but not both. But there's a loophole + in that we can enter Forbid(), unload the code, close the library + and exit and nobody will be able to allocate this program's + memory until after the process has been terminated. */ + Forbid(); + + UnLoadSeg(segment_list); + } } #endif /* __amigaos4__ */ if(__UtilityBase != NULL) CloseLibrary(__UtilityBase); - /* The following trick is necessary only under dos.library V40 and below. */ - if(((struct Library *)DOSBase)->lib_Version < 50) - { - /* Now for the slightly shady part. We need to unload the segment - list this program was originally loaded with. We have to close - dos.library, though, which means that either we can close the - library or unload the code, but not both. But there's a loophole - in that we can enter Forbid(), unload the code, close the library - and exit and nobody will be able to allocate this program's - memory until after the process has been terminated. */ - Forbid(); - - UnLoadSeg(segment_list); - } - - #if defined(__amigaos4__) - { - if(IDOS != NULL) - DropInterface((struct Interface *)IDOS); - } - #endif /* __amigaos4__ */ - if(DOSBase != NULL) CloseLibrary(DOSBase); } diff --git a/library/stdlib_showerror.c b/library/stdlib_showerror.c index b92c363..a9358ac 100644 --- a/library/stdlib_showerror.c +++ b/library/stdlib_showerror.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_showerror.c,v 1.8 2005-01-09 10:10:41 obarthel Exp $ + * $Id: stdlib_showerror.c,v 1.9 2005-01-13 15:39:39 obarthel Exp $ * * :ts=4 * @@ -102,37 +102,14 @@ __show_error(const char * message) /* If we can't hope to print the error message, show a requester instead. */ if(__no_standard_io || __WBenchMsg != NULL) { - if(IntuitionBase->lib_Version >= 37) + UBYTE program_name[256]; + struct EasyStruct es; + STRPTR title_string; + + /* The following does not make great sense on OS4. */ + #if NOT defined(__amigaos4__) { - UBYTE program_name[256]; - struct EasyStruct es; - STRPTR title_string; - - if(__WBenchMsg != NULL) - { - title_string = (STRPTR)FilePart(__WBenchMsg->sm_ArgList[0].wa_Name); - } - else - { - if(GetProgramName(program_name,sizeof(program_name))) - title_string = FilePart((STRPTR)program_name); - else - title_string = (STRPTR)"Error"; - } - - memset(&es,0,sizeof(es)); - - es.es_StructSize = sizeof(es); - es.es_Title = title_string; - es.es_TextFormat = (STRPTR)message; - es.es_GadgetFormat = (STRPTR)"Sorry"; - - EasyRequestArgs(NULL,&es,NULL,NULL); - } - else - { - /* The following does not make great sense on OS4. */ - #if NOT defined(__amigaos4__) + if(IntuitionBase->lib_Version < 37) { static struct TextAttr default_font = { (STRPTR)"topaz.font",8,FS_NORMAL,FPF_ROMFONT|FPF_DESIGNED }; static struct IntuiText sorry_text = {0,1,JAM1,6,3,(struct TextAttr *)NULL,(STRPTR)"Sorry",(struct IntuiText *)NULL}; @@ -144,9 +121,32 @@ __show_error(const char * message) body_text.IText = (STRPTR)message; AutoRequest(NULL,&body_text,NULL,&sorry_text,0,0,37 + 8 * strlen(message),46); + + goto out; } - #endif /* __amigaos4__ */ } + #endif /* __amigaos4__ */ + + if(__WBenchMsg != NULL) + { + title_string = (STRPTR)FilePart(__WBenchMsg->sm_ArgList[0].wa_Name); + } + else + { + if(GetProgramName(program_name,sizeof(program_name))) + title_string = FilePart((STRPTR)program_name); + else + title_string = (STRPTR)"Error"; + } + + memset(&es,0,sizeof(es)); + + es.es_StructSize = sizeof(es); + es.es_Title = title_string; + es.es_TextFormat = (STRPTR)message; + es.es_GadgetFormat = (STRPTR)"Sorry"; + + EasyRequestArgs(NULL,&es,NULL,NULL); } else {