OpenASIP
2.0
src
applibs
Simulator
TTASimulatorCLI.cc
Go to the documentation of this file.
1
/*
2
Copyright (c) 2002-2016 Tampere University.
3
4
This file is part of TTA-Based Codesign Environment (TCE).
5
6
Permission is hereby granted, free of charge, to any person obtaining a
7
copy of this software and associated documentation files (the "Software"),
8
to deal in the Software without restriction, including without limitation
9
the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
and/or sell copies of the Software, and to permit persons to whom the
11
Software is furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
DEALINGS IN THE SOFTWARE.
23
*/
24
/**
25
* @file TTASimulatorCLI.cc
26
*
27
* Declaration of TTASimulatorCLI class.
28
*
29
* @author Henry Linjamäki 2016 (henry.linjamaki@tut.fi)
30
* @note rating: red
31
*/
32
#include "
TTASimulatorCLI.hh
"
33
34
#include "
SimulatorConstants.hh
"
35
#include "
SimulatorInterpreter.hh
"
36
37
#include "
FileSystem.hh
"
38
39
40
TTASimulatorCLI::TTASimulatorCLI
(
SimulatorFrontend
& frontend)
41
:
SimulatorCLI
(frontend) {
42
43
// check if there is an initialization file in user's home dir and
44
// execute it
45
const
std::string personalInitScript =
46
FileSystem::homeDirectory
() + DIR_SEPARATOR +
SIM_INIT_FILE_NAME
;
47
if
(
FileSystem::fileExists
(personalInitScript)) {
48
interpreter_
->
processScriptFile
(personalInitScript);
49
}
50
51
// check if there is an initialization file in the current dir and
52
// execute it
53
const
std::string currentDirInitScript =
54
FileSystem::currentWorkingDir
() + DIR_SEPARATOR +
SIM_INIT_FILE_NAME
;
55
if
(
FileSystem::fileExists
(currentDirInitScript)) {
56
interpreter_
->
processScriptFile
(currentDirInitScript);
57
}
58
}
59
60
TTASimulatorCLI::~TTASimulatorCLI
() {
61
62
}
63
FileSystem.hh
SimulatorCLI::interpreter_
SimulatorInterpreter * interpreter_
Definition:
SimulatorCLI.hh:63
SIM_INIT_FILE_NAME
#define SIM_INIT_FILE_NAME
The initialization script file name.
Definition:
SimulatorConstants.hh:48
SimulatorConstants.hh
FileSystem::homeDirectory
static std::string homeDirectory()
TTASimulatorCLI::~TTASimulatorCLI
virtual ~TTASimulatorCLI()
Definition:
TTASimulatorCLI.cc:60
TTASimulatorCLI::TTASimulatorCLI
TTASimulatorCLI()=delete
FileSystem::fileExists
static bool fileExists(const std::string fileName)
SimulatorInterpreter.hh
FileSystem::currentWorkingDir
static std::string currentWorkingDir()
Definition:
FileSystem.cc:142
TTASimulatorCLI.hh
SimulatorCLI
Definition:
SimulatorCLI.hh:48
SimulatorFrontend
Definition:
SimulatorFrontend.hh:89
TclInterpreter::processScriptFile
virtual bool processScriptFile(const std::string &scriptFileName)
Definition:
TclInterpreter.cc:250
Generated by
1.8.17