Listing: 1 (* Release 3.10 *) 2 (*-------------------------------------------------------------------------* 3 * * 4 * COMMDEMO.MOD - COMMS Toolkit demonstration program * 5 * * 6 * COPYRIGHT (C) 1988..1992 Clarion Software Corporation. * 7 * All Rights Reserved * 8 * * 9 *--------------------------------------------------------------------------*) 10 11 MODULE CommDemo; 12 IMPORT ComSetup,CommUtil,Filenames,IO,Keyboard,Lib,RS232,ScriptProcessor, 13 Str,Term,Timer,Window; 14 15 CONST 16 TermWin = Window.WinDef(0,0,79,23,Window.LightGray,Window.Black,TRUE,FALSE,FALSE,FALSE,Window.SingleFrame,Window.White,Window.White); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 17 StatWin = Window.WinDef(0,24,79,24,Window.White,Window.Blue,TRUE,FALSE,FALSE,FALSE,Window.SingleFrame,Window.White,Window.White); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 18 GenWin = Window.WinDef(2,2,31,6,Window.White,Window.Blue,TRUE,FALSE,FALSE,TRUE,Window.SingleFrame,Window.White,Window.Blue); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 19 20 (*...............................................*) 21 22 PROCEDURE Init; 23 VAR 24 stat : CommUtil.StatusFields; ***** ^ not supported yet 25 BEGIN 26 ComSetup.InitSetup; ***** ^ not supported yet ***** ^ not supported yet 27 WITH ComSetup.Setup.Serial DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 28 RS232.SelectPort(Port); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 29 RS232.InitPort(Baud,DataBits,StopBits,Parity); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ undeclared identifier 30 END; ***** ^ not supported yet 31 RS232.Install; ***** ^ not supported yet ***** ^ not supported yet 32 CASE ComSetup.Setup.Emulation OF ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 33 Term.EmVT100 : Term.EmulateVT100; | ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 34 Term.EmVT52 : Term.EmulateVT52; | ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 35 Term.EmANSI : Term.EmulateANSI; | ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 36 END; 37 CommUtil.InitUtil; ***** ^ not supported yet ***** ^ not supported yet 38 CommUtil.WrChar := Term.WrChar; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 39 ScriptProcessor.InitScriptProcessor; ***** ^ not supported yet ***** ^ not supported yet 40 Timer.StartClock; ***** ^ not supported yet ***** ^ not supported yet 41 Timer.StopClock; ***** ^ not supported yet ***** ^ not supported yet 42 FOR stat:=CommUtil.logo TO CommUtil.time DO ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 43 CommUtil.StatusLine(stat) ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 44 END; 45 END Init; ***** ^ not supported yet 46 47 (*...............................................*) 48 49 PROCEDURE DialDirectory; 50 VAR 51 c : CHAR; 52 Lnth : CARDINAL; 53 Result : INTEGER; 54 FileSpec : CommUtil.String80; ***** ^ not supported yet 55 BEGIN 56 IF ScriptProcessor.ScriptState=ScriptProcessor.Off THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 57 Filenames.MakeFilename('',ComSetup.Setup.General.ScriptDir,'*','.CMD',FileSpec); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 58 Lnth := Str.Length(FileSpec); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 59 Result := CommUtil.SelectFile(1,1,'Dial',FileSpec,CommUtil.ScriptFile); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 60 IF Result>=0 THEN 61 FileSpec[Lnth-5]:=0C; ***** ^ not supported yet ***** ^ not supported yet 62 Str.Concat(CommUtil.ScriptFile,FileSpec,CommUtil.ScriptFile); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 63 IF ScriptProcessor.LoadScript(CommUtil.ScriptFile) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 64 END; 65 END; 66 END; 67 END DialDirectory; ***** ^ not supported yet 68 69 (*................................................*) 70 71 PROCEDURE ToggleLogging(xpos,ypos:CARDINAL); 72 VAR 73 Ch : CHAR; 74 BEGIN 75 IF CommUtil.LogMode<>CommUtil.CloseLogging THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 76 CommUtil.SetLogMode(CommUtil.CloseLogging); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 77 ELSE 78 CommUtil.CaptureFile[0] := 0C; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 79 CommUtil.ReadString(xpos,ypos,'Text Logging',' File Name? ',CommUtil.CaptureFile); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 80 IF (CommUtil.CaptureFile[0]=0C) AND (CommUtil.FuncKeyTyped<>CommUtil.Escape) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 81 CommUtil.CaptureFile := 'TERM.LOG'; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 END; 83 IF CommUtil.CaptureFile[0]<>0C THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 84 CommUtil.SetLogMode(CommUtil.OpenLogging); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 85 END; 86 END; 87 END ToggleLogging; ***** ^ not supported yet 88 89 (*................................................*) 90 91 PROCEDURE LeaveProgram():BOOLEAN; 92 VAR 93 Ch : CHAR; 94 Win : Window.WinType; ***** ^ not supported yet 95 Def : Window.WinDef; ***** ^ not supported yet 96 BEGIN 97 Def := GenWin; ***** ^ not supported yet 98 WITH Def DO ***** ^ not supported yet 99 Foreground := CommUtil.Colors.GenFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 100 Background := CommUtil.Colors.GenBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 101 FrameFore := CommUtil.Colors.GenFrFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 102 FrameBack := CommUtil.Colors.GenFrBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 END ; ***** ^ not supported yet 104 Win := Window.Open(Def); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 105 Window.GotoXY(3,2); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 106 IO.WrStr('Leave Program (Y/N): N'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 107 IO.WrChar(CHR(8)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 108 REPEAT 109 Ch:=CAP(IO.RdKey()); ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 110 IF (Ch=CHR(27)) OR (Ch=CHR(13)) THEN ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 111 Ch:='N'; ***** ^ undeclared identifier 112 END; 113 UNTIL (Ch='Y') OR (Ch='N'); ***** ^ undeclared identifier ***** ^ undeclared identifier 114 Window.Close(Win); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 115 RETURN Ch='Y'; ***** ^ undeclared identifier 116 END LeaveProgram; ***** ^ not supported yet 117 118 (*................................................*) 119 120 PROCEDURE Intro; 121 VAR 122 Ch : CHAR; 123 Def : Window.WinDef; ***** ^ not supported yet 124 Win : Window.WinType; ***** ^ not supported yet 125 BEGIN 126 Def := GenWin; ***** ^ not supported yet 127 WITH Def DO ***** ^ not supported yet 128 X1:=24; ***** ^ undeclared identifier 129 Y1:=3; ***** ^ undeclared identifier 130 X2:=X1+31; ***** ^ undeclared identifier ***** ^ undeclared identifier 131 Y2:=Y1+17; ***** ^ undeclared identifier ***** ^ undeclared identifier 132 CursorOn:=FALSE; ***** ^ undeclared identifier 133 Foreground := CommUtil.Colors.GenFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 134 Background := CommUtil.Colors.GenBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 135 FrameFore := CommUtil.Colors.GenFrFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 136 FrameBack := CommUtil.Colors.GenFrBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 137 END; ***** ^ not supported yet 138 Win := Window.Open(Def); ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 139 IO.WrStr(' ----------------------------'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 140 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 141 IO.WrStr(' TopSpeed Modula-2 '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 142 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 143 IO.WrStr(' Comms Toolkit V3.10 Demo'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 144 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 145 IO.WrStr(' ----------------------------'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 146 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 147 IO.WrStr(' Keys: '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 148 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 149 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 150 IO.WrStr(' F1 : This info '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 151 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 152 IO.WrStr(' ALT-0..9 : Send Macro '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 153 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 154 IO.WrStr(' PgUp : Upload a File '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 155 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 156 IO.WrStr(' PgDn : Download a File'); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 157 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 158 IO.WrStr(' ALT-B : Send Break '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 159 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 160 IO.WrStr(' ALT-D : Dial Menu '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 161 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 162 IO.WrStr(' ALT-H : Hangup '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 163 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 164 IO.WrStr(' ALT-L : Toggle Logging '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 165 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 166 IO.WrStr(' ALT-S : Setup '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 167 IO.WrLn; ***** ^ not supported yet ***** ^ not supported yet 168 IO.WrStr(' ALT-X : Exit Demo '); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 169 WHILE NOT Term.KeyPressed() DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 170 END; 171 Window.Close(Win); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier 172 END Intro; ***** ^ not supported yet 173 174 (*................................................*) 175 176 PROCEDURE Terminal; 177 VAR 178 Carrier,EndSession: BOOLEAN; 179 180 (*. . . . . . . . . . . . . . . . . . . . . . . .*) 181 182 PROCEDURE CheckCarrier; 183 BEGIN 184 IF Carrier<>RS232.CarrierDetect() THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 185 (* carrier has changed state *) 186 Carrier := RS232.CarrierDetect(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 187 CommUtil.StatusLine(CommUtil.carrier); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 188 IF Carrier THEN 189 Timer.StartClock ***** ^ not supported yet ***** ^ not supported yet 190 ELSE 191 Timer.StopClock ***** ^ not supported yet ***** ^ not supported yet 192 END; 193 END; 194 IF Carrier THEN 195 Timer.UpdateTimer; ***** ^ not supported yet ***** ^ not supported yet 196 CommUtil.StatusLine(CommUtil.time); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 197 END; 198 END CheckCarrier; ***** ^ not supported yet 199 200 (*. . . . . . . . . . . . . . . . . . . . . . . .*) 201 202 PROCEDURE SpecialKey; 203 VAR 204 c : CHAR; 205 BEGIN 206 c := Term.RdKey(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 207 CASE ORD(c) OF ***** ^ undeclared identifier ***** ^ not supported yet 208 31 : (* Alt-S *) 209 ComSetup.ChangeSetup; ***** ^ not supported yet ***** ^ not supported yet 210 CommUtil.StatusLine(CommUtil.emul); | ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 211 32 : (* Alt-D *) 212 DialDirectory; | ***** ^ not supported yet 213 35 : (* Alt-H - Hangup Line *) 214 RS232.UnInstall; (* forces DTR & RTS to drop *) ***** ^ not supported yet ***** ^ not supported yet 215 Lib.Delay(500); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 216 RS232.Install; | ***** ^ not supported yet ***** ^ not supported yet 217 38 : (* Alt-L - Toggle Logging *) 218 ToggleLogging(10,10); | ***** ^ not supported yet ***** ^ not supported yet 219 45 : (* Alt-X - Exit Program *) 220 EndSession := LeaveProgram(); | ***** ^ not supported yet ***** ^ not supported yet 221 48 : (* ALT-B - Send Break for half a second *) 222 RS232.SetBreak(5); | ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 223 59 : (* F1 - Show Intro again *) 224 Intro; | ***** ^ not supported yet 225 73 : (* PgUp *) 226 CommUtil.DoUpload; | ***** ^ not supported yet ***** ^ not supported yet 227 81 : (* PgDn *) 228 CommUtil.DoDownload; | ***** ^ not supported yet ***** ^ not supported yet 229 120..129 : (* ALT-0 to ALT-9 *) 230 CommUtil.TransmitMacro((ORD(c)+1) MOD 10); | ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 231 END; 232 END SpecialKey; ***** ^ not supported yet 233 234 (*. . . . . . . . . . . . . . . . . . . . . . . .*) 235 236 PROCEDURE CheckKeyboard; 237 VAR 238 c : CHAR; 239 BEGIN 240 IF Term.KeyPressed() THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 241 c := Term.RdKey(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 242 IF c=0C THEN 243 SpecialKey ***** ^ not supported yet 244 ELSIF (c=CHR(27)) AND (ScriptProcessor.ScriptState<>ScriptProcessor.Off) THEN ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 245 ScriptProcessor.TerminateScript; ***** ^ not supported yet ***** ^ not supported yet 246 ELSE 247 RS232.SerialWrite(c,1); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 248 END; 249 END; 250 END CheckKeyboard; ***** ^ not supported yet 251 252 (*. . . . . . . . . . . . . . . . . . . . . . . .*) 253 254 PROCEDURE CheckRemote; 255 VAR 256 c : CHAR; 257 Cnt : CARDINAL; 258 BEGIN 259 Cnt := 0; 260 WHILE (Cnt<10) AND RS232.SerialRead(c,0) DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 261 CommUtil.Screen(c); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 262 INC(Cnt); ***** ^ undeclared identifier ***** ^ not supported yet 263 END; 264 END CheckRemote; ***** ^ not supported yet 265 266 (*. . . . . . . . . . . . . . . . . . . . . . . .*) 267 268 BEGIN (* Terminal *) 269 EndSession := FALSE; 270 Carrier := FALSE; 271 REPEAT 272 CheckCarrier; ***** ^ not supported yet 273 CheckRemote; ***** ^ not supported yet 274 CheckKeyboard; ***** ^ not supported yet 275 ScriptProcessor.SingleStep; ***** ^ not supported yet ***** ^ not supported yet 276 UNTIL EndSession; 277 END Terminal; ***** ^ not supported yet 278 279 (*...............................................*) 280 281 VAR 282 Def : Window.WinDef; ***** ^ not supported yet 283 BEGIN (* CommDemo *) 284 Def := StatWin; ***** ^ not supported yet 285 WITH Def DO ***** ^ not supported yet 286 Foreground := CommUtil.Colors.StatFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 287 Background := CommUtil.Colors.StatBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 288 END; ***** ^ not supported yet 289 CommUtil.StatW := Window.Open(Def); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 290 Def := TermWin; ***** ^ not supported yet 291 WITH Def DO ***** ^ not supported yet 292 Foreground := CommUtil.Colors.TermFore; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 293 Background := CommUtil.Colors.TermBack; ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 294 END; ***** ^ not supported yet 295 CommUtil.TermW := Window.Open(Def); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 296 Init; ***** ^ not supported yet 297 Intro; ***** ^ not supported yet 298 Terminal; ***** ^ not supported yet 299 RS232.UnInstall; ***** ^ not supported yet ***** ^ not supported yet 300 CommUtil.SetLogMode(CommUtil.CloseLogging); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 301 Window.Close(CommUtil.TermW); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 302 Window.Close(CommUtil.StatW); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 303 Window.CursorOn; ***** ^ not supported yet ***** ^ not supported yet 304 END CommDemo. 305 473 errors