I am currently working on a small cccc plug-in.
The plug-in will issue a 'wxExecute' to have the cccc executable to it's thing.
I am observing a few strange things.
But first :
assumption : the starting working directory is the directory where the .cbp file is of the active project.
When I run command I want the plug-in to execute in the project directory it works.
Works meaning in this scenario :
* it finds the files specified on the command line (that is a list of ProjectFile::relativeFilename 's)
* it creates an output directory (.cccc, or when I specify a directory, my directory specified)
This is for example my command in the project directory :
killerbot@thorgal:~/Projects/Traficon/view_vipnt_buildserver/vipnt/Codec/Project> cccc --outdir=ldc "../inc/CodecP.h" "../src/Codec.cpp" "../src/Codec.h" "../src/CodecDecoder.cpp" "../src/CodecDecoder.h" "../src/CodecDisplay.cpp" "../src/CodecDisplay.h" "../src/CodecP.cpp"
or
killerbot@thorgal:~/Projects/Traficon/view_vipnt_buildserver/vipnt/Codec/Project> cccc "../inc/CodecP.h" "../src/Codec.cpp" "../src/Codec.h" "../src/CodecDecoder.cpp" "../src/CodecDecoder.h" "../src/CodecDisplay.cpp" "../src/CodecDisplay.h" "../src/CodecP.cpp"
However when this command is executed through wxExecute from the plug-in (NOTE :tested on LINUX) :
Then cccc can't find the files, when I remove those " , then it can find the files.
But in any case it will never create the output directory (and place the report files in it).
What would make it behave so different ?
Follow up : Anyone already can tell me how I can launch the CB html viewer, (the one which kicks in when you click the url at the bottom of the build log after a build), this would help me a lot otherwise I have to go hunting in the code ;-) ?
I just created a small test-program and run its own code through cccc, works fine here.
By the way: I only tested it with synchronous execution.
Here is my example code:
void testFrame::OnExecute(wxCommandEvent& event)
{
wxArrayString output, error;
wxString cmd = _T("cccc --outdir=ldc \"testApp.h\" \"testApp.cpp\" \"testMain.h\" \"testMain.cpp\"");
TextCtrl1->AppendText(_T("Now executing: ") + cmd + _T("\n\n"));
long result = wxExecute(cmd , output, error, wxEXEC_SYNC | wxEXEC_NODISABLE);
if(result != 0)
{
TextCtrl1->AppendText(_T("error executing ") + cmd + _T("\n"));
}
else
{
TextCtrl1->AppendText(_T("Output of output-stream:\n"));
for(unsigned int i = 0; i < output.GetCount(); i++)
{
TextCtrl1->AppendText(output[i]+_T("\n"));
}
TextCtrl1->AppendText(_T("\nOutput of error-stream:\n"));
for(unsigned int i = 0; i < error.GetCount(); i++)
{
TextCtrl1->AppendText(error[i]+_T("\n"));
}
}
}
and the output:
Now executing: cccc --outdir=ldc "testApp.h" "testApp.cpp" "testMain.h" "testMain.cpp"
Output of output-stream:
Output of error-stream:
CCCC - a code counter for C and C++
===================================
A program to analyse C and C++ source code and report on
some simple software metrics
Version 3.pre84
Copyright Tim Littlefair, 1995, 1996, 1997, 1998, 1999, 2000
with contributions from Bill McLean, Herman Hueni, Lynn Wilson
Peter Bell, Thomas Hieber and Kenneth H. Cox.
The development of this program was heavily dependent on
the Purdue Compiler Construction Tool Set (PCCTS)
by Terence Parr, Will Cohen, Hank Dietz, Russel Quoung,
Tom Moog and others.
This software is provided with NO WARRANTY
Parsing
Processing testApp.h as C/C++ (c++.ansi)
Processing testApp.cpp as C/C++ (c++.ansi)
Processing testMain.h as C/C++ (c++.ansi)
testMain.h(50): syntax error at token DECLARE_EVENT_TABLE
testMain.h(50): trying to match class_block_item_list at 'DECLARE_EVENT_TABLE'
Processing testMain.cpp as C/C++ (c++.ansi)
failed opt_const_modifier for token 159 END_EVENT_TABLE
testMain.cpp(56): syntax error at token END_EVENT_TABLE
testMain.cpp(56): trying to match opt_const_modifier at 'END_EVENT_TABLE'
Generating HTML reports
Generating XML reports
Primary HTML output is in ldc/cccc.html
Detailed HTML reports on modules and source are in ldc
Primary XML output is in ldc/cccc.xml
Detailed XML reports on modules are in ldc
Database dump is in ldc/cccc.db
The output-directory (ldc) is created.
I changed my directory-structure to:
.
|-- include
| |-- testApp.h
| |-- testMain.h
| |-- wx_pch.h
| `-- wx_pch.h.gch
| `-- Debug_include_wx_pch_h_gch
|-- src
| |-- testApp.cpp
| `-- testMain.cpp
|-- test
| |-- test.cbp
| `-- test.depend
`-- wxsmith
`-- testframe.wxs
and the command to:
wxString cmd = _T("cccc --outdir=ldc \"../include/testApp.h\" \"../src/testApp.cpp\" \"../include/testMain.h\" \"../src/testMain.cpp\"");
Execution working dir is "."
output is now:
Now executing: cccc --outdir=ldc "../include/testApp.h" "../src/testApp.cpp" "../include/testMain.h" "../src/testMain.cpp"
Output of output-stream:
Output of error-stream:
CCCC - a code counter for C and C++
===================================
A program to analyse C and C++ source code and report on
some simple software metrics
Version 3.pre84
Copyright Tim Littlefair, 1995, 1996, 1997, 1998, 1999, 2000
with contributions from Bill McLean, Herman Hueni, Lynn Wilson
Peter Bell, Thomas Hieber and Kenneth H. Cox.
The development of this program was heavily dependent on
the Purdue Compiler Construction Tool Set (PCCTS)
by Terence Parr, Will Cohen, Hank Dietz, Russel Quoung,
Tom Moog and others.
This software is provided with NO WARRANTY
Parsing
Processing ../include/testApp.h as C/C++ (c++.ansi)
Processing ../src/testApp.cpp as C/C++ (c++.ansi)
Processing ../include/testMain.h as C/C++ (c++.ansi)
../include/testMain.h(50): syntax error at token DECLARE_EVENT_TABLE
../include/testMain.h(50): trying to match class_block_item_list at 'DECLARE_EVENT_TABLE'
Processing ../src/testMain.cpp as C/C++ (c++.ansi)
failed opt_const_modifier for token 159 END_EVENT_TABLE
../src/testMain.cpp(56): syntax error at token END_EVENT_TABLE
../src/testMain.cpp(56): trying to match opt_const_modifier at 'END_EVENT_TABLE'
Generating HTML reports
Generating XML reports
Primary HTML output is in ldc/cccc.html
Detailed HTML reports on modules and source are in ldc
Primary XML output is in ldc/cccc.xml
Detailed XML reports on modules are in ldc
Database dump is in ldc/cccc.db
As you can see, it still works.
Can you provide the code you use, maybe I find a problem, you did not see ("Two heads are better than one").