-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.cpp
42 lines (32 loc) · 1.23 KB
/
format.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "format.h"
Format::Format(const string & t, const string & label)
: InOutStatement(label)
{
if(trace) cout << "\nFormat::nFormat{\n";
if(trace) cout << "t.size(): " << t.size() << "\n";
int lastClosingBracket = t.find_last_of(")");
if(trace) cout << "lastClosingBracket: " << lastClosingBracket << "\n";
bracket = t.substr(1, lastClosingBracket - 1);
variables = lastClosingBracket == t.size() - 1 ? string("") : t.substr(lastClosingBracket + 2);
if(trace) cout << " bracket|" << bracket << "|\n";
if(trace) cout << "variables|" << variables << "|\n";
if(trace) cout << "\n}Format::nFormat\n";
}
//----------------------------------------------------------------
Format::~Format()
{
}
//----------------------------------------------------------------
string Format::toCPlusPlus(const int & indent)
{
return "";
}
//----------------------------------------------------------------
string Format::toFortran(const int & indent)
{
if(trace) cout << "\nFormat::toFortran{\n";
string result = label->toFortran() + string(indent, '\t') + "format (" + bracket + ") " + variables + "\n";
if(trace) cout << "\n}Format::toFortran\n" << result << "\n";
return result;
}
//----------------------------------------------------------------