FreeBASIC  0.91.0
error_assert_wstr.c
Go to the documentation of this file.
1 /* assertion functions */
2 
3 #include "fb.h"
4 
5 #define BUFFER_SIZE 1024
6 
7 static void hConvToA( char *buffer, FB_WCHAR *expression )
8 {
9  fb_wstr_ConvToA( buffer, expression, BUFFER_SIZE-1 );
10  buffer[BUFFER_SIZE-1] = 0; /* null terminator */
11 }
12 
13 FBCALL void fb_AssertW( char *filename, int linenum, char *funcname, FB_WCHAR *expression )
14 {
15  char buffer[BUFFER_SIZE];
16 
17  /* Convert the expression wstring to a zstring */
18  hConvToA( buffer, expression );
19 
20  /* then let the zstring version handle it */
21  fb_Assert( filename, linenum, funcname, buffer );
22 
23  /* This way we don't need to bother using fwprintf() or similar,
24  which would only make things unnecessarily complex,
25  especially since it doesn't exist on DJGPP. */
26 }
27 
28 FBCALL void fb_AssertWarnW( char *filename, int linenum, char *funcname, FB_WCHAR *expression )
29 {
30  char buffer[BUFFER_SIZE];
31  hConvToA( buffer, expression );
32  fb_AssertWarn( filename, linenum, funcname, buffer );
33 }