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

tommyline at ...674... tommyline at ...674...
Mon Aug 1 20:21:29 CEST 2011


Benoit,
Thanks for correcting my errors. 
I'm working on point 1 and 4, it's not so difficult, but if you could explain me why shouldn't I use pointer (point 2) if it works, and what to use instead?
The same with point 3, as I wrote some time ago, I'm not a good C programmer, I'm still learning.
And after I clean up my code, I promise not to mess anymore ;)

Tomek.

----- Original Message -----
From: "Benoît Minisini" <gambas at ...1...>
To: gambas-devel at lists.sourceforge.net
Sent: Monday, 1 August, 2011 5:52:24 PM
Subject: [Gambas-devel] A few comment about Tommy's changes

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

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel




More information about the Devel mailing list