teco

Check-in [2ae9116804]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tidy up commenting
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:2ae91168046297a2c354168c5e2a623c818d4adb2cd32f1c3361b18dfc8403f6
User & Date: ajv-899-334-8894@vsta.org 2013-12-20 00:55:35
Context
2013-12-22
19:48
Add a prototype check-in: 13e94774a4 user: ajv-899-334-8894@vsta.org tags: master, trunk
2013-12-20
00:55
Tidy up commenting check-in: 2ae9116804 user: ajv-899-334-8894@vsta.org tags: master, trunk
2013-12-19
19:31
Fix up interface between emacs and undo check-in: 7d89c9e50c user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/fill.tec.

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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
! mf--Fill paragraph point lies within, written all in TECO !
! Optional arg is line length, default is 70 !









@^uf\
+0ua
qa"e
 70um
|
 qaum 
'

! Save text registers we scribble on !
[t[u

! Decimal !
^D

! Move to beginning of paragraph !

! Move to first line which doesn't start with text !
<
 ! Move to start of line !
 0l

 ! Leave loop when line doesn't start with alphanum !
 ::@s/R/;

 ! Back up another line !
 -l

 ! Exit at start of buffer !
 ."e 1;'
>

! Don't include line unless it's just leading white space !
."g
 0l::@s/S/"u 1l'
'
0l

! Record position in QAn, also QSn so can delete when done !
.ua
qaus

! Move to end of paragraph !
<
 ! Move to start of line !
 0l

 ! Leave loop when line doesn't start with alphanum !
 ::@s/R/;

 ! Forward a line !
 l
>

! End position in QBn !
.ub

! Avoid zero-length operations !
qa-qb"e Empty paragraph specified
 ^c'

! Build the filled text right below the unfilled text, jumping back !
! and forth !

! QPn is our current output position !
qbup
! QCn is our current output column !
0uc

! Honor leading white space !
qaj
<
 ::@s/S/;
 1r
 ::@s/	/"s 8%c | 1%c 1c '
>
! Copy white space into output, skip past it !
! Move text via QT !
qa,.xt
.ua
qpjgt.up

! Set QU to white space chars !
@^uu/ 	
/

! While words, assemble and fill !
<
 ! Skip leading white space !
 qaj
 <::@s/gu/;>
 .ua

 ! Walk across word, pull into QT !
 <::@s/gu/"s 1r 1; | 1c'>
 qa,.xt
 .ua

 ! If we're past end of range we want, terminate loop !
 qa-qb;

 ! If it won't fit on the line, terminate current line and start over !
 qc+:qt+1-qm"g
  qpj @i/
/ 0uc .up
 '

 ! Add in our word, update column counter !
 qpj
 qc"g
  1r @::s/./"s @i/ / 1%c | 1c' ! Two spaces between sentences !
  @i/ / 1%c ! Space between words !
 '
 gt .up
 :qt%c
>

! Chop off unfilled text, add trailing newline !
qpj
@i/
/
qs,qbk
qsj

! Restore text registers we scribble on !
]u]t
\

|
|
>
>
>
>
>
>
>
>
>


|
<
|
<
<
<
|


|


|

|

|


|


|


|



|





|



|

|


|


|



|


|



|
|

|

|


|






|
|


|

|



|

|




|




|


|





|


|
|





|






|



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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
!* mf--Fill paragraph point lies within, written all in TECO !
!* Optional arg is line length, default is 70 !
!* Textual Q regs: !
!*  t - current word being filled into output !
!*  u - list of space chars !
!* Number Q regs: !
!*  a - current position in input !
!*  b - end position of input !
!*  c - current output column !
!*  p - current output position !
!*  s - position of start of input !
@^uf\
+0ua
qa"e 70um | qaum '





!* Save text registers we scribble on !
[t[u

!* Decimal !
^D

!* Move to beginning of paragraph !

!* Move to first line which doesn't start with text !
<
 !* Move to start of line !
 0l

 !* Leave loop when line doesn't start with alphanum !
 ::@s/R/;

 !* Back up another line !
 -l

 !* Exit at start of buffer !
 ."e 1;'
>

!* Don't include line unless it's just leading white space !
."g
 0l::@s/S/"u 1l'
'
0l

!* Record position in QAn, also QSn so can delete when done !
.ua
qaus

!* Move to end of paragraph !
<
 !* Move to start of line !
 0l

 !* Leave loop when line doesn't start with alphanum !
 ::@s/R/;

 !* Forward a line !
 l
>

!* End position in QBn !
.ub

!* Avoid zero-length operations !
qa-qb"e Empty paragraph specified
 ^c'

!* Build the filled text right below the unfilled text, jumping back !
!* and forth !

!* QPn is our current output position !
qbup
!* QCn is our current output column !
0uc

!* Honor leading white space !
qaj
<
 ::@s/S/;
 1r
 ::@s/	/"s 8%c | 1%c 1c '
>
!* Copy white space into output, skip past it !
!* Move text via QT !
qa,.xt
.ua
qpj gt .up

!* Set QU to white space chars !
@^uu/ 	
/

!* While words, assemble and fill !
<
 !* Skip leading white space !
 qaj
 <::@s/gu/;>
 .ua

 !* Walk across word, pull into QT !
 <::@s/gu/"s 1r 1; | 1c'>
 qa,.xt
 .ua

 !* If we're past end of range we want, terminate loop !
 qa-qb;

 !* If it won't fit on the line, terminate current line and start over !
 qc+:qt+1-qm"g
  qpj @i/
/ 0uc .up
 '

 !* Add in our word, update column counter !
 qpj
 qc"g
  1r @::s/./"s @i/ / 1%c | 1c' !* Two spaces between sentences !
  @i/ / 1%c !* Space between words !
 '
 gt .up
 :qt%c
>

!* Chop off unfilled text, add trailing newline !
qpj
@i/
/
qs,qbk
qsj

!* Restore text registers we scribble on !
]u]t
\