From emil.lenngren at ...176... Sun Aug 5 19:26:47 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Sun, 5 Aug 2012 19:26:47 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: <4FFDFF4A.10803@...1...> References: <4FF99C73.5040909@...1...> <4FFA3A08.9050805@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> Message-ID: Bug: Is this typedef really correct? #define TYPE_are_objects(_t1, _t2) (((_t1) & (_t2)) >= T_OBJECT) Theoretically, _t1 could be 0xf0f0f0f0 and _t2 could be 0x0f0f0f00, both are valid pointers, but according to that typedef, they are not objects. /Emil 2012/7/12 Beno?t Minisini > Le 12/07/2012 00:19, Emil Lenngren a ?crit : > > OK, good. > > > > I will be on holiday from tomorrow until the first week in August, so I > > will start work when I come home. > > > > /Emil > > > > So good holidays! > > -- > Beno?t Minisini > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emil.lenngren at ...176... Mon Aug 6 00:47:22 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Mon, 6 Aug 2012 00:47:22 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: References: <4FF99C73.5040909@...1...> <4FFA3A08.9050805@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> Message-ID: Another segfault bug: Dim i As Integer Dim a As Complex = 3i Dim b As Complex = 4i For i = 1 To 2 Print a = b b = Null Next /Emil 2012/8/5 Emil Lenngren > Bug: Is this typedef really correct? > #define TYPE_are_objects(_t1, _t2) (((_t1) & (_t2)) >= T_OBJECT) > > Theoretically, _t1 could be 0xf0f0f0f0 and _t2 could be 0x0f0f0f00, both > are valid pointers, but according to that typedef, they are not objects. > > /Emil > > > 2012/7/12 Beno?t Minisini > >> Le 12/07/2012 00:19, Emil Lenngren a ?crit : >> > OK, good. >> > >> > I will be on holiday from tomorrow until the first week in August, so I >> > will start work when I come home. >> > >> > /Emil >> > >> >> So good holidays! >> >> -- >> Beno?t Minisini >> >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Mon Aug 6 21:35:04 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 06 Aug 2012 21:35:04 +0200 Subject: [Gambas-devel] Components name and installation In-Reply-To: References: Message-ID: <50201C68.2070908@...1...> Le 23/07/2012 11:46, Patrik Karlsson a ?crit : > Hi, > I finally succeeded in writing my first 'dummy' component, it does not > do much, but it looks to be a valid component. :) > > In the Packaging section of > http://gambasdoc.org/help/dev/gambas?v3#t20 I am told to use the name > convention gambas3-vendor-name, so I'm using gambas3-trixon-testa. > > On the same page it says: "Even if the packager wizard allows to insert > the package vendor string into the package name, please avoid it." > > When I create an installation package, the name > is gambas3-trixon-gambas3-trixon-testa-3.2.1 and the checkbox for prefix > is selected and disabled. My global Preference/Packaging/Prefix... is > set to "No". > > Once compiled and installed the component is named gambas3-trixon-testa. > Is "gambas3-trixon-gambas3-trixon-testa" a bug in gambas or in my brain? > OK. The documentation is not up to date. The name of a component package is gambas3--. If you name your project 'gambas3-trixon-testa', if you set 'trixon' as vendor name, then you will get the following package name: gambas3-trixon-gambas3-trixon-testa. So you should name your project just 'testa'. Regards, -- Beno?t Minisini From gambas at ...1... Mon Aug 6 21:53:07 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 06 Aug 2012 21:53:07 +0200 Subject: [Gambas-devel] Components name and installation In-Reply-To: References: <5012A8D0.8020003@...1...> Message-ID: <502020A3.2000404@...1...> Le 29/07/2012 20:29, Patrik Karlsson a ?crit : > > One more thing that might or might not be related. The menu option > library/component properties is disabled but functional via short cuts > for library and components, ctrl shift p. > Hu? What are you talking about? -- Beno?t Minisini From gambas at ...1... Mon Aug 6 22:04:19 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 06 Aug 2012 22:04:19 +0200 Subject: [Gambas-devel] Components name and installation In-Reply-To: References: Message-ID: <50202343.2080300@...1...> Le 23/07/2012 11:46, Patrik Karlsson a ?crit : > One more thing regarding installing, > http://gambasdoc.org/help/dev/gambas?v3#t19 > > "You can install the component > in your home directory by > checking the corresponding option in the "Make executable" dialog." > > I cant get this 'per user' install to work, it does not show up in > gambas among the other components. I just put > my gambas3-trixon-testa.gambas in ~/. > What is the "corresponding option"? Sorry, this is a Gambas 2 only thing. > The same component works just fine when installed globally. In Gambas 3, you really make components for global things, i.e. reusable software not tied to a specific project. But you can make libraries instead. They are Gambas projects that you can link in the project property dialog. They library executables must be installed in the same directory as the main project using them at runtime. Regards, -- Beno?t Minisini From gambas at ...1... Mon Aug 6 22:05:42 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 06 Aug 2012 22:05:42 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: References: <4FF99C73.5040909@...1...> <4FFA3A08.9050805@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> Message-ID: <50202396.8020801@...1...> Le 05/08/2012 19:26, Emil Lenngren a ?crit : > Bug: Is this typedef really correct? > #define TYPE_are_objects(_t1, _t2) (((_t1) & (_t2)) >= T_OBJECT) > > Theoretically, _t1 could be 0xf0f0f0f0 and _t2 could be 0x0f0f0f00, both > are valid pointers, but according to that typedef, they are not objects. This is a well-known kind of optimizations often named as "bug". :-) -- Beno?t Minisini From pata.karlsson at ...176... Mon Aug 6 22:10:16 2012 From: pata.karlsson at ...176... (Patrik Karlsson) Date: Mon, 6 Aug 2012 22:10:16 +0200 Subject: [Gambas-devel] Components name and installation In-Reply-To: <502020A3.2000404@...1...> References: <5012A8D0.8020003@...1...> <502020A3.2000404@...1...> Message-ID: 2012/8/6 Beno?t Minisini > Le 29/07/2012 20:29, Patrik Karlsson a ?crit : > > > > One more thing that might or might not be related. The menu option > > library/component properties is disabled but functional via short cuts > > for library and components, ctrl shift p. > > > > Hu? What are you talking about? > > -- > Beno?t Minisini > What I ment was that the menu item "Project/Library properties" and "Project/Component properties" could not be selected with the mouse, but the short cut, "ctrl shift p" worked just fine. I have just moved from ubuntu (unity) to kubuntu and everything is ok now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Mon Aug 6 22:14:35 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 06 Aug 2012 22:14:35 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: References: <4FF99C73.5040909@...1...> <4FFA3A08.9050805@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> Message-ID: <502025AB.1040907@...1...> Le 06/08/2012 00:47, Emil Lenngren a ?crit : > Another segfault bug: > > Dim i As Integer > Dim a As Complex = 3i > Dim b As Complex = 4i > For i = 1 To 2 > Print a = b > b = Null > Next > > /Emil > Fixed in revision #5012. Regards, -- Beno?t Minisini From pata.karlsson at ...176... Mon Aug 6 22:19:22 2012 From: pata.karlsson at ...176... (Patrik Karlsson) Date: Mon, 6 Aug 2012 22:19:22 +0200 Subject: [Gambas-devel] Components name and installation In-Reply-To: <50202343.2080300@...1...> References: <50202343.2080300@...1...> Message-ID: 2012/8/6 Beno?t Minisini > Le 23/07/2012 11:46, Patrik Karlsson a ?crit : > > One more thing regarding installing, > > http://gambasdoc.org/help/dev/gambas?v3#t19 > > > > "You can install the component > > in your home directory by > > checking the corresponding option in the "Make executable" dialog." > > > > I cant get this 'per user' install to work, it does not show up in > > gambas among the other components. I just put > > my gambas3-trixon-testa.gambas in ~/. > > What is the "corresponding option"? > > Sorry, this is a Gambas 2 only thing. > > > The same component works just fine when installed globally. > > In Gambas 3, you really make components for global things, i.e. reusable > software not tied to a specific project. > > But you can make libraries instead. They are Gambas projects that you > can link in the project property dialog. They library executables must > be installed in the same directory as the main project using them at > runtime. > > Regards, > > -- > Beno?t Minisini > > Thanks for clearing that up. My goal is to produce a component but I had some trouble making the dev cycle smooth when having to install it globally before testing it from a "calling project" everytime. Later I notised that I could link a component executable as a library so its all ok now. (unless I need the classes visible in the IDE palette at design time). /patrik -------------- next part -------------- An HTML attachment was scrubbed... URL: From emil.lenngren at ...176... Tue Aug 7 00:06:58 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Tue, 7 Aug 2012 00:06:58 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: <50202396.8020801@...1...> References: <4FF99C73.5040909@...1...> <4FFA3A08.9050805@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> <50202396.8020801@...1...> Message-ID: Ok. Have never seen it before... It is quite risky. #define OBJECT_are_not_null(_o1, _o2) (((intptr_t)(_o1) & (intptr_t)(_o2)) != 0) The same there, the objects 0x0f0f0f00 and 0xf0f0f0f0 are not non-null according to that define... /Emil 2012/8/6 Beno?t Minisini > Le 05/08/2012 19:26, Emil Lenngren a ?crit : > > Bug: Is this typedef really correct? > > #define TYPE_are_objects(_t1, _t2) (((_t1) & (_t2)) >= T_OBJECT) > > > > Theoretically, _t1 could be 0xf0f0f0f0 and _t2 could be 0x0f0f0f00, both > > are valid pointers, but according to that typedef, they are not objects. > > This is a well-known kind of optimizations often named as "bug". :-) > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Tue Aug 7 00:22:47 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 07 Aug 2012 00:22:47 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: References: <4FF99C73.5040909@...1...> <4FFA3A08.9050805@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> <50202396.8020801@...1...> Message-ID: <502043B7.5000800@...1...> Le 07/08/2012 00:06, Emil Lenngren a ?crit : > Ok. Have never seen it before... It is quite risky. > > #define OBJECT_are_not_null(_o1, _o2) (((intptr_t)(_o1) & > (intptr_t)(_o2)) != 0) > > The same there, the objects 0x0f0f0f00 and 0xf0f0f0f0 are not non-null > according to that define... > > /Emil > Yep. Same mistake... -- Beno?t Minisini From gambas at ...1... Tue Aug 7 00:40:38 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 07 Aug 2012 00:40:38 +0200 Subject: [Gambas-devel] About gb.gsl components In-Reply-To: <502043B7.5000800@...1...> References: <4FF99C73.5040909@...1...> <4FFA46B3.40506@...1...> <4FFB1688.80000@...1...> <4FFB59E3.8050506@...1...> <4FFB658F.3000204@...1...> <4FFC49A8.3070204@...1...> <4FFDF9F5.1020000@...1...> <4FFDFF4A.10803@...1...> <50202396.8020801@...1...> <502043B7.5000800@...1...> Message-ID: <502047E6.6040407@...1...> Le 07/08/2012 00:22, Beno?t Minisini a ?crit : > Le 07/08/2012 00:06, Emil Lenngren a ?crit : >> Ok. Have never seen it before... It is quite risky. >> >> #define OBJECT_are_not_null(_o1, _o2) (((intptr_t)(_o1) & >> (intptr_t)(_o2)) != 0) >> >> The same there, the objects 0x0f0f0f00 and 0xf0f0f0f0 are not non-null >> according to that define... >> >> /Emil >> > > Yep. Same mistake... > Fixed in revision #5015. -- Beno?t Minisini From tobias at ...692... Sat Aug 11 19:13:08 2012 From: tobias at ...692... (Tobias Boege) Date: Sat, 11 Aug 2012 19:13:08 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory Message-ID: <20120811171308.GB526@...693...> Hi, I want to save a GB_VARIANT into a buffer, Ref() the object inside, if any, and return in later properly. My code looks something like this: static void *val; BEGIN_METHOD(Store, GB_VARIANT value) /* Tried also GB_VARIANT here, but the error differs only, maybe * because of the application... */ GB.Alloc(&val, sizeof(GB_VARIANT_VALUE)); GB.StoreVariant(ARG(value), val); END_METHOD BEGIN_METHOD_VOID(Restore) GB.ReturnVariant(val); GB.Free(&val); END_METHOD Suppose each Store() matches a Restore(), I get Segfaults in VALUE_write() and since I don't quite look through Gambas datatype and storage (yesterday crusaded against object reference counting successfully, though) I thought it's simpler to ask directly - the array types were not really helpful to me as I could not get to the exact point where memory allocation takes place. Or, if I were there (ARRAY_add_data()?), I didn't get it. BTW, the above is clearly simplified, I need allocating val dynamically. Regards, Tobi From gambas at ...1... Mon Aug 13 21:58:10 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 13 Aug 2012 21:58:10 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <20120811171308.GB526@...693...> References: <20120811171308.GB526@...693...> Message-ID: <50295C52.50307@...1...> Le 11/08/2012 19:13, Tobias Boege a ?crit : > Hi, > > I want to save a GB_VARIANT into a buffer, Ref() the object inside, if any, > and return in later properly. My code looks something like this: > > static void *val; > > BEGIN_METHOD(Store, GB_VARIANT value) > > /* Tried also GB_VARIANT here, but the error differs only, maybe > * because of the application... */ > GB.Alloc(&val, sizeof(GB_VARIANT_VALUE)); > GB.StoreVariant(ARG(value), val); > > END_METHOD > > BEGIN_METHOD_VOID(Restore) > > GB.ReturnVariant(val); > GB.Free(&val); > > END_METHOD > > Suppose each Store() matches a Restore(), I get Segfaults in VALUE_write() > and since I don't quite look through Gambas datatype and storage (yesterday > crusaded against object reference counting successfully, though) I thought > it's simpler to ask directly - the array types were not really helpful to > me as I could not get to the exact point where memory allocation takes > place. Or, if I were there (ARRAY_add_data()?), I didn't get it. > > BTW, the above is clearly simplified, I need allocating val dynamically. > > Regards, > Tobi > Oops, I forgot you... :-) A Gambas Variant is store inside a GB_VARIANT_VALUE structure. You don't need to allocate it on the heap. // A Variant must be initialized to NULL static GB_VARIANT_VALUE val = { T_NULL }; BEGIN_METHOD(Store, GB_VARIANT value) GB.StoreVariant(ARG(value), &val); END_METHOD BEGIN_METHOD_VOID(Restore) // The variant is copied in a temporary place. GB.ReturnVariant(&val); // Free the stored variant. // But you can't do it now, because the Variant will // be referenced after the function has returned only. // GB.StoreVariant(NULL, &val); END_METHOD As you can't release the Variant inside the Restore method, you must free the contents of 'val' in the '_exit' special method of your class. Regards, -- Beno?t Minisini From tobias at ...692... Mon Aug 13 22:40:39 2012 From: tobias at ...692... (Tobias Boege) Date: Mon, 13 Aug 2012 22:40:39 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <50295C52.50307@...1...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> Message-ID: <20120813204039.GB484@...693...> On Mon, 13 Aug 2012, Beno?t Minisini wrote: > Le 11/08/2012 19:13, Tobias Boege a ?crit : > > Hi, > > > > I want to save a GB_VARIANT into a buffer, Ref() the object inside, if any, > > and return in later properly. My code looks something like this: > > > > static void *val; > > > > BEGIN_METHOD(Store, GB_VARIANT value) > > > > /* Tried also GB_VARIANT here, but the error differs only, maybe > > * because of the application... */ > > GB.Alloc(&val, sizeof(GB_VARIANT_VALUE)); > > GB.StoreVariant(ARG(value), val); > > > > END_METHOD > > > > BEGIN_METHOD_VOID(Restore) > > > > GB.ReturnVariant(val); > > GB.Free(&val); > > > > END_METHOD > > > > Suppose each Store() matches a Restore(), I get Segfaults in VALUE_write() > > and since I don't quite look through Gambas datatype and storage (yesterday > > crusaded against object reference counting successfully, though) I thought > > it's simpler to ask directly - the array types were not really helpful to > > me as I could not get to the exact point where memory allocation takes > > place. Or, if I were there (ARRAY_add_data()?), I didn't get it. > > > > BTW, the above is clearly simplified, I need allocating val dynamically. > > > > Regards, > > Tobi > > > > Oops, I forgot you... :-) > > A Gambas Variant is store inside a GB_VARIANT_VALUE structure. You don't > need to allocate it on the heap. > Did you read the last paragraph in my previous mail? I need that dynamically on the heap, but see below. > // A Variant must be initialized to NULL > > static GB_VARIANT_VALUE val = { T_NULL }; > > BEGIN_METHOD(Store, GB_VARIANT value) > > GB.StoreVariant(ARG(value), &val); > > END_METHOD > > BEGIN_METHOD_VOID(Restore) > > // The variant is copied in a temporary place. > GB.ReturnVariant(&val); > > // Free the stored variant. > // But you can't do it now, because the Variant will > // be referenced after the function has returned only. > // GB.StoreVariant(NULL, &val); > > END_METHOD > > As you can't release the Variant inside the Restore method, you must > free the contents of 'val' in the '_exit' special method of your class. > > Regards, > > -- > Beno?t Minisini Sorry, I don't understand what to do now. Maybe I have to be clearer to not talk past each other. I started a gb.adt for abstract datatypes as I remember some people needed that and to get better in programming Gambas components at all - gb.ncurses still waits and will probably be more complex than what I am used to with the Gambas API. I already got circular double-linked lists (almost without memory problems) working and implemented Stack and Queue on top of a general Deque class (using linked lists. It is questionable if these are really needed as we have Variant[] already but to this later, please). One memory bug torments me for two days now and I want to be really sure it is not located in the Deque class but in the Lists. The above problem concerns, as you might expect now, the Deque functions. The object will receive multiple Variants which can be Objects or non-Objects like Integer. How would I store and link them into the Deque list and later unlink and restore so that reference-counted types get their ref and the others do not? I think, for this aim, the GB.StoreVariant() is the right function. But when an element is dequeued from a Queue, the memory occupied by the list node and the GB_VARIANT_VALUE buffer should be freed. Something like the code above already worked but valgrind reported two problems in VALUE_write() ("Conditional jump or move depends on uninitialised value(s)"). I am convinced that my test application is causing these by pushing two Integers onto the Stack (due to location and number of valgrind warnings)... Any remarks on this? Here is the actual code, however: BEGIN_METHOD(Deque_PushFront, GB_VARIANT value) void *newval; GB.Alloc(&newval, sizeof(GB_VARIANT_VALUE)); GB.StoreVariant(ARG(value), newval); CDEQUE_push_front(THIS, newval); // Just links the copy to the list END_METHOD BEGIN_METHOD_VOID(Deque_PopFront) void *value; if (CDEQUE_is_empty(THIS)) { GB.ReturnNull(); return; } value = CDEQUE_pop_front(THIS); // Retrieves newval from above and // deletes the list node GB.ReturnVariant(value); GB.Free(&value); END_METHOD (Don't mind the names ;-)) Re-thinking the whole situation: Do I even need to copy the Variant I receive? If the Deque gets to hold an Integer, for example, it is expected that it holds a copy of it so that the original Integer can be modified without changing the queued value. So concluding, it is _indeed_ necessary to copy, right? Thank you for consideration. Regards, Tobi From tobias at ...692... Tue Aug 14 15:37:17 2012 From: tobias at ...692... (Tobias Boege) Date: Tue, 14 Aug 2012 15:37:17 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <50295C52.50307@...1...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> Message-ID: <20120814133717.GA533@...693...> On Mon, 13 Aug 2012, Beno?t Minisini wrote: > Le 11/08/2012 19:13, Tobias Boege a ?crit : > > Hi, > > > > I want to save a GB_VARIANT into a buffer, Ref() the object inside, if any, > > and return in later properly. My code looks something like this: > > > > static void *val; > > > > BEGIN_METHOD(Store, GB_VARIANT value) > > > > /* Tried also GB_VARIANT here, but the error differs only, maybe > > * because of the application... */ > > GB.Alloc(&val, sizeof(GB_VARIANT_VALUE)); > > GB.StoreVariant(ARG(value), val); > > > > END_METHOD > > > > BEGIN_METHOD_VOID(Restore) > > > > GB.ReturnVariant(val); > > GB.Free(&val); > > > > END_METHOD > > > > Suppose each Store() matches a Restore(), I get Segfaults in VALUE_write() > > and since I don't quite look through Gambas datatype and storage (yesterday > > crusaded against object reference counting successfully, though) I thought > > it's simpler to ask directly - the array types were not really helpful to > > me as I could not get to the exact point where memory allocation takes > > place. Or, if I were there (ARRAY_add_data()?), I didn't get it. > > > > BTW, the above is clearly simplified, I need allocating val dynamically. > > > > Regards, > > Tobi > > > > Oops, I forgot you... :-) > > A Gambas Variant is store inside a GB_VARIANT_VALUE structure. You don't > need to allocate it on the heap. > > // A Variant must be initialized to NULL > > static GB_VARIANT_VALUE val = { T_NULL }; Oh. The above detail get me rid of the valgrind warnings! Great. Solely some (phantom) reference problems persist... From gambas at ...1... Tue Aug 14 15:47:38 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 14 Aug 2012 15:47:38 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <20120813204039.GB484@...693...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> <20120813204039.GB484@...693...> Message-ID: <502A56FA.809@...1...> Le 13/08/2012 22:40, Tobias Boege a ?crit : > On Mon, 13 Aug 2012, Beno?t Minisini wrote: >> Le 11/08/2012 19:13, Tobias Boege a ?crit : >>> Hi, >>> >>> I want to save a GB_VARIANT into a buffer, Ref() the object inside, if any, >>> and return in later properly. My code looks something like this: >>> >>> static void *val; >>> >>> BEGIN_METHOD(Store, GB_VARIANT value) >>> >>> /* Tried also GB_VARIANT here, but the error differs only, maybe >>> * because of the application... */ >>> GB.Alloc(&val, sizeof(GB_VARIANT_VALUE)); >>> GB.StoreVariant(ARG(value), val); >>> >>> END_METHOD >>> >>> BEGIN_METHOD_VOID(Restore) >>> >>> GB.ReturnVariant(val); >>> GB.Free(&val); >>> >>> END_METHOD >>> >>> Suppose each Store() matches a Restore(), I get Segfaults in VALUE_write() >>> and since I don't quite look through Gambas datatype and storage (yesterday >>> crusaded against object reference counting successfully, though) I thought >>> it's simpler to ask directly - the array types were not really helpful to >>> me as I could not get to the exact point where memory allocation takes >>> place. Or, if I were there (ARRAY_add_data()?), I didn't get it. >>> >>> BTW, the above is clearly simplified, I need allocating val dynamically. >>> >>> Regards, >>> Tobi >>> >> >> Oops, I forgot you... :-) >> >> A Gambas Variant is store inside a GB_VARIANT_VALUE structure. You don't >> need to allocate it on the heap. >> > > Did you read the last paragraph in my previous mail? I need that > dynamically on the heap, but see below. > >> // A Variant must be initialized to NULL >> >> static GB_VARIANT_VALUE val = { T_NULL }; >> >> BEGIN_METHOD(Store, GB_VARIANT value) >> >> GB.StoreVariant(ARG(value), &val); >> >> END_METHOD >> >> BEGIN_METHOD_VOID(Restore) >> >> // The variant is copied in a temporary place. >> GB.ReturnVariant(&val); >> >> // Free the stored variant. >> // But you can't do it now, because the Variant will >> // be referenced after the function has returned only. >> // GB.StoreVariant(NULL, &val); >> >> END_METHOD >> >> As you can't release the Variant inside the Restore method, you must >> free the contents of 'val' in the '_exit' special method of your class. >> >> Regards, >> >> -- >> Beno?t Minisini > > Sorry, I don't understand what to do now. Maybe I have to be clearer to not > talk past each other. I started a gb.adt for abstract datatypes as I > remember some people needed that and to get better in programming Gambas > components at all - gb.ncurses still waits and will probably be more > complex than what I am used to with the Gambas API. I already got circular > double-linked lists (almost without memory problems) working and implemented > Stack and Queue on top of a general Deque class (using linked lists. It is > questionable if these are really needed as we have Variant[] already but to > this later, please). > One memory bug torments me for two days now and I want to be really sure it > is not located in the Deque class but in the Lists. > > The above problem concerns, as you might expect now, the Deque functions. > The object will receive multiple Variants which can be Objects or > non-Objects like Integer. How would I store and link them into the Deque > list and later unlink and restore so that reference-counted types get their > ref and the others do not? I think, for this aim, the GB.StoreVariant() is > the right function. > But when an element is dequeued from a Queue, the memory occupied by the > list node and the GB_VARIANT_VALUE buffer should be freed. > Something like the code above already worked but valgrind reported two > problems in VALUE_write() ("Conditional jump or move depends on > uninitialised value(s)"). I am convinced that my test application is causing > these by pushing two Integers onto the Stack (due to location and number of > valgrind warnings)... Any remarks on this? > Here is the actual code, however: > > BEGIN_METHOD(Deque_PushFront, GB_VARIANT value) > > void *newval; > > GB.Alloc(&newval, sizeof(GB_VARIANT_VALUE)); > GB.StoreVariant(ARG(value), newval); > CDEQUE_push_front(THIS, newval); // Just links the copy to the list > > END_METHOD > > BEGIN_METHOD_VOID(Deque_PopFront) > > void *value; > > if (CDEQUE_is_empty(THIS)) { > GB.ReturnNull(); > return; > } > value = CDEQUE_pop_front(THIS); // Retrieves newval from above and > // deletes the list node > GB.ReturnVariant(value); > GB.Free(&value); > > END_METHOD > > (Don't mind the names ;-)) > > Re-thinking the whole situation: Do I even need to copy the Variant I > receive? > If the Deque gets to hold an Integer, for example, it is expected that it > holds a copy of it so that the original Integer can be modified without > changing the queued value. So concluding, it is _indeed_ necessary to > copy, right? > > Thank you for consideration. > > Regards, > Tobi > Too much english for me in one sole mail. :-) Did you look at how the Collection class has been implemented? --> /main/gbx/gbx_c_collection.c Or simpler the Variant[] array? --> /main/gbx/gbx_c_array.c They both store and retrieve variants. Or you can look at how the Control.Tag property in gb.qt4, it's a variant stored inside a dynamically allocated object. --> /gb.qt4/src/CWidget.cpp If the Variant is not global, but stored inside a dynamically allocated C structure, nothing changes: --8<------------------------------------------------------- // My object typedef struct { GB_BASE ob; GB_VARIANT_VALUE tag; } MYOBJECT; #define THIS ((MYOBJECT *)_object) BEGIN_METHOD(Store, GB_VARIANT value) GB.StoreVariant(ARG(value), &THIS->tag); END_METHOD BEGIN_METHOD_VOID(Restore) // The variant is copied in a temporary place. GB.ReturnVariant(&THIS->tag); // Free the stored variant. // But you can't do it now, because the Variant will // be referenced after the function has returned only. // GB.StoreVariant(NULL, &THIS->tag); END_METHOD --8<------------------------------------------------------- Regards, -- Beno?t Minisini From tobias at ...692... Tue Aug 14 16:10:25 2012 From: tobias at ...692... (Tobias Boege) Date: Tue, 14 Aug 2012 16:10:25 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <502A56FA.809@...1...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> <20120813204039.GB484@...693...> <502A56FA.809@...1...> Message-ID: <20120814141025.GB533@...693...> On Tue, 14 Aug 2012, Beno?t Minisini wrote: > > BEGIN_METHOD(Deque_PushFront, GB_VARIANT value) > > > > void *newval; > > > > GB.Alloc(&newval, sizeof(GB_VARIANT_VALUE)); > > GB.StoreVariant(ARG(value), newval); > > CDEQUE_push_front(THIS, newval); // Just links the copy to the list > > > > END_METHOD > > > > BEGIN_METHOD_VOID(Deque_PopFront) > > > > void *value; > > > > if (CDEQUE_is_empty(THIS)) { > > GB.ReturnNull(); > > return; > > } > > value = CDEQUE_pop_front(THIS); // Retrieves newval from above and > > // deletes the list node > > GB.ReturnVariant(value); > > GB.Free(&value); > > > > END_METHOD > > > > (Don't mind the names ;-)) > > > > Too much english for me in one sole mail. :-) > You haven't had to write it! ;-) > Did you look at how the Collection class has been implemented? > > --> /main/gbx/gbx_c_collection.c > > Or simpler the Variant[] array? > > --> /main/gbx/gbx_c_array.c > The latter, yes. Until this minute, I looked again and saw that all Arrays simply hold the memory they once occupied - kind of optimisation, I think, and necessary as you said below... > They both store and retrieve variants. Or you can look at how the > Control.Tag property in gb.qt4, it's a variant stored inside a > dynamically allocated object. > > --> /gb.qt4/src/CWidget.cpp > > If the Variant is not global, but stored inside a dynamically allocated > C structure, nothing changes: I'll have a look at the other two then. > > --8<------------------------------------------------------- > > // My object > > typedef > struct { > GB_BASE ob; > GB_VARIANT_VALUE tag; > } > MYOBJECT; > > #define THIS ((MYOBJECT *)_object) > > BEGIN_METHOD(Store, GB_VARIANT value) > > GB.StoreVariant(ARG(value), &THIS->tag); > > END_METHOD > > BEGIN_METHOD_VOID(Restore) > > // The variant is copied in a temporary place. > GB.ReturnVariant(&THIS->tag); > > // Free the stored variant. > // But you can't do it now, because the Variant will > // be referenced after the function has returned only. > // GB.StoreVariant(NULL, &THIS->tag); > > END_METHOD > > --8<------------------------------------------------------- > > Regards, > > -- > Beno?t Minisini > _This_ is confusing and may be the error in my code. I thought, the Variant is copied to a temporary place by GB.Return*() (AFAICS this "TEMP" variable. Haven't I once heard that Gambas is not thread-safe? :-)) Why can't I free up my storage of the Variant? Maybe my approach is just too different from what you proposed... What comes to my mind now is this: GB.StoreVariant() refs the Object it takes but it gets never unref'd by my code. If this is true, no wonder why I had memory errors... I can (and actually wanted to) rewrite the code a bit so I can test your suggestion - which is not to try to free the buffer but instead keep it and re-use like the Array classes do. We'll see... Thanks. Regards, Tobi From sebikul at ...176... Tue Aug 14 20:32:51 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Tue, 14 Aug 2012 15:32:51 -0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer Message-ID: Hi! I would first want to note that i'm not a C/C++ developer, although i can easily read the code, so some of the following bugs may be a misunderstanding. I had the crazy idea of compiling gambas (rev 5042) using clang-analyzer [0] to see if it could finds some bugs, and here are some of them (as stated before, some may be invalid) --- File: main/gbc/gbc_read.c Line: 481, 544, 575 Code: car = next_char(); Message: Value stored to 'car' is never read Line: 1073 Code: after -= n; Message: Value stored to 'after' is never read --- File: main/gbc/gbc_output.c Line: 1070 Code: sym = (SYMBOL *)TABLE_get_symbol(Class->table, func->name); Message: Value stored to 'sym' is never read Line: 1087 Code: param = &func->local[j]; Message: Value stored to 'param' is never read --- File: main/gbx /gbx_watch.c Line: 364 Code: pos = ARRAY_count(watch_callback); Message: Value stored to 'pos' is never read Note that this only applies if DEBUG_WATCH is set --- File: gb.jit/jit_runtime.c Line: 524, 518, 430 Value stored to 'variant' is never read Line: 438 Value stored to 'type' is never read Line: 844 Value stored to 'val' during its initialization is never read Line: 430 Value stored to 'result' during its initialization is never read --- There are also a lot of "Dereference of null pointer" bugs but i really don't know what they are ;) If these are valid bugs (and are worth fixing), please let me know so i do a project-wide report. There are a lot of entries on the report, and it has only been run on some of the components! Here are some quick stats: gb.gtk: 18 bugs gb.xml: 4 bugs main: 29 bugs gb.jit: 12 bugs I really hope this helps!! [0] http://clang-analyzer.llvm.org/ From gambas at ...1... Tue Aug 14 20:39:52 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 14 Aug 2012 20:39:52 +0200 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: Message-ID: <502A9B78.6060002@...1...> Le 14/08/2012 20:32, Sebastian Kulesz a ?crit : > Hi! I would first want to note that i'm not a C/C++ developer, > although i can easily read the code, so some of the following bugs may > be a misunderstanding. > > I had the crazy idea of compiling gambas (rev 5042) using > clang-analyzer [0] to see if it could finds some bugs, and here are > some of them (as stated before, some may be invalid) > > --- > File: main/gbc/gbc_read.c > > Line: 481, 544, 575 > Code: car = next_char(); > Message: Value stored to 'car' is never read > > Line: 1073 > Code: after -= n; > Message: Value stored to 'after' is never read > > --- > > File: main/gbc/gbc_output.c > > Line: 1070 > Code: sym = (SYMBOL *)TABLE_get_symbol(Class->table, func->name); > Message: Value stored to 'sym' is never read > > Line: 1087 > Code: param = &func->local[j]; > Message: Value stored to 'param' is never read > > --- > > File: main/gbx /gbx_watch.c > Line: 364 > Code: pos = ARRAY_count(watch_callback); > Message: Value stored to 'pos' is never read > > Note that this only applies if DEBUG_WATCH is set > > --- > > File: gb.jit/jit_runtime.c > Line: 524, 518, 430 > Value stored to 'variant' is never read > > Line: 438 > Value stored to 'type' is never read > > Line: 844 > Value stored to 'val' during its initialization is never read > > Line: 430 > Value stored to 'result' during its initialization is never read > > --- > > There are also a lot of "Dereference of null pointer" bugs but i > really don't know what they are ;) > > If these are valid bugs (and are worth fixing), please let me know so > i do a project-wide report. There are a lot of entries on the report, > and it has only been run on some of the components! Here are some > quick stats: > > gb.gtk: 18 bugs > gb.xml: 4 bugs > main: 29 bugs > gb.jit: 12 bugs > > I really hope this helps!! > Interesting. Can you provide the full output of all warnings? -- Beno?t Minisini From jussi.lahtinen at ...176... Tue Aug 14 20:43:12 2012 From: jussi.lahtinen at ...176... (Jussi Lahtinen) Date: Tue, 14 Aug 2012 21:43:12 +0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: Message-ID: > File: main/gbc/gbc_read.c > > Line: 481, 544, 575 > Code: car = next_char(); > Message: Value stored to 'car' is never read > With quick look, at least these seems to be valid... Nice find! Jussi -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebikul at ...176... Tue Aug 14 20:45:38 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Tue, 14 Aug 2012 15:45:38 -0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: <502A9B78.6060002@...1...> References: <502A9B78.6060002@...1...> Message-ID: On Tue, Aug 14, 2012 at 3:39 PM, Beno?t Minisini wrote: > Le 14/08/2012 20:32, Sebastian Kulesz a ?crit : >> Hi! I would first want to note that i'm not a C/C++ developer, >> although i can easily read the code, so some of the following bugs may >> be a misunderstanding. >> >> I had the crazy idea of compiling gambas (rev 5042) using >> clang-analyzer [0] to see if it could finds some bugs, and here are >> some of them (as stated before, some may be invalid) >> >> --- >> File: main/gbc/gbc_read.c >> >> Line: 481, 544, 575 >> Code: car = next_char(); >> Message: Value stored to 'car' is never read >> >> Line: 1073 >> Code: after -= n; >> Message: Value stored to 'after' is never read >> >> --- >> >> File: main/gbc/gbc_output.c >> >> Line: 1070 >> Code: sym = (SYMBOL *)TABLE_get_symbol(Class->table, func->name); >> Message: Value stored to 'sym' is never read >> >> Line: 1087 >> Code: param = &func->local[j]; >> Message: Value stored to 'param' is never read >> >> --- >> >> File: main/gbx /gbx_watch.c >> Line: 364 >> Code: pos = ARRAY_count(watch_callback); >> Message: Value stored to 'pos' is never read >> >> Note that this only applies if DEBUG_WATCH is set >> >> --- >> >> File: gb.jit/jit_runtime.c >> Line: 524, 518, 430 >> Value stored to 'variant' is never read >> >> Line: 438 >> Value stored to 'type' is never read >> >> Line: 844 >> Value stored to 'val' during its initialization is never read >> >> Line: 430 >> Value stored to 'result' during its initialization is never read >> >> --- >> >> There are also a lot of "Dereference of null pointer" bugs but i >> really don't know what they are ;) >> >> If these are valid bugs (and are worth fixing), please let me know so >> i do a project-wide report. There are a lot of entries on the report, >> and it has only been run on some of the components! Here are some >> quick stats: >> >> gb.gtk: 18 bugs >> gb.xml: 4 bugs >> main: 29 bugs >> gb.jit: 12 bugs >> >> I really hope this helps!! >> > > Interesting. Can you provide the full output of all warnings? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Sure! I removed the "Analyzer Failures" to trim the filesize. Open the index.html, you will find your way. This is only from the main/component. If you need others let me know -------------- next part -------------- A non-text attachment was scrubbed... Name: scan-build-2012-08-14-1.tar.bz2 Type: application/x-bzip2 Size: 337191 bytes Desc: not available URL: From gambas at ...1... Tue Aug 14 20:56:15 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 14 Aug 2012 20:56:15 +0200 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: Message-ID: <502A9F4F.7030405@...1...> Le 14/08/2012 20:43, Jussi Lahtinen a ?crit : > > File: main/gbc/gbc_read.c > > Line: 481, 544, 575 > Code: car = next_char(); > Message: Value stored to 'car' is never read > > > With quick look, at least these seems to be valid... Nice find! > > Jussi > The "is never read" warnings are actually not important and can be safely ignored. I a more interested in "Dereference of null pointer" errors! -- Beno?t Minisini From jussi.lahtinen at ...176... Tue Aug 14 20:56:11 2012 From: jussi.lahtinen at ...176... (Jussi Lahtinen) Date: Tue, 14 Aug 2012 21:56:11 +0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: <502A9B78.6060002@...1...> Message-ID: As I understand at least this is false positive (wrong assumption): CTIMER *timer; 51 52 timer = OBJECT_create_native(CLASS_Timer, NULL); 53 OBJECT_REF(timer, "CTIMER_every"){ if (timer) ((OBJECT *)(timer))->ref++; }; 1 Within the expansion of the macro 'OBJECT_REF': a Assuming 'timer' is null 54 timer->callback = callback; 2 Access to field 'callback' results in a dereference of a null pointer (loaded from variable 'timer') But anyway this code analyzer looks very promising. Jussi On 14 August 2012 21:45, Sebastian Kulesz wrote: > On Tue, Aug 14, 2012 at 3:39 PM, Beno?t Minisini > wrote: > > Le 14/08/2012 20:32, Sebastian Kulesz a ?crit : > >> Hi! I would first want to note that i'm not a C/C++ developer, > >> although i can easily read the code, so some of the following bugs may > >> be a misunderstanding. > >> > >> I had the crazy idea of compiling gambas (rev 5042) using > >> clang-analyzer [0] to see if it could finds some bugs, and here are > >> some of them (as stated before, some may be invalid) > >> > >> --- > >> File: main/gbc/gbc_read.c > >> > >> Line: 481, 544, 575 > >> Code: car = next_char(); > >> Message: Value stored to 'car' is never read > >> > >> Line: 1073 > >> Code: after -= n; > >> Message: Value stored to 'after' is never read > >> > >> --- > >> > >> File: main/gbc/gbc_output.c > >> > >> Line: 1070 > >> Code: sym = (SYMBOL *)TABLE_get_symbol(Class->table, func->name); > >> Message: Value stored to 'sym' is never read > >> > >> Line: 1087 > >> Code: param = &func->local[j]; > >> Message: Value stored to 'param' is never read > >> > >> --- > >> > >> File: main/gbx /gbx_watch.c > >> Line: 364 > >> Code: pos = ARRAY_count(watch_callback); > >> Message: Value stored to 'pos' is never read > >> > >> Note that this only applies if DEBUG_WATCH is set > >> > >> --- > >> > >> File: gb.jit/jit_runtime.c > >> Line: 524, 518, 430 > >> Value stored to 'variant' is never read > >> > >> Line: 438 > >> Value stored to 'type' is never read > >> > >> Line: 844 > >> Value stored to 'val' during its initialization is never read > >> > >> Line: 430 > >> Value stored to 'result' during its initialization is never read > >> > >> --- > >> > >> There are also a lot of "Dereference of null pointer" bugs but i > >> really don't know what they are ;) > >> > >> If these are valid bugs (and are worth fixing), please let me know so > >> i do a project-wide report. There are a lot of entries on the report, > >> and it has only been run on some of the components! Here are some > >> quick stats: > >> > >> gb.gtk: 18 bugs > >> gb.xml: 4 bugs > >> main: 29 bugs > >> gb.jit: 12 bugs > >> > >> I really hope this helps!! > >> > > > > Interesting. Can you provide the full output of all warnings? > > > > -- > > Beno?t Minisini > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Gambas-devel mailing list > > Gambas-devel at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > Sure! > > I removed the "Analyzer Failures" to trim the filesize. Open the > index.html, you will find your way. This is only from the > main/component. If you need others let me know > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jussi.lahtinen at ...176... Tue Aug 14 20:59:45 2012 From: jussi.lahtinen at ...176... (Jussi Lahtinen) Date: Tue, 14 Aug 2012 21:59:45 +0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: <502A9F4F.7030405@...1...> References: <502A9F4F.7030405@...1...> Message-ID: Yes, I know (unless assertion is from some heavy function, then it is way to optimize). It was too early excitement about working code analyzer (my experiences are not very good). Jussi On 14 August 2012 21:56, Beno?t Minisini wrote: > Le 14/08/2012 20:43, Jussi Lahtinen a ?crit : > > > > File: main/gbc/gbc_read.c > > > > Line: 481, 544, 575 > > Code: car = next_char(); > > Message: Value stored to 'car' is never read > > > > > > With quick look, at least these seems to be valid... Nice find! > > > > Jussi > > > > The "is never read" warnings are actually not important and can be > safely ignored. > > I a more interested in "Dereference of null pointer" errors! > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jussi.lahtinen at ...176... Tue Aug 14 21:03:40 2012 From: jussi.lahtinen at ...176... (Jussi Lahtinen) Date: Tue, 14 Aug 2012 22:03:40 +0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: <502A9F4F.7030405@...1...> Message-ID: I must take that back... many of them work, they are just so damn bothersome with all the false positives! Jussi On 14 August 2012 21:59, Jussi Lahtinen wrote: > Yes, I know (unless assertion is from some heavy function, then it is way > to optimize). > It was too early excitement about working code analyzer (my experiences > are not very good). > > Jussi > > > > > On 14 August 2012 21:56, Beno?t Minisini wrote: > >> Le 14/08/2012 20:43, Jussi Lahtinen a ?crit : >> > >> > File: main/gbc/gbc_read.c >> > >> > Line: 481, 544, 575 >> > Code: car = next_char(); >> > Message: Value stored to 'car' is never read >> > >> > >> > With quick look, at least these seems to be valid... Nice find! >> > >> > Jussi >> > >> >> The "is never read" warnings are actually not important and can be >> safely ignored. >> >> I a more interested in "Dereference of null pointer" errors! >> >> -- >> Beno?t Minisini >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebikul at ...176... Tue Aug 14 21:04:10 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Tue, 14 Aug 2012 16:04:10 -0300 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: <502A9F4F.7030405@...1...> Message-ID: On Tue, Aug 14, 2012 at 3:59 PM, Jussi Lahtinen wrote: > Yes, I know (unless assertion is from some heavy function, then it is way to > optimize). > It was too early excitement about working code analyzer (my experiences are > not very good). > > Jussi > > > > > On 14 August 2012 21:56, Beno?t Minisini > wrote: >> >> Le 14/08/2012 20:43, Jussi Lahtinen a ?crit : >> > >> > File: main/gbc/gbc_read.c >> > >> > Line: 481, 544, 575 >> > Code: car = next_char(); >> > Message: Value stored to 'car' is never read >> > >> > >> > With quick look, at least these seems to be valid... Nice find! >> > >> > Jussi >> > >> >> The "is never read" warnings are actually not important and can be >> safely ignored. >> >> I a more interested in "Dereference of null pointer" errors! >> >> -- >> Beno?t Minisini >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > Here are some components that have "Dereference of null pointer" errors gb.xml -> This one has a different error: Undefined allocation of 0 bytes (CERT MEM04-C; CWE-131) gb.gtk gb.qt4 -------------- next part -------------- A non-text attachment was scrubbed... Name: scan-build-2012-08-14-4.tar.bz2 Type: application/x-bzip2 Size: 18788 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: scan-build-2012-08-14-5.tar.bz2 Type: application/x-bzip2 Size: 164138 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: scan-build-2012-08-14-6.tar.bz2 Type: application/x-bzip2 Size: 44103 bytes Desc: not available URL: From emil.lenngren at ...176... Tue Aug 14 21:33:30 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Tue, 14 Aug 2012 21:33:30 +0200 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: <502A9F4F.7030405@...1...> Message-ID: clang-analyzer seems to analyse on a per-file basis. It's impossible to write an analyser that only analyses per-file basis that doesn't report false positives. You need a whole-program-analyser for that. /Emil 2012/8/14 Sebastian Kulesz > On Tue, Aug 14, 2012 at 3:59 PM, Jussi Lahtinen > wrote: > > Yes, I know (unless assertion is from some heavy function, then it is > way to > > optimize). > > It was too early excitement about working code analyzer (my experiences > are > > not very good). > > > > Jussi > > > > > > > > > > On 14 August 2012 21:56, Beno?t Minisini > > wrote: > >> > >> Le 14/08/2012 20:43, Jussi Lahtinen a ?crit : > >> > > >> > File: main/gbc/gbc_read.c > >> > > >> > Line: 481, 544, 575 > >> > Code: car = next_char(); > >> > Message: Value stored to 'car' is never read > >> > > >> > > >> > With quick look, at least these seems to be valid... Nice find! > >> > > >> > Jussi > >> > > >> > >> The "is never read" warnings are actually not important and can be > >> safely ignored. > >> > >> I a more interested in "Dereference of null pointer" errors! > >> > >> -- > >> Beno?t Minisini > >> > >> > >> > ------------------------------------------------------------------------------ > >> Live Security Virtual Conference > >> Exclusive live event will cover all the ways today's security and > >> threat landscape has changed and how IT managers can respond. > Discussions > >> will include endpoint security, mobile security and the latest in > malware > >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >> _______________________________________________ > >> Gambas-devel mailing list > >> Gambas-devel at lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > > > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Gambas-devel mailing list > > Gambas-devel at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > > Here are some components that have "Dereference of null pointer" errors > > gb.xml -> This one has a different error: Undefined allocation of 0 > bytes (CERT MEM04-C; CWE-131) > gb.gtk > gb.qt4 > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adrien.prokopowicz at ...176... Tue Aug 14 23:14:10 2012 From: adrien.prokopowicz at ...176... (Adrien Prokopowicz) Date: Tue, 14 Aug 2012 23:14:10 +0200 Subject: [Gambas-devel] Compiling gambas using clang-analyzer In-Reply-To: References: Message-ID: <1412101.1cjdZsizlU@...707...> Le mardi 14 ao?t 2012 16:04:10 Sebastian Kulesz a ?crit : > On Tue, Aug 14, 2012 at 3:59 PM, Jussi Lahtinen > > wrote: > > Yes, I know (unless assertion is from some heavy function, then it is way > > to optimize). > > It was too early excitement about working code analyzer (my experiences > > are > > not very good). > > > > Jussi > > > > > > > > > > On 14 August 2012 21:56, Beno?t Minisini > > > > wrote: > >> Le 14/08/2012 20:43, Jussi Lahtinen a ?crit : > >> > File: main/gbc/gbc_read.c > >> > > >> > Line: 481, 544, 575 > >> > Code: car = next_char(); > >> > Message: Value stored to 'car' is never read > >> > > >> > With quick look, at least these seems to be valid... Nice find! > >> > > >> > Jussi > >> > >> The "is never read" warnings are actually not important and can be > >> safely ignored. > >> > >> I a more interested in "Dereference of null pointer" errors! > >> > >> -- > >> Beno?t Minisini > >> > >> > >> ------------------------------------------------------------------------- > >> ----- Live Security Virtual Conference > >> Exclusive live event will cover all the ways today's security and > >> threat landscape has changed and how IT managers can respond. Discussions > >> will include endpoint security, mobile security and the latest in malware > >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >> _______________________________________________ > >> Gambas-devel mailing list > >> Gambas-devel at lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > > -------------------------------------------------------------------------- > > ---- Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Gambas-devel mailing list > > Gambas-devel at lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/gambas-devel > > Here are some components that have "Dereference of null pointer" errors > > gb.xml -> This one has a different error: Undefined allocation of 0 > bytes (CERT MEM04-C; CWE-131) > gb.gtk > gb.qt4 Hi, The 4 errors in gb.xml seems to be false positives. The analyzer points out that 0 can be passed at memory allocation size. The warning would be valid for malloc, but not for realloc (used here) : if 0 is passed to realloc(), the memory is freed, and a NULL pointer is returned. This behaviour is intended. But this tool can be useful, I'll keep it in mind. :-) Regards, Adrien. From tobias at ...692... Fri Aug 17 17:36:38 2012 From: tobias at ...692... (Tobias Boege) Date: Fri, 17 Aug 2012 17:36:38 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <20120814141025.GB533@...693...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> <20120813204039.GB484@...693...> <502A56FA.809@...1...> <20120814141025.GB533@...693...> Message-ID: <20120817153638.GA947@...693...> On Tue, 14 Aug 2012, Tobias Boege wrote: > > BEGIN_METHOD_VOID(Restore) > > > > // The variant is copied in a temporary place. > > GB.ReturnVariant(&THIS->tag); > > > > // Free the stored variant. > > // But you can't do it now, because the Variant will > > // be referenced after the function has returned only. > > // GB.StoreVariant(NULL, &THIS->tag); > > > > END_METHOD > > > > --8<------------------------------------------------------- > > > > Regards, > > > > -- > > Beno?t Minisini > > > > _This_ is confusing and may be the error in my code. I thought, the Variant > is copied to a temporary place by GB.Return*() (AFAICS this "TEMP" variable. > Haven't I once heard that Gambas is not thread-safe? :-)) > Why can't I free up my storage of the Variant? > Maybe my approach is just too different from what you proposed... What comes > to my mind now is this: GB.StoreVariant() refs the Object it takes but it > gets never unref'd by my code. If this is true, no wonder why I had memory > errors... > > I can (and actually wanted to) rewrite the code a bit so I can test your > suggestion - which is not to try to free the buffer but instead keep it and > re-use like the Array classes do. We'll see... Thanks. > > Regards, > Tobi OK, recalling the Socket class I apparently found a method to do this properly: I GB.Post() my destruction function. This works perfectly and is - I hope - correct. Commit coming soon. Regards, Tobi From gambas at ...1... Fri Aug 17 17:48:27 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 17 Aug 2012 17:48:27 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <20120817153638.GA947@...693...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> <20120813204039.GB484@...693...> <502A56FA.809@...1...> <20120814141025.GB533@...693...> <20120817153638.GA947@...693...> Message-ID: <502E67CB.4080506@...1...> Le 17/08/2012 17:36, Tobias Boege a ?crit : > On Tue, 14 Aug 2012, Tobias Boege wrote: >>> BEGIN_METHOD_VOID(Restore) >>> >>> // The variant is copied in a temporary place. >>> GB.ReturnVariant(&THIS->tag); >>> >>> // Free the stored variant. >>> // But you can't do it now, because the Variant will >>> // be referenced after the function has returned only. >>> // GB.StoreVariant(NULL, &THIS->tag); >>> >>> END_METHOD >>> >>> --8<------------------------------------------------------- >>> >>> Regards, >>> >>> -- >>> Beno?t Minisini >>> >> >> _This_ is confusing and may be the error in my code. I thought, the Variant >> is copied to a temporary place by GB.Return*() (AFAICS this "TEMP" variable. >> Haven't I once heard that Gambas is not thread-safe? :-)) >> Why can't I free up my storage of the Variant? >> Maybe my approach is just too different from what you proposed... What comes >> to my mind now is this: GB.StoreVariant() refs the Object it takes but it >> gets never unref'd by my code. If this is true, no wonder why I had memory >> errors... >> >> I can (and actually wanted to) rewrite the code a bit so I can test your >> suggestion - which is not to try to free the buffer but instead keep it and >> re-use like the Array classes do. We'll see... Thanks. >> >> Regards, >> Tobi > > OK, recalling the Socket class I apparently found a method to do this > properly: I GB.Post() my destruction function. This works perfectly and is - > I hope - correct. > > Commit coming soon. > > Regards, > Tobi > That hack won't work if you don't have an event loop. And it's an horrible hack. :-) What you need is something like what has been used in the implementation of the Array.Pop() method : that method returns something that must be freed. That needs some new stuff in the interpreter API. But at the moment I'm not sure how I will do that, so you must wait a little! Regards, -- Beno?t Minisini From tobias at ...692... Fri Aug 17 18:05:14 2012 From: tobias at ...692... (Tobias Boege) Date: Fri, 17 Aug 2012 18:05:14 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <502E67CB.4080506@...1...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> <20120813204039.GB484@...693...> <502A56FA.809@...1...> <20120814141025.GB533@...693...> <20120817153638.GA947@...693...> <502E67CB.4080506@...1...> Message-ID: <20120817160514.GB947@...693...> On Fri, 17 Aug 2012, Beno?t Minisini wrote: > Le 17/08/2012 17:36, Tobias Boege a ?crit : > > On Tue, 14 Aug 2012, Tobias Boege wrote: > >>> BEGIN_METHOD_VOID(Restore) > >>> > >>> // The variant is copied in a temporary place. > >>> GB.ReturnVariant(&THIS->tag); > >>> > >>> // Free the stored variant. > >>> // But you can't do it now, because the Variant will > >>> // be referenced after the function has returned only. > >>> // GB.StoreVariant(NULL, &THIS->tag); > >>> > >>> END_METHOD > >>> > >>> --8<------------------------------------------------------- > >>> > >>> Regards, > >>> > >>> -- > >>> Beno?t Minisini > >>> > >> > >> _This_ is confusing and may be the error in my code. I thought, the Variant > >> is copied to a temporary place by GB.Return*() (AFAICS this "TEMP" variable. > >> Haven't I once heard that Gambas is not thread-safe? :-)) > >> Why can't I free up my storage of the Variant? > >> Maybe my approach is just too different from what you proposed... What comes > >> to my mind now is this: GB.StoreVariant() refs the Object it takes but it > >> gets never unref'd by my code. If this is true, no wonder why I had memory > >> errors... > >> > >> I can (and actually wanted to) rewrite the code a bit so I can test your > >> suggestion - which is not to try to free the buffer but instead keep it and > >> re-use like the Array classes do. We'll see... Thanks. > >> > >> Regards, > >> Tobi > > > > OK, recalling the Socket class I apparently found a method to do this > > properly: I GB.Post() my destruction function. This works perfectly and is - > > I hope - correct. > > > > Commit coming soon. > > > > Regards, > > Tobi > > > > That hack won't work if you don't have an event loop. And it's an > horrible hack. :-) > > What you need is something like what has been used in the implementation > of the Array.Pop() method : that method returns something that must be > freed. > > That needs some new stuff in the interpreter API. > > But at the moment I'm not sure how I will do that, so you must wait a > little! > > Regards, > > -- > Beno?t Minisini > There is a question I wanted to ask after I commited but as it certainly comes from this "horrible hack": I noticed that with the above method I get objects which I put in a Stack or Queue (and never popped or dequeued in order to test their self-cleanup functions) destroyed *really* late, not to say at program termination. This would be one outcome of the missing event loop, most probably. It worked so far and I don't fear changing it later in favour of something better. Hmm, well, Array.Pop() certainly does its job but I thought _this_ would be a hack. It is nebulous to me what it does after GB.ReturnPtr() and why but I will dig deeper into the right way once the code is up. Regards, Tobi From gambas at ...1... Fri Aug 17 18:15:24 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 17 Aug 2012 18:15:24 +0200 Subject: [Gambas-devel] Store GB_VARIANT in memory In-Reply-To: <20120817160514.GB947@...693...> References: <20120811171308.GB526@...693...> <50295C52.50307@...1...> <20120813204039.GB484@...693...> <502A56FA.809@...1...> <20120814141025.GB533@...693...> <20120817153638.GA947@...693...> <502E67CB.4080506@...1...> <20120817160514.GB947@...693...> Message-ID: <502E6E1C.1020709@...1...> Le 17/08/2012 18:05, Tobias Boege a ?crit : > On Fri, 17 Aug 2012, Beno?t Minisini wrote: >> Le 17/08/2012 17:36, Tobias Boege a ?crit : >>> On Tue, 14 Aug 2012, Tobias Boege wrote: >>>>> BEGIN_METHOD_VOID(Restore) >>>>> >>>>> // The variant is copied in a temporary place. >>>>> GB.ReturnVariant(&THIS->tag); >>>>> >>>>> // Free the stored variant. >>>>> // But you can't do it now, because the Variant will >>>>> // be referenced after the function has returned only. >>>>> // GB.StoreVariant(NULL, &THIS->tag); >>>>> >>>>> END_METHOD >>>>> >>>>> --8<------------------------------------------------------- >>>>> >>>>> Regards, >>>>> >>>>> -- >>>>> Beno?t Minisini >>>>> >>>> >>>> _This_ is confusing and may be the error in my code. I thought, the Variant >>>> is copied to a temporary place by GB.Return*() (AFAICS this "TEMP" variable. >>>> Haven't I once heard that Gambas is not thread-safe? :-)) >>>> Why can't I free up my storage of the Variant? >>>> Maybe my approach is just too different from what you proposed... What comes >>>> to my mind now is this: GB.StoreVariant() refs the Object it takes but it >>>> gets never unref'd by my code. If this is true, no wonder why I had memory >>>> errors... >>>> >>>> I can (and actually wanted to) rewrite the code a bit so I can test your >>>> suggestion - which is not to try to free the buffer but instead keep it and >>>> re-use like the Array classes do. We'll see... Thanks. >>>> >>>> Regards, >>>> Tobi >>> >>> OK, recalling the Socket class I apparently found a method to do this >>> properly: I GB.Post() my destruction function. This works perfectly and is - >>> I hope - correct. >>> >>> Commit coming soon. >>> >>> Regards, >>> Tobi >>> >> >> That hack won't work if you don't have an event loop. And it's an >> horrible hack. :-) >> >> What you need is something like what has been used in the implementation >> of the Array.Pop() method : that method returns something that must be >> freed. >> >> That needs some new stuff in the interpreter API. >> >> But at the moment I'm not sure how I will do that, so you must wait a >> little! >> >> Regards, >> >> -- >> Beno?t Minisini >> > > There is a question I wanted to ask after I commited but as it certainly > comes from this "horrible hack": I noticed that with the above method I get > objects which I put in a Stack or Queue (and never popped or dequeued in > order to test their self-cleanup functions) destroyed *really* late, not > to say at program termination. This would be one outcome of the missing > event loop, most probably. > It worked so far and I don't fear changing it later in favour of something > better. Hmm, well, Array.Pop() certainly does its job but I thought _this_ > would be a hack. It is nebulous to me what it does after GB.ReturnPtr() and > why but I will dig deeper into the right way once the code is up. > > Regards, > Tobi > The returned value is referenced when put on the caller stack after the function have actually returned. So if you release it just after the call to GB.ReturnXXX(), you actually free it before the interpreter sees it! So the trick is using two functions: "Borrow", that references a value, and "Unborrow", that dereferences it without freeing it (as we know that the return value will be reference later). So it will be a matter of writing something like that: BEGIN_METHOD_VOID(Restore) // The variant is copied in a temporary place. GB.ReturnVariant(&THIS->tag); // Unreference the variant without freeing it, and put NULL // inside the tag. I call the method "Release" and not "Borrow". GB.ReleaseVariant(&THIS->tag); END_METHOD For coherency, I should add a GB.ReleaseObject() and GB.ReleaseString() method. I will tell you when this is done. -- Beno?t Minisini From gambas at ...1... Sat Aug 18 13:32:52 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 18 Aug 2012 13:32:52 +0200 Subject: [Gambas-devel] About gb.adt Message-ID: <502F7D64.9090906@...1...> Hi, Tobias, I never told you, but you never told me exactly what you was doing... :-) If a component depends on no other shared library than the shared library already used by the interpreter (libc, libm, libpthread, libffi), then its source code must be located in the '/trunk/main/lib' directory. Because it's one less "configure" to run! Regards, -- Beno?t Minisini From tobias at ...692... Sat Aug 18 14:49:38 2012 From: tobias at ...692... (Tobias Boege) Date: Sat, 18 Aug 2012 14:49:38 +0200 Subject: [Gambas-devel] About gb.adt In-Reply-To: <502F7D64.9090906@...1...> References: <502F7D64.9090906@...1...> Message-ID: <20120818124938.GB520@...693...> On Sat, 18 Aug 2012, Beno?t Minisini wrote: > Hi, Tobias, > > I never told you, but you never told me exactly what you was doing... :-) > > If a component depends on no other shared library than the shared > library already used by the interpreter (libc, libm, libpthread, > libffi), then its source code must be located in the '/trunk/main/lib' > directory. Because it's one less "configure" to run! > > Regards, > > -- > Beno?t Minisini > Hmm, see my last paragraph in the accouncement at gambas-user :-) I will be back this evening and move the stuff in there. Regards, Tobi From gambas at ...1... Sun Aug 19 21:20:45 2012 From: gambas at ...1... (=?UTF-8?B?QmVub8OudCBNaW5pc2luaQ==?=) Date: Sun, 19 Aug 2012 21:20:45 +0200 Subject: [Gambas-devel] [Gambas-user] gb.adt component In-Reply-To: <20120818124717.GA520@...693...> References: <20120818124717.GA520@...693...> Message-ID: <50313C8D.6050608@...1...> Le 18/08/2012 14:47, Tobias Boege a ?crit : > Hi, > > as of rev5052 you will notice a new gb.adt component as a playground for > abstract datatypes implementations. > I had most of the algorithms already lying around from another project. > Everything is, however, written from scratch and the code depends on nothing > but the C library. > > Only hurdle was to incorporate the algorithms into the Gambas memory > management: You can imagine, that it is tricky to implement circular > double-linked lists of objects without creating circular references on the > list nodes. > > The implementation of linked lists features two new classes: > - List, which represents a single list node. Technically speaking this list > node is a fully capable linked list itself because it is linked to itself. > - ListRoot which is just a List object marked special so that special > properties can be applied to it. > > About List: > The first I want to state is that List nodes can be either used standalone > and created to _carry_ an object or they can be embedded into a new class > and _be carried_ by the object. You must tell the List constructor what kind > of mode your List node shall perform in. This is important because an > embedded List node which references its container creates unresolvable > circular references - which we don't want - otherwise a non-embedded list > nodes which does not reference its linked object may see the latter vanish > away because of its reference count becoming zero - not good either. > > List nodes have a Next-element, Prev-element and Data-element pointer. As > said above, they are linked lists itself because initially their Next and > Prev pointers point to themselves. > Note carefully that the List.Add*() functions add _entire lists_. This is > normally not a problem because most people will add one node (which is > linked to itself into an empty list) but it is also possible to: > > ' List1 -> List2 > List1.AddAfter(List2) > > ' GlobalList -> List1 -> List2 > GlobalList.AddAfter(List1) > > As far as a List node is in a non-empty list (i.e. a list which is not only > made up of itself), it gets a reference count. By the nature of circular > linked lists, this creates circular references. Consequently, if you create > a list, you must tidy it up by means of List.Clear() or differently, > depending on your application. > > As imaginable with circular double-linked lists, you can do everything from > any node in the list: Add new lists/nodes, traverse the list, clear the > list, enumerate all objects in a list, unlink single nodes, extract lists > from others, etc.. > > About ListRoot: > Don't fear the ListRoot because it is the means I intended to solve the > memory obstacle of circular references. Actually ListRoot may be a > misleading name (help me native speakers!). ListRoot semantics differ from > normal List nodes in the following details: > > - ListRoots don't carry data > - In a 'For Each data In List' they are skipped (s.a.) > - When linked in a list they get _no_ reference count. > - They cannot be linked to a list but the list must be linked to them. This > helps prevent multiple ListRoots in a List infrastructure. > > You got the two main reasons for which the List and ListRoot classes are > native now: I play tricks with reference counts (with embedded Lists and > ListRoots). > If you like to adhere to just two constraints you can have your lists be > tidied up for you automatically: > 1. Link a ListRoot to your list (the For-Each detail above tries to hide the > presence of ListRoot from your normal work) > 2. Always keep the ListRoot in a variable as long as you want the list to be > existent. When the ListRoot leaves scope, is thus freed, it calls > List.Clear() in its _free() special method so that all List nodes are > freed properly. It is possible for a linked ListRoot to get a zero > reference count because it just doesn't get a ref when in a list - in > contrast to normal List nodes, as stated above. > > You will see how it works in the attached test project. > > Bruce, I hope you will never have to write linked lists from scratch > anymore ;-) Tell me if the current implementation is useful if you find > time. > > Next are the classes Deque, Stack, Queue and PrioQueue (priority queue) > which are quite self-explanatory and nothing special. Except, maybe, that > they are built on top of the List interface so you can decide if you need to > maintain highly dynamic sort of Deque (use my implementation) or a > fixed-size one (use Variant[] then). > > Last so far is the Circular class. It provides a fixed-size circular/ring > buffer with one reader and one writer. > > I invite you to try these classes out. Report problems and suggestions. I > haven't read this Knuth so alternate ideas and interfaces are likely to be > around and are welcome! > > Beno?t, there is a datastructure CLIST_INTF declared in gb.adt/src/c_list.h. > I have not yet worried about GB.GetInterface() or something so please excuse > me taking an unduly independent line. I saw that there already is a > rudimentary linked list in main/share/gb_list_temp.h. I personally use > linked lists quite often and thought it could be part of the interpreter API > just as Memory and Gambas arrays are. What do you think about that? > > Regards, > Tobi > Hi Tobi, If Deque, Stack... classes can be useful, I'm not sure about your List and ListRoot classes. I think you tried to mimic in Gambas the way linked list are implemented in C: consequently, the Gambas interface is over-complicated. First, you must know that linked list are far less useful nowadays. As they trash the CPU cache, using an array is way faster, the speed gain usually compensating the need for reallocation. Bet let's ignore that point. I think a List class should have the following interface: - Create a new List. (_new) - Put one Variant at the beginning. (Add / Append) - Put one Variant at the end. (Prepend) - Enumerate the contents. (_next) - Have an internal cursor, on which we could do a MoveNext() and MovePrevious(). (MoveNext, MovePrevious, MoveFirst, MoveLast). - Have a current item, and be allow to retrieve it. (Current) - A Count property. (Count) - An array method to retrieve the i-th element (slowly of course). (_get), and eventually to modify it (_put) - Take the current element from the list (i.e. removing it from the list and returning it). (Take) - Find a value inside the list. (Find or FindFirst, maybe FindLast too) - Find a value from the current one, forward or backward. (FindNext, FindPrevious). Internally, the List can be managed with a double-linked list of nodes, each node having a GB_VARIANT_VALUE inside. But, for performance reasons, it can later be implemented as a double-linked list of arrays of Variant. Faster, but harder to implement. As for "embedding" the list inside an object, i.e. doing what we usually do in C, I think I understood what you want to do, but I don't think it is really useful in Gambas. The only advantage I see is being able to find the next (or previous) object of the list as soon as you have a reference on the object. Which is not possible with the previous List class. To do that, maybe I would create another class (something like 'StaticList'). But anyway it will not be easy to have a practical interface! As for having a list interface in the interpreter API: why not. But it would be done if this is really useful, as implementation of linked list is done in a few lines of codes, and usually need to be adapted for performance reasons. Anyway see '/trunk/main/share/gb_list.h' and '/trunk/main/share/gb_list_temp.h', which is my own implementation of embedded linked lists in C. So tell me what you think. Regards, -- Beno?t Minisini From tobias at ...692... Sun Aug 19 23:28:01 2012 From: tobias at ...692... (Tobias Boege) Date: Sun, 19 Aug 2012 23:28:01 +0200 Subject: [Gambas-devel] [Gambas-user] gb.adt component In-Reply-To: <50313C8D.6050608@...1...> References: <20120818124717.GA520@...693...> <50313C8D.6050608@...1...> Message-ID: <20120819212800.GA515@...693...> On Sun, 19 Aug 2012, Beno??t Minisini wrote: > Hi Tobi, > > If Deque, Stack... classes can be useful, I'm not sure about your List > and ListRoot classes. > > I think you tried to mimic in Gambas the way linked list are implemented > in C: consequently, the Gambas interface is over-complicated. > Could be. I strived after the least possible constraints on how to use the List class. ListRoot is just there to automate cleanup. It may got complicated at the surface... > First, you must know that linked list are far less useful nowadays. As > they trash the CPU cache, using an array is way faster, the speed gain > usually compensating the need for reallocation. Bet let's ignore that point. > This information is absolutely new to me - but makes sense! > I think a List class should have the following interface: > - Create a new List. (_new) > - Put one Variant at the beginning. (Add / Append) > - Put one Variant at the end. (Prepend) > - Enumerate the contents. (_next) > - Have an internal cursor, on which we could do a MoveNext() and > MovePrevious(). (MoveNext, MovePrevious, MoveFirst, MoveLast). > - Have a current item, and be allow to retrieve it. (Current) > - A Count property. (Count) > - An array method to retrieve the i-th element (slowly of course). > (_get), and eventually to modify it (_put) > - Take the current element from the list (i.e. removing it from the list > and returning it). (Take) > - Find a value inside the list. (Find or FindFirst, maybe FindLast too) > - Find a value from the current one, forward or backward. (FindNext, > FindPrevious). So we would rather see the 'List' class as a full list and not, as I did, a single list node at a time. This will certainly ease handling - at the cost of some power. But hey: Gambas is not C. Would be good to hear from other Gambas programmers what they would expect a linked list implementation to look like. > > Internally, the List can be managed with a double-linked list of nodes, > each node having a GB_VARIANT_VALUE inside. > > But, for performance reasons, it can later be implemented as a > double-linked list of arrays of Variant. Faster, but harder to implement. > This sounds cool! Never heard of such a hybrid approach... > As for "embedding" the list inside an object, i.e. doing what we usually > do in C, I think I understood what you want to do, but I don't think it > is really useful in Gambas. > This embedding was the whole OO idea behind the thing. Sure, this would be useless if we see a List as a whole and not let the programmer touch 'list nodes'. The above proposition for List methods and stuff really looks Gambas-like and so does the idea to not have 'list node' classes but I would probably miss some of the flexibility then. Again, others' opinions would be interesting but essentially I am not averse to this interface... > The only advantage I see is being able to find the next (or previous) > object of the list as soon as you have a reference on the object. Which > is not possible with the previous List class. > All operations on the list are valid from every node in the list. If you embed a list node into a class you have all opportunities to operate on the full list as long as you have a random object linked to this list flying around in your current scope. It could be considered bad style but I can imagine cases for this feature being really handy. These can also be worked around, sure. > To do that, maybe I would create another class (something like > 'StaticList'). But anyway it will not be easy to have a practical interface! > I don't get the context. 'StaticList' for embedded nodes? Then we have the mentality of acting on individual nodes again, instead of the list as a whole - we can cancel that 'Current' property from above and the like. It would be pretty much like the current implementation, I think. Except that having two different list classes could help unscramble source code. If it is o.k. to have two distinct list classes - always assuming I got your statements right -, both could be tuned to their special usage. This way it _may_ be possible to reduce code size and complexity. > As for having a list interface in the interpreter API: why not. But it > would be done if this is really useful, as implementation of linked list > is done in a few lines of codes, and usually need to be adapted for > performance reasons. Anyway see '/trunk/main/share/gb_list.h' > and '/trunk/main/share/gb_list_temp.h', which is my own implementation > of embedded linked lists in C. > Yes, I mentioned that I saw these files and they are really damn cunning from a performance point of view - I think so, never tested - similar to what the Linux kernel does with its container_of() macro if I got it right. Albeit you need to pass additional parameters to each invocation of the functions to compute the location of the list structure. Too, IMHO, it is not a really clean and comfortable design - but no objection since it may be more efficient than the cleaner data-pointer way. BTW, do you arrange in LIST_for_each() that only structures with a statically allocated field "LIST list" can be enumerated? My point here is that gb_list_temp.h is not universal. You mean that the implementation that could go into the API must be optimised for performance; we need not just take the C backend of the Gambas List class but have an optimised version...? If we go the way without a data pointer in the list struct - as it seems -, the container_of() approach will be considerably faster though internally different because LIST will link to another LIST, not to another container struct... Feasible if need be. But, these are all wasted considerations, as you said, if there is just no need to include a List API at the moment. I most probably won't need any for gb.ncurses and the last I want is to bloat the interpreter. The above paragraphs do not count either if there is no point in improving the current gb_list_temp.h to be more universal. Regards, Tobi From sebikul at ...176... Thu Aug 23 01:54:07 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Wed, 22 Aug 2012 20:54:07 -0300 Subject: [Gambas-devel] Daily PPA build fails on lucid Message-ID: Hi! I have been getting some build errors on the Ubuntu Lucid daily build. The logs can be found here [0], just click "buildlog" under the failed builds (no launchpad account needed). Due to launchpad issues, i'm not able to request any build, as they are moving the infrastructure and have a queue of 1200 builds (13 hours). The svn revision used to build the package can be calculated using the revno on its name +1105 (Due to a bug on how source packages are built, i can't yet use the real revision). PS: I updated the PPA package so the new gb.adt component is included on every supported Ubuntu version, and fixed the man pages. They were really outdated, some options where causing segfaults or where even recently replaced (They may also be included upstream) [0] https://code.launchpad.net/~sebikul/+recipe/gambas3-daily-lucid From gambas at ...1... Thu Aug 23 09:09:06 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 23 Aug 2012 09:09:06 +0200 Subject: [Gambas-devel] Daily PPA build fails on lucid In-Reply-To: References: Message-ID: <5035D712.5090406@...1...> Le 23/08/2012 01:54, Sebastian Kulesz a ?crit : > Hi! I have been getting some build errors on the Ubuntu Lucid daily > build. The logs can be found here [0], just click "buildlog" under the > failed builds (no launchpad account needed). Due to launchpad issues, > i'm not able to request any build, as they are moving the > infrastructure and have a queue of 1200 builds (13 hours). > > The svn revision used to build the package can be calculated using the > revno on its name +1105 (Due to a bug on how source packages are > built, i can't yet use the real revision). > > PS: I updated the PPA package so the new gb.adt component is included > on every supported Ubuntu version, and fixed the man pages. They were > really outdated, some options where causing segfaults or where even > recently replaced (They may also be included upstream) > > [0] https://code.launchpad.net/~sebikul/+recipe/gambas3-daily-lucid > The last one compiles correctly, doesn't it? What man pages are you talking about? -- Beno?t Minisini From gambas at ...1... Thu Aug 23 22:12:57 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 23 Aug 2012 22:12:57 +0200 Subject: [Gambas-devel] About gb.adt (2) Message-ID: <50368EC9.6000703@...1...> Hi Tobi, A few thoughts about gb.adt. I don't know if you have rewritten the List class yet. I don't like the "gb.adt" name. Why "abstract datatypes"? They are not abstract at all. The english wikipedia names all these sorts of things (trees, maps, lists...) just "data structures". Maybe you could rename the component "gb.data" then. Because "gb.datastructure" is too long, and because "gb.ds" is too short. :-) And then you become a very nice guy and make a wonderful implementation of red-black trees for all of us. ;-) -- Beno?t Minisini From sebikul at ...176... Thu Aug 23 22:48:47 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Thu, 23 Aug 2012 17:48:47 -0300 Subject: [Gambas-devel] Daily PPA build fails on lucid In-Reply-To: <5035D712.5090406@...1...> References: <5035D712.5090406@...1...> Message-ID: On Thu, Aug 23, 2012 at 4:09 AM, Beno?t Minisini wrote: > Le 23/08/2012 01:54, Sebastian Kulesz a ?crit : >> Hi! I have been getting some build errors on the Ubuntu Lucid daily >> build. The logs can be found here [0], just click "buildlog" under the >> failed builds (no launchpad account needed). Due to launchpad issues, >> i'm not able to request any build, as they are moving the >> infrastructure and have a queue of 1200 builds (13 hours). >> >> The svn revision used to build the package can be calculated using the >> revno on its name +1105 (Due to a bug on how source packages are >> built, i can't yet use the real revision). >> >> PS: I updated the PPA package so the new gb.adt component is included >> on every supported Ubuntu version, and fixed the man pages. They were >> really outdated, some options where causing segfaults or where even >> recently replaced (They may also be included upstream) >> >> [0] https://code.launchpad.net/~sebikul/+recipe/gambas3-daily-lucid >> > > The last one compiles correctly, doesn't it? > > What man pages are you talking about? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel The source file is what is being compiled correctly, it is shown as the parent of two rows, the i386 and amd64 builds, which where failing lately. I based the Daily PPA on Kendek's work, which included a man page for gambas executables (gbx3, gbc3, gbw3, gbi3, etc). They where really outdated, so i rebased them of the help of each executable (gbX3 -h) From gambas at ...1... Thu Aug 23 23:02:51 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 23 Aug 2012 23:02:51 +0200 Subject: [Gambas-devel] Daily PPA build fails on lucid In-Reply-To: References: <5035D712.5090406@...1...> Message-ID: <50369A7B.1010600@...1...> Le 23/08/2012 22:48, Sebastian Kulesz a ?crit : >> >> The last one compiles correctly, doesn't it? >> >> What man pages are you talking about? >> >> -- >> Beno?t Minisini >> > > The source file is what is being compiled correctly, it is shown as > the parent of two rows, the i386 and amd64 builds, which where failing > lately. Sometimes I use a GTK+ function that is too new for the Lucid GTK+. If I'm told about that, I try to fix it. > > I based the Daily PPA on Kendek's work, which included a man page for > gambas executables (gbx3, gbc3, gbw3, gbi3, etc). They where really > outdated, so i rebased them of the help of each executable (gbX3 -h) I didn't know. If I knew how to write a man page, I would do it. -- Beno?t Minisini From sebikul at ...176... Thu Aug 23 23:06:19 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Thu, 23 Aug 2012 18:06:19 -0300 Subject: [Gambas-devel] Daily PPA build fails on lucid In-Reply-To: <50369A7B.1010600@...1...> References: <5035D712.5090406@...1...> <50369A7B.1010600@...1...> Message-ID: On Thu, Aug 23, 2012 at 6:02 PM, Beno?t Minisini wrote: > Le 23/08/2012 22:48, Sebastian Kulesz a ?crit : >>> >>> The last one compiles correctly, doesn't it? >>> >>> What man pages are you talking about? >>> >>> -- >>> Beno?t Minisini >>> >> >> The source file is what is being compiled correctly, it is shown as >> the parent of two rows, the i386 and amd64 builds, which where failing >> lately. > > Sometimes I use a GTK+ function that is too new for the Lucid GTK+. If > I'm told about that, I try to fix it. > >> >> I based the Daily PPA on Kendek's work, which included a man page for >> gambas executables (gbx3, gbc3, gbw3, gbi3, etc). They where really >> outdated, so i rebased them of the help of each executable (gbX3 -h) > > I didn't know. If I knew how to write a man page, I would do it. > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel You can grab them here [0]. ;) Let me know if you decide to include them in trunk as they will conflict when installing the runtime. [0] http://bazaar.launchpad.net/~sebikul/+junk/gambas3-daily-precise/files/head:/debian/ * scroll to the bottom From sebikul at ...176... Fri Aug 24 05:39:36 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Fri, 24 Aug 2012 00:39:36 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol Message-ID: Hi! I made a component to implement the pop3 protocol purely in Gambas and wanted some feedback on how the API should be implemented. Right now there is an exported class called Pop3Client that wraps the call depending if the connection should be encrypted or not using 2 sub classes (TCPClient & SSLClient) which share the same API. If it is encrypted, an openssl process is used to execute the commands and read the response, if it's not, a plain socket is used. At first i wanted to include asynchronous support, but it was REALLY buggy and difficult to implement, so i left it synchronous. A list of the implemented commands can be found at the top of the Pop3Client.class file. Although the user can use the Pop3Client.Send() call directly to send any command, their implementation should return the data on a semi parsed form I'm not sure how the API should be implemented and if the structure i'm using is the best approach. How would you implement the protocol? How would you abstract encrypted and non encrypted connections so that the difference cannot be seen by the developer? When executing a command that requires a large amount of data to be downloaded (e.g retrieve a message with attachments), subsequent calls can be overlapped, is there a way to avoid this? * Protocol specifications: http://tools.ietf.org/html/rfc1939 Thanks a lot!! -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.1.tar.gz Type: application/x-gzip Size: 8439 bytes Desc: not available URL: From tobias at ...692... Fri Aug 24 14:53:45 2012 From: tobias at ...692... (Tobias Boege) Date: Fri, 24 Aug 2012 14:53:45 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: <50368EC9.6000703@...1...> References: <50368EC9.6000703@...1...> Message-ID: <20120824125345.GC515@...693...> On Thu, 23 Aug 2012, Beno?t Minisini wrote: > Hi Tobi, > > A few thoughts about gb.adt. I don't know if you have rewritten the List > class yet. I'm working on the Lists. Maybe tonight it's finished... > > I don't like the "gb.adt" name. Why "abstract datatypes"? They are not > abstract at all. > > The english wikipedia names all these sorts of things (trees, maps, > lists...) just "data structures". > Hmm, according to what I learnt, a Stack is already an abstract datatype. Whatever the above Wikipedia author says the one writing this text[0] says that a Stack _is_ abstract and gives the kind of definition I am used to. > Maybe you could rename the component "gb.data" then. Because > "gb.datastructure" is too long, and because "gb.ds" is too short. :-) > But renaming would be no big deal, just that I like 3-character abbreviations. > And then you become a very nice guy and make a wonderful implementation > of red-black trees for all of us. ;-) > > -- > Beno?t Minisini Am I not a very nice guy already? ;-) Yes, such things are in my mind, too, but I really never did them before. My next goal was trees and graphs, anyway, but I need information about these structures and algorithms... Regards, Tobi [0] http://en.wikipedia.org/wiki/Abstract_data_type From emil.lenngren at ...176... Fri Aug 24 15:45:20 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Fri, 24 Aug 2012 15:45:20 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: <20120824125345.GC515@...693...> References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> Message-ID: Hmm.. Red-black trees... I don't know how much you guys like C++, but why not simply make a wrapper around std::set? std::set is fast and reliable. There would be no memory overhead for tree object and tree nodes compared to if you write your own. The code is already written. The only drawback I see is that you have to link to libstdc++. On the other hand, if you write your own tree, I think the binary code size will be larger because much of the stuff of std::set is already in the libstdc++.so-file. /Emil 2012/8/24 Tobias Boege > On Thu, 23 Aug 2012, Beno?t Minisini wrote: > > Hi Tobi, > > > > A few thoughts about gb.adt. I don't know if you have rewritten the List > > class yet. > > I'm working on the Lists. Maybe tonight it's finished... > > > > > I don't like the "gb.adt" name. Why "abstract datatypes"? They are not > > abstract at all. > > > > The english wikipedia names all these sorts of things (trees, maps, > > lists...) just "data structures". > > > > Hmm, according to what I learnt, a Stack is already an abstract datatype. > Whatever the above Wikipedia author says the one writing this text[0] says > that a Stack _is_ abstract and gives the kind of definition I am used to. > > > Maybe you could rename the component "gb.data" then. Because > > "gb.datastructure" is too long, and because "gb.ds" is too short. :-) > > > > But renaming would be no big deal, just that I like 3-character > abbreviations. > > > And then you become a very nice guy and make a wonderful implementation > > of red-black trees for all of us. ;-) > > > > -- > > Beno?t Minisini > > Am I not a very nice guy already? ;-) Yes, such things are in my mind, too, > but I really never did them before. My next goal was trees and graphs, > anyway, but I need information about these structures and algorithms... > > Regards, > Tobi > > [0] http://en.wikipedia.org/wiki/Abstract_data_type > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Fri Aug 24 15:51:52 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 24 Aug 2012 15:51:52 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> Message-ID: <503786F8.2040001@...1...> Le 24/08/2012 15:45, Emil Lenngren a ?crit : > Hmm.. Red-black trees... > I don't know how much you guys like C++, but why not simply make a > wrapper around std::set? > > std::set is fast and reliable. There would be no memory overhead for > tree object and tree nodes compared to if you write your own. The code > is already written. > The only drawback I see is that you have to link to libstdc++. On the > other hand, if you write your own tree, I think the binary code size > will be larger because much of the stuff of std::set is already in the > libstdc++.so-file. > > /Emil > Noooo... please, if possible, no dependency on the C++ library! -- Beno?t Minisini From emil.lenngren at ...176... Fri Aug 24 16:01:55 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Fri, 24 Aug 2012 16:01:55 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: <503786F8.2040001@...1...> References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> <503786F8.2040001@...1...> Message-ID: Haha. I will not force you. But what's the problem? Everybody has libstdc++ on their computer. Many other components like gb.qt4, gb.image.effect depend on libstdc++. /Emil 2012/8/24 Beno?t Minisini > Le 24/08/2012 15:45, Emil Lenngren a ?crit : > > Hmm.. Red-black trees... > > I don't know how much you guys like C++, but why not simply make a > > wrapper around std::set? > > > > std::set is fast and reliable. There would be no memory overhead for > > tree object and tree nodes compared to if you write your own. The code > > is already written. > > The only drawback I see is that you have to link to libstdc++. On the > > other hand, if you write your own tree, I think the binary code size > > will be larger because much of the stuff of std::set is already in the > > libstdc++.so-file. > > > > /Emil > > > > Noooo... please, if possible, no dependency on the C++ library! > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Fri Aug 24 16:55:35 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 24 Aug 2012 16:55:35 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> <503786F8.2040001@...1...> Message-ID: <503795E7.7000607@...1...> Le 24/08/2012 16:01, Emil Lenngren a ?crit : > Haha. I will not force you. But what's the problem? Everybody has > libstdc++ on their computer. Many other components like gb.qt4, > gb.image.effect depend on libstdc++. > > /Emil > It eats memory. It takes times to load. Other libraries uses libstdc++, but it is not an argument. If Tobiad or anyone else finds funny to implement that, like Adrien did with its XML component, (and if the result works of course), then go! And who said that libstdc++ is optimized? I'm suspicious. The Gambas compiler is twice faster in Gambas 3 than in Gambas 2 mainly because I stopped using the libc standard file routines. 10% of Gambas IDE startup time is spent in a Xlib routine that reads a X11 compose key configuration file - it reads each file character twice by using getc()! So you can see why I'm *always* suspicious with libraries... Ha, and C++ is awful. :-) -- Beno?t Minisini From gambas at ...1... Fri Aug 24 17:29:01 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 24 Aug 2012 17:29:01 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: <503795E7.7000607@...1...> References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> <503786F8.2040001@...1...> <503795E7.7000607@...1...> Message-ID: <50379DBD.8030703@...1...> Le 24/08/2012 16:55, Beno?t Minisini a ?crit : > Le 24/08/2012 16:01, Emil Lenngren a ?crit : >> Haha. I will not force you. But what's the problem? Everybody has >> libstdc++ on their computer. Many other components like gb.qt4, >> gb.image.effect depend on libstdc++. >> >> /Emil >> > > It eats memory. It takes times to load. Other libraries uses libstdc++, > but it is not an argument. > > If Tobiad or anyone else finds funny to implement that, like Adrien did > with its XML component, (and if the result works of course), then go! > > And who said that libstdc++ is optimized? I'm suspicious. > > The Gambas compiler is twice faster in Gambas 3 than in Gambas 2 mainly > because I stopped using the libc standard file routines. > > 10% of Gambas IDE startup time is spent in a Xlib routine that reads a > X11 compose key configuration file - it reads each file character twice > by using getc()! > > So you can see why I'm *always* suspicious with libraries... > > Ha, and C++ is awful. :-) > Another point: gb.image.effect use C++ because it is actually code taken from KDE3. But it could be rewritten entirely in C, it has only static functions modifying an image buffer. Regards, -- Beno?t Minisini From emil.lenngren at ...176... Fri Aug 24 17:50:36 2012 From: emil.lenngren at ...176... (Emil Lenngren) Date: Fri, 24 Aug 2012 17:50:36 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: <50379DBD.8030703@...1...> References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> <503786F8.2040001@...1...> <503795E7.7000607@...1...> <50379DBD.8030703@...1...> Message-ID: I agree on load time for C++ libraries. Have you looked at the source code for std::set? Try to make a faster tree ;) The really slow code in libstdc++ are the i/o-routines, iostream, fstream etc. I see no reason to use them at all. But the datastructures and algorithms are fast. It is always possible to "borrow" code from libstdc++ too, as it is GPL. /Emil 2012/8/24 Beno?t Minisini > Le 24/08/2012 16:55, Beno?t Minisini a ?crit : > > Le 24/08/2012 16:01, Emil Lenngren a ?crit : > >> Haha. I will not force you. But what's the problem? Everybody has > >> libstdc++ on their computer. Many other components like gb.qt4, > >> gb.image.effect depend on libstdc++. > >> > >> /Emil > >> > > > > It eats memory. It takes times to load. Other libraries uses libstdc++, > > but it is not an argument. > > > > If Tobiad or anyone else finds funny to implement that, like Adrien did > > with its XML component, (and if the result works of course), then go! > > > > And who said that libstdc++ is optimized? I'm suspicious. > > > > The Gambas compiler is twice faster in Gambas 3 than in Gambas 2 mainly > > because I stopped using the libc standard file routines. > > > > 10% of Gambas IDE startup time is spent in a Xlib routine that reads a > > X11 compose key configuration file - it reads each file character twice > > by using getc()! > > > > So you can see why I'm *always* suspicious with libraries... > > > > Ha, and C++ is awful. :-) > > > > Another point: gb.image.effect use C++ because it is actually code taken > from KDE3. But it could be rewritten entirely in C, it has only static > functions modifying an image buffer. > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Sat Aug 25 00:44:08 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 25 Aug 2012 00:44:08 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: Message-ID: <503803B8.3040200@...1...> Le 24/08/2012 05:39, Sebastian Kulesz a ?crit : > Hi! I made a component to implement the pop3 protocol purely in Gambas > and wanted some feedback on how the API should be implemented. > > Right now there is an exported class called Pop3Client that wraps the > call depending if the connection should be encrypted or not using 2 > sub classes (TCPClient & SSLClient) which share the same API. If it is > encrypted, an openssl process is used to execute the commands and read > the response, if it's not, a plain socket is used. > > At first i wanted to include asynchronous support, but it was REALLY > buggy and difficult to implement, so i left it synchronous. A list of > the implemented commands can be found at the top of the > Pop3Client.class file. Although the user can use the Pop3Client.Send() > call directly to send any command, their implementation should return > the data on a semi parsed form > > I'm not sure how the API should be implemented and if the structure > i'm using is the best approach. How would you implement the protocol? > How would you abstract encrypted and non encrypted connections so that > the difference cannot be seen by the developer? > When executing a command that requires a large amount of data to be > downloaded (e.g retrieve a message with attachments), subsequent calls > can be overlapped, is there a way to avoid this? > > * Protocol specifications: http://tools.ietf.org/html/rfc1939 > > Thanks a lot!! > I will look at it. Check if the new gb.task component could allow you to implement an asynchronous version of the Pop3Client (like FtpClient and HttpClient). SmtpClient handle encrypted connections the same way as you. Maybe you can look at its code? Now we will need a MIME library to parse MIME messages... Regards, -- Beno?t Minisini From tobias at ...692... Sat Aug 25 00:51:02 2012 From: tobias at ...692... (Tobias Boege) Date: Sat, 25 Aug 2012 00:51:02 +0200 Subject: [Gambas-devel] About gb.adt (2) In-Reply-To: References: <50368EC9.6000703@...1...> <20120824125345.GC515@...693...> <503786F8.2040001@...1...> <503795E7.7000607@...1...> <50379DBD.8030703@...1...> Message-ID: <20120824225102.GB509@...693...> On Fri, 24 Aug 2012, Emil Lenngren wrote: > I agree on load time for C++ libraries. > > Have you looked at the source code for std::set? Try to make a faster tree > ;) > The really slow code in libstdc++ are the i/o-routines, iostream, fstream > etc. I see no reason to use them at all. But the datastructures and > algorithms are fast. > > It is always possible to "borrow" code from libstdc++ too, as it is GPL. > > /Emil > > 2012/8/24 Beno?t Minisini > > > Le 24/08/2012 16:55, Beno?t Minisini a ?crit : > > > Le 24/08/2012 16:01, Emil Lenngren a ?crit : > > >> Haha. I will not force you. But what's the problem? Everybody has > > >> libstdc++ on their computer. Many other components like gb.qt4, > > >> gb.image.effect depend on libstdc++. > > >> > > >> /Emil > > >> > > > > > > It eats memory. It takes times to load. Other libraries uses libstdc++, > > > but it is not an argument. > > > > > > If Tobiad or anyone else finds funny to implement that, like Adrien did > > > with its XML component, (and if the result works of course), then go! > > > > > > And who said that libstdc++ is optimized? I'm suspicious. > > > > > > The Gambas compiler is twice faster in Gambas 3 than in Gambas 2 mainly > > > because I stopped using the libc standard file routines. > > > > > > 10% of Gambas IDE startup time is spent in a Xlib routine that reads a > > > X11 compose key configuration file - it reads each file character twice > > > by using getc()! > > > > > > So you can see why I'm *always* suspicious with libraries... > > > > > > Ha, and C++ is awful. :-) > > > > > > > Another point: gb.image.effect use C++ because it is actually code taken > > from KDE3. But it could be rewritten entirely in C, it has only static > > functions modifying an image buffer. > > > > Regards, > > > > -- > > Beno?t Minisini > > I always look for possible implementations out there. Libstdc++ is only one and the Linux kernel has rbtrees, too. I just don't know yet, how they both do it. I myself will not use C++. It begins for me when compiling a "hello world" sample and the compiler runs about just as long as it needs to make me think "what the hell can take that long? Grr." ;-) No, seriously: I really won't use it but if someone comes up with a more efficient implementation in C++ (or whatever), we should really use this one until we improved the C version. :-) Regards, Tobi From sebikul at ...176... Sat Aug 25 00:53:53 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Fri, 24 Aug 2012 19:53:53 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503803B8.3040200@...1...> References: <503803B8.3040200@...1...> Message-ID: On Fri, Aug 24, 2012 at 7:44 PM, Beno?t Minisini wrote: > Le 24/08/2012 05:39, Sebastian Kulesz a ?crit : >> Hi! I made a component to implement the pop3 protocol purely in Gambas >> and wanted some feedback on how the API should be implemented. >> >> Right now there is an exported class called Pop3Client that wraps the >> call depending if the connection should be encrypted or not using 2 >> sub classes (TCPClient & SSLClient) which share the same API. If it is >> encrypted, an openssl process is used to execute the commands and read >> the response, if it's not, a plain socket is used. >> >> At first i wanted to include asynchronous support, but it was REALLY >> buggy and difficult to implement, so i left it synchronous. A list of >> the implemented commands can be found at the top of the >> Pop3Client.class file. Although the user can use the Pop3Client.Send() >> call directly to send any command, their implementation should return >> the data on a semi parsed form >> >> I'm not sure how the API should be implemented and if the structure >> i'm using is the best approach. How would you implement the protocol? >> How would you abstract encrypted and non encrypted connections so that >> the difference cannot be seen by the developer? >> When executing a command that requires a large amount of data to be >> downloaded (e.g retrieve a message with attachments), subsequent calls >> can be overlapped, is there a way to avoid this? >> >> * Protocol specifications: http://tools.ietf.org/html/rfc1939 >> >> Thanks a lot!! >> > > I will look at it. > > Check if the new gb.task component could allow you to implement an > asynchronous version of the Pop3Client (like FtpClient and HttpClient). > > SmtpClient handle encrypted connections the same way as you. Maybe you > can look at its code? > > Now we will need a MIME library to parse MIME messages... > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Hey, I was about to propose an implementation of a threading component! Well done! The code used to talk to openssl was actually taken from the SmtpClient class, there is a notice about that in the source code. ;) I believe that asynchronous implementation should wait until A. the api is well defined and B. the gb.task component matures a little bit. However, i will start playing around with it so i can give some feedback. The MIME parsing should definitely be done using an external library, like gmime [0]. There are a LOT of specifications that need to be read and implemented, and i think that reinventing the wheel using another material would be pointless in this case. [0] http://spruce.sourceforge.net/gmime/ * Supported specifications also listed here Thanks! From tobias at ...692... Sat Aug 25 04:08:36 2012 From: tobias at ...692... (Tobias Boege) Date: Sat, 25 Aug 2012 04:08:36 +0200 Subject: [Gambas-devel] [Gambas-user] gb.adt component In-Reply-To: <50313C8D.6050608@...1...> References: <20120818124717.GA520@...693...> <50313C8D.6050608@...1...> Message-ID: <20120825020836.GC509@...693...> > As for "embedding" the list inside an object, i.e. doing what we usually > do in C, I think I understood what you want to do, but I don't think it > is really useful in Gambas. > > The only advantage I see is being able to find the next (or previous) > object of the list as soon as you have a reference on the object. Which > is not possible with the previous List class. > > To do that, maybe I would create another class (something like > 'StaticList'). But anyway it will not be easy to have a practical interface! So what did you mean by the StaticList class? Those embedded ones? Regards, Tobi From gambas.fr at ...176... Sat Aug 25 10:35:45 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Sat, 25 Aug 2012 10:35:45 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> Message-ID: 2012/8/25 Sebastian Kulesz : > On Fri, Aug 24, 2012 at 7:44 PM, Beno?t Minisini > wrote: >> Le 24/08/2012 05:39, Sebastian Kulesz a ?crit : >>> Hi! I made a component to implement the pop3 protocol purely in Gambas >>> and wanted some feedback on how the API should be implemented. >>> >>> Right now there is an exported class called Pop3Client that wraps the >>> call depending if the connection should be encrypted or not using 2 >>> sub classes (TCPClient & SSLClient) which share the same API. If it is >>> encrypted, an openssl process is used to execute the commands and read >>> the response, if it's not, a plain socket is used. >>> >>> At first i wanted to include asynchronous support, but it was REALLY >>> buggy and difficult to implement, so i left it synchronous. A list of >>> the implemented commands can be found at the top of the >>> Pop3Client.class file. Although the user can use the Pop3Client.Send() >>> call directly to send any command, their implementation should return >>> the data on a semi parsed form >>> >>> I'm not sure how the API should be implemented and if the structure >>> i'm using is the best approach. How would you implement the protocol? >>> How would you abstract encrypted and non encrypted connections so that >>> the difference cannot be seen by the developer? >>> When executing a command that requires a large amount of data to be >>> downloaded (e.g retrieve a message with attachments), subsequent calls >>> can be overlapped, is there a way to avoid this? >>> >>> * Protocol specifications: http://tools.ietf.org/html/rfc1939 >>> >>> Thanks a lot!! >>> >> >> I will look at it. >> >> Check if the new gb.task component could allow you to implement an >> asynchronous version of the Pop3Client (like FtpClient and HttpClient). >> >> SmtpClient handle encrypted connections the same way as you. Maybe you >> can look at its code? >> >> Now we will need a MIME library to parse MIME messages... >> >> Regards, >> >> -- >> Beno?t Minisini >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > Hey, I was about to propose an implementation of a threading > component! Well done! > > The code used to talk to openssl was actually taken from the > SmtpClient class, there is a notice about that in the source code. ;) > > I believe that asynchronous implementation should wait until A. the > api is well defined and B. the gb.task component matures a little bit. > However, i will start playing around with it so i can give some > feedback. > > The MIME parsing should definitely be done using an external library, > like gmime [0]. There are a LOT of specifications that need to be read > and implemented, and i think that reinventing the wheel using another > material would be pointless in this case. > > [0] http://spruce.sourceforge.net/gmime/ > * Supported specifications also listed here True, the MIME Spec are really complex. If gmime can be used without getting gnome, why not ? > > Thanks! > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel -- Fabien Bodard From gambas at ...1... Sat Aug 25 14:10:56 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 25 Aug 2012 14:10:56 +0200 Subject: [Gambas-devel] [Gambas-user] gb.adt component In-Reply-To: <20120825020836.GC509@...693...> References: <20120818124717.GA520@...693...> <50313C8D.6050608@...1...> <20120825020836.GC509@...693...> Message-ID: <5038C0D0.1040301@...1...> Le 25/08/2012 04:08, Tobias Boege a ?crit : >> As for "embedding" the list inside an object, i.e. doing what we usually >> do in C, I think I understood what you want to do, but I don't think it >> is really useful in Gambas. >> >> The only advantage I see is being able to find the next (or previous) >> object of the list as soon as you have a reference on the object. Which >> is not possible with the previous List class. >> >> To do that, maybe I would create another class (something like >> 'StaticList'). But anyway it will not be easy to have a practical interface! > > So what did you mean by the StaticList class? Those embedded ones? > > Regards, > Tobi > Forget that: I meant embedding the "next" and "previous" pointer of the list inside each object, as we do in C. -- Beno?t Minisini From gambas at ...1... Sat Aug 25 14:18:47 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sat, 25 Aug 2012 14:18:47 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> Message-ID: <5038C2A7.1060404@...1...> Le 25/08/2012 10:35, Fabien Bodard a ?crit : > > True, the MIME Spec are really complex. If gmime can be used without > getting gnome, why not ? > The "g" in "gime" just means that it uses glib. It's ok for me. -- Beno?t Minisini From sebikul at ...176... Sun Aug 26 04:27:43 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Sat, 25 Aug 2012 23:27:43 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <5038C2A7.1060404@...1...> References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> Message-ID: On Sat, Aug 25, 2012 at 9:18 AM, Beno?t Minisini wrote: > Le 25/08/2012 10:35, Fabien Bodard a ?crit : >> >> True, the MIME Spec are really complex. If gmime can be used without >> getting gnome, why not ? >> > > The "g" in "gime" just means that it uses glib. It's ok for me. > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Here is an updated project with the minimal command set defined by the specification implemented. I believe the component should be strictly synchronous, as the data *needs* to be processed after being downloaded, contrary to the HttpClient where the raw data can be used depending on the application. Maybe an async implementation can be made once the gb.task component is mature enough. Please provide any feedback! -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.1.tar.gz Type: application/x-gzip Size: 8665 bytes Desc: not available URL: From gambas at ...1... Sun Aug 26 04:53:13 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 26 Aug 2012 04:53:13 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> Message-ID: <50398F99.1070104@...1...> Le 26/08/2012 04:27, Sebastian Kulesz a ?crit : > > Here is an updated project with the minimal command set defined by the > specification implemented. > > I believe the component should be strictly synchronous, as the data > *needs* to be processed after being downloaded, contrary to the > HttpClient where the raw data can be used depending on the > application. Maybe an async implementation can be made once the > gb.task component is mature enough. > > Please provide any feedback! > As soon as you have the Task class, you can embed a synchronous Pop3Client in it and retrieve your mails in the background. No need to implement an asynchronous Pop3 client! Of course, as the returned data is serialized/deserialized through a file, you can't send megabytes of data or share any object created in the background task. -- Beno?t Minisini From gambas at ...1... Sun Aug 26 05:18:29 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 26 Aug 2012 05:18:29 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> Message-ID: <50399585.1070503@...1...> Le 26/08/2012 04:27, Sebastian Kulesz a ?crit : > > Please provide any feedback! > You should better use an anonymous reference (Object) instead of a Variant. It's faster. If TCPClient and SSLClient share the same interface, they should inherit a common class. Then the Client variable will have a static datatype, and method calls are far faster (direct access instead of symbol table lookup). The public symbols are not always well chosen or written ("WelcomeMSG", "NOOP"), or incorrect ("Retrive" instead of "Retrieve"). I don't know what is the use of these static functions with long names and underscore in it. You should use underscore in method names only for event handlers. Maybe you should be able to create an interface with higher level that hides all the POP3 commands. In a few words, a Pop3Client user mainly wants these features: - The number of messages to read. (STAT) - The size of all theses messages. (STAT) - The size of one message. (LIST x) - One specific message. (RETR x) - Delete one message. (DELE x) - Undelete all messages. (RSET) - The beginning of a message. (TOP x n) All that could be done with well-named method, the _get special method... - The number of messages to read. -> .Count - The size of all theses messages. -> .Size - The size of one message. -> [x].Size - One specific message. -> [x].Text - Delete one message. -> [x].Delete() - Undelete all messages. -> .Reset() - The beginning of a message. -> No idea yet! Authentication should rely on Pop3Client properties set before starting the session. And encryption should be defined by an integer property with constants for each encryption method, like in SmtpClient. MyPop3Client.User = "xxx" MyPop3Client.Password = "yyy" MyPop3Client.Encrypt = Net.SSL The session should start automatically, as soon as we want a "transaction" action. The QUIT command should be able to be called explicitely (Quit or better Close method), and implicitely when the MyPop3Client object is freed. Once all that is done, the Pop3Client should be put in the same component that SmtpClient, and the component should be renamed gb.mail (or something like that). What do you think? -- Beno?t Minisini From gambas at ...1... Sun Aug 26 05:29:22 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 26 Aug 2012 05:29:22 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> Message-ID: <50399812.8070803@...1...> Le 26/08/2012 04:27, Sebastian Kulesz a ?crit : > On Sat, Aug 25, 2012 at 9:18 AM, Beno?t Minisini > > Please provide any feedback! > Another point: the way you retrieve the data in the Send() method is false, and it does not respect the protocol. If an answer is one line, you must read the socket until you have the end of line. If an answer is multi-line, you must read the socket until you have the end of multi-line marker ("." I think). You can use "Line Input" for that. Don't forget to tell your socket that the end of line is "CRLF". You may have to make the socket blocking too, which is not by default. Regards, -- Beno?t Minisini From gambas at ...1... Sun Aug 26 05:31:16 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Sun, 26 Aug 2012 05:31:16 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <50399812.8070803@...1...> References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> Message-ID: <50399884.3040503@...1...> Le 26/08/2012 05:29, Beno?t Minisini a ?crit : > Le 26/08/2012 04:27, Sebastian Kulesz a ?crit : >> On Sat, Aug 25, 2012 at 9:18 AM, Beno?t Minisini >> >> Please provide any feedback! >> > > Another point: the way you retrieve the data in the Send() method is > false, and it does not respect the protocol. --> Because Lof() returns the number of available bytes at the moment you call it, *not* the number of bytes that will be sent by the other part of the socket, which we can't now, otherwise we would violate the principle of causality and all the world would collapse. -- Beno?t Minisini From gambas.fr at ...176... Sun Aug 26 11:39:31 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Sun, 26 Aug 2012 11:39:31 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <50399884.3040503@...1...> References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: For the top ... Why not (x).top Le 26 ao?t 2012 05:31, "Beno?t Minisini" a ?crit : > Le 26/08/2012 05:29, Beno?t Minisini a ?crit : > > Le 26/08/2012 04:27, Sebastian Kulesz a ?crit : > >> On Sat, Aug 25, 2012 at 9:18 AM, Beno?t Minisini > >> > >> Please provide any feedback! > >> > > > > Another point: the way you retrieve the data in the Send() method is > > false, and it does not respect the protocol. > > --> Because Lof() returns the number of available bytes at the moment > you call it, *not* the number of bytes that will be sent by the other > part of the socket, which we can't now, otherwise we would violate the > principle of causality and all the world would collapse. > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebikul at ...176... Sun Aug 26 22:21:42 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Sun, 26 Aug 2012 17:21:42 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: On Sun, Aug 26, 2012 at 6:39 AM, Fabien Bodard wrote: > For the top ... Why not (x).top > > Le 26 ao?t 2012 05:31, "Beno?t Minisini" a > ?crit : > >> Le 26/08/2012 05:29, Beno?t Minisini a ?crit : >> > Le 26/08/2012 04:27, Sebastian Kulesz a ?crit : >> >> On Sat, Aug 25, 2012 at 9:18 AM, Beno?t Minisini >> >> >> >> Please provide any feedback! >> >> >> > >> > Another point: the way you retrieve the data in the Send() method is >> > false, and it does not respect the protocol. >> >> --> Because Lof() returns the number of available bytes at the moment >> you call it, *not* the number of bytes that will be sent by the other >> part of the socket, which we can't now, otherwise we would violate the >> principle of causality and all the world would collapse. >> >> -- >> Beno?t Minisini >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > Okey, here it is! I fixed the socket, implemented the _get method (i had to play a bit with arguments, it's a little bit dirty, but it works), the properties, and 2 optional commands. And cleaned the code. I'm missing a parent class for the SSLClient and TCPClient (but that's trivial and not urgent) and some other minor paper-cuts. But it works flawlessly now (depending on the server, obviously. it still has some bugs) Thanks a lot for your feedback! -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.1.tar.gz Type: application/x-gzip Size: 9595 bytes Desc: not available URL: From gambas.fr at ...176... Sun Aug 26 23:06:43 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Sun, 26 Aug 2012 23:06:43 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: Public Function List(Optional msgid As Integer) As Variant[] it can be a string[] or a class array if you know the return structure Public Function UniqueID(Optional msgid As Integer) As Variant[] well i'm not sure that a variant[] is the good answer for all :/ maybe a class array can be better ? From gambas.fr at ...176... Sun Aug 26 23:10:22 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Sun, 26 Aug 2012 23:10:22 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: why stripOK IsPositive IsNegative are STATIC PUBLIC and not simply PRIVATE ? From gambas.fr at ...176... Sun Aug 26 23:36:23 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Sun, 26 Aug 2012 23:36:23 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: 2012/8/26 Fabien Bodard : > why > stripOK > IsPositive > IsNegative are STATIC PUBLIC and not simply PRIVATE ? stat must be private too... i think YOu must to hide the functions retrieve too has you use _get for that and the function in the children class. so pop3 must just have IN PUBLIC connect disconnect delete reset count close size is the size of all messages _get The message classe : Top(lines as integer) Text UniqID Size so please re read Benoit 's mail about interface ... - The number of messages to read. (STAT) - The size of all theses messages. (STAT) - The size of one message. (LIST x) - One specific message. (RETR x) - Delete one message. (DELE x) - Undelete all messages. (RSET) - The beginning of a message. (TOP x n) All that could be done with well-named method, the _get special method... - The number of messages to read. -> .Count - The size of all theses messages. -> .Size - The size of one message. -> [x].Size - One specific message. -> [x].Text - Delete one message. -> [x].Delete() - Undelete all messages. -> .Reset() - The beginning of a message. -> [x].Summary ? OR .ShortText if you want you can use that trick too in__get dim hPopMessage as New _PopMessage as "Message" return hPopMessage end in the popmessage class you can the se the current instance of pop3Client as you need to be able to manage multiple instance for example in the text proc Private Function Text_Read() As String dim hPopClient as pop3client = Object.Parent(me) Return hpopClient._Retrieve($msgid) End you need to use only local declaration for that to not have freeing problem then. so this line : dim hPopClient as pop3client = Object.Parent(me) need to be in all the sub of _popmessage to get the instance that own the message child. i don't know if all of that can help you ... -- Fabien Bodard From sebikul at ...176... Mon Aug 27 00:24:24 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Sun, 26 Aug 2012 19:24:24 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: On Sun, Aug 26, 2012 at 6:36 PM, Fabien Bodard wrote: > 2012/8/26 Fabien Bodard : >> why >> stripOK >> IsPositive >> IsNegative are STATIC PUBLIC and not simply PRIVATE ? > > stat must be private too... i think > > YOu must to hide the functions retrieve too has you use _get for that > and the function in the children class. > > so pop3 must just have > > IN PUBLIC > connect > disconnect > delete > reset > count > close > size is the size of all messages > _get > > The message classe : > > Top(lines as integer) > Text > UniqID > Size > > > > so please re read Benoit 's mail about interface ... > > - The number of messages to read. (STAT) > - The size of all theses messages. (STAT) > - The size of one message. (LIST x) > - One specific message. (RETR x) > - Delete one message. (DELE x) > - Undelete all messages. (RSET) > - The beginning of a message. (TOP x n) > > All that could be done with well-named method, the _get special method... > > - The number of messages to read. -> .Count > - The size of all theses messages. -> .Size > - The size of one message. -> [x].Size > - One specific message. -> [x].Text > - Delete one message. -> [x].Delete() > - Undelete all messages. -> .Reset() > - The beginning of a message. -> [x].Summary ? OR .ShortText > > if you want you can use that trick too > > in__get > > dim hPopMessage as New _PopMessage as "Message" > > return hPopMessage > > end > > > > in the popmessage class you can the se the current instance of > pop3Client as you need to be able to manage multiple instance > > for example in the text proc > > Private Function Text_Read() As String > > dim hPopClient as pop3client = Object.Parent(me) > Return hpopClient._Retrieve($msgid) > > End > > > you need to use only local declaration for that to not have freeing > problem then. > > so this line : > dim hPopClient as pop3client = Object.Parent(me) > > need to be in all the sub of _popmessage to get the instance that own > the message child. > > i don't know if all of that can help you ... > > > > > -- > Fabien Bodard > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel I'll go step by step. Firstly you are right, i don't like Variant[] as a signature either, so UniqueID() and List() both return a String[] now. StripOK, IsPositive, IsNegative are static because they don't depend on the object instance. No need to make them private. What if the developer wants to parse the response on his own? It's ridiculous to make Stat private. Why should we hide a pop command from the developer? I also prefer to let the developer choose how to access the POP commands, either by methods or by using the _get _POPMessage instance (we may also implement some type of caching here). This may change too There is a method already to get the beginning of a message, see Top() and _POPMessage.Top() The last part seems to be really confusing, can you explain better please? Thanks for your feedback! From gambas.fr at ...176... Mon Aug 27 00:51:33 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Mon, 27 Aug 2012 00:51:33 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: 2012/8/27 Sebastian Kulesz : > On Sun, Aug 26, 2012 at 6:36 PM, Fabien Bodard wrote: >> 2012/8/26 Fabien Bodard : >>> why >>> stripOK >>> IsPositive >>> IsNegative are STATIC PUBLIC and not simply PRIVATE ? >> >> stat must be private too... i think >> >> YOu must to hide the functions retrieve too has you use _get for that >> and the function in the children class. >> >> so pop3 must just have >> >> IN PUBLIC >> connect >> disconnect >> delete >> reset >> count >> close >> size is the size of all messages >> _get >> >> The message classe : >> >> Top(lines as integer) >> Text >> UniqID >> Size >> >> >> >> so please re read Benoit 's mail about interface ... >> >> - The number of messages to read. (STAT) >> - The size of all theses messages. (STAT) >> - The size of one message. (LIST x) >> - One specific message. (RETR x) >> - Delete one message. (DELE x) >> - Undelete all messages. (RSET) >> - The beginning of a message. (TOP x n) >> >> All that could be done with well-named method, the _get special method... >> >> - The number of messages to read. -> .Count >> - The size of all theses messages. -> .Size >> - The size of one message. -> [x].Size >> - One specific message. -> [x].Text >> - Delete one message. -> [x].Delete() >> - Undelete all messages. -> .Reset() >> - The beginning of a message. -> [x].Summary ? OR .ShortText >> >> if you want you can use that trick too >> >> in__get >> >> dim hPopMessage as New _PopMessage as "Message" >> >> return hPopMessage >> >> end >> >> >> >> in the popmessage class you can the se the current instance of >> pop3Client as you need to be able to manage multiple instance >> >> for example in the text proc >> >> Private Function Text_Read() As String >> >> dim hPopClient as pop3client = Object.Parent(me) >> Return hpopClient._Retrieve($msgid) >> >> End >> >> >> you need to use only local declaration for that to not have freeing >> problem then. >> >> so this line : >> dim hPopClient as pop3client = Object.Parent(me) >> >> need to be in all the sub of _popmessage to get the instance that own >> the message child. >> >> i don't know if all of that can help you ... >> >> >> >> >> -- >> Fabien Bodard >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > I'll go step by step. Firstly you are right, i don't like Variant[] as > a signature either, so UniqueID() and List() both return a String[] > now. > > StripOK, IsPositive, IsNegative are static because they don't depend > on the object instance. No need to make them private. What if the > developer wants to parse the response on his own? Because an interface need to be as light as it can be. And Because it's the way of Gambas. Doing things and make it simple. If your api is well done the devellopper have no need to parse the response by himself. > It's ridiculous to make Stat private. Why should we hide a pop command > from the developer? I also prefer to let the developer choose how to > access the POP commands, either by methods or by using the _get > _POPMessage instance (we may also implement some type of caching > here). This may change too Because it's the same thing... it's the gambas way and we try to standardize the api to not make the devellopers confused. > > There is a method already to get the beginning of a message, see Top() > and _POPMessage.Top() Have you take a look at gb.smtp api ? > > The last part seems to be really confusing, can you explain better please? i will give you a true example tomarow > Thanks for your feedback! > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel -- Fabien Bodard From gambas at ...1... Mon Aug 27 00:57:56 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 27 Aug 2012 00:57:56 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> Message-ID: <503AA9F4.8000205@...1...> Le 27/08/2012 00:24, Sebastian Kulesz a ?crit : > > It's ridiculous to make Stat private. Why should we hide a pop command > from the developer? I also prefer to let the developer choose how to > access the POP commands, either by methods or by using the _get > _POPMessage instance (we may also implement some type of caching > here). This may change too > The way it is done in FtpClient is: - An higher interface like the one I described you for Pop3Client. - An Exec() method that allows to send FTP command directly. I think you can do the same. For people who want an access to the POP3 protocol, an Exec() method that takes the POP3 command as a string. Of course, you still have to handle the difference between one-line answer and multi-line answer! Regards, -- Beno?t Minisini From sebikul at ...176... Mon Aug 27 01:03:53 2012 From: sebikul at ...176... (Sebi) Date: Sun, 26 Aug 2012 23:03:53 +0000 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503AA9F4.8000205@...1...> References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> Message-ID: <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> This already exists, maybe rename Send() to Exec(). It also takes an optional parameter to choose between Single-line and Multi line responses, which are handled differently. -----Original Message----- From: Beno?t Minisini Date: Mon, 27 Aug 2012 00:57:56 To: mailing list for gambas developers Reply-To: mailing list for gambas developers Subject: Re: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol Le 27/08/2012 00:24, Sebastian Kulesz a ?crit : > > It's ridiculous to make Stat private. Why should we hide a pop command > from the developer? I also prefer to let the developer choose how to > access the POP commands, either by methods or by using the _get > _POPMessage instance (we may also implement some type of caching > here). This may change too > The way it is done in FtpClient is: - An higher interface like the one I described you for Pop3Client. - An Exec() method that allows to send FTP command directly. I think you can do the same. For people who want an access to the POP3 protocol, an Exec() method that takes the POP3 command as a string. Of course, you still have to handle the difference between one-line answer and multi-line answer! Regards, -- Beno?t Minisini ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Gambas-devel mailing list Gambas-devel at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-devel From sebikul at ...176... Mon Aug 27 05:05:46 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Mon, 27 Aug 2012 00:05:46 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> Message-ID: On Sun, Aug 26, 2012 at 8:03 PM, Sebi wrote: > This already exists, maybe rename Send() to Exec(). It also takes an optional parameter to choose between Single-line and Multi line responses, which are handled differently. > > -----Original Message----- > From: Beno?t Minisini > Date: Mon, 27 Aug 2012 00:57:56 > To: mailing list for gambas developers > Reply-To: mailing list for gambas developers > > Subject: Re: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol > > Le 27/08/2012 00:24, Sebastian Kulesz a ?crit : >> >> It's ridiculous to make Stat private. Why should we hide a pop command >> from the developer? I also prefer to let the developer choose how to >> access the POP commands, either by methods or by using the _get >> _POPMessage instance (we may also implement some type of caching >> here). This may change too >> > > The way it is done in FtpClient is: > > - An higher interface like the one I described you for Pop3Client. > > - An Exec() method that allows to send FTP command directly. > > I think you can do the same. For people who want an access to the POP3 > protocol, an Exec() method that takes the POP3 command as a string. > > Of course, you still have to handle the difference between one-line > answer and multi-line answer! > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Okey, here is a little update. I don't think we should sacrifice features for ease (at the end, both are reduced = not good), i believe it is simple enough. I'm waiting forward to your example, otherwise i prefer to leave the API as is. I don't think adding more layers of abstraction will do any good. I renamed the Send() method to Exec() and implemented a private User() and Pass() functions to clean the authentication code a bit, and wrap the .Username and .Password properties. Please let me know what you think! Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.1.tar.gz Type: application/x-gzip Size: 9756 bytes Desc: not available URL: From sebikul at ...176... Mon Aug 27 07:05:06 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Mon, 27 Aug 2012 02:05:06 -0300 Subject: [Gambas-devel] gb.desktop detect a running application Message-ID: I found on the TODO an entry for the gb.desktop component: - Detect an already running application. I had a need for that on another project. Is this what you are looking for? ---------- Public Function isRunning(sProcess as String) As Boolean Dim sOutput As String Exec ["pgrep", "-x", "-c", Shell(sProcess)] To sOutput If CInt(Trim(sOutput)) > 0 Then Return True Return False End ---------- From gambas at ...1... Mon Aug 27 10:47:39 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 27 Aug 2012 10:47:39 +0200 Subject: [Gambas-devel] gb.desktop detect a running application In-Reply-To: References: Message-ID: <503B342B.8020009@...1...> Le 27/08/2012 07:05, Sebastian Kulesz a ?crit : > I found on the TODO an entry for the gb.desktop component: > - Detect an already running application. > > I had a need for that on another project. Is this what you are looking for? > > ---------- > > Public Function isRunning(sProcess as String) As Boolean > > Dim sOutput As String > > Exec ["pgrep", "-x", "-c", Shell(sProcess)] To sOutput > > If CInt(Trim(sOutput)) > 0 Then Return True > > Return False > > End > > ---------- > Not at all. A X11 desktop is a server whose applications do not necessarily come from the same client. So to detect that an application is already running is tricky: two processes from the same executable on the same machine can run on two different desktops, how could you know that? I think that an X11 application can register some properties on the root windows so that it knows that it already runs on that desktop. I think it may be a standard, but I don't go deeper than that at the moment. Otherwise, this split between the desktop (X11) and the systems that run the application seems to be dumped with D-Bus and Wayland, so let's see! Regards, -- Beno?t Minisini From gambas.fr at ...176... Mon Aug 27 11:23:45 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Mon, 27 Aug 2012 11:23:45 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503803B8.3040200@...1...> <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> Message-ID: This is i think a good way to define API I've used a little bit of your code, for sockets but i think you need to manage more sockets errors. It's more slim and allow to do all it is possible with the pop protocole I'm just storing pop id, and message sizes as it nead a second call each time -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.2.tar.gz Type: application/x-gzip Size: 9638 bytes Desc: not available URL: From gambas at ...1... Mon Aug 27 11:29:04 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 27 Aug 2012 11:29:04 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> Message-ID: <503B3DE0.8060708@...1...> Le 27/08/2012 11:23, Fabien Bodard a ?crit : > This is i think a good way to define API > > I've used a little bit of your code, for sockets but i think you need > to manage more sockets errors. > > It's more slim and allow to do all it is possible with the pop protocole > > I'm just storing pop id, and message sizes as it nead a second call each time > Do you know that there is a subversion repository for developing? :-) -- Beno?t Minisini From gambas.fr at ...176... Mon Aug 27 12:29:29 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Mon, 27 Aug 2012 12:29:29 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503B3DE0.8060708@...1...> References: <5038C2A7.1060404@...1...> <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> Message-ID: 2012/8/27 Beno?t Minisini : > Le 27/08/2012 11:23, Fabien Bodard a ?crit : >> This is i think a good way to define API >> >> I've used a little bit of your code, for sockets but i think you need >> to manage more sockets errors. >> >> It's more slim and allow to do all it is possible with the pop protocole >> >> I'm just storing pop id, and message sizes as it nead a second call each time >> > > Do you know that there is a subversion repository for developing? :-) Who ... Me ? But it's not my code !... I don't want to do the job of sebastian it's his project... but he need to follow our way for api's ... if we want to add this to the trunk. But if he really don't want to change his point of vue i'll commit this one (with corrections). I 've stored the list of id ... but in fact pop return serialized id's from 1 ... so maybe i can not store that. maybe imap can be done on the same interface . what is MIME for ... parsing the message content ? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel -- Fabien Bodard From gambas at ...1... Mon Aug 27 13:20:25 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 27 Aug 2012 13:20:25 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> Message-ID: <503B57F9.30402@...1...> Le 27/08/2012 12:29, Fabien Bodard a ?crit : > 2012/8/27 Beno?t Minisini : >> Le 27/08/2012 11:23, Fabien Bodard a ?crit : >>> This is i think a good way to define API >>> >>> I've used a little bit of your code, for sockets but i think you need >>> to manage more sockets errors. >>> >>> It's more slim and allow to do all it is possible with the pop protocole >>> >>> I'm just storing pop id, and message sizes as it nead a second call each time >>> >> >> Do you know that there is a subversion repository for developing? :-) > > Who ... Me ? Both of you. -- Beno?t Minisini From jussi.lahtinen at ...176... Mon Aug 27 17:51:16 2012 From: jussi.lahtinen at ...176... (Jussi Lahtinen) Date: Mon, 27 Aug 2012 18:51:16 +0300 Subject: [Gambas-devel] gb.desktop detect a running application In-Reply-To: <503B342B.8020009@...1...> References: <503B342B.8020009@...1...> Message-ID: > Not at all. > > A X11 desktop is a server whose applications do not necessarily come > from the same client. > > So to detect that an application is already running is tricky: two > processes from the same executable on the same machine can run on two > different desktops, how could you know that? > > I think that an X11 application can register some properties on the root > windows so that it knows that it already runs on that desktop. I think > it may be a standard, but I don't go deeper than that at the moment. > > Otherwise, this split between the desktop (X11) and the systems that run > the application seems to be dumped with D-Bus and Wayland, so let's see! > Maybe I missed something or I don't know enough about X11, but doesn't pgrep list all processes no matter who started them and from where? If I'm wrong, is there way I could demonstrate this problem? Jussi -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebikul at ...176... Mon Aug 27 20:33:11 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Mon, 27 Aug 2012 15:33:11 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503B57F9.30402@...1...> References: <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> Message-ID: On Mon, Aug 27, 2012 at 8:20 AM, Beno?t Minisini wrote: > Le 27/08/2012 12:29, Fabien Bodard a ?crit : >> 2012/8/27 Beno?t Minisini : >>> Le 27/08/2012 11:23, Fabien Bodard a ?crit : >>>> This is i think a good way to define API >>>> >>>> I've used a little bit of your code, for sockets but i think you need >>>> to manage more sockets errors. >>>> >>>> It's more slim and allow to do all it is possible with the pop protocole >>>> >>>> I'm just storing pop id, and message sizes as it nead a second call each time >>>> >>> >>> Do you know that there is a subversion repository for developing? :-) >> >> Who ... Me ? > > Both of you. > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Okey, i feel i need to clarify some things. First off Fabien, it's not that i'm being too rigid for the interface, it's that with just words it's hard to explain what you were looking for. There is no "Gambas Coding Style" page, so i ended up using "my style". Your project helped me a *lot* (i also used another components written in gambas to be consistent) to understand what you were talking about. The interface now is extremely simple to use, and replicates the *gambas way*. I used a serious amount of snippets from your project that where only structural changes. I also implemented a caching array, so if the _get method is called twice, the same object as the first time is returned (not recreated). This also allowed me to cache the text, unique id and size. You will still see some duplicate commands in the Pop3Client and _POPMessage classes. They are not really duplicates but different implementations of the same command that can take an optional argument (the message id in this case). Obviously, the Pop3Client implementation goes without an argument and the _POPMessage uses the stored message id. I also implemented a new Status property, so the user can know in which state the pop client is according to the specifications, and restrict some calls that are only allowed in a specific state. Attached is the "merge" of both projects, most probably you will find some bugs, please let me know. I'm only missing a better error management and document some parts of the code. I will do this later. Regarding svn. As you said the gb.net.smtp would be renamed, moved, cooked, etc. i wanted to first have a working thing before we(I) break something. Also, branching in svn is really difficult and confusing (otherwise it would be as easy as bzr branch ....bzr merge), so i first wanted to test the changes locally, send a diff so others could test and THEN do the commit. That's the reason of the Release For Comment subject ;) Thank you both for your feedback! -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.1.tar.gz Type: application/x-gzip Size: 9913 bytes Desc: not available URL: From sebikul at ...176... Mon Aug 27 20:37:35 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Mon, 27 Aug 2012 15:37:35 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <50399812.8070803@...1...> <50399884.3040503@...1...> <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> Message-ID: On Mon, Aug 27, 2012 at 3:33 PM, Sebastian Kulesz wrote: > On Mon, Aug 27, 2012 at 8:20 AM, Beno?t Minisini > wrote: >> Le 27/08/2012 12:29, Fabien Bodard a ?crit : >>> 2012/8/27 Beno?t Minisini : >>>> Le 27/08/2012 11:23, Fabien Bodard a ?crit : >>>>> This is i think a good way to define API >>>>> >>>>> I've used a little bit of your code, for sockets but i think you need >>>>> to manage more sockets errors. >>>>> >>>>> It's more slim and allow to do all it is possible with the pop protocole >>>>> >>>>> I'm just storing pop id, and message sizes as it nead a second call each time >>>>> >>>> >>>> Do you know that there is a subversion repository for developing? :-) >>> >>> Who ... Me ? >> >> Both of you. >> -- >> Beno?t Minisini >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > Okey, i feel i need to clarify some things. > > First off Fabien, it's not that i'm being too rigid for the interface, > it's that with just words it's hard to explain what you were looking > for. There is no "Gambas Coding Style" page, so i ended up using "my > style". Your project helped me a *lot* (i also used another components > written in gambas to be consistent) to understand what you were > talking about. The interface now is extremely simple to use, and > replicates the *gambas way*. > > I used a serious amount of snippets from your project that where only > structural changes. I also implemented a caching array, so if the _get > method is called twice, the same object as the first time is returned > (not recreated). This also allowed me to cache the text, unique id and > size. You will still see some duplicate commands in the Pop3Client and > _POPMessage classes. They are not really duplicates but different > implementations of the same command that can take an optional argument > (the message id in this case). Obviously, the Pop3Client > implementation goes without an argument and the _POPMessage uses the > stored message id. I also implemented a new Status property, so the > user can know in which state the pop client is according to the > specifications, and restrict some calls that are only allowed in a > specific state. > > Attached is the "merge" of both projects, most probably you will find > some bugs, please let me know. I'm only missing a better error > management and document some parts of the code. I will do this later. > > Regarding svn. As you said the gb.net.smtp would be renamed, moved, > cooked, etc. i wanted to first have a working thing before we(I) break > something. Also, branching in svn is really difficult and confusing > (otherwise it would be as easy as bzr branch ....bzr merge), so i > first wanted to test the changes locally, send a diff so others could > test and THEN do the commit. That's the reason of the Release For > Comment subject ;) > > Thank you both for your feedback! Sorry, bad file, i sent back Fabien's project. PD: Last file, i promise :-) -------------- next part -------------- A non-text attachment was scrubbed... Name: Pop3Client-0.0.1.tar.gz Type: application/x-gzip Size: 10607 bytes Desc: not available URL: From gambas at ...1... Mon Aug 27 23:03:02 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Mon, 27 Aug 2012 23:03:02 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> Message-ID: <503BE086.2000404@...1...> Le 27/08/2012 20:37, Sebastian Kulesz a ?crit : >> >> Regarding svn. As you said the gb.net.smtp would be renamed, moved, >> cooked, etc. i wanted to first have a working thing before we(I) break >> something. Also, branching in svn is really difficult and confusing >> (otherwise it would be as easy as bzr branch ....bzr merge), so i >> first wanted to test the changes locally, send a diff so others could >> test and THEN do the commit. That's the reason of the Release For >> Comment subject ;) We can start with a distinct gb.net.pop3 component if you want. Merging gb.net.smtp and gb.net.pop3 into one common component will need a bit of work anyway. But putting it subversion allows people to use the component, test it, give some feedback... I will do it. Regards, -- Beno?t Minisini From gambas at ...1... Tue Aug 28 00:55:46 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Aug 2012 00:55:46 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503BE086.2000404@...1...> References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> <503BE086.2000404@...1...> Message-ID: <503BFAF2.7020102@...1...> Le 27/08/2012 23:03, Beno?t Minisini a ?crit : > Le 27/08/2012 20:37, Sebastian Kulesz a ?crit : >>> >>> Regarding svn. As you said the gb.net.smtp would be renamed, moved, >>> cooked, etc. i wanted to first have a working thing before we(I) break >>> something. Also, branching in svn is really difficult and confusing >>> (otherwise it would be as easy as bzr branch ....bzr merge), so i >>> first wanted to test the changes locally, send a diff so others could >>> test and THEN do the commit. That's the reason of the Release For >>> Comment subject ;) > > We can start with a distinct gb.net.pop3 component if you want. Merging > gb.net.smtp and gb.net.pop3 into one common component will need a bit of > work anyway. > > But putting it subversion allows people to use the component, test it, > give some feedback... I will do it. > > Regards, > Component put in subversion. I will made some changes, if you have questions about it, just ask! Regards, -- Beno?t Minisini From gambas at ...1... Tue Aug 28 01:00:31 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Aug 2012 01:00:31 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503BFAF2.7020102@...1...> References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> <503BE086.2000404@...1...> <503BFAF2.7020102@...1...> Message-ID: <503BFC0F.6060306@...1...> Le 28/08/2012 00:55, Beno?t Minisini a ?crit : > Le 27/08/2012 23:03, Beno?t Minisini a ?crit : >> Le 27/08/2012 20:37, Sebastian Kulesz a ?crit : >>>> >>>> Regarding svn. As you said the gb.net.smtp would be renamed, moved, >>>> cooked, etc. i wanted to first have a working thing before we(I) break >>>> something. Also, branching in svn is really difficult and confusing >>>> (otherwise it would be as easy as bzr branch ....bzr merge), so i >>>> first wanted to test the changes locally, send a diff so others could >>>> test and THEN do the commit. That's the reason of the Release For >>>> Comment subject ;) >> >> We can start with a distinct gb.net.pop3 component if you want. Merging >> gb.net.smtp and gb.net.pop3 into one common component will need a bit of >> work anyway. >> >> But putting it subversion allows people to use the component, test it, >> give some feedback... I will do it. >> >> Regards, >> > > Component put in subversion. I will made some changes, if you have > questions about it, just ask! > > Regards, > I will mainly make private everything that should not be public, rename some variable, make read-only what should not be writable... When writing an interface, always make the less possible things public! -- Beno?t Minisini From gambas at ...1... Tue Aug 28 01:06:08 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Aug 2012 01:06:08 +0200 Subject: [Gambas-devel] gb.desktop detect a running application In-Reply-To: References: <503B342B.8020009@...1...> Message-ID: <503BFD60.4090100@...1...> Le 27/08/2012 17:51, Jussi Lahtinen a ?crit : > > Not at all. > > A X11 desktop is a server whose applications do not necessarily come > from the same client. > > So to detect that an application is already running is tricky: two > processes from the same executable on the same machine can run on two > different desktops, how could you know that? > > I think that an X11 application can register some properties on the root > windows so that it knows that it already runs on that desktop. I think > it may be a standard, but I don't go deeper than that at the moment. > > Otherwise, this split between the desktop (X11) and the systems that run > the application seems to be dumped with D-Bus and Wayland, so let's see! > > > > Maybe I missed something or I don't know enough about X11, > but doesn't pgrep list all processes no matter who started them and from > where? > > If I'm wrong, is there way I could demonstrate this problem? > > > Jussi > pgrep will give you the processes on one X11 client, not all processes running on the X11 server, which may not be the same computer! -- Beno?t Minisini From gambas at ...1... Tue Aug 28 01:11:23 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Aug 2012 01:11:23 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> Message-ID: <503BFE9B.4020702@...1...> Le 27/08/2012 20:37, Sebastian Kulesz a ?crit : >> >> Okey, i feel i need to clarify some things. >> >> First off Fabien, it's not that i'm being too rigid for the interface, >> it's that with just words it's hard to explain what you were looking >> ... What is the use of the Hardened variable? Why did you do it? -- Beno?t Minisini From sebikul at ...176... Tue Aug 28 01:24:29 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Mon, 27 Aug 2012 20:24:29 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503BFE9B.4020702@...1...> References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> <503BFE9B.4020702@...1...> Message-ID: On Mon, Aug 27, 2012 at 8:11 PM, Beno?t Minisini wrote: > Le 27/08/2012 20:37, Sebastian Kulesz a ?crit : >>> >>> Okey, i feel i need to clarify some things. >>> >>> First off Fabien, it's not that i'm being too rigid for the interface, >>> it's that with just words it's hard to explain what you were looking > >> ... > > What is the use of the Hardened variable? Why did you do it? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel You are using an old revision!! let me push the latest sources. From gambas at ...1... Tue Aug 28 01:36:45 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Aug 2012 01:36:45 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> <503BFE9B.4020702@...1...> Message-ID: <503C048D.5070706@...1...> Le 28/08/2012 01:24, Sebastian Kulesz a ?crit : > > You are using an old revision!! let me push the latest sources. > OK... So, why Hardened? -- Beno?t Minisini From sebikul at ...176... Tue Aug 28 01:38:51 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Mon, 27 Aug 2012 20:38:51 -0300 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: <503C048D.5070706@...1...> References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> <503BFE9B.4020702@...1...> <503C048D.5070706@...1...> Message-ID: On Mon, Aug 27, 2012 at 8:36 PM, Beno?t Minisini wrote: > Le 28/08/2012 01:24, Sebastian Kulesz a ?crit : >> >> You are using an old revision!! let me push the latest sources. >> > > OK... So, why Hardened? > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel I was having some issues with sockets, so i needed to be sure i was logged in before sending some commands. Once that issue was fixed, that feature became useless. From gambas.fr at ...176... Tue Aug 28 09:42:32 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Tue, 28 Aug 2012 09:42:32 +0200 Subject: [Gambas-devel] [RFC] Gambas implementation of the pop3 protocol In-Reply-To: References: <503AA9F4.8000205@...1...> <494281999-1346022234-cardhu_decombobulator_blackberry.rim.net-400519016-@...708...> <503B3DE0.8060708@...1...> <503B57F9.30402@...1...> <503BFE9B.4020702@...1...> <503C048D.5070706@...1...> Message-ID: 2012/8/28 Sebastian Kulesz : > On Mon, Aug 27, 2012 at 8:36 PM, Beno?t Minisini > wrote: >> Le 28/08/2012 01:24, Sebastian Kulesz a ?crit : >>> >>> You are using an old revision!! let me push the latest sources. >>> >> >> OK... So, why Hardened? >> >> -- >> Beno?t Minisini >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > I was having some issues with sockets, so i needed to be sure i was > logged in before sending some commands. Once that issue was fixed, > that feature became useless. > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Just ping each time ... -- Fabien Bodard From tobias at ...692... Tue Aug 28 16:55:23 2012 From: tobias at ...692... (Tobias Boege) Date: Tue, 28 Aug 2012 16:55:23 +0200 Subject: [Gambas-devel] Finding Variant Message-ID: <20120828145523.GH1222@...693...> A non-text attachment was scrubbed... Name: not available Type: text/plain-8bit Size: 350 bytes Desc: not available URL: From gambas at ...1... Tue Aug 28 17:04:03 2012 From: gambas at ...1... (=?UTF-8?B?QmVub8OudCBNaW5pc2luaQ==?=) Date: Tue, 28 Aug 2012 17:04:03 +0200 Subject: [Gambas-devel] Finding Variant In-Reply-To: <20120828145523.GH1222@...693...> References: <20120828145523.GH1222@...693...> Message-ID: <503CDDE3.1090107@...1...> Le 28/08/2012 16:55, Tobias Boege a ?crit : > Beno?t, > > is there an easy way to compare Variants? The Variant[] has no Find() and > the rest of the compare functions are specific to their datatypes which > could all live in one Variant. This is needed for the List.Find*() > functions so either "equal" or "not equal" will be enough for a result. (May > even memcmp() suffice for that?) > > Regards, > Tobi > No, the Variant comparison has only be implemented in operators. I will do that, and then I will add an API to compare two values. And no, memcmp() is not enough! -- Beno?t Minisini From tobias at ...692... Tue Aug 28 17:25:58 2012 From: tobias at ...692... (Tobias Boege) Date: Tue, 28 Aug 2012 17:25:58 +0200 Subject: [Gambas-devel] Free state memory when enumeration BREAKs Message-ID: <20120828152558.GJ1222@...693...> Hi, for my enumeration state, I allocate a buffer via GB.Alloc(). If it happens that the enumeration gets aborted by means of BREAK, is there any notification mechanism? And just to be sure I well understood: GB.ListEnum(), GB.NextEnum() and GB.GetEnum() are used together to modify all other currently active enumerations in case the common enumeration object is modified? Regards, Tobi From gambas at ...1... Tue Aug 28 18:07:00 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 28 Aug 2012 18:07:00 +0200 Subject: [Gambas-devel] Free state memory when enumeration BREAKs In-Reply-To: <20120828152558.GJ1222@...693...> References: <20120828152558.GJ1222@...693...> Message-ID: <503CECA4.4090105@...1...> Le 28/08/2012 17:25, Tobias Boege a ?crit : > Hi, > > for my enumeration state, I allocate a buffer via GB.Alloc(). If it happens > that the enumeration gets aborted by means of BREAK, is there any > notification mechanism? > > And just to be sure I well understood: GB.ListEnum(), GB.NextEnum() and > GB.GetEnum() are used together to modify all other currently active > enumerations in case the common enumeration object is modified? > > Regards, > Tobi > At the moment, there is no support for allocation associated with an enumeration. During the _next method, GB.GetEnum() returns a pointer to an array of four pointers (or four intptr_t, or anything you want that fit). You have to use that to store your enumeration state, and nothing more. At the start of the enumeration, the contents of these four pointers is zero. An enumerator must handle destruction of other objects. But, for performance reasons, it cannot ensure that it won't forget any object if something change in the enumerated objects. After an object has been removed from the enumerated object, you can use GB.ListEnum(), GB.NextEnum() and GB.GetEnum() to browse all current enumerations, and modify their state to take the removal into account. But this can be a tricky job. Look at gbx_c_collection.c for an example. At the moment: - Array enumeration ignores object removal. - Collection enumeration handles object removal, by checking the state of each enumeration. If an enumeration points at the object removal, it is moved forward automatically. So, as you see, the rule for container classes is: removing an object during an enumeration has an undefined behaviour, except that the interpreter won't crash! Regards, -- Beno?t Minisini From tobias at ...692... Tue Aug 28 18:51:42 2012 From: tobias at ...692... (Tobias Boege) Date: Tue, 28 Aug 2012 18:51:42 +0200 Subject: [Gambas-devel] Free state memory when enumeration BREAKs In-Reply-To: <503CECA4.4090105@...1...> References: <20120828152558.GJ1222@...693...> <503CECA4.4090105@...1...> Message-ID: <20120828165142.GK1222@...693...> On Tue, 28 Aug 2012, Beno?t Minisini wrote: > Le 28/08/2012 17:25, Tobias Boege a ?crit : > > Hi, > > > > for my enumeration state, I allocate a buffer via GB.Alloc(). If it happens > > that the enumeration gets aborted by means of BREAK, is there any > > notification mechanism? > > > > And just to be sure I well understood: GB.ListEnum(), GB.NextEnum() and > > GB.GetEnum() are used together to modify all other currently active > > enumerations in case the common enumeration object is modified? > > > > Regards, > > Tobi > > > > At the moment, there is no support for allocation associated with an > enumeration. > > During the _next method, GB.GetEnum() returns a pointer to an array of > four pointers (or four intptr_t, or anything you want that fit). You > have to use that to store your enumeration state, and nothing more. > > At the start of the enumeration, the contents of these four pointers is > zero. > > An enumerator must handle destruction of other objects. But, for > performance reasons, it cannot ensure that it won't forget any object if > something change in the enumerated objects. > > After an object has been removed from the enumerated object, you can use > GB.ListEnum(), GB.NextEnum() and GB.GetEnum() to browse all current > enumerations, and modify their state to take the removal into account. > But this can be a tricky job. Look at gbx_c_collection.c for an example. > > At the moment: > > - Array enumeration ignores object removal. > > - Collection enumeration handles object removal, by checking the state > of each enumeration. If an enumeration points at the object removal, it > is moved forward automatically. > > So, as you see, the rule for container classes is: removing an object > during an enumeration has an undefined behaviour, except that the > interpreter won't crash! > > Regards, > > -- > Beno?t Minisini > Oh, it is 4*sizeof(intptr_t). This is different in the docs (which says 16 bytes). Hence my confusion. I need 2 pointers and an int. On 64-bit this exceeds 16 bytes, but will go into 4*sizeof(intptr_t). OK. It should altogether not be that hard to implement the accounting of removed objects in enumerations... Thanks. Regards, Tobi From jussi.lahtinen at ...176... Wed Aug 29 17:19:43 2012 From: jussi.lahtinen at ...176... (Jussi Lahtinen) Date: Wed, 29 Aug 2012 18:19:43 +0300 Subject: [Gambas-devel] gb.desktop detect a running application In-Reply-To: <503BFD60.4090100@...1...> References: <503B342B.8020009@...1...> <503BFD60.4090100@...1...> Message-ID: I was thinking what is the real usage for this feature. If you want to limit access for some data to one instance at time, then this is not good way to do it (instead lock with id of opener should be used). And if you just want to prevent accidental multiple instances of your program, then I would guess the suggested code would do most of the job. Anyway, there is no way to know whether you have started some program in remote computer in some of the various ways. Jussi On 28 August 2012 02:06, Beno?t Minisini wrote: > Le 27/08/2012 17:51, Jussi Lahtinen a ?crit : > > > > Not at all. > > > > A X11 desktop is a server whose applications do not necessarily come > > from the same client. > > > > So to detect that an application is already running is tricky: two > > processes from the same executable on the same machine can run on two > > different desktops, how could you know that? > > > > I think that an X11 application can register some properties on the > root > > windows so that it knows that it already runs on that desktop. I > think > > it may be a standard, but I don't go deeper than that at the moment. > > > > Otherwise, this split between the desktop (X11) and the systems that > run > > the application seems to be dumped with D-Bus and Wayland, so let's > see! > > > > > > > > Maybe I missed something or I don't know enough about X11, > > but doesn't pgrep list all processes no matter who started them and from > > where? > > > > If I'm wrong, is there way I could demonstrate this problem? > > > > > > Jussi > > > > pgrep will give you the processes on one X11 client, not all processes > running on the X11 server, which may not be the same computer! > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas at ...1... Wed Aug 29 23:03:56 2012 From: gambas at ...1... (=?UTF-8?B?QmVub8OudCBNaW5pc2luaQ==?=) Date: Wed, 29 Aug 2012 23:03:56 +0200 Subject: [Gambas-devel] Finding Variant In-Reply-To: <503CDDE3.1090107@...1...> References: <20120828145523.GH1222@...693...> <503CDDE3.1090107@...1...> Message-ID: <503E83BC.7030702@...1...> Le 28/08/2012 17:04, Beno?t Minisini a ?crit : > Le 28/08/2012 16:55, Tobias Boege a ?crit : >> Beno?t, >> >> is there an easy way to compare Variants? The Variant[] has no Find() and >> the rest of the compare functions are specific to their datatypes which >> could all live in one Variant. This is needed for the List.Find*() >> functions so either "equal" or "not equal" will be enough for a result. (May >> even memcmp() suffice for that?) >> >> Regards, >> Tobi >> > > No, the Variant comparison has only be implemented in operators. I will > do that, and then I will add an API to compare two values. > > And no, memcmp() is not enough! > In revision #5099, you have a new API: GB.CompValue(). It takes two 'GB_VARIANT_VALUE *' 'a' and 'b', and returns 1 if 'a' is greater than 'b', -1 if 'b' is greater than 'a', and 0 if 'a' equals 'b'. When 'a' and 'b' do not have the same type, it tries to do its best (conversion if they are not objects, NULL is always the lower value, and object is always greater than a non-object...). Regards, -- Beno?t Minisini From gambas at ...1... Thu Aug 30 03:26:19 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 30 Aug 2012 03:26:19 +0200 Subject: [Gambas-devel] About gb.net.pop3 Message-ID: <503EC13B.3020300@...1...> Hi Sebastian, I am going to make many changes to the interface of your component. It will be faster for me to make them directly rather than explain them by mail. So once I have done my commit, please look at the result and ask me your questions so that I can justify my changes. :-) Regards, -- Beno?t Minisini From tobias at ...692... Thu Aug 30 04:18:16 2012 From: tobias at ...692... (Tobias Boege) Date: Thu, 30 Aug 2012 04:18:16 +0200 Subject: [Gambas-devel] About List interface Message-ID: <20120830021816.GA10921@...693...> Hi Benoit, I think the current List class follows your suggestions but there are some critical points: 1. Enumeration I use the List.Current as the enumeration pointer as this seems conclusive: For Each List Print List.Current ' All items Next This makes of course problems in nested loops with triggered BREAK. The current implementation works somewhat cruel internally (until I incorporate List.Take() into the enumeration state updating) that the user may not understand what is going on. My question therefore: Should List.Current not be modified at all during For Each or should the limitations written down? 2. Enumeration (2) >From where shall the enumeration start? From the beginning or the Current node? 3. Prepend and the first Current When the first element is added to the List, it automatically gets Current. Before, there is none. If afterwards another element gets Prepend()'d, Current is the second node without the user doing anything on Current. Is this logical enough? Remarks I have the ususal test project and some benchmarks so far. Interestingly, the current implementation cannot beat Variant[] even in best cache locality order of operations... by a hair's breadth ;-) I'll continue with improving the List internally and looking for rbtrees. Regards, Tobi From gambas.fr at ...176... Thu Aug 30 10:10:30 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Thu, 30 Aug 2012 10:10:30 +0200 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: <503EC13B.3020300@...1...> References: <503EC13B.3020300@...1...> Message-ID: J'm'en s'rai dout? :-b. Le 30 ao?t 2012 03:27, "Beno?t Minisini" a ?crit : > Hi Sebastian, > > I am going to make many changes to the interface of your component. > > It will be faster for me to make them directly rather than explain them > by mail. > > So once I have done my commit, please look at the result and ask me your > questions so that I can justify my changes. :-) > > Regards, > > -- > Beno?t Minisini > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gambas.fr at ...176... Thu Aug 30 10:12:18 2012 From: gambas.fr at ...176... (Fabien Bodard) Date: Thu, 30 Aug 2012 10:12:18 +0200 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: References: <503EC13B.3020300@...1...> Message-ID: Can you make csockets more finished... For use with other mail protocols Le 30 ao?t 2012 10:10, "Fabien Bodard" a ?crit : > J'm'en s'rai dout? :-b. > Le 30 ao?t 2012 03:27, "Beno?t Minisini" a > ?crit : > >> Hi Sebastian, >> >> I am going to make many changes to the interface of your component. >> >> It will be faster for me to make them directly rather than explain them >> by mail. >> >> So once I have done my commit, please look at the result and ask me your >> questions so that I can justify my changes. :-) >> >> Regards, >> >> -- >> Beno?t Minisini >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebikul at ...176... Thu Aug 30 21:56:40 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Thu, 30 Aug 2012 16:56:40 -0300 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: <503EC13B.3020300@...1...> References: <503EC13B.3020300@...1...> Message-ID: On Wed, Aug 29, 2012 at 10:26 PM, Beno?t Minisini wrote: > Hi Sebastian, > > I am going to make many changes to the interface of your component. > > It will be faster for me to make them directly rather than explain them > by mail. > > So once I have done my commit, please look at the result and ask me your > questions so that I can justify my changes. :-) > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel Sure, no problem. I started implementing a MIME class to parse the message. The specification is not difficult to implement, it's just large. I intend to first implement parsing the headers of the message and body. The only change i made is to create a new class which implements the MIME specs and make _POPMessage a child, so there should be no conflicts when merging. From gambas at ...1... Thu Aug 30 22:04:52 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Thu, 30 Aug 2012 22:04:52 +0200 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: References: <503EC13B.3020300@...1...> Message-ID: <503FC764.2000008@...1...> Le 30/08/2012 21:56, Sebastian Kulesz a ?crit : > On Wed, Aug 29, 2012 at 10:26 PM, Beno?t Minisini > wrote: >> Hi Sebastian, >> >> I am going to make many changes to the interface of your component. >> >> It will be faster for me to make them directly rather than explain them >> by mail. >> >> So once I have done my commit, please look at the result and ask me your >> questions so that I can justify my changes. :-) >> >> Regards, >> >> -- >> Beno?t Minisini >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > Sure, no problem. I started implementing a MIME class to parse the > message. The specification is not difficult to implement, it's just > large. I intend to first implement parsing the headers of the message > and body. The only change i made is to create a new class which > implements the MIME specs and make _POPMessage a child, so there > should be no conflicts when merging. > Do you use gmime? The MIME class must not depend on anything specific to Pop3Client. And you should be able to convert a string to a MIME structure (receiving mail) and to create a MIME structure, and then convert it to a string (sending mail). That way, gb.net.smtp will be able to be rewritten entirely in Gambas. :-) Regards, -- Beno?t Minisini From sebikul at ...176... Thu Aug 30 22:12:27 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Thu, 30 Aug 2012 17:12:27 -0300 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: <503FC764.2000008@...1...> References: <503EC13B.3020300@...1...> <503FC764.2000008@...1...> Message-ID: On Thu, Aug 30, 2012 at 5:04 PM, Beno?t Minisini wrote: > Le 30/08/2012 21:56, Sebastian Kulesz a ?crit : >> On Wed, Aug 29, 2012 at 10:26 PM, Beno?t Minisini >> wrote: >>> Hi Sebastian, >>> >>> I am going to make many changes to the interface of your component. >>> >>> It will be faster for me to make them directly rather than explain them >>> by mail. >>> >>> So once I have done my commit, please look at the result and ask me your >>> questions so that I can justify my changes. :-) >>> >>> Regards, >>> >>> -- >>> Beno?t Minisini >>> >>> ------------------------------------------------------------------------------ >>> Live Security Virtual Conference >>> Exclusive live event will cover all the ways today's security and >>> threat landscape has changed and how IT managers can respond. Discussions >>> will include endpoint security, mobile security and the latest in malware >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>> _______________________________________________ >>> Gambas-devel mailing list >>> Gambas-devel at lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/gambas-devel >> >> Sure, no problem. I started implementing a MIME class to parse the >> message. The specification is not difficult to implement, it's just >> large. I intend to first implement parsing the headers of the message >> and body. The only change i made is to create a new class which >> implements the MIME specs and make _POPMessage a child, so there >> should be no conflicts when merging. >> > > Do you use gmime? > > The MIME class must not depend on anything specific to Pop3Client. > > And you should be able to convert a string to a MIME structure > (receiving mail) and to create a MIME structure, and then convert it to > a string (sending mail). > > That way, gb.net.smtp will be able to be rewritten entirely in Gambas. :-) > > Regards, > > -- > Beno?t Minisini > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Gambas-devel mailing list > Gambas-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-devel I'm using plain Gambas. gmime is too complex and the specs don't require anything that gambas can't do ;) The MIMEMessage class is independent, so that if we later implement IMAP, for example, it can be done without additional work. From sebikul at ...176... Fri Aug 31 03:55:05 2012 From: sebikul at ...176... (Sebastian Kulesz) Date: Thu, 30 Aug 2012 22:55:05 -0300 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: References: <503EC13B.3020300@...1...> <503FC764.2000008@...1...> Message-ID: On Thu, Aug 30, 2012 at 5:12 PM, Sebastian Kulesz wrote: > On Thu, Aug 30, 2012 at 5:04 PM, Beno?t Minisini > wrote: >> Le 30/08/2012 21:56, Sebastian Kulesz a ?crit : >>> On Wed, Aug 29, 2012 at 10:26 PM, Beno?t Minisini >>> wrote: >>>> Hi Sebastian, >>>> >>>> I am going to make many changes to the interface of your component. >>>> >>>> It will be faster for me to make them directly rather than explain them >>>> by mail. >>>> >>>> So once I have done my commit, please look at the result and ask me your >>>> questions so that I can justify my changes. :-) >>>> >>>> Regards, >>>> >>>> -- >>>> Beno?t Minisini >>>> >>>> ------------------------------------------------------------------------------ >>>> Live Security Virtual Conference >>>> Exclusive live event will cover all the ways today's security and >>>> threat landscape has changed and how IT managers can respond. Discussions >>>> will include endpoint security, mobile security and the latest in malware >>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>> _______________________________________________ >>>> Gambas-devel mailing list >>>> Gambas-devel at lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/gambas-devel >>> >>> Sure, no problem. I started implementing a MIME class to parse the >>> message. The specification is not difficult to implement, it's just >>> large. I intend to first implement parsing the headers of the message >>> and body. The only change i made is to create a new class which >>> implements the MIME specs and make _POPMessage a child, so there >>> should be no conflicts when merging. >>> >> >> Do you use gmime? >> >> The MIME class must not depend on anything specific to Pop3Client. >> >> And you should be able to convert a string to a MIME structure >> (receiving mail) and to create a MIME structure, and then convert it to >> a string (sending mail). >> >> That way, gb.net.smtp will be able to be rewritten entirely in Gambas. :-) >> >> Regards, >> >> -- >> Beno?t Minisini >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Gambas-devel mailing list >> Gambas-devel at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-devel > > I'm using plain Gambas. gmime is too complex and the specs don't > require anything that gambas can't do ;) > > The MIMEMessage class is independent, so that if we later implement > IMAP, for example, it can be done without additional work. I like the changes :) One question only. When you reference $iPort to iPort (line Pop3Client:186) you are never telling the user which port is being used (even though it should be obvious). Is this intentional? Leaving POP3 aside, i just pushed an initial implementation of a MIME parser. It's far from complete, and the code is *really dirty* and unorganized, but it already has basic functionality. Right now it can only parse a message into a structure, not backwards, but this will come later. i'm having some trouble decoding Quoted-Printable content, but that's because i don't know much of regex. I found this one online, but i don't know much of the pcre component and how to directly replace matches, so i hardcoded it into a big loop but it is really buggy. I'd really thank some help here. regex: =([0-9a-fA-F]{2}) Quoted-Printable specs: http://tools.ietf.org/html/rfc2045#page-19 The parsing of the headers is divided into 2 steps. Firts multi-line headers are grouped together with a new-line separator so they are easy to parse. Then they are organized inside a collection. If a header is repeated it's value is replaced by a String[] instance and each time a repetition is fount it's appended to this array. I feel it is still fast, regardless of it's not-so-optimized implementation. Please leave your comments! From tobias at ...692... Fri Aug 31 13:57:14 2012 From: tobias at ...692... (Tobias Boege) Date: Fri, 31 Aug 2012 13:57:14 +0200 Subject: [Gambas-devel] About List interface In-Reply-To: <20120830021816.GA10921@...693...> References: <20120830021816.GA10921@...693...> Message-ID: <20120831115714.GA718@...693...> On Thu, 30 Aug 2012, Tobias Boege wrote: > Hi Benoit, > > I think the current List class follows your suggestions but there are some > critical points: > > 1. Enumeration > I use the List.Current as the enumeration pointer as this seems conclusive: > > For Each List > Print List.Current ' All items > Next > > This makes of course problems in nested loops with triggered BREAK. The > current implementation works somewhat cruel internally (until I incorporate > List.Take() into the enumeration state updating) that the user may not > understand what is going on. > > My question therefore: Should List.Current not be modified at all during > For Each or should the limitations written down? > > 2. Enumeration (2) > >From where shall the enumeration start? From the beginning or the Current > node? > > 3. Prepend and the first Current > When the first element is added to the List, it automatically gets Current. > Before, there is none. If afterwards another element gets Prepend()'d, > Current is the second node without the user doing anything on Current. Is > this logical enough? > > Remarks > I have the ususal test project and some benchmarks so far. Interestingly, > the current implementation cannot beat Variant[] even in best cache locality > order of operations... by a hair's breadth ;-) > I'll continue with improving the List internally and looking for rbtrees. > > Regards, > Tobi > 4. Backwards enumeration I'd like to enable the user to For Each backwards. What would that look like? I thought of a property named Backwards which sets a bit in the List to start the next enumeration as backwards and returns itself. It would look like this then: For Each List.Backwards Print List.Current ' All items backwards Next What do you think? From gambas at ...1... Fri Aug 31 20:05:45 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 31 Aug 2012 20:05:45 +0200 Subject: [Gambas-devel] About List interface In-Reply-To: <20120830021816.GA10921@...693...> References: <20120830021816.GA10921@...693...> Message-ID: <5040FCF9.3060908@...1...> Le 30/08/2012 04:18, Tobias Boege a ?crit : > Hi Benoit, > > I think the current List class follows your suggestions but there are some > critical points: > > 1. Enumeration > I use the List.Current as the enumeration pointer as this seems conclusive: > > For Each List > Print List.Current ' All items > Next > > This makes of course problems in nested loops with triggered BREAK. The > current implementation works somewhat cruel internally (until I incorporate > List.Take() into the enumeration state updating) that the user may not > understand what is going on. > > My question therefore: Should List.Current not be modified at all during > For Each or should the limitations written down? Each enumeration has its own internal pointer. List.Current must be completely independent of all enumerations. > > 2. Enumeration (2) >>From where shall the enumeration start? From the beginning or the Current > node? From the beginning. If the user needs to start somewhere else, he will do it by hand. > > 3. Prepend and the first Current > When the first element is added to the List, it automatically gets Current. > Before, there is none. If afterwards another element gets Prepend()'d, > Current is the second node without the user doing anything on Current. Is > this logical enough? You can choose to make the last inserted element current, whatever the insertion method was. Regards, -- Beno?t Minisini From gambas at ...1... Fri Aug 31 20:08:56 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 31 Aug 2012 20:08:56 +0200 Subject: [Gambas-devel] About List interface In-Reply-To: <20120831115714.GA718@...693...> References: <20120830021816.GA10921@...693...> <20120831115714.GA718@...693...> Message-ID: <5040FDB8.3050204@...1...> Le 31/08/2012 13:57, Tobias Boege a ?crit : > > 4. Backwards enumeration > I'd like to enable the user to For Each backwards. What would that look > like? I thought of a property named Backwards which sets a bit in the List > to start the next enumeration as backwards and returns itself. It would > look like this then: > > For Each List.Backwards > Print List.Current ' All items backwards > Next > > What do you think? As I said before, each enumeration must be indepedent of List.Current. Moreover, the syntax should be compatible with other container classes (Array and Collection): Dim vElt As Variant For Each vElt in TheList ... Next Anyway, if you want you can implement: For Each vElt in TheList.Backwards ... Next But then the Backwards property should use GB_RETURN_SELF() and returns a virtual class (named ".List.Backwards") having just its own "_next" enumerator. Regards, -- Beno?t Minisini From gambas at ...1... Fri Aug 31 20:17:43 2012 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Fri, 31 Aug 2012 20:17:43 +0200 Subject: [Gambas-devel] About gb.net.pop3 In-Reply-To: References: <503EC13B.3020300@...1...> <503FC764.2000008@...1...> Message-ID: <5040FFC7.6000801@...1...> Le 31/08/2012 03:55, Sebastian Kulesz a ?crit : >> >> I'm using plain Gambas. gmime is too complex and the specs don't >> require anything that gambas can't do ;) >> >> The MIMEMessage class is independent, so that if we later >> implement IMAP, for example, it can be done without additional >> work. > > I like the changes :) One question only. When you reference $iPort > to iPort (line Pop3Client:186) you are never telling the user which > port is being used (even though it should be obvious). Is this > intentional? Mmm... Yes? The idea is that "zero" (which is never a valid port for a standard protocol afaik) means "takes the default port". This is needed the default port is different if you use encryption or not. > > Leaving POP3 aside, i just pushed an initial implementation of a > MIME parser. It's far from complete, and the code is *really dirty* Ouch.... > and unorganized, but it already has basic functionality. Right now it > can only parse a message into a structure, not backwards, but this > will come later. i'm having some trouble decoding Quoted-Printable > content, but that's because i don't know much of regex. I found this > one online, but i don't know much of the pcre component and how to > directly replace matches, so i hardcoded it into a big loop but it > is really buggy. I'd really thank some help here. > > regex: =([0-9a-fA-F]{2}) Quoted-Printable specs: > http://tools.ietf.org/html/rfc2045#page-19 Aaarrgh... No regexp. Never use them for that! It's for Perl programmers and it's slow and it's buggy 99% of the time. These routines must be implemented in C for speed reasons. The structure of the component should go there: - A part in C with the low-level routines. - A part in Gambas that implements the Pop3 protocol, the MIME message routines, and the SMTP protocol rewritten in Gambas in the future. > > The parsing of the headers is divided into 2 steps. Firts multi-line > headers are grouped together with a new-line separator so they are > easy to parse. Then they are organized inside a collection. If a > header is repeated it's value is replaced by a String[] instance and > each time a repetition is fount it's appended to this array. I feel > it is still fast, regardless of it's not-so-optimized > implementation. > > Please leave your comments! You decided to not use gmime. OK. But so you have to be very careful when following the MIME specs, otherwise many of mails will be unreadable. I know what I am talking about with gb.net.smtp whose code is not mine at the beginning... As for the interface : MIME is hierarchical, so you have to implement different classes with some begin containers MIME parts, and other contents MIME parts. You can look at gmime to know what to do, and simplify their structure if you can. Regards, -- Beno?t Minisini