From rmorgan62 at ...176... Wed Feb 1 14:59:47 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Wed, 1 Feb 2012 05:59:47 -0800 Subject: [Gambas-devel] Adding files to component projects Message-ID: Hi Benoit, What do I need to do to include new source files in my component project. I have created a set of new files for complex number and will be adding several more files over the course of the project. I tried rebuilding Gambas with ./reconf-all etc... but that didn't work. So do I need to manually add my files to one of the autotools files? Thanks again for your help. Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Thu Feb 2 01:34:38 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Wed, 1 Feb 2012 16:34:38 -0800 Subject: [Gambas-devel] Class Properties Message-ID: Hi Benoit, I have created a minimalist class with two properties. I expected that the properties would be created on a per-instance bases. However, what i got was something similar to static properties. When I create two instances of the class setting a property in one instance, sets it in the other. So I know I missed something here... I have sample code and output below. P.S. Currently I am including the c source file in my main file to force compiling the code. So I still need to figure out how to add a source file to the make process. Thanks again! Randy ' In Gambas Dim q As Complex Dim v As Complex = New Complex q = New Complex q.Real = 10 q.Imag = 5 v.Real = 12 v.Imag = 6 Print q.Real Print q.Imag Print v.Real Print v.Imag Print q Print v ----------------------------------------------------- Output ----------------------------------------------------- 12 6 12 6 (Complex 0x8b5865c) (Complex 0x8bad4fc) ' In Class file #ifndef __C_GSL_COMPLEX_C #define __C_GSL_COMPLEX_C #include "c_complex.h" #include "gambas.h" #include "gb_common.h" #include "c_gsl.h" #include #include #include #endif // Class Properties double real; double imagined; BEGIN_PROPERTY(GSLCOMPLEX_REAL) if (READ_PROPERTY) GB.ReturnFloat(real); else real = (VPROP(GB_FLOAT)); END_PROPERTY BEGIN_PROPERTY(GSLCOMPLEX_IMAGINED) if (READ_PROPERTY) GB.ReturnFloat(imagined); else imagined = (VPROP(GB_FLOAT)); END_PROPERTY /************************************************** Describe Class properties and methods to Gambas **************************************************/ GB_DESC CGslComplexDesc[] = { GB_DECLARE("Complex", sizeof(CCOMPLEX)), GB_PROPERTY("Real", "f", GSLCOMPLEX_REAL), GB_PROPERTY("Imag", "f", GSLCOMPLEX_IMAGINED), GB_END_DECLARE }; -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Thu Feb 2 09:33:13 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 02 Feb 2012 09:33:13 +0100 Subject: [Gambas-devel] Adding files to component projects In-Reply-To: References: Message-ID: <4F2A4A49.5020500@...1...> Le 01/02/2012 14:59, Randall Morgan a ?crit : > Hi Benoit, > > What do I need to do to include new source files in my component project. I > have created a set of new files for complex number and will be adding > several more files over the course of the project. > I tried rebuilding Gambas with ./reconf-all etc... but that didn't work. So > do I need to manually add my files to one of the autotools files? > > Thanks again for your help. > > Randall > Do you know how autoconf and automake work? -- Beno?t Minisini From rmorgan62 at ...176... Thu Feb 2 11:39:17 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Thu, 2 Feb 2012 02:39:17 -0800 Subject: [Gambas-devel] Adding files to component projects In-Reply-To: <4F2A4A49.5020500@...1...> References: <4F2A4A49.5020500@...1...> Message-ID: Good morning Benoit, I do have an understanding of autotools at a very high level. I understand that the Makefile contains rules for the files to be compiled. But I have worked with only the simplest of makefiles, all written by hand . I did do a little research before asking this question. I always try to locate the answers myself first. However, I do not have a good grasp of the m4 scripting language or it's use in these makefiles. I am also a bit paranoid of screwing something else up.... In my mind a simple ./reconf should have done it as it looks to me like the m4 scripts try to locate all the .c and .h files, and reconf runs autoconf. But I did not get an object file, c_complex.o file, when I did this. The only dependency on c_complex.c is in the main file's CLASSES array. So what have I missed? Thanks, Randall 2012/2/2 Beno?t Minisini > Le 01/02/2012 14:59, Randall Morgan a ?crit : > > Hi Benoit, > > > > What do I need to do to include new source files in my component > project. I > > have created a set of new files for complex number and will be adding > > several more files over the course of the project. > > I tried rebuilding Gambas with ./reconf-all etc... but that didn't work. > So > > do I need to manually add my files to one of the autotools files? > > > > Thanks again for your help. > > > > Randall > > > > Do you know how autoconf and automake work? > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Thu Feb 2 11:55:22 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 02 Feb 2012 11:55:22 +0100 Subject: [Gambas-devel] Adding files to component projects In-Reply-To: References: <4F2A4A49.5020500@...1...> Message-ID: <4F2A6B9A.5020403@...1...> Le 02/02/2012 11:39, Randall Morgan a ?crit : > Good morning Benoit, > > I do have an understanding of autotools at a very high level. > > I understand that the Makefile contains rules for the files to be > compiled. But I have worked with only the simplest of makefiles, all > written by hand . I did do a little research before asking this > question. I always try to locate the answers myself first. However, I do > not have a good grasp of the m4 scripting language or it's use in these > makefiles. I am also a bit paranoid of screwing something else up.... In > my mind a simple ./reconf should have done it as it looks to me like the > m4 scripts try to locate all the .c and .h files, and reconf runs > autoconf. But I did not get an object file, c_complex.o file, when I did > this. The only dependency on c_complex.c is in the main file's CLASSES > array. So what have I missed? > > Thanks, > > Randall > You never modify Makefiles or any generated file. This is the job of autoconf and automake. What you must modify is the Makefile.am file. Each time you add a source file (*.c, *.cpp or *.h) you must add it to the list of sources files in the Makefile.am file, at the line beginning with "gb_gsl_la_SOURCES =" Then you must regenerate the files, either by running automake or doing a './reconf' in the 'gb.gsl' directory. The './reconf' is heavier, as it does everything from scratch, but you are sure that everything is correctly regenerated. Regards, -- Beno?t Minisini From rmorgan62 at ...176... Thu Feb 2 12:00:38 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Thu, 2 Feb 2012 03:00:38 -0800 Subject: [Gambas-devel] Adding files to component projects In-Reply-To: <4F2A6B9A.5020403@...1...> References: <4F2A4A49.5020500@...1...> <4F2A6B9A.5020403@...1...> Message-ID: Thank you for the info. I know I ask a lot of dumb questions but the day will come when I have this all figured out. Then I hope to be an asset rather than a liability to your project. Randall 2012/2/2 Beno?t Minisini > Le 02/02/2012 11:39, Randall Morgan a ?crit : > > Good morning Benoit, > > > > I do have an understanding of autotools at a very high level. > > > > I understand that the Makefile contains rules for the files to be > > compiled. But I have worked with only the simplest of makefiles, all > > written by hand . I did do a little research before asking this > > question. I always try to locate the answers myself first. However, I do > > not have a good grasp of the m4 scripting language or it's use in these > > makefiles. I am also a bit paranoid of screwing something else up.... In > > my mind a simple ./reconf should have done it as it looks to me like the > > m4 scripts try to locate all the .c and .h files, and reconf runs > > autoconf. But I did not get an object file, c_complex.o file, when I did > > this. The only dependency on c_complex.c is in the main file's CLASSES > > array. So what have I missed? > > > > Thanks, > > > > Randall > > > > You never modify Makefiles or any generated file. This is the job of > autoconf and automake. > > What you must modify is the Makefile.am file. Each time you add a source > file (*.c, *.cpp or *.h) you must add it to the list of sources files in > the Makefile.am file, at the line beginning with "gb_gsl_la_SOURCES =" > > Then you must regenerate the files, either by running automake or doing > a './reconf' in the 'gb.gsl' directory. The './reconf' is heavier, as it > does everything from scratch, but you are sure that everything is > correctly regenerated. > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Thu Feb 2 22:48:08 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Thu, 2 Feb 2012 13:48:08 -0800 Subject: [Gambas-devel] How to pass objects and access their properties Message-ID: Hi Benoit, I have a skeleton Complex class now but I am having difficulty locating any sample code that shows how to pass an object in to a method and access it's properties. The reason I want to do this is that complex numbers have a real and imaginary component. libgsl defines these as a structure containing two doubles. So my class contains two properties real, and imag. Rather than having the user write something like: Q.Add(V.real, V.imag) I would prefer the user be able to simply pass in the complex object and let the underlying code access the properties of the object. So can you point me to some sample code where I can see how this might be done? Thanks, Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Fri Feb 3 20:17:10 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 03 Feb 2012 20:17:10 +0100 Subject: [Gambas-devel] How to pass objects and access their properties In-Reply-To: References: Message-ID: <4F2C32B6.9010905@...1...> Le 02/02/2012 22:48, Randall Morgan a ?crit : > Hi Benoit, > > I have a skeleton Complex class now but I am having difficulty locating > any sample code that shows how to pass an object in to a method and > access it's properties. > > The reason I want to do this is that complex numbers have a real and > imaginary component. libgsl defines these as a structure containing two > doubles. So my class > contains two properties real, and imag. Rather than having the user > write something like: > > Q.Add(V.real, V.imag) > > I would prefer the user be able to simply pass in the complex object and > let the underlying code access the properties of the object. > > So can you point me to some sample code where I can see how this might > be done? > > Thanks, > > Randall > > If you want some answers, I need that you commit your new source files! (svn add + svn commit) Regards, -- Beno?t Minisini From rmorgan62 at ...176... Sat Feb 4 16:03:00 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Sat, 4 Feb 2012 07:03:00 -0800 Subject: [Gambas-devel] How to pass objects and access their properties In-Reply-To: <4F2C32B6.9010905@...1...> References: <4F2C32B6.9010905@...1...> Message-ID: Hi Benoit, I didn't want to commit code that I was using to experiment and learn the inner workings of Gambas. Anyhow, I figured out that a pointer to the GB_OBJECT structure is what is being passed to my class method. >From there it had to learn that the value held a pointer to my GSLCOMPLEX structure and using the value stored in gb_object:value cast to a GSLCOMPLEX pointer I could access my object members. So I've ended up with code that looks like this: // In gsl_complex.h extern GB_DESC CGslComplexDesc[]; typedef struct __GSLCOMPLEX { GB_OBJECT ob; double real; double imagined; } GSLCOMPLEX; // In gsl_complex.c BEGIN_METHOD(GSLCOMPLEX_X, GB_OBJECT x;) GSLCOMPLEX *p; p = ARG(x)->value; // Get GSLCOMPLEX pointer from GB_OBJECT:value member // Now using our GSLCOMPLEX pointer we can access the GSLCOMPLEX structure members GB.ReturnFloat(p->real); END_METHOD /************************************************** Describe Class properties and methods to Gambas **************************************************/ GB_DESC CGslComplexDesc[] = { GB_DECLARE("Complex", sizeof(GSLCOMPLEX)), GB_PROPERTY("real", "f", GSLCOMPLEX_REAL), GB_PROPERTY("imag", "f", GSLCOMPLEX_IMAGINED), GB_STATIC_METHOD("X", "f", GSLCOMPLEX_X, "(x)o"), GB_END_DECLARE }; As I said, I always try to figure things out myself. I ask when I get stuck. But even then I do not give up trying! Even us old dogs can learn tricks :-) Randall 2012/2/3 Beno?t Minisini > Le 02/02/2012 22:48, Randall Morgan a ?crit : > > Hi Benoit, > > > > I have a skeleton Complex class now but I am having difficulty locating > > any sample code that shows how to pass an object in to a method and > > access it's properties. > > > > The reason I want to do this is that complex numbers have a real and > > imaginary component. libgsl defines these as a structure containing two > > doubles. So my class > > contains two properties real, and imag. Rather than having the user > > write something like: > > > > Q.Add(V.real, V.imag) > > > > I would prefer the user be able to simply pass in the complex object and > > let the underlying code access the properties of the object. > > > > So can you point me to some sample code where I can see how this might > > be done? > > > > Thanks, > > > > Randall > > > > > > If you want some answers, I need that you commit your new source files! > (svn add + svn commit) > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Sun Feb 5 09:14:07 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 05 Feb 2012 09:14:07 +0100 Subject: [Gambas-devel] How to pass objects and access their properties In-Reply-To: References: <4F2C32B6.9010905@...1...> Message-ID: <4F2E3A4F.2000800@...1...> Le 04/02/2012 16:03, Randall Morgan a ?crit : > Hi Benoit, > > I didn't want to commit code that I was using to experiment and learn > the inner workings of Gambas. > > Anyhow, I figured out that a pointer to the GB_OBJECT structure is what > is being passed to my class method. > From there it had to learn that the value held a pointer to my > GSLCOMPLEX structure and using the value > stored in gb_object:value cast to a GSLCOMPLEX pointer I could access my > object members. > > So I've ended up with code that looks like this: > > // In gsl_complex.h > > extern GB_DESC CGslComplexDesc[]; > > typedef > struct __GSLCOMPLEX > { > GB_OBJECT ob; ---> Nope. GB_OBJECT is a structure that represents a Gambas object reference. You must use GB_BASE there. GB_BASE is the structure that is the "base" of all Gambas objects. > double real; > double imagined; > } > GSLCOMPLEX; > > > > // In gsl_complex.c > > BEGIN_METHOD(GSLCOMPLEX_X, GB_OBJECT x;) > GSLCOMPLEX *p; > p = ARG(x)->value; // Get GSLCOMPLEX pointer from GB_OBJECT:value > member You must use the VARG(x) macro instead of ARG(x)->value. At the moment it is the same thing of course, but if the GB_OBJECT macro changes, VARG(x) will be updated accordingly, not ARG(x)->value. > // Now using our GSLCOMPLEX pointer we can access the GSLCOMPLEX > structure members > GB.ReturnFloat(p->real); > END_METHOD > > > /************************************************** > Describe Class properties and methods to Gambas > **************************************************/ > GB_DESC CGslComplexDesc[] = > { > GB_DECLARE("Complex", sizeof(GSLCOMPLEX)), > > GB_PROPERTY("real", "f", GSLCOMPLEX_REAL), > GB_PROPERTY("imag", "f", GSLCOMPLEX_IMAGINED), > > GB_STATIC_METHOD("X", "f", GSLCOMPLEX_X, "(x)o"), > GB_END_DECLARE > }; > > And I strongly suggest to name implementation functions differently: not "GSLCOMPLEX_REAL", but "GslComplex_Real" (The 'Pascal' way). Regards, -- Beno?t Minisini From gambas at ...1... Sun Feb 5 09:17:15 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 05 Feb 2012 09:17:15 +0100 Subject: [Gambas-devel] How to pass objects and access their properties In-Reply-To: References: <4F2C32B6.9010905@...1...> Message-ID: <4F2E3B0B.8070209@...1...> Le 04/02/2012 16:03, Randall Morgan a ?crit : > Hi Benoit, > > I didn't want to commit code that I was using to experiment and learn > the inner workings of Gambas. > Don't hesitate to commit it as soon as possible. /trunk is a development version, and I am not going to make release now, so mistakes are possible. :-) That way I can see your code faster, and eventually tell you if you follow a bad path. It's not always funny to rewrite code! :-) Regards, -- Beno?t Minisini From rmorgan62 at ...176... Mon Feb 6 12:38:29 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Mon, 6 Feb 2012 03:38:29 -0800 Subject: [Gambas-devel] How to pass objects and access their properties In-Reply-To: <4F2C32B6.9010905@...1...> References: <4F2C32B6.9010905@...1...> Message-ID: Hi Benoit, Thanks for the pointers. I have changed my files to include your suggestions. I changed the naming of my classes after spending a lot of time looking at the PDF component. I guess that's not the best example but does seem to deal with several of the issues I face in the gsl project. I do have another question. It turns out that not all of the gsl library is contained in the libgsl.so. For many functions there are other supporting libraries. I need to link to libgslcblas.so so how do I add this to the project? Is this something that need to be put into the Makefile.am in the source directory? Thanks, Randall 2012/2/3 Beno?t Minisini > Le 02/02/2012 22:48, Randall Morgan a ?crit : > > Hi Benoit, > > > > I have a skeleton Complex class now but I am having difficulty locating > > any sample code that shows how to pass an object in to a method and > > access it's properties. > > > > The reason I want to do this is that complex numbers have a real and > > imaginary component. libgsl defines these as a structure containing two > > doubles. So my class > > contains two properties real, and imag. Rather than having the user > > write something like: > > > > Q.Add(V.real, V.imag) > > > > I would prefer the user be able to simply pass in the complex object and > > let the underlying code access the properties of the object. > > > > So can you point me to some sample code where I can see how this might > > be done? > > > > Thanks, > > > > Randall > > > > > > If you want some answers, I need that you commit your new source files! > (svn add + svn commit) > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Mon Feb 6 13:05:31 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Mon, 6 Feb 2012 04:05:31 -0800 Subject: [Gambas-devel] Error Handling and Type Testing Message-ID: Hi Benoit, I'd like to ask you about how best to handle errors. How to report them to back to Gambas, and how to handle type testing. I will only be implementing the gsl functions that work with Gambas types i.e. integer, singles, and doubles. Is it necessary to test for these types in my code or will gb take care of the testing? If i do need to test for input types how can I tell gb that a type error has occurred? The gsl library allocates memory for structures (gsl_complex, vectors, and matrices) internally. I'm not sure that gb is can manage this memory. Therefore is it best to copy the gsl allocated structures to my own and then free the memory allocated by libgsl? If so should I be using GB.Alloc for this? Thanks for the info. I am keeping notes on all of this so I can write the tutorial once I have a good grasp of this process. Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tommyline at ...674... Mon Feb 6 15:16:26 2012 From: tommyline at ...674... (tommyline at ...674...) Date: Mon, 6 Feb 2012 14:16:26 +0000 (GMT) Subject: [Gambas-devel] Fwd: Declaring static array in library methods. In-Reply-To: <20849404.1590.1328520478482.JavaMail.root@...675...> Message-ID: <21542420.11070.1328537786282.JavaMail.root@...675...> Hi Gambas Genies :) Trying to send it again, as i have problem with getting throught. I'm trying to implement glDrawElements() method to Opengl library, but got few problems. To use arrays I have to use glVertexPointer() method first and there comes truoble. gl.h: glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); <-it sends the pointer to the array to opengl. Initially I've tried the code: EGIN_METHOD(GLVERTEXPOINTER, GB_INTEGER size; GB_INTEGER type; GB_INTEGER stride; GB_OBJECT tab ); int s=VARG(size); if ((s==2) || (s==3) || (s==4)){ GB_ARRAY arr = (GB_ARRAY) VARG(tab); int i; int count = GB.Array.Count(arr); GLfloat param[count]; for (i=0; i requires static array !!! for (i=0; i Hi Benoit, After a little digging I have found that adding the library to the TEMPLATE/conf/gb.gsl.conf file seems to add the external library to the link command. Is this the proper way to add an external library to a component project? Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Wed Feb 8 08:14:27 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Wed, 08 Feb 2012 08:14:27 +0100 Subject: [Gambas-devel] How to pass objects and access their properties In-Reply-To: References: <4F2C32B6.9010905@...1...> Message-ID: <4F3220D3.8090206@...1...> Le 06/02/2012 12:38, Randall Morgan a ?crit : > Hi Benoit, > > Thanks for the pointers. I have changed my files to include your > suggestions. I changed the naming of my classes after spending a lot of > time looking at the PDF component. I guess that's not the best example > but does seem to deal with several of the issues I face in the gsl project. > > I do have another question. It turns out that not all of the gsl library > is contained in the libgsl.so. For many functions there are other > supporting libraries. I need to link to libgslcblas.so so how do I add > this to the project? Is this something that need to be put into the > Makefile.am in the source directory? > > Thanks, > > Randall > > You have to modify 'configure.ac' and 'Makefile.am'. If the libraries have their own pkg-config configuration, then you can process the same way as in the gb.qt4 'configure.ac' file: ##---------------------------------------------------------------------- ## GB_COMPONENT_PKG_CONFIG ## Component detection macro based on pkg-config ## ## $1 = Component key in lower case (ex: pgsql) ## $2 = Component key in upper case (ex: PGSQL) ## $3 = Component name (ex: PostgreSQL) ## $4 = Sub-directory name ## $5 = pkg-config module(s) name(s) with optional required version(s) ## $6 = Warning message (optional) ## ## => defines HAVE_*_COMPONENT (to know if you can compile the ## component) ## *_INC (for the compiler) and *_LIB / *_LDFLAGS (for the linker) ##----------------------------------------------------------------------- GB_COMPONENT_PKG_CONFIG( qt, QT, [QT4 toolkit], [src], QtCore ">= 4.5.0" QtGui Qt3Support QtSvg ) If the libraries do not have pkg-config configuration, then you have to process like gb.sdl: ##----------------------------------------------------------------------- ## GB_COMPONENT_SEARCH ## Component detection macro that uses GB_COMPONENT_PKG_CONFIG first, ## and then GB_COMPONENT. ## ## $1 = Component key in lower case (ex: postgresql) ## $2 = Component key in upper case (ex: POSTGRESQL) ## $3 = Component name (ex: PostgreSQL) ## $4 = Sub-directory name ## $5 = pkg-config module name (optional) ## $6 = How to get include path (must return it in gb_val) ## $7 = How to get library path (must return it in gb_val) ## $8 = Libraries ## $9 = Compiler flags (optional) ## $10 = Warning message (optional) ## ## => defines HAVE_*_COMPONENT (to know if you can compile the ## component) ## *_INC (for the compiler) and *_LIB (for the linker) ##----------------------------------------------------------------------- GB_COMPONENT_SEARCH( sdl, SDL, [SDL], [src], sdl "> 1.2.8" SDL_ttf glew xcursor, [GB_FIND(GL/glew.h SDL_ttf.h X11/Xcursor/Xcursor.h, /usr /usr/local `sdl-config --prefix`, include include/SDL)], [GB_FIND(libSDL_ttf.$SHLIBEXT libGLEW.$SHLIBEXT libXcursor.$SHLIBEXT, /usr /usr/local `sdl-config --prefix`, lib)], [$X_LIBS -lSDL_ttf -lGLEW -lXcursor], [$SDL_CFLAGS] ) As you can see, it is more complex as you have to specify all compilation flags explicitely. Regards, -- Beno?t Minisini From gambas at ...1... Wed Feb 8 08:21:55 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Wed, 08 Feb 2012 08:21:55 +0100 Subject: [Gambas-devel] Error Handling and Type Testing In-Reply-To: References: Message-ID: <4F322293.9090505@...1...> Le 06/02/2012 13:05, Randall Morgan a ?crit : > Hi Benoit, > > I'd like to ask you about how best to handle errors. You must use the GB.Error() function that takes the error string as argument, or one of the GB_ERR_* predefined error constants (look in 'gambas.h'). GB.Error() can takes up to four optional substitution argument, like the Subst$() function. > How to report them > to back to Gambas, Once you have call GB.Error(), you must return from the implementation function explicitely. > and how to handle type testing. > > I will only be implementing the gsl functions that work with Gambas > types i.e. integer, singles, and doubles. Is it necessary to test for > these types in my code or will gb take care of the testing? > If i do need to test for input types how can I tell gb that a type error > has occurred? As soon as you do not deal with Variants, you don't have to check types at all. Gambas does it for you. But if you use object references, you should use the GB.CheckObject() function on them. This function returns TRUE if the object reference is NULL or "invalid". FALSE otherwise. > > The gsl library allocates memory for structures (gsl_complex, vectors, > and matrices) internally. I'm not sure that gb is can manage this > memory. Therefore is it best to copy the gsl allocated structures to my > own and then free the memory allocated by libgsl? If so should I be > using GB.Alloc for this? Oops. No. When you have some kinds of objects in a library (usually something allocated with a dedicated function, and freed or unreferenced with another one), then you have two cases: 1) You have full control of the library object life. You have a pointer to this object in the Gambas object structure. You allocate the library object in the Gambas constructor, and free (or dereference) it in the Gambas destructor. 2) The library object can be destroyed independently of you. For example: a GUI window can be destroyed by the user. Then you must have a mechanism somewhere that will warn you. Once warned, you then make the Gambas object "invalid". As I don't think that you need that at the moment, I will give more details only if you request them. Regards, -- Beno?t Minisini From gambas at ...1... Wed Feb 8 08:22:17 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Wed, 08 Feb 2012 08:22:17 +0100 Subject: [Gambas-devel] Linking external libraries to components. In-Reply-To: References: Message-ID: <4F3222A9.6090807@...1...> Le 06/02/2012 15:46, Randall Morgan a ?crit : > Hi Benoit, > > After a little digging I have found that adding the library to the > TEMPLATE/conf/gb.gsl.conf file seems to add the external library to the > link command. > Is this the proper way to add an external library to a component project? > > Randall > Not really. See my previous mail. -- Beno?t Minisini From rmorgan62 at ...176... Thu Feb 9 15:56:48 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Thu, 9 Feb 2012 06:56:48 -0800 Subject: [Gambas-devel] Proper way to the current object Message-ID: Hi Benoit, I am a bit perplexed. I have some code that works and some that doesn't... I think I have been looking at the code too long to see the issue. So I was hoping your eyes might help. I have used: #define THIS ((GSLCOMPLEX *) _object) -- in c_complex.h to get a pointer to the current object of type GSLCOMPLEX. Next I use: THIS->number.real; to access the value stored in the real member of the number structure. The number structure is a member of the GSLCOMPLEX structure The structures are defined as below: typedef struct __GSLCOMPLEXNUM { double real; double imagined; } GSLCOMPLEXNUM; typedef struct __GSLCOMPLEX { GB_BASE ob; GSLCOMPLEXNUM number; } GSLCOMPLEX; This seems to work when I am simply passing a value to store in the property but causes seg faults when I try to pass the value of THIS->number.real to a function. I know I have missed something very elementary but simply can't see it at this moment... Once you respond I know I will be kicking myself for not seeing it! What I need to do is pass the values stored in GSLCOMPLEX->number.real, and GSLCOMPLEX->number.imagined to c function. My guess is that my method of getting the current object is not working as at times I seem to get a null value for THIS and a value of 0x8 for THIS->number. Thanks for the help! -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Sat Feb 11 02:01:11 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Fri, 10 Feb 2012 17:01:11 -0800 Subject: [Gambas-devel] Needed Info Message-ID: Hi Benoit, Can you expand on the purpose of the following: /* The following symbols must be declared with EXPORT in a component: - GB - GB_INIT() - GB_EXIT() */ I have started the documentation as promised though I still have a lot to learn. But while waiting for replies from you I figured I could at least start on the documentation for what i do know... But there is nothing written on these items except that they must be declared extern. My guess is: GB is the master Gamabs object. GB_INIT() is used for initialization of a class, something like a constructor? GB_EXIT() is used to shut down the class cleanly like a destructor? Any confirmation or additional information would be very helpful. Thanks -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Sat Feb 11 20:17:01 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 11 Feb 2012 20:17:01 +0100 Subject: [Gambas-devel] Needed Info In-Reply-To: References: Message-ID: <4F36BEAD.9070702@...1...> Le 11/02/2012 02:01, Randall Morgan a ?crit : > Hi Benoit, > > Can you expand on the purpose of the following: > > /* The following symbols must be declared with EXPORT in a component: > - GB > - GB_INIT() > - GB_EXIT() > */ > > I have started the documentation as promised though I still have a lot > to learn. But while waiting for replies from you I figured I could at > least start on the documentation for what i do know... But there is > nothing written on these items except that they must be declared extern. > > My guess is: GB is the master Gamabs object. > > GB_INIT() is used for initialization of a class, something like a > constructor? > > GB_EXIT() is used to shut down the class cleanly like a destructor? > > Any confirmation or additional information would be very helpful. > > Thanks > GB_INIT() and GB_EXIT() are two mandatory exported functions: - GB_INIT() is called by the interpreter to initialize the component. - GB_EXIT() is called by the interpreter to uninitialize the component. GB is a structure (GB_INTERFACE) that is filled by the interpreter with the interpreter API when the component is loaded. So the GB symbol must be exported too. Look at the source of any component to see how they are declared. Another unrelated point now: as soon as I find time, I will tell you what to remove and clean-up in your component. Some GSL functions are not useful in Gambas (mainly because they already exist in the interpreter), so they should not be implemented in the component. Regards, -- Beno?t Minisini From gambas at ...1... Sat Feb 11 20:20:22 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 11 Feb 2012 20:20:22 +0100 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: References: Message-ID: <4F36BF76.7060101@...1...> Le 09/02/2012 15:56, Randall Morgan a ?crit : > Hi Benoit, > > I am a bit perplexed. I have some code that works and some that > doesn't... I think I have been looking at the code too long to see the > issue. So I was hoping your eyes might help. > > I have used: > > #define THIS ((GSLCOMPLEX *) _object) -- in c_complex.h > > to get a pointer to the current object of type GSLCOMPLEX. > > Next I use: > > THIS->number.real; > > to access the value stored in the real member of the number structure. > The number structure is a member of the GSLCOMPLEX structure > > The structures are defined as below: > > typedef > struct __GSLCOMPLEXNUM > { > double real; > double imagined; > } > GSLCOMPLEXNUM; > > typedef > struct __GSLCOMPLEX > { > GB_BASE ob; > GSLCOMPLEXNUM number; > } > GSLCOMPLEX; > > This seems to work when I am simply passing a value to store in the > property but causes seg faults when I try to pass the value of > THIS->number.real to a function. > I know I have missed something very elementary but simply can't see it > at this moment... Once you respond I know I will be kicking myself for > not seeing it! > > What I need to do is pass the values stored in GSLCOMPLEX->number.real, > and GSLCOMPLEX->number.imagined to c function. > > My guess is that my method of getting the current object is not working > as at times I seem to get a null value for THIS and a value of 0x8 for > THIS->number. > > > Thanks for the help! > > Please be more precise. Which code does not work exactly? -- Beno?t Minisini From gambas at ...1... Sat Feb 11 20:23:49 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 11 Feb 2012 20:23:49 +0100 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: References: Message-ID: <4F36C045.8080004@...1...> Le 09/02/2012 15:56, Randall Morgan a ?crit : > Hi Benoit, > > I am a bit perplexed. I have some code that works and some that > doesn't... If a method or a property returns a "GslComplex", then its signature must use "GslComplex;" (or just "GslComplex" in a return value signature). Do not use "o", this is an anonymous object that you should use only if the method or property returns any object. And when you receive an object reference through GB_OBJECT, you must use GB.CheckObject() to check it (to ensure it is not null). Regards, -- Beno?t Minisini From gambas at ...1... Sat Feb 11 20:24:48 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 11 Feb 2012 20:24:48 +0100 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: <4F36C045.8080004@...1...> References: <4F36C045.8080004@...1...> Message-ID: <4F36C080.6080307@...1...> Le 11/02/2012 20:23, Beno?t Minisini a ?crit : > Le 09/02/2012 15:56, Randall Morgan a ?crit : >> Hi Benoit, >> >> I am a bit perplexed. I have some code that works and some that >> doesn't... > > If a method or a property returns a "GslComplex", then its signature > must use "GslComplex;" (or just "GslComplex" in a return value > signature). Do not use "o", this is an anonymous object that you should > use only if the method or property returns any object. > > And when you receive an object reference through GB_OBJECT, you must use > GB.CheckObject() to check it (to ensure it is not null). > > Regards, > Another point: Use NULL and not a void string for methods returning nothing, and/or having no arguments. -- Beno?t Minisini From gambas at ...1... Sat Feb 11 20:36:10 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 11 Feb 2012 20:36:10 +0100 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: <4F36C080.6080307@...1...> References: <4F36C045.8080004@...1...> <4F36C080.6080307@...1...> Message-ID: <4F36C32A.4080206@...1...> Le 11/02/2012 20:24, Beno?t Minisini a ?crit : > Le 11/02/2012 20:23, Beno?t Minisini a ?crit : >> Le 09/02/2012 15:56, Randall Morgan a ?crit : >>> Hi Benoit, >>> >>> I am a bit perplexed. I have some code that works and some that >>> doesn't... >> >> If a method or a property returns a "GslComplex", then its signature >> must use "GslComplex;" (or just "GslComplex" in a return value >> signature). Do not use "o", this is an anonymous object that you should >> use only if the method or property returns any object. >> >> And when you receive an object reference through GB_OBJECT, you must use >> GB.CheckObject() to check it (to ensure it is not null). >> >> Regards, >> > > Another point: Use NULL and not a void string for methods returning > nothing, and/or having no arguments. > Other points again. 1) Why didn't you use gsl_complex directly in the GSLCOMPLEX structure? 2) You chose to create a new Complex each time you act on it. Maybe this is not a good idea (for performance reasons). I think you should better: - Act on the current object without creating a new one, and return it anyway. - Add a Copy() method to copy a complex number when this is really needed. So here is the "not-tested" result: -------------------------------------------------------------------- typedef struct { GB_BASE ob; gsl_complex c; } GSLCOMPLEX; BEGIN_METHOD(GslComplex_Add, GB_OBJECT x) GSLCOMPLEX *x = VARG(x); if (GB.CheckObject(x)) return; THIS->c = gsl_complex_add(THIS->c, x->c); GB.ReturnObject(THIS); // GB.ReturnXXXX() methods return nothing! END_METHOD -------------------------------------------------------------------- The code is simpler, isn't it? -- Beno?t Minisini From rmorgan62 at ...176... Sat Feb 11 22:56:23 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Sat, 11 Feb 2012 13:56:23 -0800 Subject: [Gambas-devel] Needed Info In-Reply-To: <4F36BEAD.9070702@...1...> References: <4F36BEAD.9070702@...1...> Message-ID: Hi Benoit, I do understand that some of the function are provided by Gambas natively. I included them in an effort to keep the GSL class as complete as possible. Someone experienced with using GSL from Ada or C/C++ may expect those function to be included. Therefore, I decided to include them. Also, the GSL library provides "known" levels of accuracy in function like Pow and ArcTan, which may be expected by the component user. 2012/2/11 Beno?t Minisini > Le 11/02/2012 02:01, Randall Morgan a ?crit : > > Hi Benoit, > > > > Can you expand on the purpose of the following: > > > > /* The following symbols must be declared with EXPORT in a component: > > - GB > > - GB_INIT() > > - GB_EXIT() > > */ > > > > I have started the documentation as promised though I still have a lot > > to learn. But while waiting for replies from you I figured I could at > > least start on the documentation for what i do know... But there is > > nothing written on these items except that they must be declared extern. > > > > My guess is: GB is the master Gamabs object. > > > > GB_INIT() is used for initialization of a class, something like a > > constructor? > > > > GB_EXIT() is used to shut down the class cleanly like a destructor? > > > > Any confirmation or additional information would be very helpful. > > > > Thanks > > > > GB_INIT() and GB_EXIT() are two mandatory exported functions: > - GB_INIT() is called by the interpreter to initialize the component. > - GB_EXIT() is called by the interpreter to uninitialize the component. > > GB is a structure (GB_INTERFACE) that is filled by the interpreter with > the interpreter API when the component is loaded. So the GB symbol must > be exported too. > > Look at the source of any component to see how they are declared. > > Another unrelated point now: as soon as I find time, I will tell you > what to remove and clean-up in your component. Some GSL functions are > not useful in Gambas (mainly because they already exist in the > interpreter), so they should not be implemented in the component. > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Sat Feb 11 23:07:47 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Sat, 11 Feb 2012 14:07:47 -0800 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: <4F36C32A.4080206@...1...> References: <4F36C045.8080004@...1...> <4F36C080.6080307@...1...> <4F36C32A.4080206@...1...> Message-ID: Hi Benoit, The reason for creating a new object containing the result was requested by Juergen. He's the math wizard her, I am just trying to make the GSL work in Gambas for him. However, I do feel after thinking about it that if most methods save the result in the current method you limit the usuability of the library. Most calculations will require the result to be passed to another object. Now I am still learning about all of this so it could change... The code in the current files is nowhere near final and is there for experimentation as for me that is the best way to learn. The reason for creating a separate complex number is because this structure may change to include both accuracy information and may or may not be modified to include information on whether the number is Cartesian or polar. Both of which could also be included in a single object. However, when I move to vectors and matrices these structures will need to be separate structures and at the moment this gives me a way to experiment with having a separate structure. 2012/2/11 Beno?t Minisini > Le 11/02/2012 20:24, Beno?t Minisini a ?crit : > > Le 11/02/2012 20:23, Beno?t Minisini a ?crit : > >> Le 09/02/2012 15:56, Randall Morgan a ?crit : > >>> Hi Benoit, > >>> > >>> I am a bit perplexed. I have some code that works and some that > >>> doesn't... > >> > >> If a method or a property returns a "GslComplex", then its signature > >> must use "GslComplex;" (or just "GslComplex" in a return value > >> signature). Do not use "o", this is an anonymous object that you should > >> use only if the method or property returns any object. > >> > >> And when you receive an object reference through GB_OBJECT, you must use > >> GB.CheckObject() to check it (to ensure it is not null). > >> > >> Regards, > >> > > > > Another point: Use NULL and not a void string for methods returning > > nothing, and/or having no arguments. > > > > Other points again. > > 1) Why didn't you use gsl_complex directly in the GSLCOMPLEX structure? > > 2) You chose to create a new Complex each time you act on it. > > Maybe this is not a good idea (for performance reasons). I think you > should better: > > - Act on the current object without creating a new one, and return it > anyway. > > - Add a Copy() method to copy a complex number when this is really needed. > > So here is the "not-tested" result: > > -------------------------------------------------------------------- > > typedef > struct { > GB_BASE ob; > gsl_complex c; > } > GSLCOMPLEX; > > BEGIN_METHOD(GslComplex_Add, GB_OBJECT x) > > GSLCOMPLEX *x = VARG(x); > > if (GB.CheckObject(x)) > return; > > THIS->c = gsl_complex_add(THIS->c, x->c); > GB.ReturnObject(THIS); // GB.ReturnXXXX() methods return nothing! > > END_METHOD > > -------------------------------------------------------------------- > > The code is simpler, isn't it? > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Sun Feb 12 00:41:40 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Sat, 11 Feb 2012 15:41:40 -0800 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: <4F36BF76.7060101@...1...> References: <4F36BF76.7060101@...1...> Message-ID: Specifically, In the GslComplex_Add method the line: // Save the values of the current object into a. GSL_SET_COMPLEX(&a, THIS->number.real, THIS->number.imagined); Causes a seg fault while when replaced with: GSL_SET_COMPLEX(&a, 10.0, 12.0); The method functions as expected. Testing seems to indicate that the value of THIS is null. THIS is defined in the class header file as: #define THIS ((GSLCOMPLEX *)_object) It was my understanding that the above line would result in a pointer to the current object. And in the get/set property methods it seems to work that way. 2012/2/11 Beno?t Minisini > Le 09/02/2012 15:56, Randall Morgan a ?crit : > > Hi Benoit, > > > > I am a bit perplexed. I have some code that works and some that > > doesn't... I think I have been looking at the code too long to see the > > issue. So I was hoping your eyes might help. > > > > I have used: > > > > #define THIS ((GSLCOMPLEX *) _object) -- in c_complex.h > > > > to get a pointer to the current object of type GSLCOMPLEX. > > > > Next I use: > > > > THIS->number.real; > > > > to access the value stored in the real member of the number structure. > > The number structure is a member of the GSLCOMPLEX structure > > > > The structures are defined as below: > > > > typedef > > struct __GSLCOMPLEXNUM > > { > > double real; > > double imagined; > > } > > GSLCOMPLEXNUM; > > > > typedef > > struct __GSLCOMPLEX > > { > > GB_BASE ob; > > GSLCOMPLEXNUM number; > > } > > GSLCOMPLEX; > > > > This seems to work when I am simply passing a value to store in the > > property but causes seg faults when I try to pass the value of > > THIS->number.real to a function. > > I know I have missed something very elementary but simply can't see it > > at this moment... Once you respond I know I will be kicking myself for > > not seeing it! > > > > What I need to do is pass the values stored in GSLCOMPLEX->number.real, > > and GSLCOMPLEX->number.imagined to c function. > > > > My guess is that my method of getting the current object is not working > > as at times I seem to get a null value for THIS and a value of 0x8 for > > THIS->number. > > > > > > Thanks for the help! > > > > > > Please be more precise. Which code does not work exactly? > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Sun Feb 12 20:32:20 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 12 Feb 2012 20:32:20 +0100 Subject: [Gambas-devel] Proper way to the current object In-Reply-To: References: <4F36C045.8080004@...1...> <4F36C080.6080307@...1...> <4F36C32A.4080206@...1...> Message-ID: <4F3813C4.5080406@...1...> Le 11/02/2012 23:07, Randall Morgan a ?crit : > Hi Benoit, > > The reason for creating a new object containing the result was requested > by Juergen. He's the math wizard her, I am just trying to make the GSL > work in Gambas for him. Even if only Juergen asks for GSL, you are actually making the component for every possible user. > However, I do feel after thinking about it that > if most methods save the result in the current method you limit the > usuability of the library. No. By systematically creating a new object, you are doing something that is not always needed, and so you lower the processing speed. So I told you not to create this object, and to add a Copy() method. For complex numbers, copying is not a heavy process, but think about bigger objects (matrix, polynomial...), where a systematic copy will be a problem. > Most calculations will require the result to > be passed to another object. What is the relation between not systematically intenally copying object and passing a result? > Now I am still learning about all of this > so it could change... > > The code in the current files is nowhere near final and is there for > experimentation as for me that is the best way to learn. > > The reason for creating a separate complex number is because this > structure may change to include both accuracy information and may or may > not be modified to include information on whether the number > is Cartesian or polar. Both of which could also be included in a single > object. I think this is a bad idea, because: 1) People expect the behaviour of the GSL library. 2) Using GSL types directly makes code cleaner and shorter. Later, when you will have a working component and more experience, you will be able to make complex numbers more complex. :-) Regards, -- Beno?t Minisini From rmorgan62 at ...176... Mon Feb 13 21:52:15 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Mon, 13 Feb 2012 12:52:15 -0800 Subject: [Gambas-devel] Correct way to get pointer to current object Message-ID: Hi Benoit, I have removed all but the bare minimum code and I am asking for you to look at this code. I have left only the property and GslComplex_Add() method in the c_complex.c file. My issue is that although I have defined "THIS" in the header file I get a null value for THIS in the GslComplex_Add method. Yet it is not null in the property methods. The c_complex.c and c_complex.h files have been committed to the repo for your convince. I have included most of your suggestions. The only thing I have not included is that I am still creating and returning a new object. If you could provide me a better understanding as to why THIS is null in GslComplex_Add() I would be very grateful. Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Tue Feb 14 02:43:56 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Mon, 13 Feb 2012 17:43:56 -0800 Subject: [Gambas-devel] Correct way to get pointer to current object In-Reply-To: References: Message-ID: Never mind. I got it figured out. On Mon, Feb 13, 2012 at 12:52 PM, Randall Morgan wrote: > Hi Benoit, > > I have removed all but the bare minimum code and I am asking for you to > look at this code. I have left only the property and > GslComplex_Add() method in the c_complex.c file. My issue is that > although I have defined "THIS" in the header file I get a null value for > THIS in the GslComplex_Add method. Yet it is not null in the property > methods. The c_complex.c and c_complex.h files have been committed to the > repo for your convince. I have included most of your suggestions. The only > thing I have not included is that I am still creating and returning a new > object. > > If you could provide me a better understanding as to why THIS is null in > GslComplex_Add() I would be very grateful. > > Randall > > -- > If you ask me if it can be done. The answer is YES, it can always be done. > The correct questions however are... What will it cost, and how long will > it take? > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Tue Feb 14 08:33:49 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 14 Feb 2012 08:33:49 +0100 Subject: [Gambas-devel] Correct way to get pointer to current object In-Reply-To: References: Message-ID: <4F3A0E5D.8090906@...1...> Le 14/02/2012 02:43, Randall Morgan a ?crit : > Never mind. I got it figured out. > I didn't find the mistake yet. :-) I will commit some changes in your component: - Add c_complex.c and c_complex.h to the Makefile.am file. - Use "Tab" characters to indent source code, not spaces. - Add some methods to the Complex class so that you see how to implement them (an example is better than a long speech). Regards, -- Beno?t Minisini From rmorgan62 at ...176... Tue Feb 14 08:38:52 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Mon, 13 Feb 2012 23:38:52 -0800 Subject: [Gambas-devel] Correct way to get pointer to current object In-Reply-To: <4F3A0E5D.8090906@...1...> References: <4F3A0E5D.8090906@...1...> Message-ID: Sorry, In my local files I do have the files added to Makefile.am. The error was that I declared the function as a static method, which is why it wasn't getting the object pointer. Once I noticed this everything started working. 2012/2/13 Beno?t Minisini > Le 14/02/2012 02:43, Randall Morgan a ?crit : > > Never mind. I got it figured out. > > > > I didn't find the mistake yet. :-) > > I will commit some changes in your component: > > - Add c_complex.c and c_complex.h to the Makefile.am file. > > - Use "Tab" characters to indent source code, not spaces. > > - Add some methods to the Complex class so that you see how to implement > them (an example is better than a long speech). > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Wed Feb 15 23:12:57 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Wed, 15 Feb 2012 14:12:57 -0800 Subject: [Gambas-devel] Function Signature Message-ID: Hi, I am having trouble writing the proper function signature for a function that passes an array of floats. I have look ad the GL class of the OpenGl component as it seems to pass a lot of array as matrices. Something I will be doing shortly with Polynomials. I have the function: BEGIN_METHOD(GslPoly_Eval, GB_OBJECT array; GB_FLOAT x;) I have the following declaration in the class desc struct: GB_METHOD("Eval", "f", GSLPOLY_Eval, "(a)Float[](x)f") This does not work but if I swap the order of the arguments then it works. What am I missing and do you know of a good text on writing proper signatures for Gambas and/or C. Thanks again for your help! -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tommyline at ...674... Wed Feb 15 23:50:24 2012 From: tommyline at ...674... (tommyline at ...674...) Date: Wed, 15 Feb 2012 22:50:24 +0000 (GMT) Subject: [Gambas-devel] Function Signature In-Reply-To: Message-ID: <7552076.19547.1329346224721.JavaMail.root@...675...> Hi Randall, Some time ago I was adding nurbs and quadrics to glu library, take a look at GLU.c, nurbscurve and nurbssurface, there is a semicolon after each array declaration. Hope this helps. Tomek. ----- Original Message ----- From: "Randall Morgan" To: "mailing list for gambas developers" Sent: Wednesday, 15 February, 2012 10:12:57 PM Subject: [Gambas-devel] Function Signature Hi, I am having trouble writing the proper function signature for a function that passes an array of floats. I have look ad the GL class of the OpenGl component as it seems to pass a lot of array as matrices. Something I will be doing shortly with Polynomials. I have the function: BEGIN_METHOD(GslPoly_Eval, GB_OBJECT array; GB_FLOAT x;) I have the following declaration in the class desc struct: GB_METHOD("Eval", "f", GSLPOLY_Eval, "(a)Float[](x)f") This does not work but if I swap the order of the arguments then it works. What am I missing and do you know of a good text on writing proper signatures for Gambas and/or C. Thanks again for your help! -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Gambas-devel mailing list Gambas-devel at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-devel From rmorgan62 at ...176... Thu Feb 16 00:08:22 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Wed, 15 Feb 2012 15:08:22 -0800 Subject: [Gambas-devel] Function Signature In-Reply-To: <7552076.19547.1329346224721.JavaMail.root@...675...> References: <7552076.19547.1329346224721.JavaMail.root@...675...> Message-ID: Thanks! I'll look at that now. On Wed, Feb 15, 2012 at 2:50 PM, wrote: > Hi Randall, > > Some time ago I was adding nurbs and quadrics to glu library, take a look > at GLU.c, nurbscurve and nurbssurface, there is a semicolon after each > array declaration. > > Hope this helps. > Tomek. > > ----- Original Message ----- > From: "Randall Morgan" > To: "mailing list for gambas developers" < > gambas-devel at lists.sourceforge.net> > Sent: Wednesday, 15 February, 2012 10:12:57 PM > Subject: [Gambas-devel] Function Signature > > > Hi, > > I am having trouble writing the proper function signature for a function > that passes an array of floats. I have look ad the GL class of the OpenGl > component as it seems to pass a lot of array as matrices. Something I will > be doing shortly with Polynomials. > > I have the function: > > BEGIN_METHOD(GslPoly_Eval, GB_OBJECT array; GB_FLOAT x;) > > I have the following declaration in the class desc struct: > > GB_METHOD("Eval", "f", GSLPOLY_Eval, "(a)Float[](x)f") > > This does not work but if I swap the order of the arguments then it works. > What am I missing and do you know of a good text on writing proper > signatures for Gambas and/or C. > > Thanks again for your help! > > > > -- > If you ask me if it can be done. The answer is YES, it can always be done. > The correct questions however are... What will it cost, and how long will > it take? > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Thu Feb 16 00:21:14 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Wed, 15 Feb 2012 15:21:14 -0800 Subject: [Gambas-devel] Function Signature In-Reply-To: References: <7552076.19547.1329346224721.JavaMail.root@...675...> Message-ID: Thank you that info was a great help! On Wed, Feb 15, 2012 at 3:08 PM, Randall Morgan wrote: > Thanks! I'll look at that now. > > > > > On Wed, Feb 15, 2012 at 2:50 PM, wrote: > >> Hi Randall, >> >> Some time ago I was adding nurbs and quadrics to glu library, take a look >> at GLU.c, nurbscurve and nurbssurface, there is a semicolon after each >> array declaration. >> >> Hope this helps. >> Tomek. >> >> ----- Original Message ----- >> From: "Randall Morgan" >> To: "mailing list for gambas developers" < >> gambas-devel at lists.sourceforge.net> >> Sent: Wednesday, 15 February, 2012 10:12:57 PM >> Subject: [Gambas-devel] Function Signature >> >> >> Hi, >> >> I am having trouble writing the proper function signature for a function >> that passes an array of floats. I have look ad the GL class of the OpenGl >> component as it seems to pass a lot of array as matrices. Something I will >> be doing shortly with Polynomials. >> >> I have the function: >> >> BEGIN_METHOD(GslPoly_Eval, GB_OBJECT array; GB_FLOAT x;) >> >> I have the following declaration in the class desc struct: >> >> GB_METHOD("Eval", "f", GSLPOLY_Eval, "(a)Float[](x)f") >> >> This does not work but if I swap the order of the arguments then it >> works. What am I missing and do you know of a good text on writing proper >> signatures for Gambas and/or C. >> >> Thanks again for your help! >> >> >> >> -- >> If you ask me if it can be done. The answer is YES, it can always be >> done. The correct questions however are... What will it cost, and how long >> will it take? >> >> >> ------------------------------------------------------------------------------ >> Virtualization & Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> >> >> ------------------------------------------------------------------------------ >> Virtualization & Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> > > > > -- > If you ask me if it can be done. The answer is YES, it can always be done. > The correct questions however are... What will it cost, and how long will > it take? > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Thu Feb 16 00:38:39 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 16 Feb 2012 00:38:39 +0100 Subject: [Gambas-devel] Function Signature In-Reply-To: References: <7552076.19547.1329346224721.JavaMail.root@...675...> Message-ID: <4F3C41FF.1060802@...1...> Le 16/02/2012 00:08, Randall Morgan a ?crit : > Thanks! I'll look at that now. > Yes, you have to add a ';' at the end of the class name in signatures. Anyway, I looked at the polynomial part of the GSL documentation, and I think you shouldn't use the library interface directly, but create one class for each polynomial type: Polynomial: 'gsl_poly_*' functions. ComplexPolynomial: 'gsl_complex_poly_*' functions. NewtonPolynomial: 'gsl_poly_dd_*' functions. The C structures associated with these classes would be: typedef struct { GB_BASE ob; double *c; // coefficients int len; } CPOLYNOMIAL; typedef struct { GB_BASE ob; gsl_complex *c; // coefficients int len; } CCOMPLEXPOLYNOMIAL; These two classes should act like an array (_get, _put methods, Count, Max property). Contrary to arrays, writing the i-th element should automatically expands the internal '*c' array. Then we should add an arbitrary maximum length to a polynomial. A ToString() methods is a good idea too. typedef struct { GB_BASE ob; double *dd; double *xa; int len; } CNEWTONPOLYNOMIAL; This class is not exactly like an array, as a Newton polynomial is defined by two arrays of double. But AFAIK, you have only three methods to implement: gsl_poly_dd_init: create a NewtonPolynomial from an array of points. gsl_poly_dd_eval: evaluate the value of a NewtonPolynomial for a specific value of 'x'. gsl_poly_dd_taylor: converts a NewtonPolynomial to a Taylor expansion. Apparently this taylor expansion is just an array of double, and is not used anywhere else in the library. So no need to create a specific object for it. Tell me what you think about that, and if you see where to go exactly. If you have difficulties to write the array methods of these classes, I will help you. Regards, -- Beno?t Minisini From rmorgan62 at ...176... Thu Feb 16 01:16:39 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Wed, 15 Feb 2012 16:16:39 -0800 Subject: [Gambas-devel] Function Signature In-Reply-To: <4F3C41FF.1060802@...1...> References: <7552076.19547.1329346224721.JavaMail.root@...675...> <4F3C41FF.1060802@...1...> Message-ID: Thanks Benoit, I do truly appreciate all your help! The ToString method you added to the complex class was a wonderful addition and so I will include it in the other classes. I'll let Juergen look at your recommendations but I see no issues other than my lack of current programming techniques and knowledge of Gambas internals. In the last few minutes I was able to write a crude test for dealing with array of doubles passed into a method (See c_polynomial.c). However, at this point I am simply trying to figure out how it all works. If I understand you correctly, then I simply need to create an array within the class and use a method to add values to that array. Then run a method on the array values. Is this correct? If it is I was already thinking along those lines... Thanks again for everyone's help and support! 2012/2/15 Beno?t Minisini > Le 16/02/2012 00:08, Randall Morgan a ?crit : > > Thanks! I'll look at that now. > > > > Yes, you have to add a ';' at the end of the class name in signatures. > > Anyway, I looked at the polynomial part of the GSL documentation, and I > think you shouldn't use the library interface directly, but create one > class for each polynomial type: > > Polynomial: 'gsl_poly_*' functions. > ComplexPolynomial: 'gsl_complex_poly_*' functions. > NewtonPolynomial: 'gsl_poly_dd_*' functions. > > The C structures associated with these classes would be: > > typedef > struct { > GB_BASE ob; > double *c; // coefficients > int len; > } > CPOLYNOMIAL; > > typedef > struct { > GB_BASE ob; > gsl_complex *c; // coefficients > int len; > } > CCOMPLEXPOLYNOMIAL; > > These two classes should act like an array (_get, _put methods, Count, > Max property). > > Contrary to arrays, writing the i-th element should automatically > expands the internal '*c' array. Then we should add an arbitrary maximum > length to a polynomial. > > A ToString() methods is a good idea too. > > typedef > struct { > GB_BASE ob; > double *dd; > double *xa; > int len; > } > CNEWTONPOLYNOMIAL; > > This class is not exactly like an array, as a Newton polynomial is > defined by two arrays of double. But AFAIK, you have only three methods > to implement: > > gsl_poly_dd_init: create a NewtonPolynomial from an array of points. > > gsl_poly_dd_eval: evaluate the value of a NewtonPolynomial for a > specific value of 'x'. > > gsl_poly_dd_taylor: converts a NewtonPolynomial to a Taylor expansion. > Apparently this taylor expansion is just an array of double, and is not > used anywhere else in the library. So no need to create a specific > object for it. > > Tell me what you think about that, and if you see where to go exactly. > If you have difficulties to write the array methods of these classes, I > will help you. > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Fri Feb 17 19:54:15 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Fri, 17 Feb 2012 10:54:15 -0800 Subject: [Gambas-devel] Proper way to free memory Message-ID: HI, If I have a class that allocates memory using GB.Alloc() and that memory is used for the life of the class, How can I free this memory as the class exits. I've tried calling GB.Free() in a CLASSXXX_free() method but I still get an error from gb3x telling me that 1 allocation was not freed. Thanks for your help! -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Sat Feb 18 14:00:55 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 18 Feb 2012 14:00:55 +0100 Subject: [Gambas-devel] Proper way to free memory In-Reply-To: References: Message-ID: <4F3FA107.3030406@...1...> Le 17/02/2012 19:54, Randall Morgan a ?crit : > HI, > > If I have a class that allocates memory using GB.Alloc() and that memory > is used for the life of the class, How can I free this memory as the > class exits. I've tried calling GB.Free() in a CLASSXXX_free() method > but I still get an error from gb3x telling me that 1 allocation was not > freed. > > Thanks for your help! > Use the static destructor "_exit". -- Beno?t Minisini From gambas at ...1... Sat Feb 18 14:05:51 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 18 Feb 2012 14:05:51 +0100 Subject: [Gambas-devel] [Gambas-user] When to use GB.NewArray or GB.Array.New In-Reply-To: References: Message-ID: <4F3FA22F.8050303@...1...> Le 16/02/2012 21:46, Randall Morgan a ?crit : > Hi, > > I am experimenting with arrays in C components. I have looked at the > documentation on arrays and see that there are two types of arrays. It > looks like GB.NewArray simply reserves memory and GB.Array.New creates a > new GAMBAS array object. > > My question is: When is it appropriate to use each of these types. To me it > seems that GB>NewArray would be used only for temporary memory allocation > as in a function and therefore should be freed with GB.FreeArray before > exiting the function. Also, that GB.ArrayNew would be used anytime you need > a persistent array such as returning an array object or using the array as > a class member/property. Is this correct? > > Thanks for the clarification! > > (please use the developer mailing-list for such questions...) GB.NewArray() and GB.FreeArray() allows you to create dynamic C arrays whose allocation is managed by the interpreter. These arrays can grow automatically as needed (with GB.Add or GB.Insert), or shrink (with GB.Remove). You use them when you need a array whose size is not static. GB.Array.New creates a Gambas array object (Integer[], String[], and so on). You use it when you need to return a Gambas array from a property or a method. Then you have two choices: either you create it and store it inside your object structure, or you create it only when you return from the property or method. Regards, -- Beno?t Minisini From gambas at ...1... Sat Feb 18 14:18:31 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 18 Feb 2012 14:18:31 +0100 Subject: [Gambas-devel] Problems in gb.gsl Message-ID: <4F3FA527.8040306@...1...> Here is a list of what I have detected (I may have missed some things!) 1) You cannot use 'Pointer' to implement the Complex.Frexp method. You must do differently. Maybe by returning a Variant[] with a Float and an Integer. Gambas cannot return more than one value. 2) gsl_frexp has nothing to do with complex numbers. So why do you put it in the Complex class? 3) Arguments must be named the "Pascal" way: so you must write (X) in the signature, not (x). 4) "static GSLCOMPLEX *create_complex();" written in c_complex.h is a mistake. "static" means that the create_complex() function is private to the c_complex.c file. If you need to use create_complex() outside of c_complex.c, you must remove the 'static' keyword, and then you can declare it in the header file. Moreover, you will have to rename it so that we know that it is not static anymore: something like 'COMPLEX_create' (this is the convention I use). 5) You must update all your source file top commentaty with the true file name. 6) GB.NewArray() and its fellows will help you to implement the Polynomial class: you just have to keep a 'double *' pointer, and these functions will do everything for you: allocating, freeing, increasing the array size, shrinking it. The 'len' field I put in the CPOLYNOMIAL structure is actually not needed, as GB.Count() returns the size of the array. Regards, -- Beno?t Minisini From rmorgan62 at ...176... Sat Feb 18 23:22:24 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Sat, 18 Feb 2012 14:22:24 -0800 Subject: [Gambas-devel] Problems in gb.gsl In-Reply-To: <4F3FA527.8040306@...1...> References: <4F3FA527.8040306@...1...> Message-ID: 2012/2/18 Beno?t Minisini > Here is a list of what I have detected (I may have missed some things!) > > 1) You cannot use 'Pointer' to implement the Complex.Frexp method. You > must do differently. Maybe by returning a Variant[] with a Float and an > Integer. Gambas cannot return more than one value. > That's why I returned on value and modified the contents of another as is typical C. However, I too felt this was not Basic like. I will look at a variant solution. > > 2) gsl_frexp has nothing to do with complex numbers. So why do you put > it in the Complex class? > True. My only excuse is not enough coffee! > > 3) Arguments must be named the "Pascal" way: so you must write (X) in > the signature, not (x). > Ok. Changed this in all files and will add it to my list of notes. > > 4) "static GSLCOMPLEX *create_complex();" written in c_complex.h is a > mistake. "static" means that the create_complex() function is private to > the c_complex.c file. If you need to use create_complex() outside of > c_complex.c, you must remove the 'static' keyword, and then you can > declare it in the header file. Moreover, you will have to rename it so > that we know that it is not static anymore: something like > 'COMPLEX_create' (this is the convention I use). > Ok, so static does more than just making it available before class creation. Noted and added to my notes. Will change shortly. > > 5) You must update all your source file top commentaty with the true > file name. > Did this to my local files yesterday when I noticed the error. Should be resolved on next check in. > > 6) GB.NewArray() and its fellows will help you to implement the > Polynomial class: you just have to keep a 'double *' pointer, and these > functions will do everything for you: allocating, freeing, increasing > the array size, shrinking it. The 'len' field I put in the CPOLYNOMIAL > structure is actually not needed, as GB.Count() returns the size of the > array. > Ok, will play more with them. I don't like the idea of limiting the number of coefficients artificially. Since this is a scientific library their may be times when one wants to use it in circumstances that are atypical. So dynamically allocating space and letting he machine resources limit the library use I think is more appropriate. But I also want to do this in a manner that is not wasteful or puts undo burden on the system. Hence my experiment with allocating a fixed number of coefficients when we run out of space. I'm guessing I can do the same with GB.AllocArray and friends. Thanks for your input and feedback, Randall > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmorgan62 at ...176... Sun Feb 19 00:02:44 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Sat, 18 Feb 2012 15:02:44 -0800 Subject: [Gambas-devel] Problems in gb.gsl In-Reply-To: References: <4F3FA527.8040306@...1...> Message-ID: Hi Benoit, It would be good to add an "See Also" for GB.Add, GB.Count, etc to the document page for GB.NewArray. Just so people know that these methods can be used together if they do not read the GB.Add or GB.Count pages first. On Sat, Feb 18, 2012 at 2:22 PM, Randall Morgan wrote: > > > 2012/2/18 Beno?t Minisini > >> Here is a list of what I have detected (I may have missed some things!) >> >> 1) You cannot use 'Pointer' to implement the Complex.Frexp method. You >> must do differently. Maybe by returning a Variant[] with a Float and an >> Integer. Gambas cannot return more than one value. >> > > That's why I returned on value and modified the contents of another as > is typical C. > However, I too felt this was not Basic like. I will look at a variant > solution. > > >> >> 2) gsl_frexp has nothing to do with complex numbers. So why do you put >> it in the Complex class? >> > > True. My only excuse is not enough coffee! > > >> >> 3) Arguments must be named the "Pascal" way: so you must write (X) in >> the signature, not (x). >> > > Ok. Changed this in all files and will add it to my list of notes. > > >> >> 4) "static GSLCOMPLEX *create_complex();" written in c_complex.h is a >> mistake. "static" means that the create_complex() function is private to >> the c_complex.c file. If you need to use create_complex() outside of >> c_complex.c, you must remove the 'static' keyword, and then you can >> declare it in the header file. Moreover, you will have to rename it so >> that we know that it is not static anymore: something like >> 'COMPLEX_create' (this is the convention I use). >> > > Ok, so static does more than just making it available before class > creation. > Noted and added to my notes. Will change shortly. > > >> >> 5) You must update all your source file top commentaty with the true >> file name. >> > > Did this to my local files yesterday when I noticed the error. Should > be resolved on next check in. > >> >> 6) GB.NewArray() and its fellows will help you to implement the >> Polynomial class: you just have to keep a 'double *' pointer, and these >> functions will do everything for you: allocating, freeing, increasing >> the array size, shrinking it. The 'len' field I put in the CPOLYNOMIAL >> structure is actually not needed, as GB.Count() returns the size of the >> array. >> > > Ok, will play more with them. I don't like the idea of limiting the > number of coefficients artificially. > Since this is a scientific library their may be times when one wants to > use it in circumstances that > are atypical. So dynamically allocating space and letting he machine > resources limit the library use > I think is more appropriate. But I also want to do this in a manner > that is not wasteful or puts undo > burden on the system. Hence my experiment with allocating a fixed > number of coefficients when we > run out of space. I'm guessing I can do the same with GB.AllocArray and > friends. > > Thanks for your input and feedback, > > Randall > > > > >> Regards, >> >> -- >> Beno?t Minisini >> >> >> ------------------------------------------------------------------------------ >> Virtualization & Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> > > > > -- > If you ask me if it can be done. The answer is YES, it can always be done. > The correct questions however are... What will it cost, and how long will > it take? > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Sun Feb 19 02:09:54 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 19 Feb 2012 02:09:54 +0100 Subject: [Gambas-devel] Problems in gb.gsl In-Reply-To: References: <4F3FA527.8040306@...1...> Message-ID: <4F404BE2.304@...1...> Le 19/02/2012 00:02, Randall Morgan a ?crit : > Hi Benoit, > > It would be good to add an "See Also" for GB.Add, GB.Count, etc to the > document page for GB.NewArray. Just so people know that these methods > can be used together if they do not read the GB.Add or GB.Count pages first. > Yes. I have started to rewrite and complete the API documentation, but I don't have enough time at the moment. -- Beno?t Minisini From rmorgan62 at ...176... Wed Feb 22 02:57:43 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Tue, 21 Feb 2012 17:57:43 -0800 Subject: [Gambas-devel] Unit Testing Message-ID: Hi Benoit, Can you tell me what you use for unit testing C/C++ components and Gambas programs if anything? I can't seem to find any Gambas tools for program testing and while I hacked a simply unit testing set of subs for gambas3 I'd really like a good set of tools for testing gambas and the components I write. Thanks, Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From LJMA at ...689... Mon Feb 27 11:00:35 2012 From: LJMA at ...689... (LJMA at ...689...) Date: Mon, 27 Feb 2012 11:00:35 +0100 (CET) Subject: [Gambas-devel] User Control Message-ID: <24732881.12871330336835474.JavaMail.root@...690...> Hi, I have some problems when creating a user control. To give an example to make it clearer questions: Export Public Const _Properties As String = "*,Obligatorio=True,Tipo{Class1.*},Tipo2{Class2.*}" Public Const _IsControl As Boolean = True Public Const _DrawWith As String = "TextBox" Private hObs As Observer Property Obligatorio As Boolean Private $Obligatorio As Boolean Property Tipo As String Private $Tipo As String Property Tipo2 As Integer Private $Tipo2 As Integer Public Sub _new() hObs = New Observer(Me) As "TextBox" ' Super.background = &amp;FFFFFF&amp; End Public Sub TextBox_GotFocus() Last.background = &amp;9FFFFF&amp; End Public Sub TextBox_lostFocus() Last.background = &amp;FFFFFF&amp; If Me.Obligatorio = True Then Super.background = &amp;FF0000&amp; else Super.background = &amp;FFFFFF&amp; Endif End Private Function Obligatorio_Read() As Boolean Return $Obligatorio End Private Sub Obligatorio_Write(Value As Boolean) $Obligatorio = Value End Private Function Tipo_Read() As String Return $Tipo End Private Sub Tipo_Write(Value As String) $Tipo = Value End Private Function Tipo2_Read() As Integer Return $Tipo2 End Private Sub Tipo2_Write(Value As Integer) $Tipo2 = Value End la Clase Class1: Public Const Entero As String = "Entero" Public Const Float As String = "Float" Public Const Cadena As String = "Cadena" La Clase Class2: Public Const Entero As Integer = 0 Public Const Float As Integer = 1 Public Const Cadena As Integer = 2 This code creates a user component that is placed in blue when it receives focus and should be red when you lose if the property "Obligatorio" is True. As you can see, by default, this property is True. Although set to True at design time, then at runtime does not catch this value, take always False. It's like missing code to assign the property values ??assigned at design time to property variables. Nor does it create a property with a list of options. According to the How To: For properties that take their value into a list of predefined constants of the same class, you can specify a class instead of a property kind, with an optional list of constants. Class . ( * | Constant1 ; Constant2 ; ... ) [ = Default ] The IDE will will use a ComboBox control to edit the value of the property, and will fill it with the specified constants. Any idea what I'm doing wrong? Thanks for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Mon Feb 27 11:05:56 2012 From: gambas at ...1... (=?UTF-8?B?QmVub8OudCBNaW5pc2luaQ==?=) Date: Mon, 27 Feb 2012 11:05:56 +0100 Subject: [Gambas-devel] User Control In-Reply-To: <24732881.12871330336835474.JavaMail.root@...690...> References: <24732881.12871330336835474.JavaMail.root@...690...> Message-ID: <4F4B5584.5020707@...1...> Le 27/02/2012 11:00, LJMA at ...689... a ?crit : > Hi, > > I have some problems when creating a user control. To give an example to make it clearer questions: > > > Export > > Public Const _Properties As String = "*,Obligatorio=True,Tipo{Class1.*},Tipo2{Class2.*}" > Public Const _IsControl As Boolean = True > Public Const _DrawWith As String = "TextBox" > Private hObs As Observer > Property Obligatorio As Boolean > Private $Obligatorio As Boolean > Property Tipo As String > Private $Tipo As String > Property Tipo2 As Integer > Private $Tipo2 As Integer > > Public Sub _new() > hObs = New Observer(Me) As "TextBox" ' > Super.background =&FFFFFF& > End > > > Public Sub TextBox_GotFocus() > Last.background =&9FFFFF& > End > > Public Sub TextBox_lostFocus() > Last.background =&FFFFFF& > If Me.Obligatorio = True Then > Super.background =&FF0000& > else > Super.background =&FFFFFF& > Endif > End > > Private Function Obligatorio_Read() As Boolean > Return $Obligatorio > End > > Private Sub Obligatorio_Write(Value As Boolean) > $Obligatorio = Value > End > > Private Function Tipo_Read() As String > Return $Tipo > End > > Private Sub Tipo_Write(Value As String) > $Tipo = Value > End > > Private Function Tipo2_Read() As Integer > Return $Tipo2 > End > > Private Sub Tipo2_Write(Value As Integer) > $Tipo2 = Value > End > > la Clase Class1: > > Public Const Entero As String = "Entero" > Public Const Float As String = "Float" > Public Const Cadena As String = "Cadena" > > La Clase Class2: > > Public Const Entero As Integer = 0 > Public Const Float As Integer = 1 > Public Const Cadena As Integer = 2 > > > This code creates a user component that is placed in blue when it receives focus and should be red when > you loseif the property "Obligatorio" is True. > > As you can see, by default,this property is True. Although set to True at design time, thenat runtime does not catch this value, > takealways False. It's like missing code to assign the property values ??assigned at design time to > property variables. > > > Nor does it create a property with a list of options. According to the How To: > > For properties that take their value into a list of predefined > constants of the same class, you can specify a class instead of a > property kind, with an optional list of constants. > Class . ( * | Constant1 ; Constant2 ; ... ) [ = Default ] > The IDE will will use a ComboBox control to edit the value of the property, and will fill it with the specified constants. > > > > Any idea what I'm doing wrong? > > Thanks for your help. > You didn't care enough with the big yellow message in the documentation! :-) Telling the IDE that the property default value is TRUE is not enough. You must initialize the property with that default value in the code too. So you have to write that: Private $Obligatorio As Boolean = True Regards, -- Beno?t Minisini From gambas at ...1... Mon Feb 27 14:16:54 2012 From: gambas at ...1... (=?UTF-8?B?QmVub8OudCBNaW5pc2luaQ==?=) Date: Mon, 27 Feb 2012 14:16:54 +0100 Subject: [Gambas-devel] User Control In-Reply-To: <14070004.28081330345415885.JavaMail.defaultUser@...691...> References: <24732881.12871330336835474.JavaMail.root@...690...> <4F4B5584.5020707@...1...> <14070004.28081330345415885.JavaMail.defaultUser@...691...> Message-ID: <4F4B8246.2080808@...1...> Le 27/02/2012 13:23, LJMA at ...689... a ?crit : > Hi Beno?t, > > Traducir del: espa?ol > Escribe texto o la direcci?n de un sitio web, o bien, traduce un > documento . > Cancelar > Sorry for not reading.The first problem solved, but I can not create a > property with a list of options. According to the How To: > > For properties that take their value into a list of predefined > constants of the same class, you can specify a class instead of a > property kind, with an optional list of constants. > Class . ( * | Constant1 ; Constant2 ; ... ) [ = Default ] > The IDE will will use a ComboBox control to edit the value of the > property, and will fill it with the specified constants. > > The Class1: > Public Const Entero As String = "Entero" > Public Const Float As String = "Float" > Public Const Cadena As String = "Cadena" > > > Public Const _Properties As String = > "*,Obligatorio=True,Tipo{Class1.*}=Cadena" > Property Tipo As String > Private $Tipo As String = "Cadena" > > Thanks for your help again, > > Regards, > > I'm not sure that you can use string constants at the moment. You should use numeric constant. Regards, -- Beno?t Minisini From rmorgan62 at ...176... Tue Feb 28 19:25:30 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Tue, 28 Feb 2012 10:25:30 -0800 Subject: [Gambas-devel] Returning Non-standard type arrays Message-ID: Hi, Can someone show a some sample code for creating and returning a variant array. I have a method that will return a two element array and I need a Float in index 0 and an integer in index 1 or the variant array. I've tried looking at code in the DBUS component but can't seem to get an handle on it. In another method I need to return an array of objects of the type on one of my classes "Complex" I seem to have figured out how to return arrays of ints, float, etc but I am having trouble with objects and complex types. Any samples or help would be greatly appreciated. Thanks, Randall -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Tue Feb 28 23:26:01 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Feb 2012 23:26:01 +0100 Subject: [Gambas-devel] Returning Non-standard type arrays In-Reply-To: References: Message-ID: <4F4D5479.9030909@...1...> Le 28/02/2012 19:25, Randall Morgan a ?crit : > Hi, > > Can someone show a some sample code for creating and returning a variant > array. I have a method that will return a two element array and I need a > Float in index 0 and an integer in index 1 or the variant array. I've > tried looking at code in the DBUS component but can't seem to get an > handle on it. For which GSL function do you need that? > > In another method I need to return an array of objects of the type on > one of my classes "Complex" I seem to have figured out how to return > arrays of ints, float, etc but I am having trouble with objects and > complex types. > > Any samples or help would be greatly appreciated. The datatype for an array of complex is "Complex[]". Then you create your array with the GB.Array.New() API, by using GB.FindClass("Complex") as second argument. Once done, you have a array of Complex that is actually an array of pointers pointing at Complex Gambas object all initialized to NULL. You must create the Complex objects, and then put it inside the Complex[] array that way: GB_ARRAY array; GB.Array.New(&array, GB.FindClass("Complex"), size); // Create a new Complex *GB.Array.Get(TheArray, index) = TheComplexPointer; GB.Ref(TheComplexPointer); Don't forget to reference the Complex object when you put it inside the array. Regards, > > Thanks, > > Randall > > > -- > If you ask me if it can be done. The answer is YES, it can always be > done. The correct questions however are... What will it cost, and how > long will it take? > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > > > > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel -- Beno?t Minisini From rmorgan62 at ...176... Wed Feb 29 01:23:03 2012 From: rmorgan62 at ...176... (Randall Morgan) Date: Tue, 28 Feb 2012 16:23:03 -0800 Subject: [Gambas-devel] Returning Non-standard type arrays In-Reply-To: <4F4D5479.9030909@...1...> References: <4F4D5479.9030909@...1...> Message-ID: Hi Benoit, The Frexp function (as well as others) returns a double as the result but also modifies one of the parameters to return the integer exponent. So returning these two values as a variant array of two elements, one float and one int seems to make the most sense. 2012/2/28 Beno?t Minisini > Le 28/02/2012 19:25, Randall Morgan a ?crit : > > Hi, > > > > Can someone show a some sample code for creating and returning a variant > > array. I have a method that will return a two element array and I need a > > Float in index 0 and an integer in index 1 or the variant array. I've > > tried looking at code in the DBUS component but can't seem to get an > > handle on it. > > For which GSL function do you need that? > > > > > In another method I need to return an array of objects of the type on > > one of my classes "Complex" I seem to have figured out how to return > > arrays of ints, float, etc but I am having trouble with objects and > > complex types. > > > > Any samples or help would be greatly appreciated. > > The datatype for an array of complex is "Complex[]". > > Then you create your array with the GB.Array.New() API, by using > GB.FindClass("Complex") as second argument. > > Once done, you have a array of Complex that is actually an array of > pointers pointing at Complex Gambas object all initialized to NULL. > > You must create the Complex objects, and then put it inside the > Complex[] array that way: > > GB_ARRAY array; > > GB.Array.New(&array, GB.FindClass("Complex"), size); > > // Create a new Complex > > *GB.Array.Get(TheArray, index) = TheComplexPointer; > > GB.Ref(TheComplexPointer); > > Don't forget to reference the Complex object when you put it inside the > array. > > Regards, > > > > > Thanks, > > > > Randall > > > > > > -- > > If you ask me if it can be done. The answer is YES, it can always be > > done. The correct questions however are... What will it cost, and how > > long will it take? > > > > > > > ------------------------------------------------------------------------------ > > Keep Your Developer Skills Current with LearnDevNow! > > The most comprehensive online learning library for Microsoft developers > > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > > Metro Style Apps, more. Free future releases when you subscribe now! > > http://p.sf.net/sfu/learndevnow-d2d > > > > > > > > _______________________________________________ > > Gambas-devel mailing list > > Gambas-devel at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -------------- next part -------------- An HTML attachment was scrubbed... URL: