source: Sophya/trunk/SophyaPI/PIext/cxxexecutor.cc@ 1287

Last change on this file since 1287 was 1287, checked in by ercodmgr, 25 years ago

utilisation du cxxcmplnk cmv 2/11/00

  • Property svn:executable set to *
File size: 19.2 KB
Line 
1#include "cxxexecutor.h"
2
3#include <typeinfo>
4
5#include "strutilxx.h"
6#include "dvlist.h"
7#include "cxxcmplnk.h"
8
9#include "nomgadapter.h"
10#include "pistdimgapp.h"
11
12
13/* --Methode-- */
14CxxExecutor::CxxExecutor(PIACmd *mpiac, PIStdImgApp* /* app */)
15 : mUserCodeFn(""), mUserFctFn("")
16 , mCompOpt(""), mLinkOpt(""), mMyLibs("")
17 , mDefTmp(""), mDefRoot("cxx_spiapp"), mDefFunc("usercxx"), mPrtLevel(1)
18{
19mIncList.resize(0);
20mCallArgs.resize(0);
21
22// Gestion des fichiers par default dans TmpDir
23NamedObjMgr omg;
24string tmpdir = omg.GetTmpDir();
25if(tmpdir.size()>1) mDefTmp = tmpdir;
26
27// On enregistre les nouvelles commandes
28string hgrp = "CxxExecutorCmd";
29string usage,kw;
30
31kw = "c++exec";
32usage = "c++exec: Execute the following c++ user code\n";
33usage+= "Usage: c++exec c++ user code\n";
34usage+= "Warning: c++ user code can be found in \"TmpDir/"+mDefRoot+".h\"\n";
35usage+= " total generated code can be found in \"TmpDir/"+mDefRoot+".cc\"";
36mpiac->RegisterCommand(kw, usage, this, hgrp);
37
38kw = "c++execfrf";
39usage = "c++execfrf: Execute c++ user_code [user_function_code]\n";
40usage+= "Usage: c++execfrf fileuser.cc [fileuserfct.cc]\n";
41usage+= "Warning: total generated code can be found in \"TmpDir/"+mDefRoot+".cc\"";
42mpiac->RegisterCommand(kw, usage, this, hgrp);
43
44kw = "c++args";
45usage = "c++args: Define user function arguments for c++exec and c++execfrf\n";
46usage+= "Usage: c++args arg1 arg2 arg3 ...\n";
47usage+= " c++args -? : give current arguments\n";
48usage+= " c++args : reset current arguments";
49mpiac->RegisterCommand(kw, usage, this, hgrp);
50
51kw = "c++create";
52usage = "c++create: create a file \"file.cc\" to be used by spiapp\n";
53usage+= "Usage: c++create file.cc func c++ user code...\n";
54mpiac->RegisterCommand(kw, usage, this, hgrp);
55
56kw = "c++createfrf";
57usage = "c++createfrf: create a file \"file.cc\" to be used by spiapp\n";
58usage+= " with a user file code \"fileuser.cc\"\n";
59usage+= " and an optional user function code \"fileuserfct.cc\"\n";
60usage+= "Usage: c++createfrf file.cc func fileuser.cc [fileuserfct.cc]\n";
61mpiac->RegisterCommand(kw, usage, this, hgrp);
62
63kw = "c++compile";
64usage = "c++compile: compile a file (file.cc -> file.so)\n";
65usage+= "Usage: c++compile file\n";
66usage+= "Warning: give \"file\" or \"file.so\" to create \"file.so\" from \"file.cc\"\n";
67usage+= " : to be used before c++link";
68mpiac->RegisterCommand(kw, usage, this, hgrp);
69
70kw = "c++link";
71usage = "c++link: link function \"func\" in file.so to spiapp\n";
72usage+= "Usage: c++link file.so func";
73mpiac->RegisterCommand(kw, usage, this, hgrp);
74
75kw = "c++include";
76usage = "c++include: give personnal includes to be used\n";
77usage+= "Usage: c++include myinc1.h myinc2.h ...\n";
78usage+= " c++include -? : give current include files\n";
79usage+= " c++include : reset current include files\n";
80usage+= "Warning: to be used before c++create... c++exec...";
81mpiac->RegisterCommand(kw, usage, this, hgrp);
82
83kw = "c++compileopt";
84usage = "c++compileopt: give additionnal compile options\n";
85usage+= "Usage: c++compileopt -g -O5 -IMy_Inc_Dir ...\n";
86usage+= " c++compileopt -? : give current compile options\n";
87usage+= " c++compileopt : reset current compile options\n";
88usage+= "Warning: to be used before c++compile";
89mpiac->RegisterCommand(kw, usage, this, hgrp);
90
91kw = "c++linkopt";
92usage = "c++linkopt: give additionnal link options\n";
93usage+= "Usage: c++linkopt -g -O5 ...\n";
94usage+= " c++linkopt -? : give current link options\n";
95usage+= " c++linkopt : reset current link options\n";
96usage+= "Warning: to be used before c++compile";
97mpiac->RegisterCommand(kw, usage, this, hgrp);
98
99kw = "c++mylibs";
100usage = "c++mylibs: give additionnal libraries\n";
101usage+= "Usage: c++mylibs -LMy_Lib_Dir -lmylib1 -lmylib2 ...\n";
102usage+= " c++mylibs -? : give current additionnal libraries\n";
103usage+= " c++mylibs : reset current additionnal libraries\n";
104usage+= "Warning: to be used before c++compile";
105mpiac->RegisterCommand(kw, usage, this, hgrp);
106
107
108}
109
110/* --Methode-- */
111CxxExecutor::~CxxExecutor()
112{
113}
114
115/* --Methode-- */
116int CxxExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
117{
118int rc=0;
119if(kw == "c++exec") {
120 if(tokens.size()<1) {
121 cout<<"Usage: c++exec c++ user code"<<endl;
122 return(1);
123 }
124 rc = ExecuteCXX(toks); if(rc) return(1);
125
126} else if(kw == "c++execfrf") {
127 if(tokens.size()<1) {
128 cout<<"Usage: c++execfrf fileuser.cc [fileuserfct.cc]"<<endl;
129 return(1);
130 }
131 rc = FillUserCode(tokens[0]); if(rc) return(1);
132 if(tokens.size()>1) rc = FillUserFctFrF(tokens[1]);
133 else rc = FillUserFctFrF();
134 if(rc) return(1);
135 rc = CrFile(); if(rc) return(1);
136 rc = Compile(); if(rc) return(1);
137 rc = Link(); if(rc) return(1);
138 rc = Call(); if(rc) return(1);
139
140} else if(kw == "c++args") {
141 if(tokens.size()==1) if(tokens[0]=="-?")
142 {cout<<"c++args "<<GetArgs()<<endl; return(0);}
143 FillArgs(tokens);
144
145} else if(kw == "c++create") {
146 if(tokens.size()<3) {
147 cout<<"Usage: c++create file.cc func c++ user code ..."<<endl;
148 return(1);
149 }
150 rc = FillUserCode(toks,2); if(rc) return(1);
151 rc = FillUserFctFrS(); if(rc) return(1);
152 rc = CrFile(tokens[0],tokens[1]); if(rc) return(1);
153
154} else if(kw == "c++createfrf") {
155 if(tokens.size()<3) {
156 cout<<"Usage: c++createfrf file.cc func fileuser.cc [fileuserfct.cc]"<<endl;
157 return(1);
158 }
159 rc = FillUserCode(tokens[2]); if(rc) return(1);
160 if(tokens.size()>3) rc = FillUserFctFrF(tokens[3]);
161 else rc = FillUserFctFrF(tokens[3]);
162 if(rc) return(1);
163 rc = CrFile(tokens[0],tokens[1]); if(rc) return(1);
164
165} else if(kw == "c++compile") {
166 if(tokens.size()>=1) rc = Compile(tokens[0]);
167 else rc = Compile();
168 if(rc) return(1);
169
170} else if(kw == "c++link") {
171 if(tokens.size()>=2) rc = Link(tokens[0],tokens[1]);
172 else if(tokens.size()>=1) rc = Link(tokens[0]);
173 else rc = Link();
174 if(rc) return(1);
175
176} else if(kw == "c++include") {
177 if(tokens.size()==1) if(tokens[0]=="-?")
178 {cout<<"c++include "<<GetInclude()<<endl; return(0);}
179 FillInclude(tokens);
180
181} else if(kw == "c++compileopt") {
182 if(tokens.size()==1) if(tokens[0]=="-?")
183 {cout<<"c++compileopt "<<GetCompileOpt()<<endl; return(0);}
184 FillCompileOpt(tokens);
185
186} else if(kw == "c++linkopt") {
187 if(tokens.size()==1) if(tokens[0]=="-?")
188 {cout<<"c++linkopt "<<GetLinkOpt()<<endl; return(0);}
189 FillLinkOpt(tokens);
190
191} else if(kw == "c++mylibs") {
192 if(tokens.size()==1) if(tokens[0]=="-?")
193 {cout<<"c++mylibs "<<GetLinkLibs()<<endl; return(0);}
194 FillLinkLibs(tokens);
195}
196
197return(0);
198}
199
200/* --Methode-- */
201int CxxExecutor::ExecuteCXX(string usercode,string userfct)
202{
203int rc=0;
204rc = FillUserCode(usercode,0); if(rc) return(1);
205rc = FillUserFctFrS(userfct); if(rc) return(1);
206rc = CrFile(); if(rc) return(1);
207rc = Compile(); if(rc) return(1);
208rc = Link(); if(rc) return(1);
209rc = Call(); if(rc) return(1);
210return 0;
211}
212
213/* --Methode-- */
214int CxxExecutor::CrFile(string cfilename,string func)
215// Si un nom n'est pas precise alors TmpDir/cxx_spiapp.cc
216{
217if(cfilename.size()<1) cfilename = mDefTmp + mDefRoot + ".cc";
218
219if(func.size()<1) func = mDefFunc;
220
221ofstream os(cfilename.c_str(),ios::out);
222if(!os)
223 {cout<<"CxxExecutor::CrFile: unable to open "<<cfilename<<endl;
224 return 1;}
225
226PutInclude(os);
227os<<endl;
228
229PutIncludeUser(os);
230os<<endl;
231
232os<<"//-------------------------------------------------//"<<endl;
233os<<"//----------------- User Functions ----------------//"<<endl;
234os<<"//-------------------------------------------------//"<<endl;
235if(mUserFctFn.size()>0) os<<"#include \""<<mUserFctFn<<"\""<<endl;
236os<<endl;
237
238
239os<<"extern \"C\" {"<<endl;
240os<<" int "<<func<<"( vector<string>& args );"<<endl;
241os<<"}"<<endl<<endl;
242os<<"int "<<func<<"( vector<string>& args )"<<endl;
243os<<"{"<<endl;
244os<<"// Some definitions to help using spiapp;"<<endl;
245os<<"NamedObjMgr omg;"<<endl;
246os<<"Services2NObjMgr& srvo = *omg.GetServiceObj();"<<endl;
247os<<endl;
248
249PutObject(os);
250os<<endl;
251
252PutVar(os);
253os<<endl;
254
255os<<"//--------------------------------------------//"<<endl;
256os<<"//----------------- User Code ----------------//"<<endl;
257os<<"//--------------------------------------------//"<<endl;
258if(mUserCodeFn.size()>0) os<<"#include \""<<mUserCodeFn<<"\""<<endl;
259os<<endl;
260
261os<<"return 0;"<<endl;
262os<<"}"<<endl;
263
264if(mPrtLevel)
265 cout<<"File "<<cfilename<<" for function "<<func<<" created :"<<endl;
266if(mPrtLevel && mUserCodeFn.size()>0)
267 cout<<" User code was in file "<<mUserCodeFn<<endl;
268if(mPrtLevel && mUserFctFn.size()>0)
269 cout<<" User function code was in file "<<mUserFctFn<<endl;
270return 0;
271}
272
273/* --Methode-- */
274void CxxExecutor::PutInclude(ofstream& os)
275{
276os<<"#include \"machdefs.h\""<<endl
277 <<endl
278
279 <<"//---- System et stdc++ include files"<<endl
280 <<"#include <stdio.h>"<<endl
281 <<"#include <stdlib.h>"<<endl
282 <<"#include <math.h>"<<endl
283 <<"#include <ctype.h>"<<endl
284 <<"#include <string.h>"<<endl
285 <<"#include <iostream.h>"<<endl
286 <<"#include <fstream.h>"<<endl
287 <<"#include <complex>"<<endl
288 <<endl
289
290 <<"#include <typeinfo>"<<endl
291 <<"#include <string>"<<endl
292 <<"#include <vector>"<<endl
293 <<"#include <map>"<<endl
294 <<"#include <functional>"<<endl
295 <<"#include <list>"<<endl
296 <<endl
297
298 <<"//---- Sophya include files"<<endl
299 <<"#include \"systools.h\""<<endl
300 <<"#include \"ntools.h\""<<endl
301 <<"#include \"array.h\""<<endl
302 <<"#include \"histats.h\""<<endl
303 <<endl
304
305 <<"//---- Spiapp include files"<<endl
306 <<"#include \"nobjmgr.h\""<<endl
307 <<"#include \"servnobjm.h\""<<endl
308 <<endl
309
310 <<"#define KeepObj(obj) ___nomobj = #obj; omg.AddObj(obj,___nomobj);"<<endl
311 <<"#define KeepVar(var) ___nomobj = #var; omg.GetVarList().Get(___nomobj) = var ;"<<endl
312 <<endl;
313
314return;
315}
316
317/* --Methode-- */
318void CxxExecutor::PutIncludeUser(ofstream& os)
319{
320if(mIncList.size()<1) return;
321for(uint_4 i=0;i<mIncList.size();i++)
322 os<<"#include \""<<mIncList[i]<<"\""<<endl;
323}
324
325/* --Methode-- */
326void CxxExecutor::PutObject(ofstream& os)
327{
328NamedObjMgr omg;
329NObjMgrAdapter* objmgrad;
330vector<string> objlist;
331string patt = "*";
332omg.GetObjList(patt,objlist);
333int nobjs = objlist.size();
334
335os<<"//-------------- Object List --------------"<<endl;
336os<<"//Number of objects = "<<nobjs<<endl;
337os<<"string ___nomobj;"<<endl<<endl;
338if(nobjs<=0) return;
339
340string dir,nobj,stmp,obtype;
341for(int i=0;i<nobjs;i++) {
342 objmgrad = omg.GetObjAdapter(objlist[i]);
343 omg.ParseObjectName(objlist[i],dir,nobj);
344 obtype = objmgrad->GetDataObjType();
345 stmp = "___" + nobj;
346
347 os<<"___nomobj = \""<<nobj<<"\";"<<endl;
348 os<<obtype<<"* "<<stmp
349 <<" = dynamic_cast< "<<obtype<<" * >(omg.GetObj(___nomobj));"<<endl;
350 os<<"if("<<stmp<<"==NULL) throw NullPtrError"
351 <<"(\"CxxExecutor::PutObject: Non existing object "<<nobj
352 <<"... please update file\");"<<endl;
353 os<<obtype<<"& "<<nobj<<" = (*"<<stmp<<");"<<endl<<endl;
354}
355
356return;
357}
358
359/* --Methode-- */
360void CxxExecutor::PutVar(ofstream& os)
361{
362os<<"//-------------- Variable List --------------"<<endl;
363NamedObjMgr omg;
364DVList& varlist = omg.GetVarList();
365// varlist.Show(); varlist.Print();
366DVList::ValList::const_iterator it;
367for(it=varlist.Begin(); it!=varlist.End(); it++) {
368 string key = (*it).first;
369 if (isalpha(key[0]) ) {
370 os<<"___nomobj = \""<<key<<"\";"<<endl;
371 os<<"MuTyV & $"<<key<<" = omg.GetVarList().Get(___nomobj);"<<endl;
372 }
373}
374
375return;
376}
377
378/* --Methode-- */
379int CxxExecutor::FillUserCode(string& usercode,uint_4 first)
380// User code is read from input.
381// - first is the first position in the "string" where the code starts
382// - Code is put into file "TmpDir/cxx_spiapp.h".
383{
384mUserCodeFn = "";
385
386// get the string part which is after word "first"
387string code = usercode;
388if(code.size()<=0) {cout<<"CxxExecutor::FillUserCode: no user code"<<endl;
389 return 1;}
390size_t q;
391for(uint_4 i=0;i<=first;i++) {
392 q = code.find_first_not_of(" \t");
393 if(q>=code.size()) {code=""; break;}
394 code = code.substr(q);
395 if(i==first) break;
396 q = code.find_first_of(" \t");
397 if(q>=code.size()) {code=""; break;}
398 code = code.substr(q);
399}
400if(code.size()<=0)
401 {cout<<"CxxExecutor::FillUserCode: no user code after "<<first<<endl;
402 return 1;}
403
404// Fill the file with user code
405mUserCodeFn = mDefTmp + mDefRoot + ".h";
406ofstream os(mUserCodeFn.c_str(),ios::out);
407if(!os) {cout<<"CxxExecutor::FillUserCode: unable to open "
408 <<mUserCodeFn<<endl; mUserCodeFn = ""; return 1;}
409os<<code<<endl;
410if(mPrtLevel)
411 cout<<"User code filled from standard input into "<<mUserCodeFn<<endl;
412return 0;
413}
414
415/* --Methode-- */
416int CxxExecutor::FillUserFctFrS(string userfctcode)
417// - Fill user Fonction code from string "userfct"
418// - Code is put into file "TmpDir/cxx_spiapp_fct.h".
419{
420mUserFctFn = "";
421if(userfctcode.size()<1) return 0;
422mUserFctFn = mDefTmp + mDefRoot + "_fct.h";
423ofstream os(mUserFctFn.c_str(),ios::out);
424if(!os) {cout<<"CxxExecutor::FillUserFctFrS: unable to open "
425 <<mUserFctFn<<endl; mUserFctFn = ""; return 1;}
426os<<userfctcode<<endl;
427if(mPrtLevel)
428 cout<<"User Function code filled from standard input into "<<mUserFctFn<<endl;
429return 0;
430}
431
432/* --Methode-- */
433int CxxExecutor::FillUserCode(string filename)
434// User code is read from "filename".
435{
436mUserCodeFn = filename;
437if(mPrtLevel && mUserCodeFn.size()>0)
438 cout<<"User code filled from file "<<mUserCodeFn<<endl;
439return 0;
440}
441
442/* --Methode-- */
443int CxxExecutor::FillUserFctFrF(string filefctname)
444// User function code is read from "filefctname".
445{
446mUserFctFn = filefctname;
447if(mPrtLevel && mUserFctFn.size()>0)
448 cout<<"User Function code filled from file "<<mUserFctFn<<endl;
449return 0;
450}
451
452/* --Methode-- */
453int CxxExecutor::Compile(string rootfilename)
454//--------------------------------------------------------//
455// rootfilename = | name | "" ou (default) //
456//--------------------------------------------------------//
457// fichier .cc | name.cc | TmpDir/cxx_spiapp.cc //
458// | ../dir/name.cc | //
459// fichier .o | TmpDir/name.o | TmpDir/cxx_spiapp.o //
460// fichier .so | TmpDir/name.so | TmpDir/cxx_spiapp.so //
461//--------------------------------------------------------//
462{
463if(rootfilename.size()<1) rootfilename = mDefTmp + mDefRoot;
464if(mPrtLevel) cout<<"Compile "<<rootfilename<<endl;
465
466int rc;
467CxxCompilerLinker cxx;
468if(mDefTmp.size()>0) cxx.SetTmpDir(mDefTmp);
469cxx.SetVerbose(true);
470
471// Compilation
472string fcc = rootfilename + ".cc";
473string fo = "";
474cxx.AddCompileOptions(mCompOpt);
475rc = cxx.Compile(fcc,fo);
476if(mPrtLevel) cout << "Compilation rc = "<<rc<< endl;
477if(rc) return 1;
478
479// Fabrication Shared Lib.
480string fso = "";
481cxx.AddLinkOptions(mLinkOpt);
482 string sophlib = "-lPI";
483cxx.AddLinkOptions(sophlib);
484cxx.AddLinkOptions(mMyLibs);
485rc = cxx.BuildSO(fo,fso);
486if(mPrtLevel) cout << "Shared Library rc = "<<rc<< endl;
487if(rc) return 2;
488
489return 0;
490}
491
492/* --Methode-- */
493//int CxxExecutor::Compile(string rootfilename)
494// Ne marche pas si TmpDir != ""
495//{
496//if(rootfilename.size()<1) rootfilename = mDefRoot;
497//if(mPrtLevel) cout<<"Compile: "<<rootfilename<<endl;
498//int rc = 0;
499//rc = CrMakefile();
500//if(rc) return(1);
501//string make = "";
502//make += "make -f " + mDefRoot + "_Makefile";
503//make += " CXXFLAGS=\"" + mCompOpt + "\"";
504//make += " LDFLAGS=\"" + mLinkOpt + "\"";
505//make += " MYLIBS=\"" + mMyLibs + "\"";
506//make += " " + rootfilename;
507//rc = system(make.c_str());
508//if(rc)
509// {cout<<"CxxExecutor::Compile : \n"<<make<<" Failed"<<endl;
510// return 1000+rc;}
511//return 0;
512//}
513
514/* --Methode-- */
515//int CxxExecutor::CrMakefile(void)
516// Ne marche pas si TmpDir != ""
517//{
518//string makename = mDefTmp + mDefRoot + "_Makefile";
519//ofstream os(makename.c_str(),ios::out);
520//if(!os)
521// {cout<<"CxxExecutor::CrMakefile: unable to open file for Makefile"<<endl;
522// return 1;}
523//---------------------------------------------------------------------
524//os<<"MODULEDECCXXFLAGS := -msg_quiet"<<endl;
525//os<<"include $(DPCBASEREP)/Include/MakefileUser.h"<<endl;
526//os<<"MYLIBS ="<<endl;
527//os<<"LIBS = -L$(SLB) -lPI -lextsophya -lsophya -lm"<<endl;
528//os<<"ifeq ($(MACHEROS),OSF1)"<<endl;
529//os<<"LIBS := $(LIBS) -lfor"<<endl;
530//os<<"endif"<<endl;
531//os<<"ifeq ($(MACHEROS),Linux)"<<endl;
532//os<<"LIBS := $(LIBS) -ldl -lf2c"<<endl;
533//os<<"endif"<<endl;
534//os<<"%.so:%.o"<<endl;
535//os<<"%:%.cc"<<endl;
536//os<<"%:%.o"<<endl;
537//os<<"%.o:%.cc"<<endl;
538//os<<"%.o:%.c"<<endl;
539//os<<"%:%.c"<<endl;
540//os<<endl;
541//os<<".PRECIOUS: %.so"<<endl;
542//os<<endl;
543//os<<"%:%.so"<<endl;
544//os<<"\t"<<"echo $@ \" made (.so) \""<<endl;
545//os<<"%.so:%.o"<<endl;
546//os<<"\t"<<"$(LINK.cc) -shared -o $@ $< $(LIBS) $(MYLIBS)"<<endl;
547//os<<"%.o:%.cc"<<endl;
548//os<<"\t"<<"$(COMPILE.cc) -o $@ $<"<<endl;
549//os<<"%.o:%.c"<<endl;
550//os<<"\t"<<"$(COMPILE.c) -c $(CFLAGS) $(USERFLAGS) -o $@ $<"<<endl;
551//---------------------------------------------------------------------
552//return 0;
553//}
554
555/* --Methode-- */
556int CxxExecutor::Link(string libname,string func)
557{
558if(libname.size()<1) libname = mDefTmp + mDefRoot + ".so";
559 else libname = mDefTmp + libname;
560if(func.size()<1) func = mDefFunc;
561
562NamedObjMgr omg;
563PIACmd* mpiac = omg.GetImgApp()->CmdInterpreter();
564
565string key("linkff2");
566vector<string> arg; arg.push_back(libname); arg.push_back(func);
567string toks = libname + " " + func;
568int rc = mpiac->ExecuteCommand(key,arg,toks);
569if(mPrtLevel) cout<<"Link from "<<libname<<" for function "<<func
570 <<" (rc="<<rc<<")"<<endl;
571return 0;
572}
573
574/* --Methode-- */
575int CxxExecutor::Call(string func)
576{
577if(func.size()<1) func = mDefFunc;
578
579NamedObjMgr omg;
580PIACmd* mpiac = omg.GetImgApp()->CmdInterpreter();
581
582string key("call");
583vector<string> arg; arg.push_back(func);
584string toks = func;
585if(mCallArgs.size()>0)
586 for(uint_4 i=0;i<mCallArgs.size();i++) arg.push_back(mCallArgs[i]);
587mpiac->ExecuteCommand(key,arg,toks);
588return 0;
589}
590
591/* --Methode-- */
592void CxxExecutor::FillArgs(vector<string>& args)
593{
594mCallArgs.resize(0);
595if(args.size()<1) return;
596for(uint_4 i=0;i<args.size();i++) mCallArgs.push_back(args[i]);
597}
598
599void CxxExecutor::FillArgs(string& args)
600{
601mCallArgs.resize(0);
602FillVStringFrString(args,mCallArgs,' ');
603}
604
605string CxxExecutor::GetArgs(void)
606{
607string dum = "";
608if(mCallArgs.size()<1) return dum;
609for(uint_4 i=0;i<mCallArgs.size();i++) dum += mCallArgs[i] + " ";
610return dum;
611}
612
613/* --Methode-- */
614void CxxExecutor::FillInclude(vector<string>& inc)
615{
616mIncList.resize(0);
617if(inc.size()<1) return;
618for(uint_4 i=0;i<inc.size();i++) mIncList.push_back(inc[i]);
619}
620
621void CxxExecutor::FillInclude(string& inc)
622{
623mIncList.resize(0);
624FillVStringFrString(inc,mIncList,' ');
625}
626
627string CxxExecutor::GetInclude(void)
628{
629string dum = "";
630if(mIncList.size()<1) return dum;
631for(uint_4 i=0;i<mIncList.size();i++) dum += mIncList[i] + " ";
632return dum;
633}
634
635/* --Methode-- */
636void CxxExecutor::FillCompileOpt(vector<string>& copt)
637{
638mCompOpt = "";
639if(copt.size()<1) return;
640for(uint_4 i=0;i<copt.size();i++) mCompOpt += copt[i] + " ";
641}
642
643void CxxExecutor::FillCompileOpt(string& copt)
644{
645mCompOpt = copt;
646}
647
648string CxxExecutor::GetCompileOpt(void)
649{
650return mCompOpt;
651}
652
653/* --Methode-- */
654void CxxExecutor::FillLinkOpt(vector<string>& lopt)
655{
656mLinkOpt = "";
657if(lopt.size()<1) return;
658for(uint_4 i=0;i<lopt.size();i++) mLinkOpt += lopt[i] + " ";
659}
660
661void CxxExecutor::FillLinkOpt(string& lopt)
662{
663mLinkOpt = lopt;
664}
665
666string CxxExecutor::GetLinkOpt(void)
667{
668return mLinkOpt;
669}
670
671/* --Methode-- */
672void CxxExecutor::FillLinkLibs(vector<string>& llibs)
673{
674mMyLibs = "";
675if(llibs.size()<1) return;
676for(uint_4 i=0;i<llibs.size();i++) mMyLibs += llibs[i] + " ";
677}
678
679void CxxExecutor::FillLinkLibs(string& llibs)
680{
681mMyLibs = llibs;
682}
683
684string CxxExecutor::GetLinkLibs(void)
685{
686return mMyLibs;
687}
Note: See TracBrowser for help on using the repository browser.