forked from craigsapp/hum2ly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (37 loc) · 1.05 KB
/
main.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
43
44
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Sat Aug 6 10:53:40 CEST 2016
// Last Modified: Tue Aug 9 12:53:15 CEST 2016
// Filename: main.cpp
// URL: https://github.com/craigsapp/hum2ly/blob/master/main.cpp
// Syntax: C++11
// vim: ts=3 noexpandtab
//
// Description: Command-line interface for converting Humdrum files into
// lilypond files.
//
#include "hum2ly.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
hum::HumdrumToLilypondConverter converter;
hum::Options options = converter.getOptionDefinitions();
options.process(argc, argv);
hum::HumdrumFile infile;
string filename;
if (options.getArgCount() == 0) {
filename = "<STDIN>";
infile.read(cin);
} else {
filename = options.getArg(1);
infile.read(filename);
}
converter.setOptions(argc, argv);
stringstream out;
bool status = converter.convert(out, infile);
if (!status) {
cerr << "Error converting file: " << filename << endl;
}
cout << out.str();
exit(0);
}