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