try to make sure compiler/include/mmakefile is always refreshed correctly.
[AROS.git] / rom / keymap / keymap_init.c
blobb5636a6fa9084783af0c66f27b9caadf5ca51a26
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Library header for keymap
6 Lang: english
7 */
9 /****************************************************************************************/
11 #include <proto/exec.h>
12 #include <exec/resident.h>
13 #include <exec/execbase.h>
14 #include <exec/memory.h>
15 #include <aros/symbolsets.h>
16 #include LC_LIBDEFS_FILE
17 #include "keymap_intern.h"
19 /****************************************************************************************/
21 extern struct KeyMap def_km;
23 #if DEBUG
24 struct KeymapBase *DebugKeymapBase;
25 #endif
27 /****************************************************************************************/
29 static struct KeyMapNode *AddKeymap(char *name, struct KeyMap *data, struct KeymapBase *LIBBASE)
31 struct KeyMapNode *kmn = AllocMem(sizeof(struct KeyMapNode), MEMF_CLEAR | MEMF_PUBLIC);
33 if (kmn)
35 kmn->kn_Node.ln_Name = name;
36 CopyMem(data, &kmn->kn_KeyMap, sizeof(struct KeyMap));
39 * We are being called under Forbid(), so I don't have to arbitrate
40 * That notwithstanding, if keymap resource or exec library loading
41 * ever become semaphore based, there may be some problems.
43 AddTail(&(LIBBASE->KeymapResource.kr_List), &kmn->kn_Node);
45 return kmn;
48 static int KeymapInit(LIBBASETYPEPTR LIBBASE)
50 #if DEBUG
51 DebugKeymapBase = LIBBASE;
52 #endif
54 LIBBASE->DefaultKeymap = &def_km;
56 /* Initialize and add the keymap.resource */
57 LIBBASE->KeymapResource.kr_Node.ln_Type = NT_RESOURCE;
58 LIBBASE->KeymapResource.kr_Node.ln_Name = "keymap.resource";
59 NEWLIST( &(LIBBASE->KeymapResource.kr_List) );
60 AddResource(&LIBBASE->KeymapResource);
62 /* AmigaOS default built-in keymap has "usa" name */
63 if (!AddKeymap("usa", &def_km, LIBBASE))
64 return FALSE;
66 #ifdef __mc68000
67 /* Add ROM built-in usa1 keymap, keeps WB3.0 C:IPrefs quiet
68 * TODO: add correct keymap instead of using default keymap
70 AddKeymap("usa1", &def_km, LIBBASE);
71 #endif
73 return TRUE;
76 /****************************************************************************************/
78 ADD2INITLIB(KeymapInit, 0);