FreeBASIC  0.91.0
io_print.c
Go to the documentation of this file.
1 /* print [#] functions */
2 
3 #include "fb.h"
4 
5 /*:::::*/
6 static void fb_hPrintStrEx( FB_FILE *handle, const char *s, size_t len, int mask )
7 {
8  /* add a lock here or the new-line won't be printed in the right
9  place if PRINT is been used in multiple threads and a context
10  switch happens between FB_PRINT_EX() and PrintVoidEx() */
11  FB_LOCK( );
12 
13  if( len != 0 )
14  FB_PRINT_EX(handle, s, len, 0);
15 
16  fb_PrintVoidEx( handle, mask );
17 
18  FB_UNLOCK( );
19 }
20 
21 /*:::::*/
22 void fb_PrintStringEx ( FB_FILE *handle, FBSTRING *s, int mask )
23 {
24  if( (s == NULL) || (s->data == NULL) )
25  fb_PrintVoidEx( handle, mask );
26  else
27  fb_hPrintStrEx( handle, s->data, FB_STRSIZE(s), mask );
28 
29  /* del if temp */
30  fb_hStrDelTemp( s );
31 }
32 
33 /*:::::*/
34 FBCALL void fb_PrintString ( int fnum, FBSTRING *s, int mask )
35 {
36  fb_PrintStringEx(FB_FILE_TO_HANDLE(fnum), s, mask);
37 }