Skip to content

Commit 977cba6

Browse files
committed
Fix compilation of bmc.cgi.
1 parent 11699af commit 977cba6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

cgi.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
// (see accompanying file LICENSE.txt or copy at
55
// http://www.gnu.org/licenses/gpl-3.0-standalone.html)
66

7-
#include <bmc/ttb/ttb.h>
87

98
#include "config.hpp"
109
#include <fstream>
1110
#include <boost/spirit/include/qi_parse.hpp>
1211
#include <boost/locale/encoding_utf.hpp>
1312
#include "bmc/braille/parsing/grammar/score.hpp"
1413
#include "bmc/braille/semantic_analysis.hpp"
14+
#include "bmc/braille/text2braille.hpp"
1515
#include <boost/program_options.hpp>
1616

1717
#include "bmc/lilypond.hpp"
@@ -35,7 +35,7 @@ std::string hash(std::string const &string)
3535
cgicc::option table_option(std::string const &id, cgicc::Cgicc const &cgi) {
3636
cgicc::option o(id);
3737
o.set("value", id);
38-
if (cgi.getElement("table") != cgi.getElements().end() and
38+
if (cgi.getElement("table") != cgi.getElements().end() &&
3939
cgi.getElement("table")->getValue() == id)
4040
o.set("selected", "selected");
4141
return o;
@@ -135,7 +135,7 @@ std::ostream &table_select(std::ostream &os, cgicc::Cgicc const &cgi) {
135135
cgicc::option instrument_option(std::string const &instrument, cgicc::Cgicc const &cgi) {
136136
cgicc::option o(instrument);
137137
o.set("value", instrument);
138-
if (cgi.getElement("instrument") != cgi.getElements().end() and
138+
if (cgi.getElement("instrument") != cgi.getElements().end() &&
139139
cgi.getElement("instrument")->getValue() == instrument)
140140
o.set("selected", "selected");
141141
return o;
@@ -158,7 +158,7 @@ int main()
158158
cgicc::Cgicc cgi;
159159

160160
if (cgi.getElement("table") != cgi.getElements().end()) {
161-
replaceTextTable(TABLES_DIRECTORY, cgi.getElement("table")->getValue().c_str());
161+
bmc::braille::default_table = cgi.getElement("table")->getValue();
162162
}
163163

164164
cgicc::textarea music_input(cgi("music"));
@@ -181,7 +181,7 @@ int main()
181181

182182
bool const success = parse(iter, end, parser, score);
183183

184-
if (success and iter == end) {
184+
if (success && iter == end) {
185185
::bmc::braille::compiler<error_handler_type> compile(error_handler);
186186
if (compile(score)) {
187187
prefix = hash(braille->getValue());
@@ -192,7 +192,7 @@ int main()
192192
std::ofstream ly(dir + prefix + ".ly");
193193
::bmc::lilypond::generator generate(ly, true, true, false);
194194
generate.remove_tagline();
195-
if (not cgi("instrument").empty())
195+
if (!cgi("instrument").empty())
196196
generate.instrument(cgi("instrument"));
197197
generate(score);
198198
ly.close();
@@ -203,8 +203,7 @@ int main()
203203
}
204204
}
205205
}
206-
if (not prefix.empty() and
207-
cgi.getElement("type") != cgi.getElements().end()) {
206+
if (!prefix.empty() && cgi.getElement("type") != cgi.getElements().end()) {
208207
if (cgi.getElement("type")->getValue() == "play") {
209208
std::ifstream midi_file("/tmp/bmc.cgi/" + prefix + ".midi");
210209
if (midi_file.good()) {
@@ -214,7 +213,7 @@ int main()
214213
}
215214
}
216215
}
217-
if (not cgi("hash").empty()) {
216+
if (!cgi("hash").empty()) {
218217
if (cgi.getElement("type")->getValue() == "png") {
219218
std::ifstream png_file("/tmp/bmc.cgi/" + cgi("hash") + ".png");
220219
if (png_file.good()) {
@@ -252,7 +251,7 @@ int main()
252251
<< cgicc::p() << std::endl;
253252
std::cout << cgicc::p("To allow for several parts in a single score, music always needs to end with a final bar sign.") << std::endl;
254253
}
255-
if (not cgi("music").empty() and prefix.empty()) {
254+
if (!cgi("music").empty() && prefix.empty()) {
256255
std::cout << cgicc::p("Unable to translate braille music, try again.").set("class", "error") << std::endl;
257256
std::cout << cgicc::p() << "The "
258257
<< cgicc::a("tutorial").set("href", "https://bmc.branchable.com/tutorial/")
@@ -265,12 +264,12 @@ int main()
265264
<< cgicc::label("Enter braille music: ").set("for", "music");
266265
std::cout << music_input << cgicc::div();
267266
std::cout << cgicc::input().set("type", "submit").set("value", "Transcribe to print");
268-
if (not prefix.empty()) {
267+
if (!prefix.empty()) {
269268
instrument_select(std::cout, cgi);
270269
std::cout << cgicc::input().set("type", "submit").set("name", "type").set("value", "play");
271270
}
272271
std::cout << cgicc::form();
273-
if (not prefix.empty()) {
272+
if (!prefix.empty()) {
274273
std::string alt;
275274
std::ifstream ly("/tmp/bmc.cgi/" + prefix + ".ly");
276275
if (ly.good()) {

0 commit comments

Comments
 (0)