Re: [Vala] Val(a)IDE 0.5 - IDE for Vala

2009-06-16 Thread Phil Housley
2009/6/11 Nicolas Joseph gege2...@redaction-developpez.com:

  * Unique instance

Hi, I see you are using guniqueapp for this, have you tried using
libunique?  Then you could just use the library instead of keeping a
copy of the code.

More details at:
http://live.gnome.org/LibUnique
http://live.gnome.org/TwoPointTwentyfive/ExternalDependencies
http://git.gnome.org/cgit/vala/tree/vapi/unique-1.0.vapi

-- 
Phil Housley
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Genie] Problem with gettext

2009-06-16 Thread Nicolas

Hi,

I have a strange problem using gettext.
This is my code:

const GETTEXT_PACKAGE : string = NicEdit
const LOCALE_DIR : string =  /usr/local/lib/locale
const VERSION : string =  1.0

init
   Gtk.init (ref args)
   Intl.textdomain(GETTEXT_PACKAGE)
   Intl.bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR)
   Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, UTF-8)
   Environment.set_application_name(GETTEXT_PACKAGE)
   var test = new NicEdit ()
   test.open_file(args[1])
   test.show_all ()
   Gtk.main ()

The conversion with valac work correctly, but with gcc, i have this message:

In file included from /usr/home/niko/Desktop/test/nicedit.c:5:
/usr/local/include/glib-2.0/glib/gi18n-lib.h:29:2: error: #error You 
must define GETTEXT_PACKAGE before including gi18n-lib.h.


Is this a problem in my code ?

Thanks in adavance,
Nicolas.


___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] Problem with gettext

2009-06-16 Thread Nicolas Joseph
Hi,

GETTEXT_PACKAGE must be a macro. you can define it with the -D option or, if
you use a building system, add the config.h file for all sources files with
the -include option for gcc (-X '-include config.h')

2009/6/16 Nicolas c.r@wanadoo.fr

 Hi,

 I have a strange problem using gettext.
 This is my code:

 const GETTEXT_PACKAGE : string = NicEdit
 const LOCALE_DIR : string =  /usr/local/lib/locale
 const VERSION : string =  1.0

 init
   Gtk.init (ref args)
   Intl.textdomain(GETTEXT_PACKAGE)
   Intl.bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR)
   Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, UTF-8)
   Environment.set_application_name(GETTEXT_PACKAGE)
   var test = new NicEdit ()
   test.open_file(args[1])
   test.show_all ()
   Gtk.main ()

 The conversion with valac work correctly, but with gcc, i have this
 message:

 In file included from /usr/home/niko/Desktop/test/nicedit.c:5:
 /usr/local/include/glib-2.0/glib/gi18n-lib.h:29:2: error: #error You must
 define GETTEXT_PACKAGE before including gi18n-lib.h.

 Is this a problem in my code ?

 Thanks in adavance,
 Nicolas.


 ___
 Vala-list mailing list
 Vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list




-- 
Nicolas Joseph

Responsable des rubriques C et GTK+ de developpez.com /
In charge of the C and GTK+ sections on developpez.com

http://nicolasj.developpez.com
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Val(a)IDE 0.5 - IDE for Vala

2009-06-16 Thread Nicolas Joseph
I am a little lost in these libraries, I thought guniqueapp replace them?

http://live.gnome.org/SingleInstanceApps

2009/6/16 Phil Housley undeconstruc...@gmail.com:
 2009/6/11 Nicolas Joseph gege2...@redaction-developpez.com:

  * Unique instance

 Hi, I see you are using guniqueapp for this, have you tried using
 libunique?  Then you could just use the library instead of keeping a
 copy of the code.

 More details at:
 http://live.gnome.org/LibUnique
 http://live.gnome.org/TwoPointTwentyfive/ExternalDependencies
 http://git.gnome.org/cgit/vala/tree/vapi/unique-1.0.vapi

 --
 Phil Housley




-- 
Nicolas Joseph

Responsable des rubriques C et GTK+ de developpez.com /
In charge of the C and GTK+ sections on developpez.com

http://nicolasj.developpez.com
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Val(a)IDE 0.5 - IDE for Vala

2009-06-16 Thread Emmanuele Bassi
On Tue, 2009-06-16 at 16:20 +0200, Nicolas Joseph wrote:
 I am a little lost in these libraries, I thought guniqueapp replace them?
 
 http://live.gnome.org/SingleInstanceApps

