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

tommyline at ...674... tommyline at ...674...
Tue Aug 2 10:21:32 CEST 2011


Hi Benoit,

I tried to implement gluQuadratic object, but compiler complains with:

"In file included from GLUquadratic.c:26:
cgluquadric.h:42: error: expected specifier-qualifier-list before ‘GluQuadric’ "


cgluquadric.h file contains:


#ifndef __CGLUQUADRIC_H
#define __CGLUQUADRIC_H

#include "gambas.h"
#include "main.h"
#include "GLU.h"   // <==== I thought I should include path for Glu function?

#ifndef __CGLUQUADRIC_C
extern GB_DESC GluQuadricDesc[];
#else

#define THIS OBJECT(CGLUQUADRIC)

#endif

typedef
	struct {
		GB_BASE ob;
		GluQuadric *quadric;   //  <==== this is line No 42.
		}
	CGLUQUADRIC;

#endif


cquadric.c contains:


#define __CGLUQUADRATIC_C

#include "gb_common.h"
#include "cgluquadric.h"

CGLUQUADRIC *CGLUQUADRIC_create(GluQuadric *quadric)
{
	CGLUQUADRIC *ob = GB.New(GB.FindClass("GluQuadric"), NULL, NULL);
	ob->quadric = quadric;
	return ob;
}


GB_DESC GluQuadricDesc[] =
{
	GB_DECLARE("GluQuadric", sizeof(CGLUQUADRIC)),
	GB_NOT_CREATABLE(),
	GB_END_DECLARE
};



As I told you, I think much better in the morning, and just after I woke up I realised why the pointer is not good. It's the difference between user thinking and developer thinking - You just don't have control at what people put in the code :). If I know what to do, it doesn't mean everybody does. Learning all the time. 

So if you could help me with the code...




----- Original Message -----
From: "Benoît Minisini" <gambas at ...1...>
To: "mailing list for gambas developers" <gambas-devel at ...494...t>
Sent: Monday, 1 August, 2011 9:16:56 PM
Subject: Re: [Gambas-devel] A few comment about Tommy's changes

> Benoit, I will try to implement your way, but I think much better in the
> morning, so I'll let you know tomorrow how it's going.
> 
> Tomek.

No problem. Here is some other comments:

1) I found another Gambas class to implement: one for 'GLUnurbsObj *' returned 
by gluNewNurbsRenderer().

2) As for gluDeleteNurbsRenderer() and gluDeleteQuadric(), you don't have to 
implement them explicitely, as Gambas objects are not freed explicitely by the 
user, but only there is no reference pointing at it anymore.

Concretely, you have to remove the GLUDELETENURBSRENDERER and GLUDELETEQUADRIC 
methods.

Instead, you will have to implement the "_free" special method in both 
classes. That method is called when a Gambas object is being freed. In that 
method, you will be able to call gluDeleteNurbsRenderer() or 
gluDeleteQuadric() to release the pointer stored in the Gambas object just 
before it dies and returns to the unmanifested world.

-- 
Benoît Minisini

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
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