[Gambas-devel] A few comment about Tommy's changes

Benoît Minisini gambas at ...1...
Mon Aug 1 18:52:24 CEST 2011


Tommy: I looked at your commits, and I have the following comments:

1) The name of function arguments must start with an uppercase. Instead of 
writing that:

	GB_STATIC_METHOD("BeginCurve", NULL, GLUBEGINCURVE, "(nurb)p"),

You must write:

	GB_STATIC_METHOD("BeginCurve", NULL, GLUBEGINCURVE, "(Nurb)p"),

2) You cannot use the "Pointer" datatype for that. It makes using an 
interpreter useless.

As soon as you have a C datatype that you can create, delete, copy... you must 
implement a Gambas class to manage it. I saw 'GluQuadric *', but maybe you 
used some other datatypes, did you?

3) You used GB_OBJECT to receive a GB_POINTER. If it works, it's just because 
you had luck.

4) If you receive a Gambas array as an argument (or any other Gambas object), 
you must check that you didn't receive a NULL reference.

There is an interpreter API for that, 'GB.CheckObject'. Instead of doing 
something like that:

	BEGIN_METHOD(GLVERTEXATTRIB4FV, GB_INTEGER index; GB_OBJECT v)

	  GB_ARRAY fArray = VARG(v);
	  int count = GB.Array.Count(fArray);
	  int fill = count%4 ? (4-(count%4)) : 0;
	  
	  if (!count)
	    return;

You must do that:

	BEGIN_METHOD(GLVERTEXATTRIB4FV, GB_INTEGER index; GB_OBJECT v)

	  GB_ARRAY fArray = VARG(v);
	  int count, fill;

	  if (GB.CheckObject(fArray))
	    return;

	  count = GB.Array.Count(fArray);
	  if (!count)
	    return;

	  fill = count%4 ? (4-(count%4)) : 0;

The biggest change you must do is the implementation of a Gambas class to 
manage 'GluQuadric *'.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list