Login | ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/decoder/trunk/Quelltext/DCConst.pas
Revision: 2
Committed: Thu Nov 8 11:09:30 2018 UTC (23 months, 2 weeks ago) by daniel-marschall
Content type: text/x-pascal
File size: 3166 byte(s)
Log Message:
Published revision 01 March 2007 to SVN.
Added disclaimer.
Changed the license to Apache2.

File Contents

# User Rev Content
1 daniel-marschall 2 unit DCConst;
2    
3     interface
4    
5     uses
6     Classes, SysUtils;
7    
8     type
9     TLanguageEntry = record
10     name: string;
11     text: string;
12     end;
13    
14     function max_2(A, B: integer): integer;
15     function max_3(A, B, C: integer): integer;
16     function max_4(A, B, C, D: integer): integer;
17     function max_7(A, B, C, D, E, F, G: integer): integer;
18    
19     function paramstr_firstposition(str: string): integer;
20     function paramzeile_firstposition(str: string): integer;
21     function ZaehleLinien(str: string): integer;
22     function GebeLinieaus(str: string; linie: integer): string;
23    
24     const
25     // Global
26     DC4Ver: String = '4.1 Public Beta 4b';
27    
28     // ConfigForm
29     activator = 'activator.exe';
30     StdGarbarge = 5;
31    
32     var
33     ParamZeile: string;
34    
35     implementation
36    
37     function max_2(A, B: integer): integer;
38     begin
39     result := 0;
40     if (A >= B) then result := A;
41     if (B >= A) then result := B;
42     end;
43    
44     function max_3(A, B, C: integer): integer;
45     begin
46     result := 0;
47     if (A >= B) and (A >= C) then result := A;
48     if (B >= A) and (B >= C) then result := B;
49     if (C >= A) and (C >= B) then result := C;
50     end;
51    
52     function max_4(A, B, C, D: integer): integer;
53     begin
54     result := 0;
55     if (A >= B) and (A >= C) and (A >= D) then result := A;
56     if (B >= A) and (B >= C) and (B >= D) then result := B;
57     if (C >= A) and (C >= B) and (C >= D) then result := C;
58     if (D >= A) and (D >= B) and (D >= C) then result := D;
59     end;
60    
61     function max_7(A, B, C, D, E, F, G: integer): integer;
62     begin
63     result := 0;
64     if (A >= B) and (A >= C) and (A >= D) and (A >= E) and (A >= F) and (A >= G) then result := A;
65     if (B >= A) and (B >= C) and (B >= D) and (B >= E) and (B >= F) and (B >= G) then result := B;
66     if (C >= A) and (C >= B) and (C >= D) and (C >= E) and (C >= F) and (C >= G) then result := C;
67     if (D >= A) and (D >= B) and (D >= C) and (D >= E) and (D >= F) and (D >= G) then result := D;
68     if (E >= A) and (E >= B) and (E >= C) and (E >= D) and (E >= F) and (E >= G) then result := E;
69     if (F >= A) and (F >= B) and (F >= C) and (F >= D) and (F >= E) and (F >= G) then result := F;
70     if (G >= A) and (G >= B) and (G >= C) and (G >= D) and (G >= E) and (G >= F) then result := G;
71     end;
72    
73     function paramstr_firstposition(str: string): integer;
74     var
75     i: integer;
76     begin
77     result := -1;
78     for i := 1 to paramcount() do
79     begin
80     if paramstr(i) = lowercase(str) then
81     result := i;
82     end;
83     end;
84    
85     function paramzeile_firstposition(str: string): integer;
86     var
87     i: integer;
88     begin
89     result := -1;
90     for i := 1 to ZaehleLinien(paramzeile) do
91     begin
92     if GebeLinieaus(paramzeile, i) = lowercase(str) then
93     result := i;
94     end;
95     end;
96    
97     function ZaehleLinien(str: string): integer;
98     var
99     temp: tstringlist;
100     begin
101     temp := tstringlist.Create;
102     try
103     temp.text := str;
104     result := temp.count;
105     finally
106     temp.free;
107     end;
108     end;
109    
110     function GebeLinieaus(str: string; linie: integer): string;
111     var
112     temp: tstringlist;
113     begin
114     temp := tstringlist.Create;
115     try
116     temp.text := str;
117     if linie <= temp.Count then
118     result := temp.Strings[linie-1]
119     else
120     result := '';
121     finally
122     temp.free;
123     end;
124     end;
125    
126     end.