32 #include <libFreeWRL.h>
35 #if defined(HAVE_STDARG_H)
39 #if defined(HAVE_ERRNO_H)
43 #if !defined(HAVE_STRNLEN)
48 size_t __fw_strnlen(
const char *s,
size_t maxlen)
50 const char *end = memchr(s,
'\0', maxlen);
51 return end ? (size_t) (end - s) : maxlen;
56 #if !defined(HAVE_STRNDUP)
58 char *__fw_strndup(
const char *s,
size_t n)
60 size_t len = strnlen(s, n);
61 char *
new = MALLOC(
char *, len + 1);
75 void fw_perror(FILE *f,
const char *format, ...)
82 vfprintf(f, format, ap);
86 FPRINTF(f,
"[System error: %s]\n", strerror(e));
88 FPRINTF(f,
"[System error: %d]\n", e);
103 void internalc_init(
struct tinternalc* ic)
106 ic->global_strictParsing = FALSE;
107 ic->global_plugin_print = FALSE;
108 ic->global_occlusion_disable = FALSE;
109 ic->user_request_texture_size = 0;
110 ic->global_print_opengl_errors = FALSE;
111 ic->global_trace_threads = FALSE;
118 void fwl_set_strictParsing (
bool flag) {
119 gglobal()->internalc.global_strictParsing = flag ;
126 void fwl_set_plugin_print (
bool flag) { gglobal()->internalc.global_plugin_print = flag ; }
127 void fwl_set_occlusion_disable (
bool flag) { gglobal()->internalc.global_occlusion_disable = flag; }
128 void fwl_set_print_opengl_errors(
bool flag) { gglobal()->internalc.global_print_opengl_errors = flag;}
129 void fwl_set_trace_threads (
bool flag) { gglobal()->internalc.global_trace_threads = flag;}
131 void fwl_set_texture_size (
unsigned int texture_size) {
136 tg->internalc.user_request_texture_size = texture_size;
137 rdr_caps = tg->display.rdr_caps;
142 if (texture_size > rdr_caps->system_max_texture_size)
143 rdr_caps->runtime_max_texture_size = rdr_caps->system_max_texture_size;
146 rdr_caps->runtime_max_texture_size = texture_size;
153 #ifdef FREEWRL_THREAD_COLORIZED
159 int printf_with_colored_threads(
const char *format, ...)
163 va_start( args, format );
165 printf(
"\033[22;%im", fw_thread_color(fw_thread_id()));
167 ret = vprintf( format, args );
169 printf(
"\033[22;%im", 39 );
176 int fprintf_with_colored_threads(FILE *stream,
const char *format, ...)
180 va_start( args, format );
182 fprintf(stream,
"\033[22;%im", fw_thread_color(fw_thread_id()));
184 ret = vfprintf( stream, format, args );
186 fprintf(stream,
"\033[22;%im", 39 );