Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: killerbot on October 24, 2006, 12:30:24 pm

Title: Plug-Ins : some suggested "case" conventions
Post by: killerbot on October 24, 2006, 12:30:24 pm
When ones creates a plug-in for Code::Blocks (focusing here on contrib plug-ins that should work under Windows and linux), the plug-in project will contain several files :
1) Source files
2) Project files (*.cbp, Makefile.am's ..)
3) manifest file
4) resource files

This causes the plug-in name (or it's ID, or whatever you like to call it) to show up in several places. The majority of those places require that name to be identical, meaning using the same case !! [On windows this is no issue, but on linux it is very important].
Let's have a look at those places where that name shows up.

But first let's decide on a name for our test case plug-in : "TestCase".
Quote
This would be the *suggestion* : start every word in the name with an uppercase : JustLikeThis

Allrighty, let's continue our excursion :

1) manifest.xml
Code
<Plugin name="TestCase">
--> it states the plug-in name

2) the zip file of the resources : "TestCase.zip"
 This zip file is created as a post-build step, so the correct command needs to show up in the following project files :
 TestCase.cbp (to build on windows with CB)
 TestCase-unix.cbp (to build on linux with CB)
 Makefile.am : to build on linux and windows

 Some example snippets out of those project files :
Code
		<ExtraCommands>
<Add after="zip -j9 ..\..\..\devel\share\codeblocks\TestCase.zip resources\manifest.xml resources\*.xrc" />
<Mode after="always" />
</ExtraCommands>

Code
		<ExtraCommands>
<Add after="zip -j9 ../../../devel/share/codeblocks/TestCase.zip resources/manifest.xml resources/*.xrc" />
<Mode after="always" />
</ExtraCommands>

Code
EXTRA_DIST = MyFirst.xrc MySecond.xrc manifest.xml

pkgdata_DATA = TestCase.zip
CLEANFILES = $(pkgdata_DATA)

TestCase.zip:
PWD=`pwd` cd $(srcdir) && zip $(PWD)/TestCase.zip manifest.xml *.xrc > /dev/null

3) The code registering the plug-in and loading the resource :
 TestCase.cpp :
Code
// Register the plugin
namespace
{
  PluginRegistrant<TestCase> reg(_T("TestCase"));
};

/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */

TestCase::TestCase()
{
  //ctor
  if(!Manager::LoadResource(_T("TestCase.zip")))
  {
    NotifyMissingFile(_T("TestCase.zip"));
  }
}// end of constructor

4) the output "shared" library (*.so or *.dll)
Again some example snippets from the project files

Code
<Option output="..\..\..\devel\share\CodeBlocks\plugins\TestCase.dll" prefix_auto="0" extension_auto="0" />

Code
<Option output="../../../devel/share/codeblocks/plugins/libTestCase.so" />

Code
lib_LTLIBRARIES = libSymTab.la

libTestCase_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version

libTestCase_la_LIBADD =

libTestCase_la_SOURCES =


And for consistency it's also nice if you project names are alike :
Code
	<Project>
<Option title="TestCase" />

Title: Re: Plug-Ins : some suggested "case" conventions
Post by: takeshimiya on October 24, 2006, 03:01:38 pm
I'd say:

1) CamelCase
2) lowercase
3) CamelCase
4) lowercase
5) CamelCase

In short, lowercase for all filenames, and CamelCase for everything else (project names, classes...).
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: mandrav on October 24, 2006, 03:51:16 pm
I'd say:

1) CamelCase
2) lowercase
3) CamelCase
4) lowercase
5) CamelCase

In short, lowercase for all filenames, and CamelCase for everything else (project names, classes...).

You missed the point completely.
All 5 points must match, case-sensitively (even under windows).
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: thomas on October 24, 2006, 04:04:01 pm
You missed the point completely.
All 5 points must match, case-sensitively (even under windows).
How dare you say that! Takeshi knows.
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: takeshimiya on October 24, 2006, 04:20:58 pm
You missed the point completely.
Sorry, but yes, I understood Lieven's post as something to discuss and to change...
Not how it is now.
The title "suggested case conventions" doesn't sounds like "enforced case conventions".

