Author Topic: Plug-Ins : some suggested "case" conventions  (Read 88104 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Plug-Ins : some suggested "case" conventions
« 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" />

« Last Edit: October 24, 2006, 09:06:16 pm by killerbot »

takeshimiya

  • Guest
Re: Plug-Ins : some suggested "case" conventions
« Reply #1 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...).

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plug-Ins : some suggested "case" conventions
« Reply #2 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).
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Plug-Ins : some suggested "case" conventions
« Reply #3 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

  • Guest
Re: Plug-Ins : some suggested "case" conventions
« Reply #4 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.
« Last Edit: October 24, 2006, 04:22:29 pm by Takeshi Miya »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: Plug-Ins : some suggested "case" conventions
« Reply #5 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

takeshimiya

  • Guest
Re: Plug-Ins : some suggested "case" conventions
« Reply #6 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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: Plug-Ins : some suggested "case" conventions
« Reply #7 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).

takeshimiya

  • Guest
Re: Plug-Ins : some suggested "case" conventions
« Reply #8 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



Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plug-Ins : some suggested "case" conventions
« Reply #9 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...
Be patient!
This bug will be fixed soon...

takeshimiya

  • Guest
Re: Plug-Ins : some suggested "case" conventions
« Reply #10 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. :)