Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / identify / testidentifylib.c
blobf9841344a9ac48acace1c8588e885a8ec58239fc
1 #include <proto/identify.h>
2 #include <libraries/identify.h>
4 #include <stdio.h>
6 static void idhardwarenum(void)
8 puts("\nIdHardwareNum");
9 puts("-------------");
10 printf("System %u\n", (unsigned int)IdHardwareNum(IDHW_SYSTEM, NULL));
11 printf("CPU %u\n", (unsigned int)IdHardwareNum(IDHW_CPU, NULL));
12 printf("FPU %u\n", (unsigned int)IdHardwareNum(IDHW_FPU, NULL));
13 printf("MMU %u\n", (unsigned int)IdHardwareNum(IDHW_MMU, NULL));
14 printf("OSVER %u\n", (unsigned int)IdHardwareNum(IDHW_OSVER, NULL));
15 printf("EXECVER %u\n", (unsigned int)IdHardwareNum(IDHW_EXECVER, NULL));
16 printf("WBVER %u\n", (unsigned int)IdHardwareNum(IDHW_WBVER, NULL));
17 printf("ROMSIZE %u\n", (unsigned int)IdHardwareNum(IDHW_ROMSIZE, NULL));
18 printf("CHIPSET %u\n", (unsigned int)IdHardwareNum(IDHW_CHIPSET, NULL));
19 printf("GFXSYS %u\n", (unsigned int)IdHardwareNum(IDHW_GFXSYS, NULL));
20 printf("CHIPRAM %u\n", (unsigned int)IdHardwareNum(IDHW_CHIPRAM, NULL));
21 printf("FASTRAM %u\n", (unsigned int)IdHardwareNum(IDHW_FASTRAM, NULL));
22 printf("RAM %u\n", (unsigned int)IdHardwareNum(IDHW_RAM, NULL));
23 printf("SETPATCHVER %u\n", (unsigned int)IdHardwareNum(IDHW_SETPATCHVER, NULL));
24 printf("AUDIOSYS %u\n", (unsigned int)IdHardwareNum(IDHW_AUDIOSYS, NULL));
25 printf("OSNR %u\n", (unsigned int)IdHardwareNum(IDHW_OSNR, NULL));
26 printf("VMMCHIPRAM %u\n", (unsigned int)IdHardwareNum(IDHW_VMMCHIPRAM, NULL));
27 printf("VMMFASTRAM %u\n", (unsigned int)IdHardwareNum(IDHW_VMMFASTRAM, NULL));
28 printf("VMMRAM %u\n", (unsigned int)IdHardwareNum(IDHW_VMMRAM, NULL));
29 printf("PLNCHIPRAM %u\n", (unsigned int)IdHardwareNum(IDHW_PLNCHIPRAM, NULL));
30 printf("PLNFASTRAM %u\n", (unsigned int)IdHardwareNum(IDHW_PLNFASTRAM, NULL));
31 printf("PLNRAM %u\n", (unsigned int)IdHardwareNum(IDHW_PLNRAM, NULL));
32 printf("VBR %u\n", (unsigned int)IdHardwareNum(IDHW_VBR, NULL));
33 printf("LASTALERT %u\n", (unsigned int)IdHardwareNum(IDHW_LASTALERT, NULL));
34 printf("VBLANKFREQ %u\n", (unsigned int)IdHardwareNum(IDHW_VBLANKFREQ, NULL));
35 printf("POWERFREQ %u\n", (unsigned int)IdHardwareNum(IDHW_POWERFREQ, NULL));
36 printf("ECLOCK %u\n", (unsigned int)IdHardwareNum(IDHW_ECLOCK, NULL));
37 printf("SLOWRAM %u\n", (unsigned int)IdHardwareNum(IDHW_SLOWRAM, NULL));
38 printf("GARY %u\n", (unsigned int)IdHardwareNum(IDHW_GARY, NULL));
39 printf("RAMSEY %u\n", (unsigned int)IdHardwareNum(IDHW_RAMSEY, NULL));
40 printf("BATTCLOCK %u\n", (unsigned int)IdHardwareNum(IDHW_BATTCLOCK, NULL));
41 printf("CHUNKYPLANAR %u\n", (unsigned int)IdHardwareNum(IDHW_CHUNKYPLANAR, NULL));
42 printf("POWERPC %u\n", (unsigned int)IdHardwareNum(IDHW_POWERPC, NULL));
43 printf("PPCCLOCK %u\n", (unsigned int)IdHardwareNum(IDHW_PPCCLOCK, NULL));
44 printf("CPUREV %u\n", (unsigned int)IdHardwareNum(IDHW_CPUREV, NULL));
45 printf("CPUCLOCK %u\n", (unsigned int)IdHardwareNum(IDHW_CPUCLOCK, NULL));
46 printf("FPUCLOCK %u\n", (unsigned int)IdHardwareNum(IDHW_FPUCLOCK, NULL));
47 printf("RAMACCESS %u\n", (unsigned int)IdHardwareNum(IDHW_RAMACCESS, NULL));
48 printf("RAMWIDTH %u\n", (unsigned int)IdHardwareNum(IDHW_RAMWIDTH, NULL));
49 printf("RAMCAS %u\n", (unsigned int)IdHardwareNum(IDHW_RAMCAS, NULL));
50 printf("RAMBANDWIDTH %u\n", (unsigned int)IdHardwareNum(IDHW_RAMBANDWIDTH, NULL));
51 printf("TCPIP %u\n", (unsigned int)IdHardwareNum(IDHW_TCPIP, NULL));
52 printf("PPCOS %u\n", (unsigned int)IdHardwareNum(IDHW_PPCOS, NULL));
53 printf("AGNUS %u\n", (unsigned int)IdHardwareNum(IDHW_AGNUS, NULL));
54 printf("AGNUSMODE %u\n", (unsigned int)IdHardwareNum(IDHW_AGNUSMODE, NULL));
55 printf("DENISE %u\n", (unsigned int)IdHardwareNum(IDHW_DENISE, NULL));
56 printf("DENISEREV %u\n", (unsigned int)IdHardwareNum(IDHW_DENISEREV, NULL));
59 static void idhardware(void)
61 puts("\nIdHardware");
62 puts("----------");
63 printf("IDHW_SYSTEM %s\n", IdHardware(IDHW_SYSTEM, NULL));
64 printf("IDHW_CPU %s\n", IdHardware(IDHW_CPU, NULL));
65 printf("IDHW_FPU %s\n", IdHardware(IDHW_FPU, NULL));
66 printf("IDHW_MMU %s\n", IdHardware(IDHW_MMU, NULL));
67 printf("IDHW_OSVER %s\n", IdHardwareTags(IDHW_OSVER, TAG_DONE)); // variadic
68 printf("IDHW_EXECVER %s\n", IdHardware(IDHW_EXECVER, NULL));
69 printf("IDHW_WBVER %s\n", IdHardware(IDHW_WBVER, NULL));
70 printf("IDHW_ROMSIZE %s\n", IdHardware(IDHW_ROMSIZE, NULL));
71 printf("IDHW_CHIPSET %s\n", IdHardware(IDHW_CHIPSET, NULL));
72 printf("IDHW_GFXSYS %s\n", IdHardware(IDHW_GFXSYS, NULL));
73 printf("IDHW_CHIPRAM %s\n", IdHardware(IDHW_CHIPRAM, NULL));
74 printf("IDHW_FASTRAM %s\n", IdHardware(IDHW_FASTRAM, NULL));
75 printf("IDHW_RAM %s\n", IdHardware(IDHW_RAM, NULL));
76 printf("IDHW_SETPATCHVER %s\n", IdHardware(IDHW_SETPATCHVER, NULL));
77 printf("IDHW_AUDIOSYS %s\n", IdHardware(IDHW_AUDIOSYS, NULL));
78 printf("IDHW_OSNR %s\n", IdHardware(IDHW_OSNR, NULL));
79 printf("IDHW_VMMCHIPRAM %s\n", IdHardware(IDHW_VMMCHIPRAM, NULL));
80 printf("IDHW_VMMFASTRAM %s\n", IdHardware(IDHW_VMMFASTRAM, NULL));
81 printf("IDHW_VMMRAM %s\n", IdHardware(IDHW_VMMRAM, NULL));
82 printf("IDHW_PLNCHIPRAM %s\n", IdHardware(IDHW_PLNCHIPRAM, NULL));
83 printf("IDHW_PLNFASTRAM %s\n", IdHardware(IDHW_PLNFASTRAM, NULL));
84 printf("IDHW_PLNRAM %s\n", IdHardware(IDHW_PLNRAM, NULL));
85 printf("IDHW_VBR %s\n", IdHardware(IDHW_VBR, NULL));
86 printf("IDHW_LASTALERT %s\n", IdHardware(IDHW_LASTALERT, NULL));
87 printf("IDHW_VBLANKFREQ %s\n", IdHardware(IDHW_VBLANKFREQ, NULL));
88 printf("IDHW_POWERFREQ %s\n", IdHardware(IDHW_POWERFREQ, NULL));
89 printf("IDHW_ECLOCK %s\n", IdHardware(IDHW_ECLOCK, NULL));
90 printf("IDHW_SLOWRAM %s\n", IdHardware(IDHW_SLOWRAM, NULL));
91 printf("IDHW_GARY %s\n", IdHardware(IDHW_GARY, NULL));
92 printf("IDHW_RAMSEY %s\n", IdHardware(IDHW_RAMSEY, NULL));
93 printf("IDHW_BATTCLOCK %s\n", IdHardware(IDHW_BATTCLOCK, NULL));
94 printf("IDHW_CHUNKYPLANAR %s\n", IdHardware(IDHW_CHUNKYPLANAR, NULL));
95 printf("IDHW_POWERPC %s\n", IdHardware(IDHW_POWERPC, NULL));
96 printf("IDHW_PPCCLOCK %s\n", IdHardware(IDHW_PPCCLOCK, NULL));
97 printf("IDHW_CPUREV %s\n", IdHardware(IDHW_CPUREV, NULL));
98 printf("IDHW_CPUCLOCK %s\n", IdHardware(IDHW_CPUCLOCK, NULL));
99 printf("IDHW_FPUCLOCK %s\n", IdHardware(IDHW_FPUCLOCK, NULL));
100 printf("IDHW_RAMACCESS %s\n", IdHardware(IDHW_RAMACCESS, NULL));
101 printf("IDHW_RAMWIDTH %s\n", IdHardware(IDHW_RAMWIDTH, NULL));
102 printf("IDHW_RAMCAS %s\n", IdHardware(IDHW_RAMCAS, NULL));
103 printf("IDHW_RAMBANDWIDT %s\n", IdHardware(IDHW_RAMBANDWIDTH, NULL));
104 printf("IDHW_TCPIP %s\n", IdHardware(IDHW_TCPIP, NULL));
105 printf("IDHW_PPCOS %s\n", IdHardware(IDHW_PPCOS, NULL));
106 printf("IDHW_AGNUS %s\n", IdHardware(IDHW_AGNUS, NULL));
107 printf("IDHW_AGNUSMODE %s\n", IdHardware(IDHW_AGNUSMODE, NULL));
108 printf("IDHW_DENISE %s\n", IdHardware(IDHW_DENISE, NULL));
109 printf("IDHW_DENISEREV %s\n", IdHardware(IDHW_DENISEREV, NULL));
112 static void idformatstringtst(STRPTR format, ULONG len)
114 TEXT buffer[50] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
115 LONG result = IdFormatString(format, buffer, len, NULL);
116 printf("result %d string %s\n", (int)result, buffer);
119 static void idformatstring(void)
121 puts("\nIdFormatString");
122 puts("--------------");
123 idformatstringtst("abcdef", 50);
124 idformatstringtst("abcdef", 3); // shortened
125 idformatstringtst("ab$$cd$$ef", 50); // $$ -> $
126 idformatstringtst("ab$$cd$$ef", 4);
127 idformatstringtst("abc$AUDIOSYS$def", 50);
128 idformatstringtst("abc$AUDIOSYS$def", 5); // shortened
129 idformatstringtst("abc$AUDYS$def", 50); // mis-spelled command
132 static void idestimateformatsize(void)
134 puts("\nIdEstimateFormatSize");
135 puts("--------------------");
136 printf("result %d\n", (int)IdEstimateFormatSize("abcdef", NULL));
137 printf("result %d\n", (int)IdEstimateFormatSize("abc$$def", NULL));
138 printf("result %d\n", (int)IdEstimateFormatSize("abc$AUDIOSYS$def", NULL));
139 printf("result %d\n", (int)IdEstimateFormatSize("abc$AUDYS$def", NULL));
142 static void idalert(void)
144 puts("\nIdAlert");
145 puts("-------");
146 TEXT buffer1[30];
147 TEXT buffer2[30];
148 TEXT buffer3[30];
149 TEXT buffer4[30];
150 printf("result %d\n", (int)IdAlertTags(0x82010007, IDTAG_DeadStr, buffer1, IDTAG_SubsysStr, buffer2, IDTAG_GeneralStr, buffer3, IDTAG_SpecStr, buffer4, IDTAG_StrLength, 30, TAG_DONE));
151 printf("DeadStr %s SubsysStr %s GeneralStr %s SpecStr %s\n", buffer1, buffer2, buffer3, buffer4);
152 printf("result %d\n", (int)IdAlertTags(0x8400000C, IDTAG_DeadStr, buffer1, IDTAG_SubsysStr, buffer2, IDTAG_GeneralStr, buffer3, IDTAG_SpecStr, buffer4, IDTAG_StrLength, 30, TAG_DONE));
153 printf("DeadStr %s SubsysStr %s GeneralStr %s SpecStr %s\n", buffer1, buffer2, buffer3, buffer4);
154 printf("result %d\n", (int)IdAlertTags(0x04010003, IDTAG_DeadStr, buffer1, IDTAG_SubsysStr, buffer2, IDTAG_GeneralStr, buffer3, IDTAG_SpecStr, buffer4, IDTAG_StrLength, 30, TAG_DONE));
155 printf("DeadStr %s SubsysStr %s GeneralStr %s SpecStr %s\n", buffer1, buffer2, buffer3, buffer4);
158 static void idexpansion(void)
160 puts("\nIdExpansion");
161 puts("-----------");
162 TEXT buffer[30];
163 printf("result %d\n", (int)IdExpansionTags(IDTAG_ManufStr, buffer, IDTAG_StrLength, 30, TAG_DONE));
164 printf("ManufStr %s\n", buffer);
167 static void idfunction(void)
169 puts("\nIdFunction");
170 puts("-----------");
171 TEXT buffer[30];
172 printf("result %d\n", (int)IdFunctionTags("identify", 30, IDTAG_FuncNameStr, buffer, IDTAG_StrLength, 30, TAG_DONE));
173 printf("FuncNameStr %s\n", buffer);
174 printf("result %d\n", (int)IdFunctionTags("identify", 36, IDTAG_FuncNameStr, buffer, IDTAG_StrLength, 30, TAG_DONE));
175 printf("FuncNameStr %s\n", buffer);
178 int main(void)
180 idhardwarenum();
181 idhardware();
182 idformatstring();
183 idestimateformatsize();
184 idalert();
185 idexpansion();
186 idfunction();
188 return 0;