예제 #1
0
파일: gui.c 프로젝트: pcwalton/NetSurf
/**
 * Main entry point from OS.
 */
int main(int argc, char** argv)
{
	char *messages;
	char *options;

	/* check home directory is available */
	nsgtk_check_homedir();

	respaths = nsgtk_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"GTK_RESPATH":./gtk/res");

	gtk_init(&argc, &argv);
	
        /* set standard error to be non-buffering */
	setbuf(stderr, NULL);

	options = filepath_find(respaths, "Choices");
	messages = filepath_find(respaths, "Messages");

	netsurf_init(&argc, &argv, options, messages);

	free(messages);
	free(options);

	gui_init(argc, argv, respaths);

	netsurf_main_loop();
	
	/* Ensure all scaffoldings are destroyed before we go into exit */
	while (scaf_list != NULL)
		nsgtk_scaffolding_destroy(scaf_list);
	
	netsurf_exit();

	return 0;
}
예제 #2
0
파일: gui.c 프로젝트: galexcode/NetSurf68k
/** Entry point from OS.
 *
 * /param argc The number of arguments in the string vector.
 * /param argv The argument string vector.
 * /return The return code to the OS
 */
int
main(int argc, char** argv)
{
	struct browser_window *bw;
	char *options;
	char *messages;

	setbuf(stderr, NULL);

	respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);

	options = filepath_find(respaths, "Choices");
	messages = filepath_find(respaths, "messages");

	netsurf_init(&argc, &argv, options, messages);

	free(messages);
	free(options);

	gui_init(argc, argv);

	LOG(("calling browser_window_create"));
	bw = browser_window_create(feurl, 0, 0, true, false);

	netsurf_main_loop();

	browser_window_destroy(bw);

	netsurf_exit();

	return 0;
}
예제 #3
0
파일: gui.cpp 프로젝트: pombredanne/NetSurf
/** Normal entry point from OS */
int main(int argc, char** argv)
{
	setbuf(stderr, NULL);

	BPath options;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
		options.Append("x-vnd.NetSurf");
	}

	if (!replicated) {
		// create the Application object before trying to use messages
		// so we can open an alert in case of error.
		new NSBrowserApplication;
	}

	const char* messages = "/boot/apps/netsurf/res/en/Messages";

	/* initialise netsurf */
	netsurf_init(&argc, &argv, options.Path(), messages);

    gui_init(argc, argv);
    gui_init2(argc, argv);

	netsurf_main_loop();

	netsurf_exit();

	return 0;
}
예제 #4
0
/** Normal entry point from OS */
int main(int argc, char** argv)
{
	nserror ret;
	BPath options;
	struct gui_table beos_gui_table = {
		&beos_browser_table,
		beos_window_table,
		beos_download_table,
		&beos_clipboard_table,
                &beos_fetch_table
	};

	if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
		options.Append("x-vnd.NetSurf");
	}

	if (!replicated) {
		// create the Application object before trying to use messages
		// so we can open an alert in case of error.
		new NSBrowserApplication;
	}

	/* initialise logging. Not fatal if it fails but not much we
	 * can do about it either.
	 */
	nslog_init(nslog_stream_configure, &argc, argv);

	/* user options setup */
	ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
	if (ret != NSERROR_OK) {
		die("Options failed to initialise");
	}
	nsoption_read(options.Path(), NULL);
	nsoption_commandline(&argc, argv, NULL);

	/* common initialisation */
	BPath messages = get_messages_path();
	ret = netsurf_init(messages.Path(), &beos_gui_table);
	if (ret != NSERROR_OK) {
		die("NetSurf failed to initialise");
	}

	gui_init(argc, argv);

	netsurf_main_loop();

	netsurf_exit();

	return 0;
}
예제 #5
0
파일: gui.c 프로젝트: galexcode/NetSurf68k
/** Entry point from OS.
 *
 * /param argc The number of arguments in the string vector.
 * /param argv The argument string vector.
 * /return The return code to the OS
 */
