Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: BlueHazzard on July 23, 2013, 06:50:02 pm

Title: patchs in pipeline
Post by: BlueHazzard on July 23, 2013, 06:50:02 pm
Hi...
i have now time to work a bit on c::b
There are 4 patches i have created on berlios, but no comments... can someone say something about them ;)

Add an option to add the include directory automatically to the project:
 http://developer.berlios.de/patch/?func=detailpatch&patch_id=3488&group_id=5358
discussion about this would be welcome (mostly about if the path should be added to the main project, or to every build target)

Bug Fix for script menu entry
http://developer.berlios.de/patch/?func=detailpatch&patch_id=3480&group_id=5358
This Patch fixes a bug, if a script adds a menu entry, and the script gets reloaded, the old script is called by the menu entry and not the new. This patch is not really beautiful, but i think i will rework the scripting framework a bit in the future, to make this more elegant. But for now it works...

Bug Fix for a crash about a buffer overflow in the print function for squirrel
http://developer.berlios.de/patch/?func=detailpatch&patch_id=3479&group_id=5358
This really should be fixed....

Add a option for automatic line truncation in AStyle
http://developer.berlios.de/patch/?func=detailpatch&patch_id=3478&group_id=5358

greetings
Title: Re: patchs in pipeline
Post by: Alpha on July 24, 2013, 03:45:12 am
There are 4 patches i have created on berlios, but no comments... can someone say something about them ;)
I have been feeling too lazy to review code :).  I will try to look at some this week.
Title: Re: patchs in pipeline
Post by: MortenMacFly on July 24, 2013, 07:48:07 am
I have been feeling too lazy to review code :).  I will try to look at some this week.
I am testing these myself, too and I'll report back if I see serious regressions.

@alpha: For the astyle thing: Please leave it to me, as I've some more updates on that plugin. I'll assign it to me.
Title: Re: patchs in pipeline
Post by: MortenMacFly on July 24, 2013, 08:26:32 am
Bug Fix for a crash about a buffer overflow in the print function for squirrel
http://developer.berlios.de/patch/?func=detailpatch&patch_id=3479&group_id=5358
This really should be fixed....
I don't like the design of this one. It introduces a dependency for SQPlus for all plugins using ScriptingManager interface. This essentially breaks the idea of an interface. So "scriptinmanager" should definitely not include sqplus.h.

If thats the case it should be fine. A forward declaration to SQChar might be enough, but I didn't try...
Title: Re: patchs in pipeline
Post by: BlueHazzard on July 26, 2013, 10:41:36 pm
I don't like the design of this one. It introduces a dependency for SQPlus for all plugins using ScriptingManager interface. This essentially breaks the idea of an interface. So "scriptinmanager" should definitely not include sqplus.h.

If thats the case it should be fine. A forward declaration to SQChar might be enough, but I didn't try...

i see your problem... the actual dependency goes to squirrel, but it's the same... i will look into it.
Some questions:

A other possibility would be to move the function to somewhere else... Maybe a new file like scriptutil.cpp

I'm in a region with limited internet, so my answers won't be immediate.

greetings
Title: Re: patchs in pipeline
Post by: stahta01 on July 26, 2013, 11:23:18 pm
The problem with forward declaration is that SQChar can be wchar_t or char... so i have to put a preprocessorswitch

I suggest using "TCHAR" in a declaration like below; but, it might not work.

Code
typedef TCHAR SQChar;

Should work; but, I am just a C programmer. This not says not to use TCHAR in C++ Headers http://blogs.msdn.com/b/andrewarnottms/archive/2008/02/22/why-you-should-never-use-tchar-in-c-header-files.aspx (http://blogs.msdn.com/b/andrewarnottms/archive/2008/02/22/why-you-should-never-use-tchar-in-c-header-files.aspx)

TCHAR might required header tchar.h

From tchar.h in MinGW GCC installed with CB 12.11.

Quote
/*
 * Use TCHAR instead of char or wchar_t. It will be appropriately translated
 * if _UNICODE is correctly defined (or not).
 */

Tim S.

PS: I am only a Code::Blocks user; not a CB developer.
Title: Re: patchs in pipeline
Post by: MortenMacFly on July 27, 2013, 03:48:40 pm
how can i forward declare a type in c++?
Oh that was a typedef and not a class?! - Well than there is no easy solution, forward decl will not work.
Title: Re: patchs in pipeline
Post by: p2rkw on July 27, 2013, 06:36:54 pm
struct A; //forward decl
typedef A B;
?
Title: Re: patchs in pipeline
Post by: MortenMacFly on July 27, 2013, 06:43:35 pm
struct A; //forward decl
typedef A B;
?
Is it that simple? I think I need to have a look at the sources. All my remarks came from the errors when trying to compile all plugins with with the patch.
Title: Re: patchs in pipeline
Post by: BlueHazzard on July 28, 2013, 07:56:18 pm
its like
#ifdef UNICODE
 typedef SQChar wchar_t
#else
 typedef SQchar unsigned char
#endif

in squirrel.h so no easy solution...  We can use a helper file...

greetings