After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 318577 - win32 port
win32 port
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-11 14:24 UTC by Paolo Borelli
Modified: 2014-02-15 12:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
preliminary patch by Tor (12.84 KB, patch)
2005-10-11 14:24 UTC, Paolo Borelli
none Details | Review
proposed patch (4.41 KB, patch)
2005-12-05 15:48 UTC, Paolo Borelli
none Details | Review
Patch using GMappedFile as proposed (does not patch configure.in and Makefile.am) (4.58 KB, patch)
2006-01-15 23:14 UTC, Paolo Maggi
committed Details | Review

Description Paolo Borelli 2005-10-11 14:24:07 UTC
Tracking bug for the required changes for a win32 port.

Tor (CC'ed) some time ago sent in a preliminary patch for the port. I am going
to attach it here so that it doesn't get lost and also report here the comments
done by mail.
Comment 1 Paolo Borelli 2005-10-11 14:24:55 UTC
Created attachment 53330 [details] [review]
preliminary patch by Tor
Comment 2 Paolo Borelli 2005-10-11 14:31:16 UTC
- use xmlReaderForFd also on unix to avoid the ifdef
- move the added function from gsv-i18n.h to a gsv-win32 since that's where they
belong and since we are goin to switch to gi18n-lib.h
- the patch may be simplyfied after forting out bug #304147 (use of
XDG_DATA_DIRS, includes a patch)
Comment 3 Paolo Borelli 2005-12-05 15:48:03 UTC
Created attachment 55642 [details] [review]
proposed patch

Here is an updated patch: it's simply the above patch with

- the ifdefs removed (except were we use g_file_get_contents, since that load
all the file into memory... I was not sure if libxml is doing the same thing or
if it's a bit smarter)

- the code to locate lang files removed since we now use g_get_system_data_dir
(xdg stuff). I assumed that g_get_system_data_dir works out of the box on win32
in the same way, obviously I have no idea if that is correct :)


Tor, any chance you could give this a quick try? I'd love to have an official
win32 version of sourceview since there are varius proects using it
Comment 4 Tor Lillqvist 2005-12-06 03:49:21 UTC
I will look into this again "soon" (next week probably), thanks!
Comment 5 Paolo Maggi 2005-12-28 12:33:37 UTC
Comment on attachment 55642 [details] [review]
proposed patch


>+	/*
>+	 * Use of filename is not ut8 safe on w32, so read
>+	 * the whole file there.
>+	 */
>+#ifndef G_OS_WIN32
> 	doc = xmlParseFile (language->priv->lang_file_name);
>+#else
>+	{
>+		gchar *file_contents;
>+		gsize file_length;
>+
>+		if (g_file_get_contents (language->priv->lang_file_name,
>+					 &file_contents, &file_length, NULL)) {
>+			doc = xmlParseMemory (file_contents, file_length);
>+			g_free (file_contents);
>+		} else {
>+			doc = NULL;
>+		}
>+	}

What about using GMappedFile on glib >= 2.8 and removing the G_OS_WIN32 check.
Comment 6 Paolo Maggi 2006-01-15 23:14:59 UTC
Created attachment 57438 [details] [review]
Patch using GMappedFile as proposed (does not patch configure.in and Makefile.am)

This patch uses GMappedFile as I proposed in my previous comment.
It does not patch configure.in and Makefile.am to generate gtksourceview-zip.

We are going to commit this patch now.

Tor: can you please give a look at it and let us know what is missing for complete win32 support? Feel free to commit "build" related patches.
Comment 7 Paolo Maggi 2006-01-15 23:37:42 UTC
I have just committed to CVS HEAD a modified version of patch at comment #6 containing also what is needed to generate gtksourceview-zip.

I'm closing this bug. 

Tor: feel free to re-open this bug if gtksourceview 1.5.5 or CVS HEAD does not build/work on Win32.

2006-01-16  Paolo Maggi  <paolo@gnome.org>

	Fixed bug #318577 – win32 port
	
	Based on a patch by Tor Lillqvist modified by Paolo Borelli
	
	* configure.in: added gtksourceview-zip to AC_CONFIG_FILES
	
	* makefile.am: added gtksourceview-zip.in to EXTRA_DIST
	
	* gtksourceview-zip.in: new file
	
	* gtksourceview/Makefile.am: define PREFIX in INCLUDES

	* gtksourceview/gtksourcelanguage.c
	(_gtk_source_language_new_from_file): use xmlReaderForFd instead of
	xmlNewTextReaderFilename so that it's utf8 safe on win32.
	 (get_mime_types_from_file): ditto
	(language_file_parse):  use GMappedFile and xmlParseMemory instead of
	xmlParseFile