diff --git a/mystic/bbs_ansi_menubox.pas b/mystic/bbs_ansi_menubox.pas index 3a667d1..eb399da 100644 --- a/mystic/bbs_ansi_menubox.pas +++ b/mystic/bbs_ansi_menubox.pas @@ -454,6 +454,7 @@ Begin SearchX := 0; SearchY := 0; SearchA := 0; + TopPage := 1; Session.io.BufFlush; End; @@ -616,6 +617,9 @@ Begin WinSize := BY2 - Y1 - 1; TagPos := X1 + 1; + While Picked > TopPage + WinSize - 1 Do + Inc (TopPage); + If PosBar Then For Count := 1 to WinSize Do WriteXY (X1 + Width + 1, Y1 + Count, Box.BoxAttr2, #176); diff --git a/mystic/bbs_cfg_archive.pas b/mystic/bbs_cfg_archive.pas index 7c5fc6c..b2a2234 100644 --- a/mystic/bbs_cfg_archive.pas +++ b/mystic/bbs_cfg_archive.pas @@ -20,9 +20,7 @@ Procedure EditArchive (Var Arc: RecArchive); Var Box : TAnsiMenuBox; Form : TAnsiMenuForm; - Topic : String; Begin - Topic := ''; Box := TAnsiMenuBox.Create; Form := TAnsiMenuForm.Create; diff --git a/mystic/bbs_cfg_menuedit.pas b/mystic/bbs_cfg_menuedit.pas index e842441..a64ea68 100644 --- a/mystic/bbs_cfg_menuedit.pas +++ b/mystic/bbs_cfg_menuedit.pas @@ -30,7 +30,7 @@ Type End; Const - Num_Cmds = 97; + Num_Cmds = 98; MenuCmds : Array[1..Num_Cmds] of CmdRec = ( // AUTOSIG MENU COMMANDS ( Name: 'AE'; Desc: 'Autosig editor' ), @@ -61,8 +61,8 @@ Const ( Name: 'FU'; Desc: 'Upload files' ), ( Name: 'FV'; Desc: 'View archive' ), ( Name: 'FZ'; Desc: 'Toggle newscan bases' ), - ( Name: 'F1'; Desc: '(SYSOP) Mass upload' ), - ( Name: 'F2'; Desc: '(SYSOP) Directory editor' ), + ( Name: 'F1'; Desc: '(SYS) Mass upload' ), + ( Name: 'F2'; Desc: '(SYS) Directory editor' ), ( Name: 'F3'; Desc: 'Send file by location' ), // GENERAL MENU COMMANDS @@ -109,6 +109,7 @@ Const // OFFLINE MAIL MENU COMMANDS ( Name: 'OS'; Desc: 'Set QWK scanned bases' ), ( Name: 'OD'; Desc: 'Download QWK packet' ), + ( Name: 'OE'; Desc: 'Download QWKE packet' ), ( Name: 'OU'; Desc: 'Upload REP packet' ), // DOWNLOAD QUEUE MENU COMMANDS @@ -144,18 +145,18 @@ Const ( Name: '-Y'; Desc: 'Ask Yes/No (default Yes)' ), // SYSOP/EDITORS MENU COMMANDS - ( Name: '*#'; Desc: '(SYSOP) Menu editor' ), - ( Name: '*A'; Desc: '(SYSOP) Archive editor' ), - ( Name: '*E'; Desc: '(SYSOP) Event editor' ), - ( Name: '*F'; Desc: '(SYSOP) File base editor' ), - ( Name: '*G'; Desc: '(SYSOP) Message group editor' ), - ( Name: '*L'; Desc: '(SYSOP) Security level editor'), - ( Name: '*B'; Desc: '(SYSOP) Message base editor' ), - ( Name: '*P'; Desc: '(SYSOP) Protocol editor' ), - ( Name: '*R'; Desc: '(SYSOP) File group editor' ), - ( Name: '*S'; Desc: '(SYSOP) System configuration' ), - ( Name: '*U'; Desc: '(SYSOP) User editor' ), - ( Name: '*V'; Desc: '(SYSOP) Voting booth editor' ) + ( Name: '*#'; Desc: '(SYS) Menu editor' ), + ( Name: '*A'; Desc: '(SYS) Archive editor' ), + ( Name: '*E'; Desc: '(SYS) Event editor' ), + ( Name: '*F'; Desc: '(SYS) File base editor' ), + ( Name: '*G'; Desc: '(SYS) Message group editor' ), + ( Name: '*L'; Desc: '(SYS) Security level editor' ), + ( Name: '*B'; Desc: '(SYS) Message base editor' ), + ( Name: '*P'; Desc: '(SYS) Protocol editor' ), + ( Name: '*R'; Desc: '(SYS) File group editor' ), + ( Name: '*S'; Desc: '(SYS) System configuration' ), + ( Name: '*U'; Desc: '(SYS) User editor' ), + ( Name: '*V'; Desc: '(SYS) Voting booth editor' ) ); {123456789012345678901234567890} Var @@ -451,23 +452,24 @@ Begin Box.Header := ' Menu Flags (' + MenuName + ') '; Topic := '|03(|09Menu Flags|03) |01-|09> |15';; - Box.Open (6, 5, 75, 20); + Box.Open (6, 5, 75, 21); - VerticalLine (22, 7, 19); + VerticalLine (22, 7, 20); Form.AddStr ('D', ' Description' , 9, 7, 24, 7, 13, 30, 30, @Menu.Info.Description, Topic + 'Description of menu'); Form.AddStr ('A', ' Access' , 14, 8, 24, 8, 8, 30, 30, @Menu.Info.Access, Topic + 'Security requirements to access this menu'); - Form.AddTog ('T', ' Menu Type' , 11, 9, 24, 9, 11, 13, 0, 2, 'Standard Lightbar Lightbar/Grid', @Menu.Info.MenuType, Topic + 'Type of menu'); - Form.AddTog ('I', ' Input Type' , 10, 10, 24, 10, 12, 12, 0, 2, 'User_Defined HotKey LongKey', @Menu.Info.InputType, Topic + 'Input type for this menu'); - Form.AddTog ('C', ' Input Chars' , 9, 11, 24, 11, 13, 9, 0, 2, 'Uppercase Lowercase Hidden', @Menu.Info.CharType, Topic + 'Input format display'); - Form.AddBol ('G', ' Use Global' , 10, 12, 24, 12, 12, 3, @Menu.Info.Global, Topic + 'Include global menu options in this menu?'); - Form.AddStr ('N', ' Node Status' , 9, 13, 24, 13, 13, 30, 30, @Menu.Info.NodeStatus, Topic + 'Node/User status set when this menu is loaded'); - Form.AddStr ('F', ' Display File', 8, 14, 24, 14, 14, 20, 20, @Menu.Info.DispFile, Topic + 'Display file shown instead of generated menu'); - Form.AddTog ('L', ' Display Cols', 8, 15, 24, 15, 14, 1, 1, 4, '1 2 3 4', @Menu.Info.DispCols, Topic + 'Number of columns in generated menu'); - Form.AddPipe ('H', ' Menu Header' , 9, 16, 24, 16, 13, 50, 160, @Menu.Info.Header, Topic + 'Menu header displayed in generated menu'); - Form.AddPipe ('P', ' Menu Prompt' , 9, 17, 24, 17, 13, 50, 160, @Menu.Info.Footer, Topic + 'Menu prompt displayed in generated menu'); - Form.AddByte ('X', ' X' , 19, 18, 24, 18, 3, 2, 0, 80, @Menu.Info.DoneX, Topic + 'Locate to X coordinate after lightbar menu'); - Form.AddByte ('Y', ' Y' , 19, 19, 24, 19, 3, 2, 0, 50, @Menu.Info.DoneY, Topic + 'Locate to Y coordinate after lightbar menu'); + Form.AddStr ('B', ' Fallback' , 12, 9, 24, 9, 10, 20, 20, @Menu.Info.Fallback, Topic + 'Menu loaded if user has no access (Blank/Last)'); + Form.AddTog ('T', ' Menu Type' , 11, 10, 24, 10, 11, 13, 0, 2, 'Standard Lightbar Lightbar/Grid', @Menu.Info.MenuType, Topic + 'Type of menu'); + Form.AddTog ('I', ' Input Type' , 10, 11, 24, 11, 12, 12, 0, 2, 'User_Defined HotKey LongKey', @Menu.Info.InputType, Topic + 'Input type for this menu'); + Form.AddTog ('C', ' Input Chars' , 9, 12, 24, 12, 13, 9, 0, 2, 'Uppercase Lowercase Hidden', @Menu.Info.CharType, Topic + 'Input format display'); + Form.AddBol ('G', ' Use Global' , 10, 13, 24, 13, 12, 3, @Menu.Info.Global, Topic + 'Include global menu options in this menu?'); + Form.AddStr ('N', ' Node Status' , 9, 14, 24, 14, 13, 30, 30, @Menu.Info.NodeStatus, Topic + 'Node/User status set when this menu is loaded'); + Form.AddStr ('F', ' Display File', 8, 15, 24, 15, 14, 20, 20, @Menu.Info.DispFile, Topic + 'Display file shown instead of generated menu'); + Form.AddTog ('L', ' Display Cols', 8, 16, 24, 16, 14, 1, 1, 4, '1 2 3 4', @Menu.Info.DispCols, Topic + 'Number of columns in generated menu'); + Form.AddPipe ('H', ' Menu Header' , 9, 17, 24, 17, 13, 50, 160, @Menu.Info.Header, Topic + 'Menu header displayed in generated menu'); + Form.AddPipe ('P', ' Menu Prompt' , 9, 18, 24, 18, 13, 50, 160, @Menu.Info.Footer, Topic + 'Menu prompt displayed in generated menu'); + Form.AddByte ('X', ' X' , 19, 19, 24, 19, 3, 2, 0, 80, @Menu.Info.DoneX, Topic + 'Locate to X coordinate after lightbar menu'); + Form.AddByte ('Y', ' Y' , 19, 20, 24, 20, 3, 2, 0, 50, @Menu.Info.DoneY, Topic + 'Locate to Y coordinate after lightbar menu'); Form.Execute; diff --git a/mystic/bbs_common.pas b/mystic/bbs_common.pas index 81ab108..3b437e9 100644 --- a/mystic/bbs_common.pas +++ b/mystic/bbs_common.pas @@ -26,7 +26,7 @@ Uses // replace with MDL/FP RTL functions Const - WinConsoleTitle = 'Mystic Node '; + WinConsoleTitle = mysSoftwareID + ' Node '; CopyID = 'Copyright (C) ' + mysCopyYear + ' By James Coyle. All Rights Reserved.'; DateTypeStr : Array[1..4] of String[8] = ('MM/DD/YY', 'DD/MM/YY', 'YY/DD/MM', 'Ask '); diff --git a/mystic/bbs_core.pas b/mystic/bbs_core.pas index ff74241..066cae5 100644 --- a/mystic/bbs_core.pas +++ b/mystic/bbs_core.pas @@ -117,6 +117,7 @@ Begin UserHostInfo := ''; UserIPInfo := ''; CheckTimeOut := True; + TimeOut := TimerSeconds; TimeOffset := 0; TimeSaved := 0; TimerOn := False; diff --git a/mystic/bbs_edit_full.pas b/mystic/bbs_edit_full.pas index 26f8918..bf2f8fb 100644 --- a/mystic/bbs_edit_full.pas +++ b/mystic/bbs_edit_full.pas @@ -347,7 +347,7 @@ Begin UpdatePosition; End Else Begin - If CurY < TotalLine Then CurX := 1; + {If CurY < TotalLine Then} CurX := 1; keyDownArrow; End; diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index 29aa8ad..93b9405 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -48,7 +48,6 @@ Type InLimit : Byte; InSize : Byte; AllowAbort : Boolean; - Aborted : Boolean; NoFile : Boolean; Graphics : Byte; PausePtr : Byte; @@ -138,8 +137,6 @@ Begin UseInSize := False; InLimit := 0; InSize := 0; - AllowAbort := False; - Aborted := False; NoFile := False; Graphics := 1; PausePtr := 1; @@ -191,13 +188,11 @@ Begin End; Procedure TBBSIO.BufFlush; -Var - Res : LongInt; Begin {$IFDEF WINDOWS} If OutBufPos > 0 Then Begin If Not TBBSCore(Core).LocalMode Then - Res := TBBSCore(Core).Client.WriteBuf(OutBuffer, OutBufPos); + TBBSCore(Core).Client.WriteBuf(OutBuffer, OutBufPos); OutBufPos := 0; End; @@ -462,6 +457,7 @@ Begin End; 'A' : Case Code[2] of 'G' : LastMCIValue := strI2S(DaysAgo(TBBSCore(Core).User.ThisUser.Birthday) DIV 365); + 'O' : AllowAbort := False; 'S' : LastMCIValue := OutON(TBBSCore(Core).User.ThisUser.SigUse); 'V' : LastMCIValue := OutYN(Chat.Available); End; @@ -918,16 +914,17 @@ End; Function TBBSIO.OutFile (FName: String; DoPause: Boolean; Speed: Byte) : Boolean; Var - Buffer : Array[1..4096] of Char; - BufPos : LongInt; - BufSize : LongInt; - dFile : File; - Ext : String[4]; - Code : String[2]; - Old : Boolean; - Str : String; - Ch : Char; - Done : Boolean; + Buffer : Array[1..4096] of Char; + BufPos : LongInt; + BufSize : LongInt; + dFile : File; + Ext : String[4]; + Code : String[2]; + SavedPause : Boolean; + SavedAbort : Boolean; + Str : String; + Ch : Char; + Done : Boolean; Function CheckFileInPath (Path: String) : Boolean; Var @@ -1009,8 +1006,10 @@ Begin NoFile := False; Result := True; - Old := AllowPause; + SavedPause := AllowPause; + SavedAbort := AllowAbort; AllowPause := DoPause; + AllowAbort := True; PausePtr := 1; Done := False; BufPos := 0; @@ -1027,6 +1026,11 @@ Begin If BufPos MOD BaudEmulator = 0 Then WaitMS(6); End; + If AllowAbort And (InKey(0) = #32) Then Begin + AnsiColor(7); + Break; + End; + Case Ch of #10 : Begin BufAddChar (#10); @@ -1135,7 +1139,9 @@ Begin End; End; - AllowPause := Old; + AllowPause := SavedPause; + AllowAbort := SavedAbort; + Close (dFile); BufFlush; diff --git a/mystic/bbs_menudata.pas b/mystic/bbs_menudata.pas index 7e910ea..c973004 100644 --- a/mystic/bbs_menudata.pas +++ b/mystic/bbs_menudata.pas @@ -85,7 +85,7 @@ Begin ReadLn (Menu, Junk.Description); ReadLn (Menu, Junk.Access); - ReadLn (Menu, Junk.Password); + ReadLn (Menu, Junk.Fallback); ReadLn (Menu, Flags); ReadLn (Menu, Str); // resv ReadLn (Menu, Junk.NodeStatus); @@ -180,7 +180,7 @@ Begin WriteLn (Menu, Info.Description); WriteLn (Menu, Info.Access); - WriteLn (Menu, Info.Password); + WriteLn (Menu, Info.Fallback); WriteLn (Menu, Flags); WriteLn (Menu, ''); // resv WriteLn (Menu, Info.NodeStatus); diff --git a/mystic/bbs_menus.pas b/mystic/bbs_menus.pas index 9219d05..567cfaa 100644 --- a/mystic/bbs_menus.pas +++ b/mystic/bbs_menus.pas @@ -279,7 +279,8 @@ Begin End; 'O' : Case Cmd[2] of 'S' : Session.Msgs.ToggleNewScan(True); - 'D' : Session.Msgs.DownloadQWK(CmdData); + 'D' : Session.Msgs.DownloadQWK(False, CmdData); + 'E' : Session.Msgs.DownloadQWK(True, CmdData); 'U' : Session.Msgs.UploadREP; End; 'Q' : Case Cmd[2] of @@ -594,9 +595,7 @@ Begin Repeat Inc (Count); - If SpecialKey(Data.Item[Count]^.HotKey) Then Continue; - - // check command acs for validkey? + If SpecialKey(Data.Item[Count]^.HotKey) Or Not TBBSCore(Owner).User.Access(Data.Item[Count]^.Access) Then Continue; Found := Data.Item[Count]^.HotKey = Temp + UpCase(Ch); @@ -837,6 +836,26 @@ Begin If TBBSCore(Owner).io.IsArrow Then Begin Case Data.Info.MenuType of 1 : Case Ch of + #71 : Case ExecuteByHotKey('HOME', -1) of + 0 : ; + 1 : Break; + 2 : Exit; + End; + #73 : Case ExecuteByHotKey('PAGEUP', -1) of + 0 : ; + 1 : Break; + 2 : Exit; + End; + #79 : Case ExecuteByHotKey('END', -1) of + 0 : ; + 1 : Break; + 2 : Exit; + End; + #81 : Case ExecuteByHotKey('PAGEDOWN', -1) of + 0 : ; + 1 : Break; + 2 : Exit; + End; #72, #75 : Begin TempPos := CursorPos; @@ -898,12 +917,18 @@ Begin AddChar(#8); End; - #09 : If Data.Info.MenuType = 2 Then - Case ExecuteGridCommand(Data.Item[CursorPos]^.JumpTab, 5) of + #09 : Begin + Case Data.Info.MenuType of + 1 : Count := ExecuteByHotKey('TAB', -1); + 2 : Count := ExecuteGridCommand(Data.Item[CursorPos]^.JumpEscape, 5); + End; + + Case Count of 0 : ; 1 : Break; 2 : Exit; End; + End; #13 : Begin TBBSCore(Owner).io.AnsiGotoXY(Data.Info.DoneX, Data.Info.DoneY); @@ -916,13 +941,18 @@ Begin If Found Then Exit Else Break; End; - #27 : If Data.Info.MenuType = 2 Then begin - Case ExecuteGridCommand(Data.Item[CursorPos]^.JumpEscape, 6) of + #27 : Begin + Case Data.Info.MenuType of + 1 : Count := ExecuteByHotKey('ESCAPE', -1); + 2 : Count := ExecuteGridCommand(Data.Item[CursorPos]^.JumpEscape, 6); + End; + + Case Count of 0 : ; 1 : Break; 2 : Exit; End; - end; + End; Else If Length(TempStr) < mysMaxMenuInput Then Begin Found := False; @@ -932,13 +962,18 @@ Begin Repeat Inc (Count); - If SpecialKey(Data.Item[Count]^.HotKey) Then Continue; + If SpecialKey(Data.Item[Count]^.HotKey) or Not TBBSCore(Owner).User.Access(Data.Item[Count]^.Access) Then Continue; Found := Data.Item[Count]^.HotKey = TempStr + UpCase(Ch); + session.systemlog('comparing cmd: ' + data.item[count]^.hotkey + ' to ' + tempstr + upcase(ch)); + If Not ValidKey Then ValidKey := TempStr + UpCase(Ch) = Copy(Data.Item[Count]^.HotKey, 1, Length(TempStr + Ch)); + session.systemlog('valid key is: ' + stri2s(ord(validkey))); + session.systemlog('found is: ' + stri2s(ord(found))); + Until Found or (Count >= Data.NumItems); If Found And (TBBSCore(Owner).User.Access(Data.Item[Count]^.Access)) Then Begin @@ -953,9 +988,9 @@ Begin TBBSCore(Owner).io.AnsiGotoXY(Data.Info.DoneX, Data.Info.DoneY); If Data.Info.MenuType = 1 Then - Found := ExecuteCommandList(CursorPos, -1) = 2 + Found := ExecuteCommandList(Count, -1) = 2 Else - Found := ExecuteCommandList(CursorPos, 0) = 2; + Found := ExecuteCommandList(Count, 0) = 2; If Found Then Exit Else Break; End Else @@ -1013,9 +1048,15 @@ Begin If Not LoadMenu(Forced) Then Exit; If Not TBBSCore(Owner).User.Access(Data.Info.Access) Then Begin + If Data.Info.Fallback <> '' Then Begin + MenuName := Data.Info.Fallback; + Exit; + End; + MenuName := MenuOld; TBBSCore(Owner).io.OutFull(TBBSCore(Owner).GetPrompt(149)); + Exit; End; diff --git a/mystic/mide.pas b/mystic/mide.pas index ec0a582..fa26712 100644 --- a/mystic/mide.pas +++ b/mystic/mide.pas @@ -19,14 +19,18 @@ // // ==================================================================== -{$I M_OPS.PAS} - Program MIDE; +{$I M_OPS.PAS} + Uses {$IFDEF DEBUG} + LineInfo, HeapTrc, {$ENDIF} + {$IFDEF UNIX} + Unix, + {$ENDIF} DOS, m_Types, m_Input, @@ -37,19 +41,18 @@ Uses m_QuickSort, m_Strings, m_FileIO, + m_IniReader, MPL_Compile; -{$I RECORDS.PAS} - Const mideVersion = '2.0.0'; mideMaxFileLines = 10000; mideMaxOpenFiles = 10; mideMaxLineSize = 254; - mideTabSpaces = 2; mideTopY : Byte = 1; mideBotY : Byte = 24; mideWinSize : Byte = 24; + mideExecOpts : String[100] = ''; colTextString = 27; { 27 } colTextKeyword = 31; { 31 } @@ -61,6 +64,14 @@ Const colEditStatus = 9 + 1 * 16; colEditPosBar = 9 + 1 * 16; +Var + cfg_TabSpaces : Byte; + cfg_Screen50 : Boolean; + cfg_AutoIndent : Boolean; + cfg_ExecPath : String[160]; + cfg_ExecUser : String[35]; + cfg_ExecPW : String[20]; + Type PEditorWindow = ^TEditorWindow; TEditorWindow = Object @@ -217,7 +228,7 @@ Begin ReadLn (TF, Str); While Pos (#9, Str) > 0 Do Begin - Insert (strRep(' ', mideTabSpaces), Str, Pos(#9, Str)); + Insert (strRep(' ', cfg_TabSpaces), Str, Pos(#9, Str)); Delete (Str, Pos(#9, Str), 1); End; @@ -254,7 +265,7 @@ Begin Load := True; End; -Procedure DrawLine (Y : Byte; S : String); +Procedure DrawLine (Y: Byte; S: String); Var sPos : Byte; @@ -271,7 +282,6 @@ Var If Console.CursorX < 79 Then Console.WriteChar (Str[A]); End; End; - Begin Console.WriteXY (2, Y, colTextNormal, strPadR(Copy(S, CurWin[CurWinNum]^.ScrlX + 1, 255), 77, ' ')); End; @@ -434,6 +444,7 @@ Begin FileList.HiChars := #77; FileList.HiAttr := ColorBar; FileList.LoAttr := ColorBox; + DirList.NoWindow := True; DirList.NoInput := True; DirList.HiAttr := ColorBox; @@ -613,35 +624,41 @@ Begin FillScreen; End; -Function Get_File_Name (Def: String) : String; +Function InBox (Header, Text, Def: String; Len, MaxLen: Byte) : String; Var - Box : TMenuBox; - InKey : TMenuInput; - Str : String; + Box : TMenuBox; + Input : TMenuInput; + Offset : Byte; + Str : String; + WinSize : Byte; Begin - Box := TMenuBox.Create(Console); - InKey := TMenuInput.Create(Console); - - InKey.LoChars := #13#27; - - Box.Header := ' Save a file '; - Box.Open (10, 8, 70, 13); - - Console.WriteXY (12, 10, 112, 'File name:'); - - Str := InKey.GetStr(12, 11, 57, 255, 1, Def); - - If InKey.ExitCode = #27 Then - Str := '' + If Len > Length(Text) Then + Offset := Len Else - If Pos('.', Str) = 0 Then Str := Str + '.mps'; + Offset := Length(Text); + + WinSize := (80 - Offset + 2) DIV 2; + + Box := TMenuBox.Create(Console); + Input := TMenuInput.Create(Console); + + Box.Header := ' ' + Header + ' '; + Input.LoChars := #13#27; + + Box.Open (WinSize, 10, WinSize + Offset + 3, 15); + + Console.WriteXY (WinSize + 2, 12, 112, Text); + + Str := Input.GetStr(WinSize + 2, 13, Len, MaxLen, 1, Def); Box.Close; - InKey.Free; + If Input.ExitCode = #27 Then Str := ''; + + Input.Free; Box.Free; - Get_File_Name := Str; + Result := Str; End; Function SaveFile (FNum: Byte; Check, AskReName: Boolean) : Boolean; @@ -667,7 +684,7 @@ Begin Exit; If AskReName Then - S := Get_File_Name(CurWin[FNum]^.FileName) + S := InBox('File', 'File Name:', CurWin[FNum]^.FileName, 50, 255) Else S := CurWin[FNum]^.FileName; @@ -737,11 +754,13 @@ Begin End; End; -Procedure Compile; +Function Compile : Boolean; Var - Box : TMenuBox; - Compile : TParserEngine; + Box : TMenuBox; + Compile : TParserEngine; Begin + Result := False; + If CurWinNum = 0 Then Exit; If Not SaveFile(CurWinNum, True, False) Then Exit; @@ -755,16 +774,46 @@ Begin Console.WriteXY (16, 11, 112, 'Message: Ok'); Console.WriteXY (11, 13, 31, strPadC('Working...', 59, ' ')); - Compile := TParserEngine.Create(@CompileStatusUpdate); - Compile.Compile(CurWin[CurWinNum]^.FileName); - Compile.Free; + Compile := TParserEngine.Create(CompileStatusUpdate); + Result := Compile.Compile(CurWin[CurWinNum]^.FileName); + Compile.Free; Box.Close; Box.Free; CurWin[CurWinNum]^.ReDrawFull; End; +Procedure RunProgram; +Var + Image : TConsoleImageRec; + CmdStr : String; +Begin + If Not Compile Then Exit; + + Console.GetScreenImage(1, 1, 80, Console.ScreenSize, Image); + + mideExecOpts := InBox('Execute', 'Enter optional data or blank for none:', mideExecOpts, 50, 100); + + CmdStr := cfg_ExecPath + 'mystic' + ' -u' + cfg_ExecUser + ' -p' + cfg_ExecPW + ' -x' + JustFileName(CurWin[CurWinNum]^.FileName); + + If mideExecOpts <> '' Then + CmdStr := CmdStr + '_' + strReplace(mideExecOpts, ' ', '_'); + + // save directory? + + {$IFDEF UNIX} + Shell (CmdStr); + {$ELSE} + Exec (GetEnv('COMSPEC'), '/C' + CmdStr); + {$ENDIF} + + // restore directory? + + Console.PutScreenImage(Image); +End; + + Procedure CloseFile; Var A : Byte; @@ -960,44 +1009,20 @@ Begin End; Procedure DownArrow; -{Var - Count : Byte;} Begin If CurWinNum = 0 Then Exit; -(* - If AnyShift Then Begin - Clips := 0; - ClipNow := True; + With CurWin[CurWinNum]^ Do Begin + If CurLine = TotalLines Then Exit; + Inc (CurLine); - ClipMarkText; + If CurY < (mideWinSize - 2) Then + Inc (CurY) + Else + ScrollDown; - Repeat - If KeyPressed Then - Case ReadKey of - #00 : Case ReadKey of - #72 : ClipDeleteText; -{ #73 : For Count := 1 to 21 Do ClipDeleteText;} - #80 : ClipMarkText; -{ #81 : For Count := 1 to 21 Do ClipMarkText;} - End; - End; - Until Not AnyShift; - - ClipCopyText; - End Else -*) - With CurWin[CurWinNum]^ Do Begin - If CurLine = TotalLines Then Exit; - Inc (CurLine); - - If CurY < (mideWinSize - 2) Then - Inc (CurY) - Else - ScrollDown; - - Relocate(False); - End; + Relocate(False); + End; End; Procedure UpArrow; @@ -1120,7 +1145,7 @@ Var Begin If CurWinNum = 0 Then Exit; - For A := 1 to mideTabSpaces Do + For A := 1 to cfg_TabSpaces Do AddChar(' '); End; @@ -1140,9 +1165,9 @@ Begin S1 := TextData[CurLine]^; S2 := TextData[CurLine + 1]^; -{If Config.AutoIndent Then} - If (S2 = '') Then - While S1[Indent] = ' ' Do Inc(Indent); + If cfg_AutoIndent Then + If (S2 = '') Then + While S1[Indent] = ' ' Do Inc(Indent); S2 := strStripB(Copy(S1, CurX+ScrlX, 255) + S2, ' '); Delete (S1, CurX+ScrlX, 255); @@ -1331,7 +1356,7 @@ Begin Break; End; 'N' : Begin - Str := Get_File_Name('new.mps'); + Str := InBox('New MPL Program', 'File Name:', 'new.mps', 50, 255); Make := True; If Str <> '' Then Begin @@ -1408,9 +1433,10 @@ Begin End; 3 : Begin CoolBoxOpen (26, 'Compile'); - BoxOpen (27, 4, 42, 6); + BoxOpen (27, 4, 42, 7); - Form.AddNone('C', ' Compile F9 ' , 28, 5, 14, 'Compile current file into Mystic executable'); + Form.AddNone('R', ' Run F8 ' , 28, 5, 14, 'Compile and then execute MPL program'); + Form.AddNone('C', ' Compile F9 ' , 28, 6, 14, 'Compile current file into Mystic executable'); Res := Form.Execute; @@ -1432,16 +1458,22 @@ Begin DrawStatus; Exit; End; + 'R' : Begin + Console.PutScreenImage(Image); + Form.Free; + RunProgram; + DrawStatus; + Exit; + End; Else MenuPtr := 0; End; End; 4 : Begin CoolBoxOpen (41, 'Options'); - BoxOpen (42, 4, 61, 7); + BoxOpen (42, 4, 61, 6); Form.AddNone('E', ' Editor Options ', 43, 5, 18, ''); - Form.AddNone('C', ' Color Options ' , 43, 6, 18, ''); Res := Form.Execute; @@ -1456,7 +1488,13 @@ Begin Else Case Res of #27 : Break; - 'C' : Begin + 'E' : Begin + Console.PutScreenImage(Image); + Form.Free; + LoadAndOpen(StartDir + 'mide.ini'); + ReDrawScreen; + DrawStatus; + Exit; End; Else MenuPtr := 0; @@ -1544,11 +1582,11 @@ Begin End; Var - Ch : Char; - A : Byte; - Str : String; - FN : String; - Mode50 : Boolean = False; + Ch : Char; + A : Byte; + Str : String; + FN : String; + INI : TINIReader; Begin GetDir (0, StartDir); @@ -1559,14 +1597,20 @@ Begin Console.SetWindowTitle('MIDE'); - For A := 1 to ParamCount Do Begin - If Pos('-50', ParamStr(A)) > 0 Then - Mode50 := True - Else - Str := ParamStr(A); - End; + INI := TINIReader.Create('mide.ini'); - If Mode50 Then Begin + cfg_Screen50 := (INI.ReadInteger('General', 'screenmode', 25) = 50); + cfg_TabSpaces := INI.ReadInteger('General', 'tab_spaces', 2); + cfg_AutoIndent := strUpper(INI.ReadString('General', 'auto_indent', 'true')) = 'TRUE'; + cfg_ExecPath := DirSlash(INI.ReadString('Execute', 'rootpath', '')); + cfg_ExecUser := INI.ReadString('Execute', 'username', 'Guest'); + cfg_ExecPW := INI.ReadString('Execute', 'password', 'Guest'); + + INI.Free; + + Str := ParamStr(1); + + If cfg_Screen50 Then Begin Console.SetScreenSize(50); mideBotY := 49; @@ -1612,36 +1656,12 @@ Begin Ch := Input.ReadKey; -{ alt+0..9 - change windows } -{ alt-x - quit } -//{ f1 - help on keyword } -{ f2 - save } -//{ f3 - open } -{ f9 - compile } - Case Ch of #00 : Begin Ch := Input.ReadKey; Case Ch of -(* - #25 : If (Clips > 0) and (CurWinNum <> 0) Then Begin - For A := 0 to Clips - 1 Do Begin - InsertLine (CurWin[CurWinNum]^.CurLine + A); - CurWin[CurWinNum]^.TextData[CurWin[CurWinNum]^.CurLine + A]^ := ClipData[A + 1]; - End; - DrawPage; - End; -*) #45 : Break; -(* - #46 : Begin - Clips := 0; - StatusLineBot(''); - End; - - #59 : ShowHelp; -*) #60 : If TotalWinNum > 0 Then SaveFile(CurWinNum, False, False); #61 : If TotalWinNum < mideMaxOpenFiles Then Begin Str := StartDir; @@ -1654,7 +1674,7 @@ Begin #62 : If TotalWinNum > 0 Then CloseFile; // #63 : SearchText(False); // #64 : SearchText(True); -// #66 : Options; + #66 : RunProgram; #67 : Compile; #71 : If CurWinNum > 0 Then Begin {home} CurWin[CurWinNum]^.CurX := 1; diff --git a/mystic/mis.pas b/mystic/mis.pas index fc93017..f10912e 100644 --- a/mystic/mis.pas +++ b/mystic/mis.pas @@ -70,7 +70,9 @@ Var TopPage : Integer; BarPos : Integer; NodeData : TNodeData; + {$IFDEF UNIX} DaemonMode : Boolean = False; + {$ENDIF} {$I MIS_ANSIWFC.PAS} diff --git a/mystic/mpl_compile.pas b/mystic/mpl_compile.pas index e2cc97b..30553d8 100644 --- a/mystic/mpl_compile.pas +++ b/mystic/mpl_compile.pas @@ -81,6 +81,7 @@ Type OutFile : File; CurFile : Byte; Ch : Char; + LastCharPos : LongInt; IdentStr : String; AllowOutput : Boolean; UpdateProc : TParserUpdateProc; @@ -267,18 +268,20 @@ Begin UpdateInfo.ErrorLine := 1; UpdateInfo.ErrorCol := 0; - InFile[CurFile].DataFile.Seek(0); + If InFile[CurFile].DataFile.Opened Then Begin + InFile[CurFile].DataFile.Seek(0); - While Not InFile[CurFile].DataFile.EOF And (InFile[CurFile].DataFile.FilePos < InFile[CurFile].Position) Do Begin - Case InFile[CurFile].DataFile.Read of - #10 : Begin - Inc (UpdateInfo.ErrorLine); - UpdateInfo.ErrorCol := 0; - End; - #09, - #13 : ; - Else - Inc (UpdateInfo.ErrorCol); + While Not InFile[CurFile].DataFile.EOF And (InFile[CurFile].DataFile.FilePos < InFile[CurFile].Position) Do Begin + Case InFile[CurFile].DataFile.Read of + #10 : Begin + Inc (UpdateInfo.ErrorLine); + UpdateInfo.ErrorCol := 0; + End; + #09, + #13 : ; + Else + Inc (UpdateInfo.ErrorCol); + End; End; End; End; @@ -469,6 +472,8 @@ Var BlockStart : Char; Str : String; Begin + LastCharPos := InFile[CurFile].Position; + GetChar; While Not UpdateInfo.ErrorType <> 0 Do Begin @@ -608,9 +613,11 @@ End; Function TParserEngine.GetStr (Str: String; Forced, CheckSpace: Boolean) : Boolean; Var Count : Byte; + Saved : LongInt; Begin Result := False; Count := 1; + Saved := LastCharPos; If Not Forced Then SavePosition; @@ -618,9 +625,10 @@ Begin NextChar; If UpCase(Ch) <> UpCase(Str[Count]) Then - If Forced Then + If Forced Then Begin + InFile[CurFile].Position := Saved; Error(mpsExpected, Str) - Else Begin + End Else Begin LoadPosition; Exit; End; @@ -2804,8 +2812,11 @@ Begin If Not InFile[CurFile].DataFile.Open(FN) Then Begin InFile[CurFile].DataFile.Done; + Error (mpsFileNotFound, FN); + If CurFile > 1 Then Dec (CurFile); + Exit; End; @@ -2830,13 +2841,17 @@ Var VerStr : String; Count : Byte; Begin - Result := False; - VerStr := mplVersion; - UsesUSER := False; - UsesCFG := False; + Result := False; + VerStr := mplVersion; + UsesUSER := False; + UsesCFG := False; + UsesMBASE := False; + UsesMGROUP := False; + UsesFBASE := False; + UsesFGROUP := False; Assign (OutFile, JustFileName(FN) + mplExtExecute); - {$I-} ReWrite (OutFile, 1); {$I+} + ReWrite (OutFile, 1); If IoResult <> 0 Then Begin Error (mpsOutputFile, 'File could be in use'); @@ -2853,6 +2868,7 @@ Begin For Count := 1 to CurFile Do Begin InFile[Count].DataFile.Close; InFile[Count].DataFile.Done; + If IoResult <> 0 Then ; End; diff --git a/mystic/mpl_execute.pas b/mystic/mpl_execute.pas index 0b6cebe..8524c10 100644 --- a/mystic/mpl_execute.pas +++ b/mystic/mpl_execute.pas @@ -248,7 +248,7 @@ Function TInterpEngine.GetMBaseStats (Num: LongInt; Var Total, New, Yours: LongI Var M : RecMessageBase; Begin - Result := Session.Msgs.GetRecord(Num, M); + Result := Session.Msgs.GetBaseByNum(Num, M); If Result Then Session.Msgs.GetMessageStats(M, Total, New, Yours); @@ -258,7 +258,7 @@ Function TInterpEngine.GetMBaseRecord (Num: LongInt) : Boolean; Var M : RecMessageBase; Begin - Result := Session.Msgs.GetRecord(Num, M); + Result := Session.Msgs.GetBaseByNum(Num, M); If Result Then GetMBaseVars(M); End; diff --git a/mystic/mpl_fileio.pas b/mystic/mpl_fileio.pas index 438856e..e69c65f 100644 --- a/mystic/mpl_fileio.pas +++ b/mystic/mpl_fileio.pas @@ -1,7 +1,7 @@ -{$I M_OPS.PAS} - Unit MPL_FileIO; +{$I M_OPS.PAS} + // all file io units should be compiled into one source file... // also, make this ONLY allocate the size of the file if the file size is // less than the buffer. @@ -25,6 +25,7 @@ Type BufPos : LongInt; InFile : File; BufEOF : Boolean; + Opened : Boolean; Constructor Init (BufferSize: LongInt); Destructor Done; @@ -70,6 +71,7 @@ Begin BufEOF := False; BufRead := 0; Buffer := NIL; + Opened := False; End; Destructor TCharFile.Done; @@ -83,6 +85,7 @@ End; Function TCharFile.Open (FN : String) : Boolean; Begin Open := False; + Opened := False; FileMode := 66; Assign (InFile, FN); @@ -99,12 +102,15 @@ Begin FillBuffer; - Open := True; + Open := True; + Opened := True; End; Procedure TCharFile.Close; Begin System.Close (InFile); + Opened := False; + Done; End; diff --git a/mystic/mystic.pas b/mystic/mystic.pas index f15becc..20e49b6 100644 --- a/mystic/mystic.pas +++ b/mystic/mystic.pas @@ -394,7 +394,7 @@ Begin Session.UserHostInfo := Copy(Temp, 5, Length(Temp)) Else If Pos('-HOST', Temp) > 0 Then - Session.UserHostInfo := Copy(Temp, 6, Length(Temp)) + Session.UserHostInfo := Copy(ParamStr(Count), 6, Length(Temp)) Else If Pos('-U', Temp) > 0 Then UserName := strReplace(Copy(Temp, 3, Length(Temp)), '_', ' ') @@ -403,7 +403,7 @@ Begin Password := Copy(Temp, 3, Length(Temp)) Else If Pos('-X', Temp) > 0 Then - Script := strReplace(Copy(Temp, 3, Length(Temp)), '_', ' ') + Script := strReplace(Copy(ParamStr(Count), 3, Length(Temp)), '_', ' ') Else If Temp = '-L' Then Session.LocalMode := True; End; diff --git a/mystic/records.pas b/mystic/records.pas index ad8a539..5a177f8 100644 --- a/mystic/records.pas +++ b/mystic/records.pas @@ -562,7 +562,7 @@ Type Description : String[30]; Access : String[mysMaxAcsSize]; DispFile : String[20]; - Password : String[20]; + Fallback : String[20]; NodeStatus : String[30]; Header : String[160]; Footer : String[160];