-
Notifications
You must be signed in to change notification settings - Fork 1
/
convert-mv1
executable file
·53 lines (48 loc) · 1.65 KB
/
convert-mv1
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
#!/bin/sh
# Mumtris conversion tool for MUMPS V1
# Copyright (C) 2012 Piotr Koper <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# CONVERSION
# 1. delete first line ";"
# 2. insert routine name
# 3. remove empty lines
# 4. replace tabs with spaces
# 5. add space after label names
# 6 - 8 change key() routine
# 9. replace zsh "d":x with GETENV
# 10 - 11 change USE $P parameters
# 12. remove the ESCAPE use
# 13. single ESC is undetectable with READ *, change info on keys
sed '
1d
4i\
mumtris
/^$/d;
s/[[:space:]]/ /g;
s/^\([^[:space:];]\+\)$/\1 /;
s/\. i c=27 d q:q/. i c=27 s (q,ex)=1 q/;
s/\.\. i $l($zb)=1 s (q,ex)=1 q/. i c=0 d/;
s/\.\. s c=$a($e($zb,3))/.. s c=$a($e($k,3))/
s/zsh "d":x/s x=$\&%GETENV("size") s:x dh=$p(x," ",1),dw=$p(x," ",2) s:x="" dh=25,dw=80/
s/u $p:noecho/u $p:"noecho"/
s/u $p:echo/u $p:"echo"/
/u $p:escape/d
s/"QUIT: ESC, Q"/"QUIT: Q"/
' mumtris.m > mumtris.v1
# LOAD
./mumps -x 'd INT^%RR("mumtris.v1")' testdb
# ENVIRONMENT SETUP
export size="`stty size`"
./mumps -x "d ^mumtris" testdb