Bring back darwin hosted port to live, might also work for android hosted but is...
[AROS.git] / test / exec / rawdofmt.c
blob61a52723dd8b3da654f58ff093711447d5e50808
1 #include <exec/rawfmt.h>
2 #include <proto/exec.h>
4 #include <stdio.h>
6 int __nocommandline = 1;
8 int main(void)
10 char buf[256];
11 ULONG count = 0;
12 IPTR args[] =
14 (IPTR)"one",
15 (IPTR)"two",
23 * NewRawDoFmt() should not need 'l' modifier for ULONGs.
24 * This is verified under MorphOS.
26 printf("Checking NewRawDoFmt...\n");
27 NewRawDoFmt("%s plus %s will be %u, next are %u, %u, %u", (APTR)RAWFMTFUNC_COUNT, &count, "one", "two", 3, 4, 5, 6);
28 printf("Count is %u\n", (unsigned)count);
29 NewRawDoFmt("%s plus %s will be %u, next are %u, %u, %u", (APTR)RAWFMTFUNC_STRING, buf, "one", "two", 3, 4, 5, 6);
30 printf("Formatted string is: %s\n", buf);
31 NewRawDoFmt("%s plus %s will be %u, next are %u, %u, %u\n", (APTR)RAWFMTFUNC_SERIAL, NULL, "one", "two", 3, 4, 5, 6);
32 printf("Serial output done\n");
34 count = 0;
37 * RawDoFmt() historically assumes UWORD argument
38 * without 'l' modifier. In AROS 'l' here stands for IPTR,
39 * not ULONG, for 64 bit compatibility.
41 printf("Checking RawDoFmt...\n");
42 RawDoFmt("%s plus %s will be %lu, next are %lu, %lu, %lu", args, (APTR)RAWFMTFUNC_COUNT, &count);
43 printf("Count is %u\n", (unsigned)count);
44 RawDoFmt("%s plus %s will be %lu, next are %lu, %lu, %lu", args, (APTR)RAWFMTFUNC_STRING, buf);
45 printf("Formatted string is: %s\n", buf);
46 RawDoFmt("%s plus %s will be %lu, next are %lu, %lu, %lu\n", args, (APTR)RAWFMTFUNC_SERIAL, NULL);
47 printf("Serial output done\n");
49 /* Now check correct sign interpretation. Specifier is intentionally %d, not %u! */
50 NewRawDoFmt("This should be positive: %d", (APTR)RAWFMTFUNC_STRING, buf, 40960);
51 printf("NewRawDoFmt sign test: %s\n", buf);
53 /* Don't depend on endianess, sign-extend on 64 bits */
54 args[0] = (SIPTR)0xA0A0A0A0;
56 /* Intentionally %d with no 'l'! UWORD argument! */
57 RawDoFmt("This should be negative: %d\n", args, (APTR)RAWFMTFUNC_STRING, buf);
58 printf("RawDoFmt sign test: %s\n", buf);
60 return 0;