4
4
// (see accompanying file LICENSE.txt or copy at
5
5
// http://www.gnu.org/licenses/gpl-3.0-standalone.html)
6
6
7
- #include < bmc/ttb/ttb.h>
8
7
9
8
#include " config.hpp"
10
9
#include < fstream>
11
10
#include < boost/spirit/include/qi_parse.hpp>
12
11
#include < boost/locale/encoding_utf.hpp>
13
12
#include " bmc/braille/parsing/grammar/score.hpp"
14
13
#include " bmc/braille/semantic_analysis.hpp"
14
+ #include " bmc/braille/text2braille.hpp"
15
15
#include < boost/program_options.hpp>
16
16
17
17
#include " bmc/lilypond.hpp"
@@ -35,7 +35,7 @@ std::string hash(std::string const &string)
35
35
cgicc::option table_option (std::string const &id, cgicc::Cgicc const &cgi) {
36
36
cgicc::option o (id);
37
37
o.set (" value" , id);
38
- if (cgi.getElement (" table" ) != cgi.getElements ().end () and
38
+ if (cgi.getElement (" table" ) != cgi.getElements ().end () &&
39
39
cgi.getElement (" table" )->getValue () == id)
40
40
o.set (" selected" , " selected" );
41
41
return o;
@@ -135,7 +135,7 @@ std::ostream &table_select(std::ostream &os, cgicc::Cgicc const &cgi) {
135
135
cgicc::option instrument_option (std::string const &instrument, cgicc::Cgicc const &cgi) {
136
136
cgicc::option o (instrument);
137
137
o.set (" value" , instrument);
138
- if (cgi.getElement (" instrument" ) != cgi.getElements ().end () and
138
+ if (cgi.getElement (" instrument" ) != cgi.getElements ().end () &&
139
139
cgi.getElement (" instrument" )->getValue () == instrument)
140
140
o.set (" selected" , " selected" );
141
141
return o;
@@ -158,7 +158,7 @@ int main()
158
158
cgicc::Cgicc cgi;
159
159
160
160
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 ();
162
162
}
163
163
164
164
cgicc::textarea music_input (cgi (" music" ));
@@ -181,7 +181,7 @@ int main()
181
181
182
182
bool const success = parse (iter, end, parser, score);
183
183
184
- if (success and iter == end) {
184
+ if (success && iter == end) {
185
185
::bmc::braille::compiler<error_handler_type> compile (error_handler);
186
186
if (compile (score)) {
187
187
prefix = hash (braille->getValue ());
@@ -192,7 +192,7 @@ int main()
192
192
std::ofstream ly (dir + prefix + " .ly" );
193
193
::bmc::lilypond::generator generate (ly, true , true , false );
194
194
generate.remove_tagline ();
195
- if (not cgi (" instrument" ).empty ())
195
+ if (! cgi (" instrument" ).empty ())
196
196
generate.instrument (cgi (" instrument" ));
197
197
generate (score);
198
198
ly.close ();
@@ -203,8 +203,7 @@ int main()
203
203
}
204
204
}
205
205
}
206
- if (not prefix.empty () and
207
- cgi.getElement (" type" ) != cgi.getElements ().end ()) {
206
+ if (!prefix.empty () && cgi.getElement (" type" ) != cgi.getElements ().end ()) {
208
207
if (cgi.getElement (" type" )->getValue () == " play" ) {
209
208
std::ifstream midi_file (" /tmp/bmc.cgi/" + prefix + " .midi" );
210
209
if (midi_file.good ()) {
@@ -214,7 +213,7 @@ int main()
214
213
}
215
214
}
216
215
}
217
- if (not cgi (" hash" ).empty ()) {
216
+ if (! cgi (" hash" ).empty ()) {
218
217
if (cgi.getElement (" type" )->getValue () == " png" ) {
219
218
std::ifstream png_file (" /tmp/bmc.cgi/" + cgi (" hash" ) + " .png" );
220
219
if (png_file.good ()) {
@@ -252,7 +251,7 @@ int main()
252
251
<< cgicc::p () << std::endl;
253
252
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;
254
253
}
255
- if (not cgi (" music" ).empty () and prefix.empty ()) {
254
+ if (! cgi (" music" ).empty () && prefix.empty ()) {
256
255
std::cout << cgicc::p (" Unable to translate braille music, try again." ).set (" class" , " error" ) << std::endl;
257
256
std::cout << cgicc::p () << " The "
258
257
<< cgicc::a (" tutorial" ).set (" href" , " https://bmc.branchable.com/tutorial/" )
@@ -265,12 +264,12 @@ int main()
265
264
<< cgicc::label (" Enter braille music: " ).set (" for" , " music" );
266
265
std::cout << music_input << cgicc::div ();
267
266
std::cout << cgicc::input ().set (" type" , " submit" ).set (" value" , " Transcribe to print" );
268
- if (not prefix.empty ()) {
267
+ if (! prefix.empty ()) {
269
268
instrument_select (std::cout, cgi);
270
269
std::cout << cgicc::input ().set (" type" , " submit" ).set (" name" , " type" ).set (" value" , " play" );
271
270
}
272
271
std::cout << cgicc::form ();
273
- if (not prefix.empty ()) {
272
+ if (! prefix.empty ()) {
274
273
std::string alt;
275
274
std::ifstream ly (" /tmp/bmc.cgi/" + prefix + " .ly" );
276
275
if (ly.good ()) {
0 commit comments