-
Notifications
You must be signed in to change notification settings - Fork 2
/
split_source.tes
125 lines (111 loc) · 3.79 KB
/
split_source.tes
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
! !
! 2013 July 11 !
! !
! The author disclaims copyright to this source code. In place of !
! a legal notice, here is a blessing: !
! !
! May you do good and not evil. !
! May you find forgiveness for yourself and forgive others. !
! May you share freely, never taking more than you give. !
! !
!***********************************************************************!
! This module extracts the individual source modules from the !
! amalgamated UnQLite source module. !
! !
@^A%SPLIT_SOURCE V1.0% ! Identify myself... !
13^T 10^T
0J Z"N <@FS%^ES% %;> ! Clean up the buffer, if it's there !
0J 0A-32"E D ' ! strip leading spaces !
ZJ -1A-32"E -D ' ! and trailing spaces !
' ! endif buffer there !
HXZ HK ! Save possible command !
! Set flags for our use, and close this file !
[S ^XUS [S EDUS [S EHUS [S ! Save all the existing flags !
ESUS [S EVUS [S ETUS [S EUUS [S ! so we can restore the user to !
! his original state on exit !
^D ! Set Radix to 10 !
0^X ! Case-sensitive search !
0ED ! ^ in search means ConTRL !
! Disable Y or _ if data loss !
2EH ! Full error messages !
0ES 0EV ! No typeout after search !
2#16#128#512#8192ET
! Set ET flag as follows - !
! 1 rw typeout in image mode !
! 2 rw terminal is a scope !
! 4 rw read lower case !
! 8 rw ^T reads with no echo !
! 16 rw cancel ^O on typeout !
! 32 rw read with no wait, returns -1 if no input !
! 64 rw detach flag !
! 128 rw abort on error !
! 256 rw truncate to set width !
! 512 ro terminal is scope and watch is present !
! 1024 ro terminal is refresh and watch is present !
! 2048 xx not used !
! 4096 rw 1 => 8bit, 0 => 7bit !
! 8192 rw Surrogate escape on !
! 16384 xx not used !
! 32768 rw trap ^C and reset !
-1EU ! No case flagging on output !
! EO is Teco's Version Number !
! 0EJ is Job Number !
! 1EJ is KB Number !
! 2EJ is PPN !
@EI%% ! Close this file !
! --------------------------------------------------------------------- !
! * Split UnQLite Amalgamated source code !
! --------------------------------------------------------------------- !
GZ ! Dump command line into buffer !
0J Z"N <@FS%^ES% %;> ! Clean up the buffer, if there !
@^UI%% @^UO%% ! init filename buffers !
0J 0A-32"E D ' ! strip leading spaces !
ZJ -1A-32"E -D ' ! and trailing spaces !
0J HXI 0UI ! copy in filename into buffer!
'
@^A%...Opening amalgamated UnQLite source file...%
:QI"N
HK ! Clear buffer !
:@ER%^EQI%"S ! Open the file, if opens !
-1UI ! flip status flag !
@^A%done...%
|
@^A%unable to open % :GI @^A%...%
'
|
@^A%no filename specified...%
'
13^T 10^T
QI"S
@^A%...Processing amalgamated source file...% 13^T 10^T
EA @EW%NLA0:%
@EW%% @EW%NLA0:%
< ! Loop !
:@N%
/*
* ----------------------------------------------------------
* File: %;
1XO
@^A%...Splitting out % :GO @^A%...%
B,.+^SPW
:@N%
* ----------------------------------------------------------
*/%;
L -.D
EA EF ! Switch to secondary stream !
:@EW%^EQO/STM%"F ! Open output, if failed !
@EW%% ! switch back to NL !
@^A%failed...%
|
@^A%done...%
'
13^T 10^T
>
'
! --------------------------------------------------------------------- !
! * Now restore all the flags and exit !
! --------------------------------------------------------------------- !
]S QSEU ]S QSET ]S QSEV ]S QSES ]S ! Restore all the flags we !
QSEH ]S QSED ]S QS^X ]S ! saved at the start !
^C