Do you know what the following C declarations mean ?

`Do you know what the following C declarations mean ?

`

Today’s good news is that you no longer need to understand them to be able to write JNA wrappers.

(however, if you do want to understand, you should read this page).

Indeed, I’ve just completed a major refactoring of JNAerator‘s parser which now recognizes many more valid C constructs.

If you want to see examples of generated code, you can have a look at JNAerator’s wiki or launch JNAeratorStudio from Java Web Start and see it in action for yourself (version 0.2 build 144).

Other changes include :

  • support for inner anonymous enums
  • support for arrays of arbitrary types (not just primitives, as previously)
  • better recognition of enum items comments (importing both the comments found on preceding line and those at the end of the line)
  • slightly improved expression support for enum items :

    enum TestEnum { First, Second = First + 10 };

  • support for int x, y(int, float) syntax
  • Fixed usage of struct keyword with no inline declaration :

    struct s {}; void f(struct s i);

  • Fixed input of {}[] characters in JNAeratorStudio
  • Added constructors with Pointer+offset to all structs, to serve as cast from pointer to struct :

    public static class S extends com.sun.jna.Structure {
    	public static class ByReference extends S implements com.sun.jna.Structure.ByReference {}
    	public static class ByValue extends S implements com.sun.jna.Structure.ByValue {}
    	/// Allocate a new S struct on the heap
    	S() {}
    	/// Cast data at given memory location (pointer + offset) as an existing S struct
    	S(com.sun.jna.Pointer pointer, int offset) {
    		super();
    		useMemory(pointer, offset);
    		read();
    	}
    }
    

Have fun !