added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / m68k-native / geninc.c
blob217ee65f9a6b2d175887ab97b7d2e7436964c2df
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/alerts.h>
7 #include <exec/types.h>
8 #include <exec/execbase.h>
9 #include <exec/tasks.h>
10 #include <dos/dosextens.h>
11 #include <hardware/custom.h>
12 #include <graphics/rastport.h>
13 #include <graphics/clip.h>
14 #include "privheaders.h"
15 #include <stdio.h>
16 #include <stddef.h>
18 #define FuncOffset(x) (int)__AROS_GETJUMPVEC(0,x)
20 ULONG BitOf(ULONG);
22 int main (void)
24 printf ("/*\n This file is generated automatically!\n\n"
25 " If you want to make changes, edit \"geninc.c\" and delete this file.\n*/\n\n");
27 printf ("/* Macros */\n"
28 "#define AROS_CSYMNAME(n) _ ## n\n"
29 "#define AROS_CDEFNAME(n) _ ## n\n"
30 "#define AROS_SLIB_ENTRY(n,s) _ ## s ## _ ## n\n"
31 "\n");
33 printf ("/* ExecBase */\n");
34 printf ("#define AttnResched %d\n", (int)offsetof (struct ExecBase, AttnResched));
35 printf ("#define IDNestCnt %d\n", (int)offsetof (struct ExecBase, IDNestCnt));
36 printf ("#define TDNestCnt %d\n", (int)offsetof (struct ExecBase, TDNestCnt));
37 printf ("#define TaskReady %d\n", (int)offsetof (struct ExecBase, TaskReady));
38 printf ("#define ThisTask %d\n", (int)offsetof (struct ExecBase, ThisTask));
40 printf ("\n/* struct Task */\n");
41 printf ("#define tc_State %d\n", (int)offsetof (struct Task, tc_State));
42 printf ("#define tc_Flags %d\n", (int)offsetof (struct Task, tc_Flags));
43 printf ("#define tc_ExceptCode %d\n", (int)offsetof (struct Task, tc_ExceptCode));
44 printf ("#define tc_ExceptData %d\n", (int)offsetof (struct Task, tc_ExceptData));
45 printf ("#define tc_SigExcept %d\n", (int)offsetof (struct Task, tc_SigExcept));
46 printf ("#define tc_SigRecvd %d\n", (int)offsetof (struct Task, tc_SigRecvd));
47 printf ("#define tc_Launch %d\n", (int)offsetof (struct Task, tc_Launch));
48 printf ("#define tc_Switch %d\n", (int)offsetof (struct Task, tc_Switch));
49 printf ("#define tc_SPReg %d\n", (int)offsetof (struct Task, tc_SPReg));
50 printf ("#define tc_SPLower %d\n", (int)offsetof (struct Task, tc_SPLower));
51 printf ("#define tc_SPUpper %d\n", (int)offsetof (struct Task, tc_SPUpper));
52 printf ("#define tc_IDNestCnt %d\n", (int)offsetof (struct Task, tc_IDNestCnt));
53 printf ("#define tc_TrapCode %d\n", (int)offsetof (struct Task, tc_TrapCode));
55 printf ("\n/* struct DosBase */\n");
56 printf ("#define dl_SysBase %d\n", (int)offsetof (struct DosLibrary, dl_SysBase));
58 printf ("\n/* struct StackSwapStruct */\n");
59 printf ("#define stk_Lower %d\n", (int)offsetof (struct StackSwapStruct, stk_Lower));
60 printf ("#define stk_Upper %d\n", (int)offsetof (struct StackSwapStruct, stk_Upper));
61 printf ("#define stk_Pointer %d\n", (int)offsetof (struct StackSwapStruct, stk_Pointer));
63 printf ("\n/* Task Flags */\n");
64 printf ("#define TS_RUN %d\n", TS_RUN);
65 printf ("#define TS_READY %d\n", TS_READY);
66 printf ("#define TF_EXCEPT 0x%04lX\n", TF_EXCEPT);
67 printf ("#define TF_SWITCH 0x%04lX\n", TF_SWITCH);
69 printf ("#define TB_EXCEPT %d\n", TB_EXCEPT);
70 printf ("#define TB_SWITCH %d\n", TB_SWITCH);
71 printf ("#define TB_LAUNCH %d\n", TB_LAUNCH);
73 printf ("\n/* Exec functions */\n");
74 printf ("#define Supervisor %d\n", FuncOffset (5));
75 printf ("#define Switch %d\n", FuncOffset (9));
76 printf ("#define Dispatch %d\n", FuncOffset (10));
77 printf ("#define Exception %d\n", FuncOffset (11));
78 printf ("#define Alert %d\n", FuncOffset (18));
79 printf ("#define Disable %d\n", FuncOffset (20));
80 printf ("#define Enable %d\n", FuncOffset (21));
81 printf ("#define Enqueue %d\n", FuncOffset (45));
82 printf ("#define CacheControl %d\n", FuncOffset (107));
83 printf ("#define StackSwap %d\n", FuncOffset (122));
85 printf ("\n/* Constants */\n");
86 printf ("#define AT_DeadEnd 0x%08X\n", AT_DeadEnd);
87 printf ("#define AN_StackProbe 0x%08X\n", AN_StackProbe);
89 printf ("\n/* Cache constants */\n");
90 printf ("#define CACRF_EnableI 0x%08lx\n", CACRF_EnableI );
91 printf ("#define CACRF_FreezeI 0x%08lx\n", CACRF_FreezeI );
92 printf ("#define CACRF_ClearI 0x%08lx\n", CACRF_ClearI );
93 printf ("#define CACRF_IBE 0x%08lx\n", CACRF_IBE );
94 printf ("#define CACRF_EnableD 0x%08lx\n", CACRF_EnableD );
95 printf ("#define CACRF_FreezeD 0x%08lx\n", CACRF_FreezeD );
96 printf ("#define CACRF_ClearD 0x%08lx\n", CACRF_ClearD );
97 printf ("#define CACRF_DBE 0x%08lx\n", CACRF_DBE );
98 printf ("#define CACRF_WriteAllocate 0x%08lx\n", CACRF_WriteAllocate);
99 printf ("#define CACRF_EnableE 0x%08lx\n", CACRF_EnableE );
100 printf ("#define CACRF_CopyBack 0x%08lx\n", CACRF_CopyBack );
101 printf ("#define DMA_Continue 0x%08lx\n", DMA_Continue );
102 printf ("#define DMA_NoModify 0x%08lx\n", DMA_NoModify );
103 printf ("#define DMA_ReadFromRA 0x%08lx\n", DMA_ReadFromRAM );
105 printf ("\n#define CACRB_EnableI %ld\n", BitOf(CACRF_EnableI ));
106 printf ("#define CACRB_FreezeI %ld\n", BitOf(CACRF_FreezeI ));
107 printf ("#define CACRB_ClearI %ld\n", BitOf(CACRF_ClearI ));
108 printf ("#define CACRB_IBE %ld\n", BitOf(CACRF_IBE ));
109 printf ("#define CACRB_EnableD %ld\n", BitOf(CACRF_EnableD ));
110 printf ("#define CACRB_FreezeD %ld\n", BitOf(CACRF_FreezeD ));
111 printf ("#define CACRB_ClearD %ld\n", BitOf(CACRF_ClearD ));
112 printf ("#define CACRB_DBE %ld\n", BitOf(CACRF_DBE ));
113 printf ("#define CACRB_WriteAllocate %ld\n", BitOf(CACRF_WriteAllocate));
114 printf ("#define CACRB_EnableE %ld\n", BitOf(CACRF_EnableE ));
115 printf ("#define CACRB_CopyBack %ld\n", BitOf(CACRF_CopyBack ));
116 printf ("#define DMAB_Continue %ld\n", BitOf(DMA_Continue ));
117 printf ("#define DMAB_NoModify %ld\n", BitOf(DMA_NoModify ));
118 printf ("#define DMAB_ReadFromR %ld\n", BitOf(DMA_ReadFromRAM ));
120 printf ("\n/* Custom register constants */\n");
121 printf ("#define custom 0xdff000\n");
122 printf ("#define dmaconr 0x%04lx\n", offsetof (struct Custom, dmaconr));
123 printf ("#define intenar 0x%04lx\n", offsetof (struct Custom, intenar));
124 printf ("#define intreqr 0x%04lx\n", offsetof (struct Custom, intreqr));
125 printf ("#define intena 0x%04lx\n", offsetof (struct Custom, intena));
126 printf ("#define intreq 0x%04lx\n", offsetof (struct Custom, intreq));
127 printf ("#define dmacon 0x%04lx\n", offsetof (struct Custom, dmacon));
129 printf ("\n/* Graphics constants */\n");
130 printf ("#define BltBitMap %d\n", FuncOffset (5));
132 printf ("\n#define lb_GfxBase %d\n", (int)offsetof (struct LayersBase, lb_GfxBase));
133 printf ("#define lb_SysBase %d\n", (int)offsetof (struct LayersBase, lb_SysBase));
135 printf ("\n#define rp_Layer %d\n", (int)offsetof (struct RastPort, Layer));
136 printf ("#define rp_BitMap %d\n", (int)offsetof (struct RastPort, BitMap));
137 printf ("#define cr_BitMap %d\n", (int)offsetof (struct ClipRect, BitMap));
138 printf ("#define cr_MinX %d\n", (int)offsetof (struct ClipRect, bounds.MinX));
139 printf ("#define cr_MinY %d\n", (int)offsetof (struct ClipRect, bounds.MinY));
140 printf ("#define cr_MaxX %d\n", (int)offsetof (struct ClipRect, bounds.MaxX));
141 printf ("#define cr_MaxY %d\n", (int)offsetof (struct ClipRect, bounds.MaxY));
143 return 0;
146 ULONG BitOf(ULONG mask)
148 LONG ret = -1;
152 mask = mask >> 1;
153 ret++;
154 } while(mask);
156 return (ULONG)ret;