4 * Panic - print a message to the screen and bail.
9 static char *types
[] = {
11 "Unimplemented feature:",
12 "Miscellaneous failure:"
19 * Limited decimal number formatter that only handles unsigned
20 * numbers less than 10,000,000.
24 formatDec(char s
[], uint64 n
)
37 for (k
= 0; k
< p
/ 2; k
++) {
46 Bug(uint64 type
, char *cond
, char *file
, uint64 line
)
49 uint64 maxStr
= ((uint64
)xResolution
- 8) / 8;
50 char lineStr
[] = {'L', 'i', 'n', 'e', ':', ' ', 0, 0, 0, 0, 0, 0, 0, 0};
53 * Bug message looks like:
60 * Type message can be:
62 * BUG_ASSERT Assertion failed
63 * BUG_UNIMPL Unimplemented feature
64 * BUG_MISC Miscellaneous failure
71 p1
.y
= 4 * 16 + 5 * 4;
72 ColorRectangle(COLOR_RED
, p0
, p1
);
76 PrintMessage(COLOR_BLACK
, p0
, types
[type
]);
79 if (strlen(cond
) > maxStr
) {
80 cond
[maxStr
- 1] = '\0';
82 PrintMessage(COLOR_BLACK
, p0
, cond
);
85 if (strlen(file
) > maxStr
) {
86 file
[maxStr
- 1] = '\0';
88 PrintMessage(COLOR_BLACK
, p0
, file
);
91 formatDec(lineStr
+ 6, line
);
92 PrintMessage(COLOR_BLACK
, p0
, lineStr
);