-
Notifications
You must be signed in to change notification settings - Fork 34
/
guide
113 lines (94 loc) · 2.69 KB
/
guide
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Get needs to quote filenames
Look needs to respect quotes around filenames
// Basics
Edit X:edwood/\+Errors: 1,$d
X:edwood/.*\.go: w
{go build -tags debug}
./testedwood.sh
{go test -covermode=count -coverprofile=count.out}
go tool cover -html=count.out
go vet
go test --run 'TestXfidreadQWctl' -covermode=count -coverprofile=count.out
// Edit commands for converting C to Go
cs 'flushwarnings\('
",
{ x/->/c/./
x/TRUE/c/true/
x/FALSE/c/false/
x/display.black/c/display.Black/
x/ ZP/c/ image.ZP/
x/[^a-zA-Z0-9_]for/+-s/for\((.*)\)/for \1 /g
x/[^a-zA-Z0-9_]if/+-s/if\((.*)\)/if \1 /g
x/[^a-zA-Z_0-9](max|min)\.[xy]/{ x/m/c/M/
x/\.y/c/.Y
x/\.x/c/.X
}
x/[^a-zA-Z_0-9]Border([^a-zA-Z_0-9]|\n)/y/[^a-zA-Z_0-9]/g/./{
i/display.ScaleSize(/
a/)/
}
}
"
textsetselect
s/textshow\(([^),]+),([^)]+)\)/\1.Show(\2)/g
,s/textsetselect\(([^),]+),([^)]+)\)/\1.SetSelect(\2)/g
,s/textinsert\(([^),]+),([^)]+)\)/\1.Insert(\2)/g
,s/typecommit\(([^)]+)\)/\1.TypeCommit()/g
s/filemark\(([^)]+)\)/\1.Mark()/g
,s/winclose\(([^)]+)\)/\1.Close()/g
,s/winlock\(([^)]+)\)/\1.Lock()/g
,s/winunlock\(([^)]+)\)/\1.Unlock()/g
// rewrite struct decl from C to Go
x/struct [a-zA-Z0-9_]+(.*)\n{([^}]*\n)+};/{
s/^ *([a-zA-Z0-9_]+)[ ]+(\*)?([a-zA-Z0-9_]+);(.*)/ \3 \2\1 \4/g
s/struct ([a-zA-Z0-9_]+)((.*\n)+){/type \1 struct {\2/
x/};/c/}\n/
}
,x/[^a-zA-Z_0-9]uchar[^a-zA-Z_0-9]/x/[a-zA-Z0-9_]+/c/byte
,x/[^a-zA-Z_0-9]short[^a-zA-Z_0-9]/x/[a-zA-Z0-9_]+/c/int
,x/[^a-zA-Z_0-9]char[^a-zA-Z_0-9]/x/[a-zA-Z0-9_]+/c/byte
// function decls.
,s/^([a-zA-Z0-9_]+)[ ]*(\*?)\n([a-zA-Z0-9_]+)(\(.*)\n{/func \3 \4 (\2 \1) {/g
,x/^func.*\([^)]*\)/x/\([^)]*\)/{
x/\(void\)/c/()
y/,/s/([a-zA-Z0-9_]+)[ ]+(\*)?([a-zA-Z0-9_]+)/\3 \2 \1/
}
// var decls
s/^[ ]*([a-zA-Z0-9_]+)[ ]+(\*?)(.*);/ \3 \2\1/g
,x/\/\*.*\*\//{
x/\/\*/c/\/\/
x/\*\//d
}
,s/setcursor\(([^),]+)([^)]*)\)/\1.Commit(\2)/g
,s/wincommit\(([^),]+)([^)]*)\)/\1.Commit(\2)/g
,s/textcommit\(&([^),]+)([^)]*)\)/\1.Commit(\2)/g
,s/qlock\(&([^)]+)\)/\1.Lock()/g
,s/qunlock\(&([^)]+)\)/\1.Unlock()/g
,s/filereset\(([^)]+)\)/\1.Reset()/g
var decls
s/([a-zA-Z0-9_]+)[ ]+(\*)?([a-zA-Z0-9_]+)/\3 \2 \1/g
// Member function call
s/([a-zA-Z0-9_]+)\(&?([a-zA-Z0-9_.]+),?/\2.\1(/
// enum to go const
,x/enum [a-zA-Z0-9_]+(.*)\n{([^}]*\n)+};/{
x/$/i/},
x/^ *([a-zA-Z0-9_]+)[ ]/p
Watch go build '-gcflags=all=-N -l' .
,x/[^a-zA-Z]+tick[^a-zA-Z]+/x/tick/c/TickImage
}
Edit X/frame\/.*\.go/{
,x/maxlines/c/MaxLines/
,x/maxtab/c/MaxTab/
,x/nchars/c/NChars/
,x/nlines/c/NLines/
,x/lastlinefull/c/LastLineFull/
,x/modified/c/Modified/
,x/tickback/c/TickBack/
,x/noredraw/c/NoRedraw/
,x/ticked/c/Ticked/
,x/tickscale/c/TickScale/
}
X/.*atch.*/
x/ {.*}/d
Watch go build '-gcflags=all=-N -l' .
/Users/plalonde/plan9port/src/libframe