Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: threeS on September 02, 2014, 08:13:02 pm

Title: Compilation Monitoring Plugin
Post by: threeS on September 02, 2014, 08:13:02 pm
Good Day!

I don't have any experience in creating plugins and I'm an average (maybe) C/C++ Programmer and a Code::Blocks IDE user when doing my assignments in school.

I'm planning to create a plugin and i know it's a good one:
A plugin that save the .cpp/.c++ (+ the system timestamp ex: *2014-09-03 2:07AM)  file every time I hit the compile/run button in the IDE and save it to my postgresql database.

Platform: Ubuntu 14.04 64 bit
Compiler: gcc version 4.8
PostgreSQL: 9.3

Is there any plugin yet created or related to this one?
Can somebody give me the link?  :)

A big thanks to all!
More Power!  :)
Title: Re: Compilation Monitoring Plugin
Post by: Alpha on September 03, 2014, 04:31:21 am
This description sounds like it is more the job for something like git or svn.

(Assuming you have already build Code::Blocks from source - if not, see the wiki for directions.)
However, if you will be the only user, an easy hack would be inserting a few PostgreSQL api calls into plugins/compilergcc/compilergcc.cpp in the function CompilerGCC::DoPrepareQueue() (around line 1560-ish +/- whatever changes in your local rev.).  If you are distributing, use RegisterEventSink() subscribe to cbEVT_COMPILER_STARTED (edit: from within your own plugin) and execute your code there.  Use find in files with C::B's source for these identifiers if you need code examples.
(Note: Specifics on PostgreSQL api are out of scope of this forum.)
Title: Re: Compilation Monitoring Plugin
Post by: oBFusCATed on September 03, 2014, 08:56:39 am
Writing a plugin will be far easier...
There are events for compilation started or finished.
A plugin can listen for them and then do its job.
Title: Re: Compilation Monitoring Plugin
Post by: teto on September 03, 2014, 11:25:49 am
You may want to start with this (very simple) codebase: http://forums.codeblocks.org/index.php/topic,19557.0.html