User forums > Using Code::Blocks

Script C::B

(1/6) > >>

LETARTARE:
hello,
I can not find how to retrieve only the files associated with a target (not project) ?.

reference:
http://wiki.codeblocks.org/index.php?title=Scripting_commands

LETARTARE:
I found a solution which requires modifying C:: B:

--- Code: ---Index: src/sdk/scripting/bindings/scriptbindings.cpp
===================================================================
--- src/sdk/scripting/bindings/scriptbindings.cpp (révision 7621)
+++ src/sdk/scripting/bindings/scriptbindings.cpp (copie de travail)
@@ -394,7 +394,8 @@
                 var(&ProjectFile::compile, "compile").
                 var(&ProjectFile::link, "link").
                 var(&ProjectFile::weight, "weight").
-                var(&ProjectFile::compilerVar, "compilerVar");
+                var(&ProjectFile::compilerVar, "compilerVar").
+                var(&ProjectFile::buildTargets, "buildTargets");
 
         SqPlus::SQClassDef<CompileOptionsBase>("CompileOptionsBase").
                 func(&CompileOptionsBase::AddPlatform, "AddPlatform").
--- End code ---

- OS: Vista Basic Pack 2
           Mingw32 with TDM-GCC 4.4/4.5 Series
- Tools: Code:: Blocks  sn7550  and 7621

I tested this code (script) , it works well on svn7550

This function indicates whether the 'prjfileori' is assigned to at least one target (otherwise returns -1)


--- Code: --- function connected(prjfileori, project) { // ProjectFile , cbProject
                local nt = project.GetBuildTargetsCount();
local ciori ;
local nameci;
local ci ;
for (ci = 0; ci < nt; ci++) {
nameci = project.GetBuildTarget(ci).GetTitle();
                // ====> use wxStringArray buildTargets  < =====
ciori = prjfilecori.buildTargets.Index(nomci);
if (ciori != -1) {
break;
}
}

return ciori;
}
--- End code ---

Is that change is possible in C: B?
And how?

oBFusCATed:
Yes, it is.

Some questions:
1. Can you mess with the targets for the file or does the buildTargets array acts as a const object in the script?
2. Do we want the scripts to mess with the targets for a file? (this question is at the other devs)


About the how question: one of the developers will commit it in svn, when it is ready:)

LETARTARE:
/**** Translation by Google ****/
Note: I have some translation problems ...

thank you for responding.

--- Quote ---1. Can you mess with the targets for the file or does the buildTargets array acts as a const object in the script?
--- End quote ---
'const object in the script'
I prefer a access method , but I have not studied enough 'Script binding' for write this.


--- Quote ---2. Do we want the scripts to mess with the targets for a file? (this question is at the other devs)
--- End quote ---
I hope so?

oBFusCATed:

--- Quote from: LETARTARE on November 29, 2011, 02:35:12 pm ---
--- Quote ---1. Can you mess with the targets for the file or does the buildTargets array acts as a const object in the script?
--- End quote ---
'const object in the script'
I prefer a access method , but I have not studied enough 'Script binding' for write this.

--- End quote ---
Can you try to modify them and then tell me if it works or not?

Navigation

[0] Message Index

[#] Next page

Go to full version