guniqueapp is not maintained anymore, and should not be used. unique is
the GNOME external dependency for single instance applications, until we
can move that functionality directly inside gtk+.

ciao,
 Emmanuele.

 2009/6/16 Phil Housley undeconstruc...@gmail.com:
  2009/6/11 Nicolas Joseph gege2...@redaction-developpez.com:
 
   * Unique instance
 
  Hi, I see you are using guniqueapp for this, have you tried using
  libunique?  Then you could just use the library instead of keeping a
  copy of the code.
 
  More details at:
  http://live.gnome.org/LibUnique
  http://live.gnome.org/TwoPointTwentyfive/ExternalDependencies
  http://git.gnome.org/cgit/vala/tree/vapi/unique-1.0.vapi
 
  --
  Phil Housley
 
 
 
 
-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi

___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libidn bindings?

2009-06-16 Thread Jiří Zárevúcky
Hello again. So I've started my my effort and since it's my first
attempt, I'd like some opinions and review.

I started with stringprep and punycode parts. Some functions are kinda
difficult to use in Vala, as they require preallocated buffer to store
output and some even use input buffer for it. So I've created some
inline methods to honor Vala's immutable strings rule.

I've also bound some structs under different name, so it is more
obvious what they are (I know I probably shouldn't do that.. I'll
change it back if that's a problem.)


I've also stumbled across a strange problem. In the Punycode.decode
inline method, I have to copy the input string (even when I don't use
the copy at all), otherwise it crashes sometimes. It's probably some
mistake I made in the inline methods, but I have no idea how can that
copy affect anything. C code gives me no clue. Can anyone look into
it?

For the test case to work, you have to add following bindings to glib-2.0.vapi:

[CCode (array_length = true)]
public unichar[] utf8_to_ucs4 (string str, long len = -1, out long
items_read = null) throws ConvertError;
[CCode (array_length = true)]
public unichar[] utf8_to_ucs4_fast (string str, long len = -1);

public string ucs4_to_utf8 (unichar[] input, out long items_read =
null, out long items_written = null) throws ConvertError;

By the way, C documentation of libidn is here:
http://www.gnu.org/software/libidn/manual/libidn.html#Stringprep-Functions

Thanks in advance for any pointers.

Dne 13. červen 2009 20:55 Jiří Zárevúcky zarevucky.j...@gmail.com napsal(a):
 Hello. Is there anyone working on those? There is no mention on this
 list or bugzilla, so I suppose there isn't. I've already started
 frying my brain with it. :)

// Copyright © 2009 Jiří Zárevúcky zarevucky.j...@gmail.com
//
// Vala binding for GNU libidn library.
// This file doesn't bind unicode and charset processing functions, as those are already present in GLib.
//

namespace libidn {

	[CCode (cname=STRINGPREP_VERSION)]
	public const string LIBIDN_VERSION;

	[CCode (cheader_filename=stringprep.h, cprefix=stringprep_rfc3454_)]
	// Stringprep character tables defined in RFC3454

	namespace RFC3454 {
		public const Stringprep.TableElement[] A_1;
		public const Stringprep.TableElement[] B_1;
		public const Stringprep.TableElement[] B_2;
		public const Stringprep.TableElement[] B_3;
		public const Stringprep.TableElement[] C_1_1;
		public const Stringprep.TableElement[] C_1_2;
		public const Stringprep.TableElement[] C_2_1;
		public const Stringprep.TableElement[] C_2_2;
		public const Stringprep.TableElement[] C_3;
		public const Stringprep.TableElement[] C_4;
		public const Stringprep.TableElement[] C_5;
		public const Stringprep.TableElement[] C_6;
		public const Stringprep.TableElement[] C_7;
		public const Stringprep.TableElement[] C_8;
		public const Stringprep.TableElement[] C_9;
		public const Stringprep.TableElement[] D_1;
		public const Stringprep.TableElement[] D_2;
	}

	[CCode (cheader_filename=stringprep.h, cprefix=Stringprep_, lower_case_cprefix=stringprep_)]
	namespace Stringprep {

		/* constants */

		public const int MAX_MAP_CHARS;

		/* enums */

