some fixes to accented characters
[tangerine.git] / rom / dos / internalunloadseg.c
blobab9505b7bd0fc400c2a262ff2e06ac11c7a4d5ec
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include "dos_intern.h"
9 #include <proto/exec.h>
10 #include <aros/libcall.h>
11 #include <aros/asmcall.h>
12 #include <exec/libraries.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/dos.h>
19 AROS_LH2(BOOL, InternalUnLoadSeg,
21 /* SYNOPSIS */
22 AROS_LHA(BPTR , seglist , D1),
23 AROS_LHA(VOID_FUNC, freefunc, A1),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 127, Dos)
28 /* FUNCTION
29 Unloads a seglist loaded with InternalLoadSeg().
31 INPUTS
32 seglist - Seglist
33 freefunc - Function to be called to free memory
35 RESULT
36 DOSTRUE if everything wents O.K.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
52 BPTR next;
54 if (seglist)
56 #if AROS_MODULES_DEBUG
57 extern struct MinList debug_seglist;
58 extern struct MinList free_debug_segnodes;
59 struct debug_segnode *segnode;
61 Forbid();
62 ForeachNode(&debug_seglist, segnode)
64 if (segnode->seglist == seglist)
66 /* use the same free function as loadseg ! */
67 struct seginfo *si;
68 while ((si = (struct seginfo *)REMHEAD(&segnode->seginfos)))
70 AROS_CALL2NR(void, freefunc,
71 AROS_LCA(APTR , (APTR)si, A1),
72 AROS_LCA(ULONG, (ULONG)sizeof(struct seginfo), D0),
73 struct Library *, (struct Library *)SysBase
77 REMOVE(segnode);
78 ADDHEAD(&free_debug_segnodes, segnode);
79 break;
82 Permit();
83 #endif
85 while (seglist)
87 next = *(BPTR *)BADDR(seglist);
89 AROS_CALL2NR(void, freefunc,
90 AROS_LCA(APTR , (BPTR *)((LONG)BADDR(seglist) - sizeof(ULONG)), A1),
91 AROS_LCA(ULONG, *(LONG *)((LONG)BADDR(seglist) - sizeof(ULONG)), D0),
92 struct Library *, (struct Library *)SysBase
95 seglist = next;
97 return TRUE;
99 else
100 return FALSE;
102 AROS_LIBFUNC_EXIT
103 } /* InternalUnLoadSeg */