summaryrefslogtreecommitdiff
path: root/tests/general/endetab.dat
blob: 76976a867fd1c047a49fef669bdc9d41d52b53e9 (plain)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
##  test data for entab/detab tester; see driver program's comments for details
#
#   Remember that the characters --> "!.$" <-- are metacharacters, and cannot
#   be used randomly for punctuation;  I got away with it that time by placing
#   them carefully <stop>

# first try with default parameters (9,17,25,33,etc)

x
 x
  x
   x
    x
     x
      x
       x
!.......x
!....... x
!.......  x
!.......   x
!.......    x
!.......     x
!.......      x
!.......       x
!.......!.......x
x!......!.......x
 x!.....!.......x
  x!....!.......x
   x!...!.......x
    x!..!.......x
     x!.!.......x
      x!!.......x	# tab replaces one char as part of longer run
       x!.......x
!.......x!......x
!....... x!.....x
!.......  x!....x
!.......   x!...x
!.......    x!..x
!.......     x!.x
!.......      x x	# tab does not replace one-char run
!.......       xx
!.......!.......x
abcde!..x
abcdef!.x
abcdefg x
abcdefg  x
abcdefg   x
abcdefg    x
abcdefg     x
abcdefg      x
abcdefg       x
abcdefg        x
abcdefg!!.......x

# test some lines with trailing spaces
$
 $
  $
   $
    $
     $
      $
       $
!.......$
!....... $
!.......  $
!.......   $
!.......    $
!.......     $
!.......      $
!.......       $
!.......!.......$
!.......!....... $
!.......!.......  $

!.......!.......!.......!.......!.......!.......!.......!.......       wxyz
!.......!.......!.......!.......!.......!.......!.......!.......!.......xyz
!.......!.......!.......!.......!.......!.......!.......!.......!....... yz
!.......!.......!.......!.......!.......!.......!.......!.......!.......  z

!.......ENTRY!..SUUO
!.......ENTRY!..NUUO
!.......CAI!....1,[BYTE (9)"s","u","u","o","/","n","u","u","o",0]
SUUO:!..TRZA!...T1,1!...!.......; flag suuo call
NUUO:!..TRO!....T1,1!...!.......; flag nuuo call
!.......MOVE!...T0,1-OFF(P)!....; get UUO code
!.......MOVEM!..T0,UUO!.!.......; save uuo
!.......MOVE!...T0,2-OFF(P)!....; load register value
!.......XCT!....UUO!....!.......; issue UUO
!....... TRZE!..T1,1!...!.......; skip unless non-skip from nuuo call
!....... TRZE!..T1,1!...!.......; skip unless skip-return from nuuo call
!....... HRREI!.T0,ERR!.!.......; indicate UUO failure
!.......MOVE!...T1,T0!..!.......; return result in r1
!.......POPJ!...P,!.....!.......; return

# now try tabs every 4 columns
= entab(s,5)

x
xx
 xx
 x x
  x x
  x  x
   x  x
   x   x
!...x!..x
!...x!.. x
!... x!.  x
!... x!.   x
!...  x!!...x
!...  x!!... x
!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...xyz

xxxx
xxx x
xxx  x
xxx   x
xxx    x
xxx!!...x
xxx!!... x

xxx$
xxx $
xxx  $
xxx   $
xxx    $
xxx!!...$
xxx!!... $

smatch(s1,s2)
char *s1, *s2;
{
!...while (~((*s1 ^ *s2) & 0137))
!...!...if (~*s1)
!...!...!...return 0;
!...!...else
!...!...!...s1++, s2++;
!...return ((*s1 & 0137) - (*s2 & 0137));
}

# try col 8, then every 4
= entab(s,8,12)
!......01!.student-record
!......!...03!.name pic x(25)
!......!...03!.home-address
!......!...!...05!.city pic x(15)
!......!...!...05!.state pic xx
!......!...!...05!.big-zip
!......!...!...!...07!.zip pic 9(5)
!......!...!...!...07!.plus-4 pic 9(4)
!......!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...xyz

# try irregular columns
= entab(11,18,30,36)
!.........entry!.sys=
 sys2!....xj
 sys3!....sa1!...a6
!.........lx1!...59-40
!.........mi   x1,sys3!......wait until done if RCL bit set
 sys=!....subr!..=!..........entry / exit
 sys1!....sa1!...1
!.........nz   x1,sys1!......wait ra+1 clear
!.........sa6!...1!..........store request
!.........eq   sys2
!.........!.......!..........!.....!.....!.....!.....!.....!.....!.....   xyz

# and now for something completely different
= entab(s,11,60) 
# (11,60,61) would need less scratch space on detab but few will know/use this

loop:!....line = input!....................................:f(end)
!.........output = line!...................................:(loop)

# end cases
= entab(s,2)
x
 x
!!x
!!!x
!!!!x
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!xyz

= entab(s,2,4)
x
 x
  x
!!.x
!!. x
!!.!.x
!!.!.!.!.!.!.!.!.!.!.xyz
!!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.xyz

= entab(s,3)
x
 x
!.x
!. x
!.!.x
!.!.!.!.!.!.!.!.!.!.xyz
!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.xyz

= entab(s,3,4)
x
 x
!.x
!.!x
!.!!x
!.!!!x
!.!!!!x
!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!xyz

# now go back to an interval of 4 and test special characters in input
= entab(s,5)

# first, just tabs in the input
\t$
\t $
\t  $
\t   $
\t!...$
 \t!...$
  \t!...$
   \t!...$
!...\t!...$
\tx
\t x
\t  x
\t   x
\t!...x
 \t!...x
  \t!...x
   \t!...x
!...\t!...x
abc\tdef\tghi\tjkl


smatch(s1,s2)
char *s1, *s2;
{
\twhile (~((*s1 ^ *s2) & 0137))
\t\tif (~*s1)
!...!...!...return 0;
   \t\telse
!...!...!...s1++, s2++;
  \treturn ((*s1 & 0137) - (*s2 & 0137));
}

# now some backspaces
abc\b!.de\b!..fghij\b!...k

# use irregular stops for testing wierder situations
= entab(5,7,10)
!...!.!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..
!...!.!..\b\b\b\b\b\b\b\b\b!...!.!..!..
!...!.!..\n!...!.!..\r!...!.!..\n\r!...!.!..\r\n!...!.!..
!...\a!.\a!..\a!..
!...\b\b\b\b!...\b\a\b\a!.!.!..\n\n\n  \t!.!..\n