#include <testfwk.h>
#include <stdarg.h>
+#ifdef __ds390
+#include <tinibios.h> /* main() must see the ISR declarations */
+#endif
+
+#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
+#define _REENTRANT
+#else
+#define _REENTRANT reentrant
+#endif
+
+#if defined(SDCC_mcs51)
+/* until changed, isr's must have a prototype in the module containing main */
+void T2_isr (void) interrupt 5;
+#endif
+
/** Define this if the port's div or mod functions are broken.
A slow loop based method will be substituded.
*/
-#define BROKEN_DIV_MOD 1
+//#define BROKEN_DIV_MOD 1
void _putchar(char c);
void _exitEmu(void);
}
#endif
-static void _printn(int n)
+static void _printn(int n) _REENTRANT
{
int rem;
_putchar('0' + rem);
}
-#ifdef SDCC_mcs51
-union
-{
- struct
- {
- int offset;
- char data_space;
- } part;
- char *p;
-} generic_p_u;
-#endif
-
void __printf(const char *szFormat, ...) REENTRANT
{
va_list ap;
if (*szFormat == '%') {
switch (*++szFormat) {
case 's': {
-#ifdef SDCC_mcs51
-#warning Workaround bug #436344
- char GENERIC *sz;
-
- generic_p_u.part.data_space = va_arg (ap, char);
- generic_p_u.part.offset = va_arg (ap, int);
- sz = generic_p_u.p;
-#else
- char GENERIC *sz = va_arg(ap, char GENERIC *);
-#endif
+ char *sz = va_arg(ap, char *);
while (*sz) {
_putchar(*sz++);
}
int __numTests;
int __numFailures;
-void
+void
__fail(const char *szMsg, const char *szCond, const char *szFile, int line)
{
__printf("--- FAIL: \"%s\" on %s at %s:%u\n", szMsg, szCond, szFile, line);
__numFailures++;
}
-int
+int
main(void)
{
- TESTFUN **cases;
+ TESTFUNP *cases;
int numCases = 0;
__printf("--- Running: %s\n", getSuiteName());
- cases = (TESTFUN **)suite();
+ cases = suite();
while (*cases) {
__printf("Running %u\n", numCases);
cases++;
numCases++;
}
-
- __printf("--- Summary: %u/%u/%u: %u failed of %u tests in %u cases.\n",
+
+ __printf("--- Summary: %u/%u/%u: %u failed of %u tests in %u cases.\n",
__numFailures, __numTests, numCases,
__numFailures, __numTests, numCases
);
_exitEmu();
+
+ return 0;
}