-
Notifications
You must be signed in to change notification settings - Fork 6
/
abcjsc
executable file
·75 lines (68 loc) · 1.55 KB
/
abcjsc
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
# abc2svg with jsc-1 (webkitgtk2)
progdir=`dirname $0`
exec jsc-1 -e "var progdir='${progdir}/'
// function to do utf-8 work...
// uncommenting this function asks for also uncommenting its call in cmdline.js
//function utf_convert(fin) {
// var b1, b2,
// fout = ''
// for (var i = 0; i < fin.length; i++) {
// b1 = fin.charCodeAt(i)
// if (b1 >= 128) {
// b2 = fin.charCodeAt(++i);
// fout += String.fromCharCode(((b1 & 0x3f) << 6) + (b2 & 0x7f))
// } else {
// fout += fin[i]
// }
// }
// return fout
//}
load(progdir + 'abc2svg-1.js')
// interpreter specific functions
abc2svg.print = function(str) {
print(str)
}
abc2svg.quit = function() {
quit(1)
}
abc2svg.readFile = function(fname) {
return read(fname)
}
abc2svg.loadjs = function(fn, relay, onerror) {
try {
load(progdir + fn)
if (relay)
relay()
} catch(e) {
if (onerror)
onerror()
else
print('Cannot read file ' + fn)
}
}
load(progdir + 'cmdline.js')
function main(args) {
if (/\.js$/.test(args[0])) {
load(args[0])
args.shift()
}
if (typeof(abc2svg.abc_init) != 'function')
load(progdir + 'toxhtml.js')
}
if (!args[0]) {
print('ABC translator with jsc-1 (webkitgtk2)\
and abc2svg-' + abc2svg.version + ' ' + abc2svg.vdate + '\n\
Usage:\n\
abcjsc [script.js] [g_options] ABC_file [f_options] [ABC_file [f_options]]*\n\
Arguments:\n\
script.js script to load - default: toxhtml.js (XHTML+SVG generation)\n\
g_options global ABC options\n\
ABC_file ABC file\n\
f_options file options')
quit()
}
abc_cmd('abcjsc', args)
}
main(arguments)
" -- "$@"