Re: [Vala] Starting with Vala

2017-04-04 Thread raum
Hello,

I humbly tried to create some programs in Vala but I made a lot of
mistakes (especially on NPC which was my first "big" program that is
really not optimized, clean, etc. but has the merit to try something
complex)

http://www.github.com/Raumy

You could take a look to "check_fs" which is better and my lastest 
"graph_map".

Regards

Raum

> Hello list,
>
> i would like to learn Vala and plan to port a Mono-GNOME-App to Vala. I
> already seen the documentation.
>
> Maybe you know some small Vala apps where i can see the code in action?
>
> Greetings
>
> Sascha
>
> --
> Sascha Manns
> Maifeldstraße 10
> 56727 Mayen
>
> P: +49-2651-4014045
> W: http://saigkill.tuxfamily.org
>
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>

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


Re: [Vala] Starting with Vala

2017-04-03 Thread Dmitry Golovin
03.04.2017, 18:01, "Sascha Manns" :
> Hello list,
>
> i would like to learn Vala and plan to port a Mono-GNOME-App to Vala. I
> already seen the documentation.
>
> Maybe you know some small Vala apps where i can see the code in action?
>
> Greetings
>
> Sascha
>
> --
> Sascha Manns
> Maifeldstraße 10
> 56727 Mayen
>
> P: +49-2651-4014045
> W: http://saigkill.tuxfamily.org
>
> ,
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list

Hi Sascha,
 
Check out the official Vala Documentation: 
https://wiki.gnome.org/Projects/Vala/Documentation
 
Probably, you will be interested in Sample Code section: 
https://wiki.gnome.org/Projects/Vala/Documentation#Sample_Code
 
Regards,
Dmitry
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Starting with Vala

2017-04-03 Thread Sascha Manns
Hello list,

i would like to learn Vala and plan to port a Mono-GNOME-App to Vala. I
already seen the documentation.

Maybe you know some small Vala apps where i can see the code in action?

Greetings

Sascha

-- 
Sascha Manns
Maifeldstraße 10
56727 Mayen

P: +49-2651-4014045
W: http://saigkill.tuxfamily.org




signature.asc
Description: OpenPGP digital signature
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Starting with Vala, problems with strings

2009-04-20 Thread Diego Jacobi
Hi again.
I am still having troubles with things that i should easily do in C.
Maybe because i have never programmed in C#, or mono or anything like
it.

In my test code i want to split a math sentence in terms, like the
next string example:
(2+a)*d+(a*b-3)-4-q/2

My function split_in_terms, is a very bad implementation (i know) that
should split the string into 4 terms, and if not possible, return
NULL.
For that i have tryed with a List, but when using nth_data it prints
this string: g_list_nth_data, only once. So i think that Lists are
not yet fully implemented so i switched to Array.
Where now i cant compile it.
ERROR:arraylist.c:322:gee_array_list_real_get: assertion failed: (_tmp0)

And i dont have any clue where the problem is.

Also i dont know when should i use pointers in Vala.
I know from C that every object must be defined as a pointer, but the
Vala bindings, doesnt defines them as pointer, so, why should i add an
*
If i dont add it, i cant change the value of the parameter.
supouse a function like next:
private static void split_in_terms(string strmath, string* term_left,
string* term_right)
This also gives a lot of warnings  for term_left and right.

Please note too the casting in:  new Arraystring(false, true,
(uint)sizeof(string));
Seems like the new array requires an ulong instead of uint which is
returned by sizeof. I dont know if this is the correct behavior or
not, but it seems strange.



private static Arraystring* split_in_terms(string strmath)
{
int x = 0;
int parentesis=0;
Arraystring list = new Arraystring(false, true, (uint)sizeof(string));
string str = strmath;
StringBuilder term = new StringBuilder();
int p = 0;

stdout.printf(str = %s\n, str);

for(weak string s = str; s.get_char()!=0 ; s = s.next_char())
{
unichar c = s.get_char();
if ( c == '(')
{
parentesis++;
term.append_unichar(c);
}
else if ( c == ')')
{
parentesis--;
term.append_unichar(c);
}
else if ( c == '+')
{
if ( parentesis == 0)
{
list.append_val( term.str );

print(%s\n,term.str);
term = new StringBuilder();
p = x+1;
if ( str.len() = p )
list.append_val( + );
}
}
else
{
term.append_unichar(c);
}
x++;
}
list.append_val( term.str );

if (parentesis != 0)
{
stdout.printf(SintaxERROR: Los parentesis no cierran
adecuadamente: %s\n, str);
return null;
}
return list;
}

