Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 747 → Rev 746

/trunk_dos/LISTTEST.PAS
3,7 → 3,7
(************************************************)
(* LISTTEST.PAS *)
(* Author: Daniel Marschall *)
(* Revision: 2022-02-16 *)
(* Revision: 2022-02-13 *)
(* License: Apache 2.0 *)
(* This file contains: *)
(* - Example how to use lists and selection CUI *)
10,7 → 10,7
(************************************************)
 
uses
Crt, Drivers, StrList, VtsCui;
Crt, StrList, VtsCui;
 
var
items: PStringList;
17,11 → 17,8
i, itemIndex: integer;
sTmp: string;
begin
InitVideo;
CursorOff;
InitList(items);
 
CreateList(items);
 
(* Fill the list for testing *)
for i := 1 to 5 do
begin
31,14 → 28,13
 
(* Do inserts and deletions to test their functionality *)
ListInsert(items, 'TEST', 0);
ListDeleteElementByIndex(items, 0);
ListDeleteElementByIndex(items, 0);
ListDeleteElement(items, 0);
ListDeleteElement(items, 0);
ListInsert(items, 'FirstElement', 0);
 
(* Test the selection GUI unit *)
ClrScr;
itemIndex := DrawSelectionList(3, 5, 15, 10, items, true, '', 0);
ResetDefaultDosColors;
itemIndex := DrawSelectionList(3, 5, 15, 10, items, true, 0);
ClrScr;
if itemIndex = -1 then
begin
53,7 → 49,4
FreeList(items);
 
ReadLn;
 