int main(int argc, char** argv)
{
    char messages[PATH_MAX];

    setbuf(stderr, NULL);
    setbuf(stdout, NULL);
#ifdef WITH_DBG_LOGFILE
    freopen("stdout.log", "a+", stdout);
    freopen("stderr.log", "a+", stderr);
#endif

    graf_mouse(BUSY_BEE, NULL);

    init_app(NULL);

    init_os_info();

    atari_find_resource((char*)&messages, "messages", "res/messages");
    atari_find_resource((char*)&options, "Choices", "Choices");

    LOG(("Initialising core..."));
    netsurf_init(&argc, &argv, options, messages);

    LOG(("Initializing GUI..."));
    gui_init(argc, argv);

    LOG(("Initializing GUI2"));
    gui_init2(argc, argv);

    graf_mouse( ARROW , NULL);

    LOG(("Creating initial browser window..."));
    browser_window_create(option_homepage_url, 0, 0, true, false);

    LOG(("Entering NetSurf mainloop..."));
    netsurf_main_loop();

    netsurf_exit();
    LOG(("ApplExit"));
#ifdef WITH_DBG_LOGFILE
    fclose(stdout);
    fclose(stderr);
#endif
    exit_gem();

    return 0;
}
예제 #6
0
파일: gui.c 프로젝트: bkeepers/cheribsd
/** Entry point from OS.
 *
 * /param argc The number of arguments in the string vector.
 * /param argv The argument string vector.
 * /return The return code to the OS
 */
