Re: Problems with C floats

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
irv said...

void 
gtk_misc_get_alignment (GtkMisc *misc, 
		        gfloat  *xalign, 
			gfloat  *yalign) 
{ 
  g_return_if_fail (GTK_IS_MISC (misc)); 
 
  if (xalign) 
    *xalign = misc->xalign; 
  if (yalign) 
    *yalign = misc->yalign; 
} 

OK, I think the GtkMisc can be assumed to be an opaque handle for our purposes, and that you only ever store the pointer, since it's a pointer to some widget. And I gfloat is just a typedef for a float, so I'd probably wrap it like something like this:

constant 
    gtk_misc_get_alignment = define_c_proc( gtk, "GtkMisc", { C_POINTER, C_POINTER, C_POINTER } ) 
    gtk_misc_buffer = allocate( 8 ), 
    xalign = gtk_misc_buffer, 
    yalign = xalign + 4 
 
function get_alignment( atom misc ) 
    c_proc( gtk_misc_get_alignment, { xalign, yalign } ) 
    return {  
        float32_to_atom( peek( xalign & 4 ), 
        float32_to_atom( peek( yalign & 4 ) 
        } 
end function 

Matt

Matt, you forgot the first argument, the pointer to GtkObject

Jacques

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu