| 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
| 2 | // Classe CxxExecutor  : Dynamic C++ compile/execution in piapp | 
|---|
| 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(); | 
|---|
| 24 |  | 
|---|
| 25 | virtual int Execute(string& keyw,vector<string>& args, string& toks); | 
|---|
| 26 |  | 
|---|
| 27 | inline void SetPrtLevel(uint_2 lp=2) {mPrtLevel = lp;} | 
|---|
| 28 |  | 
|---|
| 29 | int  ExecuteCXX(string usercode,string userfct=""); | 
|---|
| 30 |  | 
|---|
| 31 | int  CrFile(string cfilename="",string func=""); | 
|---|
| 32 | void PutInclude(ofstream& os); | 
|---|
| 33 | void PutIncludeUser(ofstream& os); | 
|---|
| 34 | void PutObject(ofstream& os); | 
|---|
| 35 | void PutVar(ofstream& os); | 
|---|
| 36 |  | 
|---|
| 37 | int  FillUserCode(string& usercode,uint_4 first); | 
|---|
| 38 | int  FillUserCode(string filename); | 
|---|
| 39 |  | 
|---|
| 40 | int  FillUserFctFrS(string userfctcode=""); | 
|---|
| 41 | int  FillUserFctFrF(string filefctname=""); | 
|---|
| 42 |  | 
|---|
| 43 | int  Compile(string rootfilename=""); | 
|---|
| 44 | /* int CrMakefile(void); */ | 
|---|
| 45 |  | 
|---|
| 46 | int  Link(string libname="",string func=""); | 
|---|
| 47 | int  Call(string func=""); | 
|---|
| 48 |  | 
|---|
| 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 |  | 
|---|
| 69 | void FillModuleImport(vector<string>& import); | 
|---|
| 70 | void FillModuleImport(string& import); | 
|---|
| 71 | string GetModuleImport(void); | 
|---|
| 72 |  | 
|---|
| 73 | private: | 
|---|
| 74 | string mUserCodeFn; | 
|---|
| 75 | string mUserFctFn; | 
|---|
| 76 | string mCompOpt; | 
|---|
| 77 | string mLinkOpt; | 
|---|
| 78 | string mMyLibs; | 
|---|
| 79 | vector<string> mIncList; | 
|---|
| 80 | vector<string> mCallArgs; | 
|---|
| 81 |  | 
|---|
| 82 | // Import des modules | 
|---|
| 83 | vector<string> mIncImportList; | 
|---|
| 84 | vector<string> mModuleImportList; | 
|---|
| 85 | vector<string> mModuleImportDefaultList; | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 | string mDefTmp; | 
|---|
| 89 | string mDefRoot; | 
|---|
| 90 | string mDefFunc; | 
|---|
| 91 |  | 
|---|
| 92 | uint_2 mPrtLevel; | 
|---|
| 93 | }; | 
|---|
| 94 |  | 
|---|
| 95 | #endif | 
|---|