		[CCode (cname=Stringprep_rc, cprefix=STRINGPREP_)]
		public enum ReturnCode {
			OK,
			CONTAINS_UNASSIGNED,
			CONTAINS_PROHIBITED,
			BIDI_BOTH_L_AND_RAL,
			BIDI_LEADTRAIL_NOT_RAL,
			BIDI_CONTAINS_PROHIBITED,
			TOO_SMALL_BUFFER,
			PROFILE_ERROR,
			FLAG_ERROR,
			UNKNOWN_PROFILE,
			NFKC_FAILED,
			MALLOC_ERROR
		}

		[Flags]
		[CCode (cname=Stringprep_profile_flags, cprefix=STRINGPREP_)]
		public enum ProfileFlags {
			NO_NFKC,
			NO_BIDI,
			NO_UNASSIGNED
		}

		[CCode (cname=Stringprep_profile_steps, cprefix=STRINGPREP_)]
		public enum ProfileSteps {
			NFKC,
			BIDI,
			MAP_TABLE,
			UNASSIGNED_TABLE,
			PROHIBIT_TABLE,
			BIDI_PROHIBIT_TABLE,
			BIDI_RAL_TABLE,
			BIDI_L_TABLE
		}

		/* structs */

		[Compact]
		[CCode (cname=Stringprep_table_element, set_type_id=false)]
		public struct TableElement {
			// start of the range, or a single charater to replace
			unichar start;
			// end of the range, or 0 if only one character
			unichar end;
			// characters to replace with, or null if element is a range
			// this shouldn't have more than MAP_MAX_CHARS members (== 4)
			unichar[] map;
		}

		[Compact]
		[CCode (cname=Stringprep_profile, set_type_id=false)]
		public struct ProfileTable {
			ProfileSteps operation;
			ProfileFlags flags;
			TableElement[] table;
		}

		[Compact]
		[CCode (cname=Stringprep_profiles, set_type_id=false)]
		public struct NamedProfile {
			string name;
			ProfileTable[] tables;
		}

		/* predefined profiles */

		[CCode (cname=stringprep_profiles, array_null_terminated=true, array_length=false)]
		// Contains all built-in profiles with appropriate names
		public NamedProfile[] ProfileList;



		[CCode (cname=stringprep_nameprep, array_null_terminated=true, array_length=false)]
		public ProfileTable[] 

[Vala] autotool support for genie

2009-06-16 Thread Jamie McCracken
hi juerg,

i note that vala now has automake support for .vala files but it
lacks .gs genie source file support

i have a patch for autotools to support genie but my perl is not very
good so please see attached patch and let me know if its right and i
will forward to autotools list

thanks

jamie 
diff --git a/automake.in b/automake.in
index bab8c42..2cb5c36 100755
--- a/automake.in
+++ b/automake.in
@@ -819,7 +819,7 @@ register_language ('name' = 'vala',
 		   'compile' = '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
 		   'ccer' = 'VALAC',
 		   'compiler' = 'VALACOMPILE',
-		   'extensions' = ['.vala'],
+		   'extensions' = ['.vala', '.gs'],
 		   'output_extensions' = sub { (my $ext = $_[0]) =~ s/vala$/c/;
 		return ($ext,) },
 		   'rule_file' = 'vala',
@@ -5947,7 +5947,7 @@ sub lang_vala_finish_target ($$)
 \t  rm -f \$(srcdir)/${derived}_vala.stamp; \\\n.
 \t  \$(am__cd) \$(srcdir)  \$(MAKE) \$(AM_MAKEFLAGS) ${derived}_vala.stamp; \\\n.
 \tfi\n
-if $file =~ s/(.*)\.vala$/$1.c/;
+if ($file =~ s/(.*)\.vala$/$1.c/) || ($file =~ s/(.*)\.gs$/$1.c/);
 }
 }
 
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] autotool support for genie

2009-06-16 Thread Jürg Billeter
Hi Jamie,

On Tue, 2009-06-16 at 19:02 -0400, Jamie McCracken wrote:
 hi juerg,
 
 i note that vala now has automake support for .vala files but it
 lacks .gs genie source file support
 
 i have a patch for autotools to support genie but my perl is not very
 good so please see attached patch and let me know if its right and i
 will forward to autotools list

You've missed at least necessary changes in 'output_extensions' (in
Vala's register_language) and in lang_vala_rewrite. Best would probably
be to port the Vala test cases to Genie (should be easy) and make sure
all Vala and Genie test cases pass.

Thanks,
Jürg

___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list