34 #include <libFreeWRL.h>
36 #include "../lib/main/MainLoop.h"
54 static int CaughtSEGV = FALSE;
55 void fv_catch_SIGQUIT();
56 void fv_catch_SIGSEGV();
59 void fv_catch_SIGALRM(
int);
60 void fv_catch_SIGHUP();
65 char *get_current_dir();
66 char *strBackslash2fore(
char *str);
70 void fwExit(
int iret){
76 void fwg_register_consolemessage_callback(
void(*callback)(
char *));
77 void fw_printstring(
char *str){
83 int main (
int argc,
char **argv)
96 char consoleBuffer[200];
98 fwg_register_consolemessage_callback(fw_printstring);
99 fwg_setConsoleParam_maxLines(30);
100 fwg_setConsoleParam_maxLineLength(70);
101 fwg_setConsoleParam_replaceTabs(1);
104 libver = libFreeWRL_get_version();
105 progver = freewrl_get_version();
106 if (strcmp(progver, libver)) {
107 sprintf(consoleBuffer ,
"FreeWRL expected library version %s, got %s...\n",progver, libver);
108 fwl_StringConsoleMessage(consoleBuffer);
110 sprintf(consoleBuffer,
"libfreewrl version %s\n", libver);
111 fwl_StringConsoleMessage(consoleBuffer);
119 if(strstr(argv[0],
"projectfiles"))
124 fdir = malloc(MAX_PATH);
125 xdir = malloc(MAX_PATH);
126 strcpy(fdir,
"FREEWRL_FONTS_DIR=");
128 strcpy(xdir,argv[0]);
129 xe = strstr(xdir,
"projectfiles");
131 xdir = strcat(xdir,
"appleOSX/OSX_Specific/fonts");
145 syspath = getenv(
"windir");
147 fdir = malloc(MAX_PATH);
148 strcpy(fdir,
"FREEWRL_FONTS_DIR=");
149 strcat(fdir,syspath);
150 strcat(fdir,
"/Fonts");
155 _putenv(
"FREEWRL_NO_VBOS=1");
165 #ifdef WANT_SIGNALHANDLERS
166 signal(SIGTERM, (
void(*)(
int)) fv_catch_SIGQUIT);
167 signal(SIGSEGV, (
void(*)(
int)) fv_catch_SIGSEGV);
170 signal(SIGQUIT, (
void(*)(
int)) fv_catch_SIGQUIT);
171 signal(SIGALRM, (
void(*)(
int)) fv_catch_SIGALRM);
172 signal(SIGHUP, (
void(*)(
int)) fv_catch_SIGHUP);
179 fv_params->width = 640;
180 fv_params->height = 480;
182 fv_params->fullscreen = FALSE;
183 fv_params->winToEmbedInto = INT_ID_UNDEFINED;
184 fv_params->verbose = FALSE;
190 if (fv_parseCommandLine(argc, argv,fv_params)) {
192 start_url = argv[optind];
195 start_url = strBackslash2fore(start_url);
211 if (!fwl_initFreeWRL(fv_params)) {
212 ERROR_MSG(
"main: aborting during initialization.\n");
215 fwl_startFreeWRL(start_url);
229 void fv_catch_SIGQUIT()
238 void fv_catch_SIGSEGV()
244 printf(
"FreeWRL got a SIGSEGV - please feel free to report this - http://freewrl.sf.net.\n");
252 void fv_catch_SIGHUP()
258 void fv_catch_SIGALRM(
int sig)
260 signal(SIGALRM, SIG_IGN);
266 #if defined(_MSC_VER)
271 signal(SIGALRM, fv_catch_SIGALRM);