Re: [Vala] Genie and extra '\n' in some strings

2012-01-06 Thread Abderrahim Kitouni
Hello,

 في خ، 05-01-2012 عند 18:54 +0100 ، كتب Piotr Borkowski:
 Hi. I was playing around with Vala and Genie and I noticed that in the
 case of Genie, the compiler adds an extra '\ n' sequence at the end of
 some strings. Is that supposed to be?

As you can see, in both cases the newline is added to a print'ed string,
so I guess it is intentional.

btw, print in genie is a statement (like in python 2), see
http://live.gnome.org/Genie

HTH,
Abderrahim

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


Re: [Vala] Genie and extra '\n' in some strings

2012-01-06 Thread Piotr Borkowski
Thank you for your reply, Abderrahim.

 As you can see, in both cases the newline is added to a print'ed string,
 so I guess it is intentional.

I think this is intentional, but I do not understand why it has been
applied. This seems unnecessary.

After compiling the functional equivalent of that program in Vala,
such additions do not occur.

Programs in C are the same except those strange extras in Genie version.


// hello.vala
public static void main (string[] args)
{
   var caption = Hello World!\n;
   var hello = new HelloWorld ();
   var message = hello.say (caption);
   print (Message: %s\n, message);
}

class HelloWorld : Object
{
   public string say (string greeting)
   {
   print (greeting);
   return OK;
   }
}


// hello.c - vala version

...

void _vala_main (gchar** args, int args_length1) {
   gchar* _tmp0_;
   gchar* caption;
   HelloWorld* _tmp1_;
   HelloWorld* hello;
   gchar* _tmp2_ = NULL;
   gchar* message;
   _tmp0_ = g_strdup (Hello World!\n);
   caption = _tmp0_;
   _tmp1_ = hello_world_new ();
   hello = _tmp1_;
   _tmp2_ = hello_world_say (hello, caption);
   message = _tmp2_;
   g_print (Message: %s\n, message);
   _g_free0 (message);
   _g_object_unref0 (hello);
   _g_free0 (caption);
}

...

gchar* hello_world_say (HelloWorld* self, const gchar* greeting) {
   gchar* result = NULL;
   const gchar* _tmp0_;
   gchar* _tmp1_;
   g_return_val_if_fail (self != NULL, NULL);
   g_return_val_if_fail (greeting != NULL, NULL);
   _tmp0_ = greeting;
   g_print (%s, _tmp0_);
   _tmp1_ = g_strdup (OK);
   result = _tmp1_;
   return result;
}

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


Re: [Vala] Genie and extra '\n' in some strings

2012-01-06 Thread Steven Oliver
Since Genie imitates Python perhaps it does it because Python does it in
most cases. See this page:
http://docs.python.org/reference/simple_stmts.html#print

Steven N. Oliver


On Fri, Jan 6, 2012 at 8:30 AM, Piotr Borkowski rezy...@gmail.com wrote:

 Thank you for your reply, Abderrahim.

  As you can see, in both cases the newline is added to a print'ed string,
  so I guess it is intentional.

 I think this is intentional, but I do not understand why it has been
 applied. This seems unnecessary.

 After compiling the functional equivalent of that program in Vala,
 such additions do not occur.

 Programs in C are the same except those strange extras in Genie version.


 // hello.vala
 public static void main (string[] args)
 {
   var caption = Hello World!\n;
   var hello = new HelloWorld ();
   var message = hello.say (caption);
   print (Message: %s\n, message);
 }

 class HelloWorld : Object
 {
   public string say (string greeting)
   {
   print (greeting);
   return OK;
   }
 }


 // hello.c - vala version

 ...

 void _vala_main (gchar** args, int args_length1) {
   gchar* _tmp0_;
   gchar* caption;
   HelloWorld* _tmp1_;
   HelloWorld* hello;
   gchar* _tmp2_ = NULL;
   gchar* message;
   _tmp0_ = g_strdup (Hello World!\n);
   caption = _tmp0_;
   _tmp1_ = hello_world_new ();
   hello = _tmp1_;
   _tmp2_ = hello_world_say (hello, caption);
   message = _tmp2_;
g_print (Message: %s\n, message);
_g_free0 (message);
   _g_object_unref0 (hello);
   _g_free0 (caption);
 }

 ...

 gchar* hello_world_say (HelloWorld* self, const gchar* greeting) {
   gchar* result = NULL;
   const gchar* _tmp0_;
   gchar* _tmp1_;
g_return_val_if_fail (self != NULL, NULL);
   g_return_val_if_fail (greeting != NULL, NULL);
   _tmp0_ = greeting;
g_print (%s, _tmp0_);
   _tmp1_ = g_strdup (OK);
   result = _tmp1_;
   return result;
 }

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

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


[Vala] Binding problem or ClutterGst problem or my problem?

2012-01-06 Thread Brian Duffy
Hello,

Having trouble figuring out why I can't use set_seek_flags(...) on a
ClutterGst VideoTexture. I'm getting the error set_seek_flags does not
exist in the context of ClutterGst.VideoTexture. I have confirmed I'm using
Clutter-Gst 1.4.4 with ClutterGst.Version.check(1,4,4). Also, I am using
Vala 0.14 on Fedora 16. Could this be a Vala binding problem? Here is the
code ...


using Clutter;
using Gst;
using ClutterGst;

class Gui {

private VideoTexture tx;
private Stage stage;

public Gui() {
 stage = new Stage();
//stage.get_default ();
stage.color = Color () { alpha = 255 };
//stage.set_fullscreen(true);
stage.set_size(1280, 720);
stage.hide.connect (Clutter.main_quit);

tx = new ClutterGst.VideoTexture();
tx.set_seek_flags(ClutterGst.SeekFlags(1));

stage.add(tx);

tx.set_reactive(true);


tx.button_press_event.connect(button_press);

tx.set_uri(file:///home/brian/Downloads/louis.mp4);
tx.set_progress(0.601732);
tx.set_playing(true);

stage.show_all();

}

private bool button_press (ButtonEvent event) {
if (tx.get_playing() == true) {
tx.set_playing(false);
stdout.printf(%f, tx.get_progress());
}else{
tx.set_playing(true);
}
return true;
}

}

void main (string[] args) {

Clutter.init(ref args);
Gst.init(ref args);
bool version = ClutterGst.Version.check(1,4,4);
if (version) {
print (true);
}else{
print (false);
}
var gui = new Gui();

Clutter.main();
}


//valac -g --pkg clutter-1.0 --pkg gstreamer-0.10 --pkg
gstreamer-interfaces-0.10 --pkg clutter-gst-1.0 g_test.vala

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