added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / rom / dos / internalunloadseg.c
blobd855e2d58448eb1088ad87288ca94386a71dc047
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
30 INPUTS
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 *****************************************************************************/
46 AROS_LIBFUNC_INIT
48 BPTR next;
50 if (seglist)
52 #if AROS_MODULES_DEBUG
53 extern struct MinList debug_seglist;
54 extern struct MinList free_debug_segnodes;
55 struct debug_segnode *segnode;
57 Forbid();
58 ForeachNode(&debug_seglist, segnode)
60 if (segnode->seglist == seglist)
62 /* use the same free function as loadseg ! */
63 struct seginfo *si;
64 while ((si = (struct seginfo *)REMHEAD(&segnode->seginfos)))
66 AROS_CALL2NR(void, freefunc,
67 AROS_LCA(APTR , (APTR)si, A1),
68 AROS_LCA(ULONG, (ULONG)sizeof(struct seginfo), D0),
69 struct Library *, (struct Library *)SysBase
73 REMOVE(segnode);
74 ADDHEAD(&free_debug_segnodes, segnode);
75 break;
78 Permit();
79 #endif
81 while (seglist)
83 next = *(BPTR *)BADDR(seglist);
85 AROS_CALL2NR(void, freefunc,
86 AROS_LCA(APTR , (BPTR *)((LONG)BADDR(seglist) - sizeof(ULONG)), A1),
87 AROS_LCA(ULONG, *(LONG *)((LONG)BADDR(seglist) - sizeof(ULONG)), D0),
88 struct Library *, (struct Library *)SysBase
91 seglist = next;
93 return TRUE;
95 else
96 return FALSE;
98 AROS_LIBFUNC_EXIT
99 } /* InternalUnLoadSeg */