CursorOn;
DoneVideo;
end.
/trunk_dos/OIDFILE.PAS
226,7 → 226,7
(* Remove last CRLF *)
oid^.Description := Copy(oid^.Description, 1, Length(oid^.Description)-Length(#13#10));
 
(* Check if everything is correct *)
(* Check if something is not correct *)
ReadOidFile := (version = WANT_VERS) and (oid^.FileId <> '');
 
Close(f);
/trunk_dos/OIDPLUS.EXE
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk_dos/OIDPLUS.PAS
3,7 → 3,7
(************************************************)
(* OIDPLUS.PAS *)
(* Author: Daniel Marschall *)
(* Revision: 2022-02-16 *)
(* Revision: 2022-02-15 *)
(* License: Apache 2.0 *)
(* This file contains: *)
(* - "OIDplus for DOS" program *)
21,7 → 21,7
Dos, Crt, Drivers, StrList, VtsFuncs, VtsCui, OidFile, OidUtils;
 
const
VERSIONINFO = 'Revision: 2022-02-16';
VERSIONINFO = 'Revision: 2022-02-15';
DEFAULT_STATUSBAR = '(C)2020-2022 ViaThinkSoft. Licensed under the terms of the Apache 2.0 license.';
TITLEBAR_LEFT_TEXT = 'OIDplus';
DISKIO_SOUND_DEBUGGING = false;
344,7 → 344,7
2) then
begin
if sInput = '' then continue;
if not IsPositiveIntegerOrZero(sInput) then
if not IsPositiveInteger(sInput) then
begin
ShowMessage('Invalid numeric ID (must be a positive integer)', 'ERROR', true);
_Pause;
802,10 → 802,20
DisplayOIDFile(rootfile);
end;
 
procedure OP_ManageRAs;
begin
ClrScr;
DrawTitleBar('Manage Registration Authorities', TITLEBAR_LEFT_TEXT, '');
DrawStatusBar('');
 
(* TODO: Implement "Manage RAs" feature *)
end;
 
procedure OP_ReturnToMSDOS;
begin
(* Note: These two lines don't seem to be necessary if you use DoneVideo *)
ResetDefaultDosColors;
ClrScr;
TextBackground(Black);
TextColor(LightGray);
ClrScr; (*Important, so that the DOS command prompt is also LightGray *)
 
WriteLn('Thank you for using OIDplus for DOS.');
815,7 → 825,7
function _GetTreeViewLine(oid: POID; indent: integer): string;
var
i: integer;
sTmp, sTmp2: string;
sTmp: string;
begin
(* Build line *)
sTmp := RepeatStr(' ', indent*TREEVIEW_INDENT);
831,13 → 841,10
sTmp := sTmp + ': ' + oid^.Description;
end;
end;
 
sTmp := StringReplace(sTmp, #13#10, ' ');
repeat
sTmp2 := sTmp;
sTmp := StringReplace(sTmp, ' ', ' ');
until sTmp = sTmp2;
 
for i := 1 to Length(sTmp) do
begin
if (sTmp[i]=#13) or (sTmp[i]=#10) then sTmp[i] := ' ';
end;
sTmp := TrimLineToWidth(sTmp, TREEVIEW_WIDTH);
_GetTreeViewLine := sTmp;
end;
887,23 → 894,6
end;
end;
 
procedure TreeViewPreview;
var
list: PStringList;
begin
CreateList(list);
 
DrawStatusBar('Press ESC to return to the main menu');
ListLoadFromFile(list, TREEVIEW_FILENAME);
DrawSelectionList(2, 3, ScreenWidth-2, ScreenHeight-4,
list, true, 'PREVIEW OF '+TREEVIEW_FILENAME, 2);
(* TODO: Jump to selected OID *)
 
DrawStatusBar(DEFAULT_STATUSBAR);
 
FreeList(list);
end;
 
procedure OP_TreeView;
var
F: Text;
953,8 → 943,6
ShowMessage('TreeView successfully exported as '+TREEVIEW_FILENAME, 'TREEVIEW EXPORT', true);
_Pause;
end;
 
TreeViewPreview;
end;
 
procedure OP_MainMenu;
961,7 → 949,7
var
menu: PStringList;
menuRes, menuLeft, menuTop: integer;
menuIdOID, menuIdTree, menuIdExit: integer;
menuIdOID, menuIdRA, menuIdTree, menuIdExit: integer;
begin
repeat
ClrScr;
974,6 → 962,7
CreateList(menu);
 
menuIdOID := ListAppend(menu, 'Manage OIDs');
menuIdRA := -99; (*ListAppend(menu, 'Manage RAs');*)
menuIdTree := ListAppend(menu, 'Export TreeView');
menuIdExit := ListAppend(menu, 'Return to DOS');
 
988,6 → 977,10
begin
OP_ManageOIDs;
end
else if menuRes = menuIdRA then
begin
OP_ManageRAs;
end
else if menuRes = menuIdTree then
begin
OP_Treeview;
1001,6 → 994,5
InitVideo; (* sets ScreenWidth and ScreenHeight *)
CursorOff;
OP_MainMenu;
CursorOn;
DoneVideo;
end.
/trunk_dos/STRLIST.PAS
3,7 → 3,7
(************************************************)
(* STRLIST.PAS *)
(* Author: Daniel Marschall *)
(* Revision: 2022-02-16 *)
(* Revision: 2022-02-14 *)
(* License: Apache 2.0 *)
(* This file contains: *)
(* - StringList implementation for Turbo Pascal *)
34,8 → 34,6
procedure SplitStrToList(str: string; list: PStringList; separator: string);
procedure OIDtoArcList(oid: string; list: PStringList);
procedure ListBubbleSortNumericString(list: PStringList);
function ListLoadFromFile(list: PStringList; filename: string): boolean;
function ListSaveToFile(list: PStringList; filename: string): boolean;
 
implementation
 
307,61 → 305,4
end;
end;
 
function ListLoadFromFile(list: PStringList; filename: string): boolean;
var
f: Text;
s: string;
begin
Assign(f, filename);
 
{$I-}
Reset(f);
{$I+}
if IoResult <> 0 then
begin
ListLoadFromFile := false;
(* Must not call Close(f) if file was never opened *)
Exit;
end;
 
ListClear(list);
 
while not EOF(f) do
begin
ReadLn(f, s);
ListAppend(list, s);
end;
 
Close(f);
ListLoadFromFile := true;
end;
 
function ListSaveToFile(list: PStringList; filename: string): boolean;
var
f: Text;
i: integer;
s: string;
begin
Assign(f, filename);
 
{$I-}
Rewrite(f);
{$I+}
if IoResult <> 0 then
begin
ListSaveToFile := false;
(* Must not call Close(f) if file was never opened *)
Exit;
end;
 
for i := 0 to ListCount(list)-1 do
begin
s := ListGetElement(list, i);
WriteLn(f, s);
end;
 
Close(f);
ListSaveToFile := true;
end;
 
end.
/trunk_dos/TODO.TXT
1,11 → 1,5
 
TODO:
* (See "TODO" entries in the *.pas files)
 
IDEAS:
* If you call OIDPLUS.EXE with an argument to a .OID file, then open this OID
* TreeView: Write to StringList (avoid recursive calls) and save StringList to file
* TreeView: In the preview, let the user jump to a specific OID
* Implement RAs
* Implement Create/Update timestamps? (people must be able to predate it)
* Data exchange between OIDplus for Win95 and OIDplus 2.0 ?
* See "TODO" entries in the *.pas files
/trunk_dos/VTSCUI.PAS
3,7 → 3,7
(************************************************)
(* VTSCUI.PAS *)
(* Author: Daniel Marschall *)
(* Revision: 2022-02-16 *)
(* Revision: 2022-02-14 *)
(* License: Apache 2.0 *)
(* This file contains: *)
(* - ViaThinkSoft CUI (Console User Interface) *)
36,7 → 36,6
procedure ShowMessage(msg: string; title: string; dobeep: boolean);
procedure CursorOn;
procedure CursorOff;
procedure ResetDefaultDosColors;
 
implementation
 
375,7 → 374,6
iEndScope := itemIndex;
goto doAgain;
end;
(* TODO: Implement PgUp and PgDown keys *)
end;
 
if sc = #13(*Return*) then
597,10 → 595,4
int 10h
end;
 
procedure ResetDefaultDosColors;
begin
TextBackground(Black);
TextColor(LightGray);
end;
 
end.
/trunk_dos/VTSFUNCS.PAS
3,7 → 3,7
(************************************************)
(* VTSFUNCS.PAS *)
(* Author: Daniel Marschall *)
(* Revision: 2022-02-16 *)
(* Revision: 2022-02-14 *)
(* License: Apache 2.0 *)
(* This file contains: *)
(* - Various functions *)
29,12 → 29,10
function DeleteFile(filename: string): boolean;
function FileExists(filename: string): boolean;
 
function IsPositiveIntegerOrZero(s: string): boolean;
function IsPositiveInteger(s: string): boolean;
function StrToInt(s: string): Integer;
function IntToStr(Value: Integer): string;
 
function StringReplace(s, search, replace: string): string;
 
implementation
 
uses
204,11 → 202,11
end;
end;
 
function IsPositiveIntegerOrZero(s: string): boolean;
function IsPositiveInteger(s: string): boolean;
var
i: integer;
begin
IsPositiveIntegerOrZero := false;
IsPositiveInteger := false;
 
if Length(s) = 0 then exit;
if (s[1] = '0') and (s <> '0') then exit;
217,7 → 215,7
if not (s[i] in ['0'..'9']) then exit;
end;
 
IsPositiveIntegerOrZero := true;
IsPositiveInteger := true;
end;
 
function StrToInt(s: string): Integer;
236,30 → 234,4
IntToStr := s;
end;
 
function StringReplace(s, search, replace: string): string;
var
i: integer;
output: string;
begin
if s = '' then exit;
if search = '' then exit; (* invalid arg *)
 
output := '';
while s <> '' do
begin
if Copy(s, 1, Length(search)) = search then
begin
output := output + replace;
Delete(s, 1, Length(search));
end
else
begin
output := output + Copy(s, 1, 1);
Delete(s, 1, 1);
end;
end;
 
StringReplace := output;
end;
 
end.