Re: [Vala] GLX (OpenGL Extension to the X Window System) binding!!



On Fri, 2008-08-15 at 15:17 +0100, Sam Liddicott wrote:
* Matías De la Puente wrote, On 15/08/08 14:12:
Hi Xavier

I have two ways to put the constants and the functions in the binding:

The first one is put the constants and the functions as they appear in
the header file, GLX_SOMETHING for constants and glXSomenthing for
functions. This can be done if I put this attibute in the namespace:

[CCode (lower_case_cprefix ="", cheader_filename="GL/glx.h")]   // No
prefix

The second one is the way you say, but for doing that i have to group
the constants because I can't put in the namespace attribute
lower_case_cprefix="GLX_" because the functions will appear like this:
GLX_glXSomething or GLX_Somenthing and if I put
lower_case_cprefix="glX" the constants will appear like this:
glXSOMETHING or glXGLX_SOMETHING.
The solution for this is to group de constants, but there's a lot of
constants and the documentation that I found don't tell me how can I
groups this contants (including the constants in GL and GLU).
I have the same problem:

[CCode (cheader_file = "ntstatus.h", cprefix="NT_STATUS_")]
namespace NT_STATUS {
  [CCode (cname="NT_STATUS_OK")]
    public static NTSTATUS OK;
  [CCode (cname="NT_STATUS_NO_MEMORY")]
    public static NTSTATUS NO_MEMORY;
  [CCode (cname="NT_STATUS_INVALID_PARAMETER")]
    public static NTSTATUS INVALID_PARAMETER;
  [CCode (cname="NT_STATUS_UNSUCCESSFUL")]
    public static NTSTATUS UNSUCCESSFUL;

    [SimpleType][Compact]
    [CCode (cname="NTSTATUS", cprefix="NTSTATUS_",
default_value="NT_STATUS_OK")]
    public struct NTSTATUS {
        [CCode (cname="NT_STATUS_IS_OK")]
        protected bool IS_OK();
    }
}


I have to specify a cname for each NTSTATUS value, or it gets a dumb
prefix and comes out as:
  nt__status_INVALID_PARAMETER
instead of
  NT_STATUS_INVALID_PARAMETER

These values should be bound as constants, not as static variables,
e.g., public const NTSTATUS OK; Vala should use upper case letters by
default, then.

Juerg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]