[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 |
|
---|
[1268] | 31 | int CrFile(string cfilename="",string func="");
|
---|
[1224] | 32 | void PutInclude(ofstream& os);
|
---|
| 33 | void PutIncludeUser(ofstream& os);
|
---|
| 34 | void PutObject(ofstream& os);
|
---|
| 35 | void PutVar(ofstream& os);
|
---|
| 36 |
|
---|
[1268] | 37 | int FillUserCode(string& usercode,uint_4 first);
|
---|
[1269] | 38 | int FillUserCode(string filename);
|
---|
[1230] | 39 |
|
---|
[1287] | 40 | int FillUserFctFrS(string userfctcode="");
|
---|
[1269] | 41 | int FillUserFctFrF(string filefctname="");
|
---|
| 42 |
|
---|
[1268] | 43 | int Compile(string rootfilename="");
|
---|
[1287] | 44 | /* int CrMakefile(void); */
|
---|
[1230] | 45 |
|
---|
[1268] | 46 | int Link(string libname="",string func="");
|
---|
| 47 | int Call(string func="");
|
---|
[1224] | 48 |
|
---|
[1230] | 49 | void FillArgs(vector<string>& args);
|
---|
| 50 | void FillArgs(string& args);
|
---|
| 51 | string GetArgs(void);
|
---|
| 52 |
|
---|
| 53 | void FillInclude(vector<string>& inc);
|
---|
| 54 | void FillInclude(string& inc);
|
---|
| 55 | string GetInclude(void);
|
---|
| 56 |
|
---|
| 57 | void FillCompileOpt(vector<string>& copt);
|
---|
| 58 | void FillCompileOpt(string& copt);
|
---|
| 59 | string GetCompileOpt(void);
|
---|
| 60 |
|
---|
| 61 | void FillLinkOpt(vector<string>& lopt);
|
---|
| 62 | void FillLinkOpt(string& lopt);
|
---|
| 63 | string GetLinkOpt(void);
|
---|
| 64 |
|
---|
| 65 | void FillLinkLibs(vector<string>& llibs);
|
---|
| 66 | void FillLinkLibs(string& llibs);
|
---|
| 67 | string GetLinkLibs(void);
|
---|
| 68 |
|
---|
[1297] | 69 | void FillModuleImport(vector<string>& import);
|
---|
| 70 | void FillModuleImport(string& import);
|
---|
| 71 | string GetModuleImport(void);
|
---|
| 72 |
|
---|
[1224] | 73 | private:
|
---|
[1237] | 74 | string mUserCodeFn;
|
---|
[1268] | 75 | string mUserFctFn;
|
---|
[1224] | 76 | string mCompOpt;
|
---|
| 77 | string mLinkOpt;
|
---|
| 78 | string mMyLibs;
|
---|
| 79 | vector<string> mIncList;
|
---|
| 80 | vector<string> mCallArgs;
|
---|
[1268] | 81 |
|
---|
[1297] | 82 | // Import des modules
|
---|
| 83 | vector<string> mIncImportList;
|
---|
| 84 | vector<string> mModuleImportList;
|
---|
| 85 | vector<string> mModuleImportDefaultList;
|
---|
| 86 |
|
---|
| 87 |
|
---|
[2181] | 88 | // string mDefTmp; remplace par la methode TmpDir() - Reza 4/9/02
|
---|
| 89 | inline string const& TmpDir() { NamedObjMgr omg; return omg.GetTmpDir(); }
|
---|
[1268] | 90 | string mDefRoot;
|
---|
| 91 | string mDefFunc;
|
---|
[1269] | 92 |
|
---|
| 93 | uint_2 mPrtLevel;
|
---|
[1224] | 94 | };
|
---|
| 95 |
|
---|
| 96 | #endif
|
---|