int
main(int argc, char** argv)
{
	struct browser_window *bw;
	char *options;
	char *messages;
	nsurl *url;
	nserror ret;
	nsfb_t *nsfb;
	struct gui_table framebuffer_gui_table = {
		.browser = &framebuffer_browser_table,
		.window = &framebuffer_window_table,
		.clipboard = framebuffer_clipboard_table,
		.fetch = framebuffer_fetch_table,
		.utf8 = framebuffer_utf8_table,
	};

	respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);

	/* initialise logging. Not fatal if it fails but not much we
	 * can do about it either.
	 */
	nslog_init(nslog_stream_configure, &argc, argv);

	/* user options setup */
	ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
	if (ret != NSERROR_OK) {
		die("Options failed to initialise");
	}
	options = filepath_find(respaths, "Choices");
	nsoption_read(options, nsoptions);
	free(options);
	nsoption_commandline(&argc, argv, nsoptions);

	/* common initialisation */
	messages = filepath_find(respaths, "Messages");
	ret = netsurf_init(messages, &framebuffer_gui_table);
	free(messages);
	if (ret != NSERROR_OK) {
		die("NetSurf failed to initialise");
	}

	/* Override, since we have no support for non-core SELECT menu */
	nsoption_set_bool(core_select_menu, true);

	if (process_cmdline(argc,argv) != true)
		die("unable to process command line.\n");

	nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
	if (nsfb == NULL)
		die("Unable to initialise framebuffer");

	framebuffer_set_cursor(&pointer_image);

	if (fb_font_init() == false)
		die("Unable to initialise the font system");

	fbtk = fbtk_init(nsfb);

	fbtk_enable_oskb(fbtk);

	urldb_load_cookies(nsoption_charp(cookie_file));

	/* create an initial browser window */

	LOG(("calling browser_window_create"));

	ret = nsurl_create(feurl, &url);
	if (ret == NSERROR_OK) {
		ret = browser_window_create(BW_CREATE_HISTORY,
					      url,
					      NULL,
					      NULL,
					      &bw);
		nsurl_unref(url);
	}
	if (ret != NSERROR_OK) {
		warn_user(messages_get_errorcode(ret), 0);
	} else {
		netsurf_main_loop();

		browser_window_destroy(bw);
	}

	netsurf_exit();

	if (fb_font_finalise() == false)
		LOG(("Font finalisation failed."));

	/* finalise options */
	nsoption_finalise(nsoptions, nsoptions_default);

	return 0;
}
예제 #7
0
파일: main.c 프로젝트: pombredanne/NetSurf
/**
 * Entry point from operating system
 **/
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
{
	char **argv = NULL;
	int argc = 0, argctemp = 0;
	size_t len;
	LPWSTR *argvw;
	char *messages;
	nserror ret;
	const char *addr;
	nsurl *url;
	nserror error;

	if (SLEN(lpcli) > 0) {
		argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
	}

	setbuf(stderr, NULL);

	/* Construct a unix style argc/argv */
	argv = malloc(sizeof(char *) * argc);
	while (argctemp < argc) {
		len = wcstombs(NULL, argvw[argctemp], 0) + 1;
		if (len > 0) {
			argv[argctemp] = malloc(len);
		}

		if (argv[argctemp] != NULL) {
			wcstombs(argv[argctemp], argvw[argctemp], len);
			/* alter windows-style forward slash flags to
			 * hyphen flags.
			 */
			if (argv[argctemp][0] == '/')
				argv[argctemp][0] = '-';
		}
		argctemp++;
	}

	respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);

	messages = filepath_find(respaths, "messages");

	options_file_location = filepath_find(respaths, "preferences");

	/* initialise netsurf */
	netsurf_init(&argc, &argv, options_file_location, messages);

	free(messages);

	ret = nsws_create_main_class(hInstance);
	ret = nsws_create_drawable_class(hInstance);
	ret = nsws_create_localhistory_class(hInstance);

	nsoption_set_bool(target_blank, false);

	nsws_window_init_pointers(hInstance);

	/* If there is a url specified on the command line use it */
	if (argc > 1) {
		addr = argv[1];
	} else if (nsoption_charp(homepage_url) != NULL) {
		addr = nsoption_charp(homepage_url);
	} else {
		addr = NETSURF_HOMEPAGE;
	}

	LOG(("calling browser_window_create"));

	error = nsurl_create(addr, &url);
	if (error == NSERROR_OK) {
		error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
					      BROWSER_WINDOW_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);

	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	} else {
		netsurf_main_loop();
	}

	netsurf_exit();

	free(options_file_location);

	return 0;
}
예제 #8
0
int
main(int argc, char** argv)
{
	struct browser_window *bw;
	char *options;
	char *messages;

	setbuf(stderr, NULL);

	freopen( "stderr.log", "w", stderr );
	freopen( "stdout.log", "w", stdout );
	

	char p[256];
	char **z;
	z=0x20;
	strcpy(p, *z);
	
	__menuet__debug_out("PATH1...\n");
	__menuet__debug_out(p);
	__menuet__debug_out("PATH1...\n");
	
	*(strrchr(p, '/')+1)='\0';
	
	strcpy(strrchr(p, '/')+1, "res/");
	
	__menuet__debug_out("PATH1...\n");
	__menuet__debug_out(p);
	__menuet__debug_out("PATH1...\n");

	asm volatile ("int $0x40"::"a"(30), "b"(1), "c"(p));
	
	LOG(("Registering surfaces for SDL and RAM.."));
	
	//extern nsfb_surface_rtns_t sdl_rtns;
	extern nsfb_surface_rtns_t ram_rtns;
	extern nsfb_surface_rtns_t able_rtns;
	extern nsfb_surface_rtns_t kolibri_rtns;
	
	//_nsfb_register_surface(NSFB_SURFACE_SDL, &sdl_rtns, "sdl");
	_nsfb_register_surface(NSFB_SURFACE_RAM, &ram_rtns, "ram");
	_nsfb_register_surface(NSFB_SURFACE_ABLE, &able_rtns, "able");
	_nsfb_register_surface(NSFB_SURFACE_KOLIBRI, &kolibri_rtns, "kolibri");
	
	
	//respaths = fb_init_resource("/kolibrios/:/hd0/1/res/:/bd0/1/res/:/tmp9/1/netsurf/res/:res/:fonts/:");
	respaths = fb_init_resource(p);

	options = filepath_find(respaths, "Choices");
	messages = filepath_find(respaths, "messages");

	__menuet__debug_out("===path to msg\n");
	__menuet__debug_out(messages);
	__menuet__debug_out("\n===path to msg\n");
	
	//netsurf_init(&argc, &argv, options, "res/messages");
	netsurf_init(&argc, &argv, options, messages);
	extern HTTP_INIT();
	HTTP_INIT();
	LOG(("NS init okay"));
	
	free(messages);
	free(options);

	LOG(("freed opts and msgs, start gui init"));
	

	gui_init(argc, argv);

	LOG(("calling browser_window_create in MAIN()"));
	bw = browser_window_create(feurl, 0, 0, true, false);


	LOG(("NS main loop..."));
	
	netsurf_main_loop();

	browser_window_destroy(bw);

	netsurf_exit();

	return 0;
}