public void calculate ()
{
double mean, max, min;
string str = holaaa+world;

print (1);
Arraystring* list = split_in_terms( str );

print (2);
for (int i = 0; i  list-length; i++)
stdout.printf (term%d = %s\n, i, list-index(i));
/*for (int i = 0; i  list-length(); i++)
stdout.printf (term%d = %s\n, i, list-nth_data 
(i)*/);*/
print (3);
.




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


[Vala] Starting with Vala, problems with strings

2009-04-19 Thread Diego Jacobi
Hi.
This may be a too much newbie question, but:
How do you access a character in a string?

private static int my_string_handler(string *str)
{
string s;
for (x = 0 ; x  str-len() ; x++)
{
if (str[x]=='+')
 {
 s = str-substring(0,x);
 stdout.printf(plus finded at = %d,   left string ist %s\n, x, s);
 return 0;
  }
}
return -1;
}

This prints an error saying that str is not an array.
I cant find anything on the docs an example on how to manipulate
strings char by char.

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


Re: [Vala] Starting with Vala, problems with strings

2009-04-19 Thread Yu Feng
Hi Diego,

private static int my_string_handler(string str)/*no '*'*/ {


}

If possible use unichar, string.next_char, string.get_char, to
manipulate string is better than directly access the char by its
location because all strings are utf8 encoded.

StringBuilder sb = new StringBuilder();
for(weak string s = str; s.get_char()!=0; s = s.next_char()) {
 unichar c = s.get_char();
 if(c != '+') sb.append_unichar(c);
 else {
   
   
   break;
 }
}

Yu
On Sun, 2009-04-19 at 20:39 +0200, Diego Jacobi wrote:
 Hi.
 This may be a too much newbie question, but:
 How do you access a character in a string?
 
 private static int my_string_handler(string *str)
 {
 string s;
 for (x = 0 ; x  str-len() ; x++)
 {
 if (str[x]=='+')
  {
  s = str-substring(0,x);
  stdout.printf(plus finded at = %d,   left string ist %s\n, x, 
 s);
  return 0;
   }
 }
 return -1;
 }
 
 This prints an error saying that str is not an array.
 I cant find anything on the docs an example on how to manipulate
 strings char by char.
 
 Cheers.
 Diego
 ___
 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


Re: [Vala] Starting with Vala, problems with strings

2009-04-19 Thread Bart Goossens




Hi Diego,
Also have a look at:
http://live.gnome.org/Vala/FAQ#head-66eaa46cac67dfc44f5bc00929c746124e5f311d

and 
http://mail.gnome.org/archives/vala-list/2008-April/msg00058.html

Best regards,
Bart

  Hi Diego,

private static int my_string_handler(string str)/*no '*'*/ {


}

If possible use unichar, string.next_char, string.get_char, to
manipulate string is better than directly access the char by its
location because all strings are utf8 encoded.

StringBuilder sb = new StringBuilder("");
for(weak string s = str; s.get_char()!=0; s = s.next_char()) {
 unichar c = s.get_char();
 if(c != '+') sb.append_unichar(c);
 else {
   
   
   break;
 }
}

Yu
On Sun, 2009-04-19 at 20:39 +0200, Diego Jacobi wrote:
  
  
Hi.
This may be a too much newbie question, but:
How do you access a character in a string?

private static int my_string_handler(string *str)
{
string s;
for (x = 0 ; x  str-len() ; x++)
{
if (str[x]=='+')
 {
 s = str-substring(0,x);
 stdout.printf("plus finded at = %d,   left string ist %s\n", x, s);
 return 0;
  }
}
return -1;
}

This prints an error saying that str is not an array.
I cant find anything on the docs an example on how to manipulate
strings char by char.

Cheers.
Diego
___
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-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list