use same location as .configured, etc, to store .files-touched
[AROS.git] / compiler / clib / __arosc_userdata.c
blob34f9361921f7718ac5a4b95ab22bb8a5c842db23
1 #include "__arosc_privdata.h"
3 #include <proto/exec.h>
4 #include <proto/dos.h>
5 #include <dos/dosextens.h>
6 #include <sys/arosc.h>
8 #include <stdlib.h>
10 #include "arosc_init.h"
12 #include "__ctype.h"
13 #include "etask.h"
15 #include <aros/debug.h>
17 extern struct Library *aroscbase;
19 struct arosc_userdata * __get_arosc_userdata(void)
21 struct arosc_privdata *acpd = NULL;
23 #ifdef AROSC_SHARED
24 struct Task *curtask = FindTask(NULL);
26 acpd = GetIntETask(curtask)->iet_acpd;
28 if (acpd == NULL)
30 /* FIXME: This is a quick hack to make old programs which use
31 * the libc from inside newly created tasks/processes
32 * without going trough special libc routines
33 * (yet to be written).
35 struct Task *parent = GetETask(curtask)->et_Parent;
36 while (parent != NULL)
38 acpd = GetIntETask(parent)->iet_acpd;
39 if(acpd != NULL) break;
40 parent = GetETask(parent)->et_Parent;
43 #endif
45 if (acpd == NULL)
47 #ifdef AROSC_ROM
48 /* JUST the user data - we really only want the ctype arrays */
49 static const struct arosc_userdata acud = {
50 .acud_ctype_b = &__ctype_b_array[128],
51 .acud_ctype_toupper = &__ctype_toupper_array[128],
52 .acud_ctype_tolower = &__ctype_tolower_array[128],
55 /* Remove the 'const' when passing back */
56 return (struct arosc_userdata *)&acud;
57 #else
58 /* No acpd found? Fall back to the builtin one. */
59 static struct arosc_privdata acpd_static;
61 acpd_static.acpd_acud.acud_ctype_b = &__ctype_b_array[128];
62 acpd_static.acpd_acud.acud_ctype_toupper = &__ctype_toupper_array[128];
63 acpd_static.acpd_acud.acud_ctype_tolower = &__ctype_tolower_array[128];
65 acpd = &acpd_static;
66 #endif
69 return &acpd->acpd_acud;