Re: [Vala] C# developer, newbie question

2018-12-19 Thread Andy Lees via vala-list
I believe it's because the string produced in your first assignment to strState is the C transformed enum value which concatenates the type and value with an "_". It does this to map the nested name space of Vala enums into the flat C name space. You would need to remove the type + "_" from the

Re: [Vala] Newbie need help

2018-09-30 Thread Andy Lees via vala-list
I find Anjuta to be usable, good for setting up projects and ok for debugging (you have to have some understanding of the Gobject structure to use it though, and "this." is "self->"). Anjuta ctags understands Vala, so go to declaration works, etc. Symbol completion is pretty good, and generally

[Vala] Catch divide by zero

2016-12-03 Thread Andy Lees
Is there a simple way to catch and propagate a divide by zero error in Vala? In C I can use a setjmp to define a catch point, and then do a suitable jongjmp from a signal handler. However this mechanism doesn't appear to be available to the Vala programmer, so what can be done? Regards, Andrew

[Vala] Socket source

2016-09-29 Thread Andy Lees
Hi, After 0.30, the socket create source function changed from returning a SocketSource to returning a GLib.Source. Now, for the correct operation of the socket callback, the returned object must be a SocketSource, so: - Is the implementation still the same, and presumably if so it is safe

Re: [Vala] Array as big as an enum

2016-08-31 Thread Andy Lees
You can access them as strings: Foo.ELEMENT.to_string() (or any Foo-typed expression). The default result may be a bit clunky, but very useful nevertheless. Add you own to_string if you want to get fancy. On Thu, Sep 1, 2016 at 3:51 AM, rastersoft wrote: > El 31/08/16 a

Re: [Vala] Trap for the unwary or incorrect code?

2016-05-21 Thread Andy Lees
22, 2016 at 12:56 AM, Al Thomas <astav...@yahoo.co.uk> wrote: > > > > > - Original Message - > > From: Andy Lees <andrewl...@gmail.com> > > Sent: Saturday, 21 May 2016, 14:56 > > Subject: [Vala] Trap for the unwary or incorrect code? > > >

[Vala] Trap for the unwary or incorrect code?

2016-05-21 Thread Andy Lees
Hi gentlemen, If I have the following code, or similar: void main (string[] args) { uint ui = 2; int i = -3; if (i < ui) { stdout.printf("Comparison works\n"); } } No output is produced. Given Vala is generally very good at warning about type mismatches, or correctly doing an

Re: [Vala] Is there any usable editor for Vala?

2016-05-17 Thread Andy Lees
Have you done Find->ctags->rebuild tags? On Wed, May 18, 2016 at 1:19 AM, Ralph Plawetzki <ra...@purejava.org> wrote: > Dear list, > > Am 14.02.2016 um 13:02 schrieb Andy Lees: > > haven't tried it. Make sure you set the ctags executable to use > > anjuta-cta

Re: [Vala] Problem with programmatic generic object instantiation

2016-02-16 Thread Andy Lees
d it appears to work ok at last. On Wed, Feb 17, 2016 at 10:26 AM, Andy Lees <andrewl...@gmail.com> wrote: > Momentarily I thought that might work, but it does match the Json > serialization structure - the context of deserializing an array does not > provide the initialised array, t

Re: [Vala] Problem with programmatic generic object instantiation

2016-02-16 Thread Andy Lees
on it needs like the Generic Type it should work on. > > In my other project, I've just initialize any public property as > > MyProperty prop { get; set; default = new MyProperty(); } > > or inside construct {} > > The point is to call MyProperty.new() not Object.new() on ge

Re: [Vala] Problem with programmatic generic object instantiation

