News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Plug-Ins : some suggested "case" conventions

Started by killerbot, October 24, 2006, 12:30:24 PM

Previous topic - Next topic

killerbot

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".
QuoteThis would be the *suggestion* : start every word in the name with an uppercase : JustLikeThis

Allrighty, let's continue our excursion :

1) manifest.xml
<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 :

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



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



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 :

// 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


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



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



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 :

<Project>
<Option title="TestCase" />



takeshimiya

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...).

mandrav

Quote from: Takeshi Miya 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...).

You missed the point completely.
All 5 points must match, case-sensitively (even under windows).
Be patient!
This bug will be fixed soon...

thomas

Quote from: mandrav on October 24, 2006, 03:51:16 PMYou missed the point completely.
All 5 points must match, case-sensitively (even under windows).
How dare you say that! Takeshi knows.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

#4
Quote from: mandrav on October 24, 2006, 03:51:16 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.

Quote from: thomas on October 24, 2006, 04:04:01 PM
How dare you say that! Takeshi knows.
Bleh, but thanks for the attitude anyways.

killerbot

the "CamelCase" is the suggestion ;-)

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

[EDIT] : http://en.wikipedia.org/wiki/CamelCase

takeshimiya

Quote from: killerbot on October 24, 2006, 04:39:28 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

killerbot

[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).

takeshimiya

Quote from: 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
: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



mandrav

Quote from: Takeshi Miya on October 24, 2006, 04:20:58 PM
Quote from: mandrav on October 24, 2006, 03:51:16 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...
Be patient!
This bug will be fixed soon...

takeshimiya

Quote from: mandrav on October 24, 2006, 07:49:20 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. :)