[1224] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
[1237] | 2 | // Classe CxxExecutor : Dynamic C++ compile/execution in piapp
|
---|
[1224] | 3 | // (c) DAPNIA (CEA) LAL (IN2P3/CNRS)
|
---|
| 4 | // C. Magneville 10/2000
|
---|
| 5 |
|
---|
| 6 | #ifndef CXXEXECUTOR_H_SEEN
|
---|
| 7 | #define CXXEXECUTOR_H_SEEN
|
---|
| 8 |
|
---|
| 9 | #include "machdefs.h"
|
---|
| 10 | #include <stdio.h>
|
---|
| 11 | #include <stdlib.h>
|
---|
| 12 | #include <iostream.h>
|
---|
| 13 |
|
---|
| 14 | #include <vector>
|
---|
| 15 | #include <string>
|
---|
| 16 |
|
---|
| 17 | #include "piacmd.h"
|
---|
| 18 | #include "nobjmgr.h"
|
---|
| 19 |
|
---|
| 20 | class CxxExecutor : public CmdExecutor {
|
---|
| 21 | public:
|
---|
| 22 | CxxExecutor(PIACmd* piac, PIStdImgApp* app);
|
---|
| 23 | virtual ~CxxExecutor();
|
---|
[1230] | 24 |
|
---|
[1268] | 25 | virtual int Execute(string& keyw,vector<string>& args, string& toks);
|
---|
[1224] | 26 |
|
---|
[1289] | 27 | inline void SetPrtLevel(uint_2 lp=2) {mPrtLevel = lp;}
|
---|
[1269] | 28 |
|
---|
| 29 | int ExecuteCXX(string usercode,string userfct="");
|
---|
| 30 |
|
---|
[2287] | 31 | // if true , declare ObjMgr variables as $varname
|
---|
| 32 | inline void DeclareObjMgrVar(bool fg=false) { mFgPutVar=fg; }
|
---|
| 33 |
|
---|
[1268] | 34 | int CrFile(string cfilename="",string func="");
|
---|
[1224] | 35 | void PutInclude(ofstream& os);
|
---|
| 36 | void PutIncludeUser(ofstream& os);
|
---|
| 37 | void PutObject(ofstream& os);
|
---|
| 38 | void PutVar(ofstream& os);
|
---|
| 39 |
|
---|
[1268] | 40 | int FillUserCode(string& usercode,uint_4 first);
|
---|
[1269] | 41 | int FillUserCode(string filename);
|
---|
[1230] | 42 |
|
---|
[1287] | 43 | int FillUserFctFrS(string userfctcode="");
|
---|
[1269] | 44 | int FillUserFctFrF(string filefctname="");
|
---|
| 45 |
|
---|
[1268] | 46 | int Compile(string rootfilename="");
|
---|
[1287] | 47 | /* int CrMakefile(void); */
|
---|
[1230] | 48 |
|
---|
[1268] | 49 | int Link(string libname="",string func="");
|
---|
| 50 | int Call(string func="");
|
---|
[1224] | 51 |
|
---|
[1230] | 52 | void FillArgs(vector<string>& args);
|
---|
| 53 | void FillArgs(string& args);
|
---|
| 54 | string GetArgs(void);
|
---|
| 55 |
|
---|
| 56 | void FillInclude(vector<string>& inc);
|
---|
| 57 | void FillInclude(string& inc);
|
---|
| 58 | string GetInclude(void);
|
---|
| 59 |
|
---|
| 60 | void FillCompileOpt(vector<string>& copt);
|
---|
| 61 | void FillCompileOpt(string& copt);
|
---|
| 62 | string GetCompileOpt(void);
|
---|
| 63 |
|
---|
| 64 | void FillLinkOpt(vector<string>& lopt);
|
---|
| 65 | void FillLinkOpt(string& lopt);
|
---|
| 66 | string GetLinkOpt(void);
|
---|
| 67 |
|
---|
| 68 | void FillLinkLibs(vector<string>& llibs);
|
---|
| 69 | void FillLinkLibs(string& llibs);
|
---|
| 70 | string GetLinkLibs(void);
|
---|
| 71 |
|
---|
[1297] | 72 | void FillModuleImport(vector<string>& import);
|
---|
| 73 | void FillModuleImport(string& import);
|
---|
| 74 | string GetModuleImport(void);
|
---|
| 75 |
|
---|
[1224] | 76 | private:
|
---|
[1237] | 77 | string mUserCodeFn;
|
---|
[1268] | 78 | string mUserFctFn;
|
---|
[1224] | 79 | string mCompOpt;
|
---|
| 80 | string mLinkOpt;
|
---|
| 81 | string mMyLibs;
|
---|
| 82 | vector<string> mIncList;
|
---|
| 83 | vector<string> mCallArgs;
|
---|
[1268] | 84 |
|
---|
[1297] | 85 | // Import des modules
|
---|
| 86 | vector<string> mIncImportList;
|
---|
| 87 | vector<string> mModuleImportList;
|
---|
| 88 | vector<string> mModuleImportDefaultList;
|
---|
| 89 |
|
---|
| 90 |
|
---|
[2181] | 91 | // string mDefTmp; remplace par la methode TmpDir() - Reza 4/9/02
|
---|
| 92 | inline string const& TmpDir() { NamedObjMgr omg; return omg.GetTmpDir(); }
|
---|
[1268] | 93 | string mDefRoot;
|
---|
| 94 | string mDefFunc;
|
---|
[1269] | 95 |
|
---|
| 96 | uint_2 mPrtLevel;
|
---|
[2287] | 97 | bool mFgPutVar; // if true , declare ObjMgr variables as $varname, default=false
|
---|
[1224] | 98 | };
|
---|
| 99 |
|
---|
| 100 | #endif
|
---|