1 {***************************************************************
4 * Purpose : Various Definitions and functions...
5 * Author : Simon Steele
6 * Copyright: This Source Code is Copyright © 1998-2000 Echo
7 * Software and Simon Steele. Please read the license
8 * agreement at www.pnotepad.org/press/psidx.html.
9 **************************************************************}
16 function CreatePNFile(filename : string; Text : pChar) : Boolean;
17 function StripNewLines(aString: string): string;
18 procedure ConvertTypes(filename : string);
20 const strFileTypes : PChar = ('.txt');
21 strOpenTypes : PChar = ('%2|Text files (*.txt)|*.txt|0|0|0|LOG files (*.log)|*.log|0|0|0|Executable Files (*.exe, *.com, *.dll)|*.exe;*.com;*.dll|0|0|0');
28 function CreatePNFile(filename : string; Text : pChar) : Boolean;
32 AssignFile(F, filename);
36 If IOResult <> 0 Then Result := False
41 function StripNewLines(aString: string): string;
46 while i <= length(aString) do
48 if aString[i] = #13 then result := result + ' ' else
49 if aString[i] <> #10 then result := result + aString[i];
54 procedure ConvertTypes(filename : string);
57 ps : string; {part of string}
66 // This assumes that it is being passed one of the old style type definition
67 // files. We'll set the status on the main form to indicate this as well...
68 OutStr := VerChar + CurrFileVer;
69 if not fileexists(filename) then
71 CreatePNFile(filename, strOpenTypes);
74 Assignfile(t, FileName);
78 until (Length(s) > 0) or EOF(t);
83 iPos := Pos(SepChar, s);
84 if (iPos = 0) and (Length(s) > 0) then
89 ps := Copy(s, 1, ipos - 1);
90 s := Copy(S, ipos + 1, Length(s));
93 OutStr := OutStr + SepChar + ps;
97 OutStr := OutStr + SepChar + ps;
101 OutStr := OutStr + SepChar + ps + SepChar + '0' + SepChar + '0';
106 Assignfile(t, filename);