forked from VE3NEA/MorseRunner
-
Notifications
You must be signed in to change notification settings - Fork 12
/
ExchFields.pas
74 lines (64 loc) · 3.34 KB
/
ExchFields.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//------------------------------------------------------------------------------
//This Source Code Form is subject to the terms of the Mozilla Public
//License, v. 2.0. If a copy of the MPL was not distributed with this
//file, You can obtain one at http://mozilla.org/MPL/2.0/.
//------------------------------------------------------------------------------
unit ExchFields;
interface
uses
Classes
;
type
// Exchange Field #1 types
TExchange1Type = (etRST, etOpName, etFdClass, etSSNrPrecedence);
// Exchange Field #2 Types
TExchange2Type = (etSerialNr, etGenericField, etArrlSection, etStateProv,
etCqZone, etItuZone, etAge, etPower, etJaPref, etJaCity,
etNaQpExch2, etNaQpNonNaExch2, etSSCheckSection);
{
Defines the characteristics and behaviors of an exchange field.
Used to declare various exchange field behaviors. Field Definitions
are indexed by a contest definition (e.g. ARRL FD uses etFdClass and
etStateProv). As new contests are added, new field definition
may be required. When adding a new exchange field definition,
search for existing code usages to find areas that will require changes.
}
TFieldDefinition = record
C: PChar; // Caption
R: PChar; // Regular Expression
L: smallint; // MaxLength
T: smallint; // Type
end;
PFieldDefinition = ^TFieldDefinition;
const
// Adding a contest: define contest-specific field types
// Exchange Field 1 settings/rules
Exchange1Settings: array[TExchange1Type] of TFieldDefinition = (
(C: 'RST'; R: '[1-5E][1-9N][1-9N]'; L: 3; T:Ord(etRST))
,(C: 'Name'; R: '[A-Z][A-Z]*'; L: 10; T:Ord(etOpName))
,(C: 'Class'; R: '[1-9][0-9]*[A-F]'; L: 3; T:Ord(etFdClass))
// ARRL SS does not parse user-entered Exchange 1 field; Exchange 2 field is used.
,(C: ''; R: '([0-9]+|#)? *[QABUMS]'; L: 4; T:Ord(etSSNrPrecedence))
);
// Exchange Field 2 settings/rules
Exchange2Settings: array[TExchange2Type] of TFieldDefinition = (
(C: 'Nr.'; R: '([0-9OTN]+)|(#)'; L: 4; T:Ord(etSerialNr)),
(C: 'Exch'; R: '[0-9A-Z]*'; L: 12; T:Ord(etGenericField)),
(C: 'Section'; R: '([A-Z][A-Z])|([A-Z][A-Z][A-Z])'; L: 3; T:Ord(etArrlSection)),
(C: 'State/Prov'; R: '[ABCDFGHIKLMNOPQRSTUVWY][ABCDEFHIJKLMNORSTUVXYZ]';
L: 6; T:Ord(etStateProv)),
(C: 'CQ-Zone'; R: '[0-9OANT]+'; L: 2; T:Ord(etCqZone)),
(C: 'Zone'; R: '[0-9]*'; L: 4; T:Ord(etItuZone)),
(C: 'Age'; R: '[0-9][0-9]'; L: 2; T:Ord(etAge)),
(C: 'Power'; R: '([0-9]*)|(K)|(KW)|([0-9A]*[OTN]*)'; L: 4; T:Ord(etPower)),
(C: 'Number'; R: '([0-9AOTN]*)([LMHP])'; L: 4; T:Ord(etJaPref)),
(C: 'Number'; R: '([0-9AOTN]*)([LMHP])'; L: 7; T:Ord(etJaCity))
// NAQP Contest: NA Stations send name and (state/prov/dxcc);
// Non-NA stations send name only
,(C: 'State'; R: '([0-9A-Z/]*)'; L: 6; T:Ord(etNaQpExch2))
,(C: 'State'; R: '()|([0-9A-Z/]*)'; L: 6; T:Ord(etNaQpNonNaExch2))
,(C: 'Nr Prec CK Sect';
R: '[0-9ONT]{1,2} +[A-Z]{2,3}'; L: 32; T:Ord(etSSCheckSection))
);
implementation
end.