1 {//-------------------------------------------------------------------------}
\r
3 {Copyright (C) 2014 Jason Self <j@jxself.org> }
\r
5 {This file is free software: you may copy, redistribute and/or modify it }
\r
6 {under the terms of the GNU Affero General Public License as published by }
\r
7 {the Free Software Foundation, either version 3 of the License, or (at your }
\r
8 {option) any later version. }
\r
10 {This file is distributed in the hope that it will be useful, but WITHOUT }
\r
11 {ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or }
\r
12 {FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License}
\r
13 {for more details. }
\r
15 {You should have received a copy of the GNU Affero General Public License }
\r
16 {along with this program; if not, see https://gnu.org/licenses or write to: }
\r
17 { Free Software Foundation, Inc. }
\r
18 { 51 Franklin Street, Fifth Floor }
\r
19 { Boston, MA 02110-1301 }
\r
22 {This file incorporates work covered by the following copyright and }
\r
23 {permission notice: }
\r
25 {Copyright (C) 1990, 2009 - Apogee Software, Ltd. }
\r
27 {This file is part of Beyond The Titanic. Beyond The Titanic is free }
\r
28 {software; you can redistribute it and/or modify it under the terms of the }
\r
29 {GNU General Public License as published by the Free Software Foundation; }
\r
30 {either version 3 of the License, or (at your option) any later version. }
\r
32 {This program is distributed in the hope that it will be useful, but WITHOUT}
\r
33 {ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or }
\r
34 {FITNESS FOR A PARTICULAR PURPOSE. }
\r
36 {Copyright (C) 1990, 2009 - Apogee Software, Ltd. }
\r
38 {This file is part of Supernova. Supernova is free software; you can }
\r
39 {redistribute it and/or modify it under the terms of the GNU General Public }
\r
40 {License as published by the Free Software Foundation; either version 3 }
\r
41 {of the License, or (at your option) any later version. }
\r
43 {This program is distributed in the hope that it will be useful, }
\r
44 {but WITHOUT ANY WARRANTY; without even the implied warranty of }
\r
45 {MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. }
\r
47 {See the GNU General Public License for more details. }
\r
49 {You should have received a copy of the GNU General Public License }
\r
50 {along with this program; if not, write to the Free Software }
\r
51 {Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.}
\r
53 {Original Source: 1990 Scott Miller }
\r
54 {Prepared for public release: 03/19/09 - Joe Siegler, Apogee Software, Ltd. }
\r
56 {//-------------------------------------------------------------------------}
\r
60 {This program WRITES and READS from the two text files: 'rooms1' and
\r
61 'rooms2'. If a description exceeds 240 letters (Max), then the file
\r
62 'rooms2' is used. Otherwise 'rooms2' = ''.}
\r
63 {This program has the line edit feature!}
\r
71 DescriptionLength = string[Max];
\r
72 ManyChar = string[1];
\r
75 Rooms1, Rooms2 : file of descriptionlength;
\r
76 Position,Counter,Start,Stop : integer;
\r
77 Text1, Text2 : descriptionlength;
\r
82 procedure Diskwrite(text1,text2: Descriptionlength; pointer: integer);
\r
84 seek(rooms1,pointer); seek(rooms2,pointer);
\r
85 WRITE(rooms1,text1); WRITE(rooms2,text2);
\r
86 writeln('Room description ',pointer,
\r
87 ' is written! Size = ',filesize(rooms1));
\r
88 close(rooms1); close(rooms2);
\r
89 end; {End of Diskwrite.}
\r
91 procedure Diskread(start,stop: integer);
\r
94 text1, text2 : descriptionlength;
\r
96 assign(rooms1,'ROOMS1');
\r
97 assign(rooms2,'ROOMS2');
\r
100 seek(rooms1,start);
\r
101 seek(rooms2,start);
\r
102 for counter:= start to stop do
\r
105 READ(rooms1,text1); READ(rooms2,text2);
\r
108 writeln(lst,'Description # ',counter);
\r
109 writeln(lst,text1,text2);
\r
113 writeln('Here is room description # ',counter);
\r
115 writeln(text1,text2);
\r
119 write('The file contains ',FileSize(rooms1),' room descriptions.');
\r
120 close(rooms1); close(rooms2);
\r
121 end; {End of Diskread.}
\r
125 if(length(text1)in[70,150,230])or(length(text2)in[70,150,230])then write(^g);
\r
129 repeat {Main loop.}
\r
134 writeln('Do you want to R)ead or W)rite?');
\r
136 if upcase(answer) <> 'R' then {Write to 'Rooms'.}
\r
139 assign(rooms1,'ROOMS1'); assign(rooms2,'ROOMS2');
\r
140 writeln('Now RESETing room files.');
\r
141 RESET(rooms1); RESET(rooms2);
\r
143 writeln('Input a string not more than ',2*Max,' characters.',
\r
144 ' ''\''-Ends string.');
\r
149 if letter = ^h then
\r
152 delete(text1,length(text1),1);
\r
156 if (letter <> '\') and (letter <> ^h) then text1:=text1+letter;
\r
157 until (length(text1)=Max) or (letter='\');
\r
159 if letter = '\' then
\r
162 writeln('Total of ',length(text1),' characters.');
\r
169 writeln('String #1 is full! Now writing to string #2.',^g);
\r
174 if letter = ^h then
\r
177 delete(text2,length(text2),1);
\r
180 if (letter <> '\') and (letter <> ^h) then text2:=text2+letter
\r
181 until (length(text2)=Max) or (letter='\');
\r
182 writeln; highvideo;
\r
183 writeln('Total description length = ',
\r
184 length(text1)+length(text2),' characters.');
\r
186 writeln('Now WRITING string to disk.');
\r
187 writeln(' At what position? (Next open is # ',filesize(rooms1),')');
\r
189 Diskwrite(text1,text2,position);
\r
191 else {Read from 'Rooms'.}
\r
194 writeln('To the S)creen or the P)rinter');
\r
196 if(upcase(answer)='P')then List:=True else List:=False;
\r
197 assign(rooms1,'ROOMS1');
\r
199 writeln('Filesize = ',filesize(rooms1),
\r
200 ' (From 0 to ',filesize(rooms1)-1,')');
\r
202 writeln('Enter starting position:');
\r
204 writeln('Evo filesize rooms1: ');
\r
205 writeln(filesize(rooms1));
\r
207 if(start > filesize(rooms1)-5)then stop:=(filesize(rooms1)-1) else
\r
209 writeln('Enter final position:');
\r
212 Diskread(start,stop);
\r
213 end; {End of else clause.}
\r
215 writeln('Another room description? Y)es or N)o');
\r
217 until upcase(answer) = 'N'; {End of Main loop.}
\r
218 writeln; writeln(^g,'You are now out of the program.')
\r