2016-02-16 Thread Andy Lees
cute code on Object creation using Object.new(), you > should use > > construct { > // Your code here > } > > When define code at MyObject.new(), you execute the code in this method > not Object.new(), then use the above should help. > > > 2016-02-16 15:58

Re: [Vala] Problem with programmatic generic object instantiation

2016-02-16 Thread Andy Lees
bleArrayList implementation based on Gee. > El feb. 16, 2016 7:10 AM, "Andy Lees" <andrewl...@gmail.com> escribió: > >> I would have expected the generic type to be obtained from the type id of >> the derived type (generic instantiation), which is obtained fresh eac

Re: [Vala] Problem with programmatic generic object instantiation

2016-02-16 Thread Andy Lees
e an object of > Generic class, because you have set tje object type. Create a generic > instance with Object.new you should provide the object type. > El feb. 16, 2016 5:14 AM, "Andy Lees" <andrewl...@gmail.com> escribió: > >> Hi, >> >> I have a ge

Re: [Vala] Parsing Vala/Genie code for auto-completion propuse: Should it be a `valac' feature or a separate project?

2016-02-15 Thread Andy Lees
Anjuta provides a ctags binary (anjuta-ctags) that will index vala code. On Tue, Feb 16, 2016 at 3:36 AM, Ben Iofel wrote: > This might help > > https://github.com/benwaffle/vala-completion > > On Sun, Feb 14, 2016, 6:34 PM Felipe Lavratti wrote: > > >

Re: [Vala] Is there any usable editor for Vala?

2016-02-14 Thread Andy Lees
Hi, A recent version of Anjuta compiled with Vala support enabled does pretty well on code completion and go to declaration, and has the best debugger for Vala that I've come across, albeit with a need to understand the C structures produced by the Vala compiler. However, for significant coding

[Vala] string.to_long vs long.parse

2016-02-10 Thread Andy Lees
Hello list, I note that string.to_long is deprecated, but that the replacement long.parse has reduced functionality. Using to_long, I can have hexadecimal, octal and binary number strings accepted, whilst long.parse doesn't allow for this. This does seem rather a backward step. Was there some

[Vala] Generic implementation

2015-12-01 Thread Andy Lees
Hi, If I define a generic array implementation for type T that contains an array of type T[], there is a requirement for anything > 4 bytes in size to be boxed. That suggests that some separate storage is created for the boxed types, is that so? And if so is each element of the array as

Re: [Vala] Generic implementation

2015-12-01 Thread Andy Lees
com> wrote: > Not really answering, but you could always run vala with -C to access the > generated C code. There you could get tge result of the conversion. > > > — > Sent from Mailbox <https://www.dropbox.com/mailbox> > > > On Wed, Dec 2, 2015 at 1:13 AM,

Re: [Vala] Fwd: Re: GenericArray problem

2015-10-17 Thread Andy Lees
. On Sat, Oct 17, 2015 at 11:58 PM, Daniel Espinosa <eso...@gmail.com> wrote: > -- Mensaje reenviado -- > De: "Daniel Espinosa" <eso...@gmail.com> > Fecha: oct. 17, 2015 7:58 AM > Asunto: Re: [Vala] GenericArray problem > Para: "Andy Lees&quo

Re: [Vala] Fwd: Re: GenericArray problem

2015-10-17 Thread Andy Lees
not a stopper issue for me, and the derivation works fine in that case. On Sun, Oct 18, 2015 at 5:25 AM, Evan Nemerson <e...@coeus-group.com> wrote: > On Sun, 2015-10-18 at 00:13 +1100, Andy Lees wrote: > > I wonder if anyone has suggestions as to why GenericArray should

[Vala] GenericArray problem

2015-10-16 Thread Andy Lees
Hi, If I declare a derived class of GenericArray, like so: public class IntArray : GenericArray { public IntArray() { } } I get a gcc error, like so: /tmp/a.vala.AH856X.c: In function ‘int_array_new’: /tmp/a.vala.AH856X.c:66:2: error: too few arguments to function

[Vala] Another question about enums and arrays

2015-04-30 Thread Andy Lees
Hi, What is the reason for enumeration values (which can be treated as ints without a cast) not being allowed where a const int is required? Surely enum values are the epitome of const values? To whit: int64 arr[AnEnum.SIZE]; results in: arr2.vala:18.20-18.30: error: Expression of constant

[Vala] Const declaration after use

2015-04-29 Thread Andy Lees
Hi, I had thought that the following issue with declaration order (variables vs #defines) in the generated C code had been fixed a while ago, but I seem to be having the old problem: Code: public enum AnEnum { LEVEL_UP, // SIZE // for array sizing } const int AnEnumSize =

[Vala] Export vapi from libray

2014-11-21 Thread Andy Lees
Hi, I would like to export an interface to some C structures from a vala library that provides a number of other classes, etc. If I include the vapi and associated .h file in the library, it compiles fine, but does not export the contents of the referenced vapi in the library vapi. How would

[Vala] Testing out parameters

2014-11-21 Thread Andy Lees
Is there a way to test if an out parameter has been provided, assuming I default it to null? In the case I want to avoid an expensive calculation if it's not required? Thanks for your attention. ___ vala-list mailing list vala-list@gnome.org

Re: [Vala] Tokenize_and_fold bug?

2014-11-17 Thread Andy Lees
Same result. Submitted bug. On Mon, Nov 17, 2014 at 7:31 PM, Michele Dionisio michele.dioni...@gmail.com wrote: try to define your variable x with [CCode (array_length = false, array_null_terminated = true)] 2014-11-17 5:15 GMT+01:00 Andy Lees andrewl...@gmail.com: Hi, Not sure

[Vala] Tokenize_and_fold bug?

2014-11-16 Thread Andy Lees
Hi, Not sure if I'm doing this wrong, but if I do something like: public static int main(string [] argv) { string[] x; var a = 1,2, 345.tokenize_and_fold (en_GB, out x); stdout.printf(Len: %d\n, a.length); foreach (var s in a) { stdout.printf(tok: %s, s); } return 0; } I get a C

Re: [Vala] Const #defs after use: is this a known problem?

2014-10-21 Thread Andy Lees
Thanks for that. I did search, but not with the right term it seems! On Tue, Oct 21, 2014 at 6:32 PM, Luca Bruno lethalma...@gmail.com wrote: On 21/10/2014 02:14, Andy Lees wrote: If I have the following structure: public class Main : Object { static const int max_chans = 64

[Vala] Const #defs after use: is this a known problem?

2014-10-20 Thread Andy Lees
If I have the following structure: public class Main : Object { static const int max_chans = 64; static int out_chans[max_chans]; The compilation fails because the #defines for the const declarations are made after the declarations of the non-const arrays. Is there a reason for

Re: [Vala] open and read a csv file

2014-10-16 Thread Andy Lees
Have a look at https://github.com/ktt-ol/serial-barcode-scanner/blob/master/src/web/csv.vala for a split regexp and how to deal with quotes. Should be fairly straightforward to use an existing io class (FileStream if reading from a file) as the basis for your data source. Regards, Andy On Fri,

[Vala] converting void** to int[]*, or other ways to generically assign arrays

2014-10-15 Thread Andy Lees
Hi, In providing a general purpose configuration facility, I register the address of configured variables in a void*. The description of a configured item is: string key; Type type; void *loc; string? deflt; int size; ConfigFlags flags; and an example configuration

Re: [Vala] Type parameter not stored as expected

2014-09-15 Thread Andy Lees
**: vala_ccode_assignment_module_real_store_parameter: assertion '_value != NULL' failed Compilation failed: 2 error(s), 0 warning(s) So perhaps that resolves the problem. Regards, Andrew Lees. On Fri, Sep 12, 2014 at 5:41 PM, Luca Bruno lethalma...@gmail.com wrote: On 12/09/2014 02:31, Andy Lees wrote

[Vala] Type parameter not stored as expected

2014-09-11 Thread Andy Lees
Greetings, I have a data type used to store parser state declared as: class ReaderState { public Object obj; public bool in_array; public Type type; public TypeClass kl; public ReaderState (Object o, bool a, Type t, TypeClass k) { this.obj = o; this.in_array =

[Vala] GLib-GObject-WARNING but code appears to work

2014-09-11 Thread Andy Lees
Greetings, I am building a simple structure driven json reader, and in the process construct objects from Type values. The construction appears to work correctly, in that the instances are created, have the expected fields that can be found by find_property, and end up with values from the json