2016-01-15 00:05:51 +01:00
|
|
|
#ifndef INCLUDE_DEBUG_H
|
|
|
|
#define INCLUDE_DEBUG_H
|
|
|
|
#print "[include <debug.h>]\n"
|
|
|
|
|
|
|
|
#ifndef INCLUDE_STRING_H
|
|
|
|
#include "../lib/strings.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
inline fastcall void debugch( ECX)
|
|
|
|
{
|
|
|
|
$push eax
|
|
|
|
$push ebx
|
|
|
|
$mov eax,63
|
|
|
|
$mov ebx,1
|
|
|
|
$int 0x40
|
|
|
|
$pop ebx
|
|
|
|
$pop eax
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall void debug( EDX)
|
|
|
|
{
|
|
|
|
$push eax
|
|
|
|
$push ebx
|
|
|
|
$push ecx
|
|
|
|
$mov eax, 63
|
|
|
|
$mov ebx, 1
|
|
|
|
NEXT_CHAR:
|
|
|
|
$mov ecx, DSDWORD[edx]
|
|
|
|
$or cl, cl
|
|
|
|
$jz DONE
|
|
|
|
$int 0x40
|
|
|
|
$inc edx
|
|
|
|
$jmp NEXT_CHAR
|
|
|
|
DONE:
|
|
|
|
$pop ecx
|
|
|
|
$pop ebx
|
|
|
|
$pop eax
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall void debugln( EDX)
|
|
|
|
{
|
|
|
|
debug( EDX);
|
2016-02-06 23:48:51 +01:00
|
|
|
debugch(10);
|
|
|
|
debugch(13);
|
2016-01-15 00:05:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void debugi(dword d_int)
|
|
|
|
{
|
|
|
|
char tmpch[12];
|
|
|
|
itoa_(#tmpch, d_int);
|
|
|
|
debugln(#tmpch);
|
|
|
|
}
|
|
|
|
|
2016-02-21 22:57:22 +01:00
|
|
|
:void debugval(dword text,number)
|
|
|
|
{
|
|
|
|
debug(text);
|
|
|
|
debug(": ");
|
|
|
|
debugi(number);
|
|
|
|
}
|
|
|
|
|
2016-01-15 00:05:51 +01:00
|
|
|
:void assert(dword _type, _actual, _expected)
|
|
|
|
{
|
|
|
|
char r[4096];
|
|
|
|
if (_type=='s') {
|
|
|
|
if (streq(_actual, _expected)) return;
|
|
|
|
sprintf(#r, "==========nok{\nactual: %s\nexpected: %s", _actual, _expected);
|
|
|
|
debugln(#r);
|
|
|
|
}
|
|
|
|
if (_type=='i') {
|
|
|
|
if (_actual == _expected)) return;
|
|
|
|
sprintf(#r, "==========nok{\nactual: %i\nexpected: %i", _actual, _expected);
|
|
|
|
debugln(#r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|