If this was meant as a documentation and not to discuss, one would expected it in the Wiki.

How dare you say that! Takeshi knows.
Bleh, but thanks for the attitude anyways.
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: killerbot on October 24, 2006, 04:39:28 pm
the "CamelCase" is the suggestion ;-)

Never heard that terminology, but I like it !!!

[EDIT] : http://en.wikipedia.org/wiki/CamelCase
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: takeshimiya on October 24, 2006, 04:42:36 pm
the "CamelCase" is the suggestion ;-)

I see
As you can see today I have problems to understand your meanings (Applied to core code) :P
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: killerbot on October 24, 2006, 04:52:22 pm
[offtopic] today you will be able to celibrate. Firefox 2.0 is coming  :D :D :D :D

PS :
Quote
Is applied to the core code : (yes/no) (meaning is it in : yes or no)
------------------------------------------------------------------------------------------------------------------------------


...

Remark : applied to the core means : a CB developer has applied your patch, so your changes are now into the core code (the real code you get from svn).
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: takeshimiya on October 24, 2006, 07:26:34 pm
[offtopic] today you will be able to celibrate. Firefox 2.0 is coming  :D :D :D :D
:P


Quote
Is applied to the core code : (yes/no) (meaning is it in : yes or no)
------------------------------------------------------------------------------------------------------------------------------


...

Remark : applied to the core means : a CB developer has applied your patch, so your changes are now into the core code (the real code you get from svn).
Yeah, but it's a bit confusing as core code also means sdk/core plugins (contrary to contribs).

Now, back on topic, your suggestion was something like this perhaps?:

astyle.dll -> AStyle.dll
autosave.dll -> AutoSave.dll
byogames.dll -> ByoGames.dll
cb_koders.dll -> KodersSearch.dll
CBProfiler.dll -> Profiler.dll
classwizard.dll -> ClassWizard.dll
codecompletion.dll -> CodeCompletion.dll
codesnippets.dll -> CodeSnippets.dll
codestat.dll -> CodeStatistics.dll
compiler.dll -> Compiler.dll
copystrings.dll -> CopyStrings.dll
debugger.dll -> Debugger.dll
defaultmimehandler.dll -> DefaultMIMEHandler.dll
devpakupdater.dll -> DevPaks.dll
DragScroll.dll -> MouseSettings.dll
envvars.dll -> EnvironmentVariables.dll
help_plugin.dll -> Help.dll
keybinder.dll -> Keybinder.dll
lib_finder.dll -> LibraryFinder.dll
scriptedwizard.dll -> ScriptedWizard.dll
symtab.dll -> SymbolTable.dll
todo.dll -> ToDo.dll
wxsmith.dll -> wxSmith.dll
xpmanifest.dll -> XPManifest.dll


Title: Re: Plug-Ins : some suggested "case" conventions
Post by: mandrav on October 24, 2006, 07:49:20 pm
You missed the point completely.
Sorry, but yes, I understood Lieven's post as something to discuss and to change...
Not how it is now.
The title "suggested case conventions" doesn't sounds like "enforced case conventions".

As in "suggested for developing your plugins".
As I told you, it really doesn't matter at all which naming scheme you will follow. What's important is that it is consistent (aka the same) in all of the aforementioned places.

So Lieven posted this suggestion for you to follow in order to have some consistency. Still, it's not enforced...
Title: Re: Plug-Ins : some suggested "case" conventions
Post by: takeshimiya on October 24, 2006, 08:01:38 pm
As I told you, it really doesn't matter at all which naming scheme you will follow. What's important is that it is consistent (aka the same) in all of the aforementioned places.
Yes, perhaps I've expressed wrong, I meant that I understood that Lieven was asking for suggestions to change the current consistency for (another) naming convention, consistent too, but different.

I missed the "I suggest to use CamelCase naming for plugins" on the first post, that later was cleared. :)