CROSSREF Manual

PASCAL
Sample Listing
1 { This program reads data base input from the terminal and enters }
2 { it into a memory resident data base. }
3 PROGRAM CrossrefExample(INPUT,OUTPUT);
4
5 IMPORT BEGIN
6 TYPE
7 Date =INTEGER;
8 PlaceName =STRING[20];
9 PersonName =STRING[20];
10 PersonKind =(National,Alien);
11 Level = 1..4;
12 END;
13
24 TYPE
25 Person = RECORD
26 Name: PersonName;
27 DateOfBirth: Date;
28 JobLevel: Level;
29 NextRecord: ^Person;
30 CASE Origin: PersonKind OF
31 National: (BirthPlace: PlaceName);
32 Alien: (CountryOfOrigin: PlaceName;
33 DateOfEntry: Date;
34 PortOfEntry: PlaceName);
35 END;
36
37 PtrToPerson = ^Person;
38
41
42 VAR
44 Name :PersonName;
45 JobLevel :Level;
46 BirthDate :Date;
47 BirthPlace :PlaceName;
48 CountryOfOrigin :PlaceName;
49 DateOfEntry :Date;
50 PortOfEntry :PlaceName;
51
52 PersonRecPointer :PtrToPerson;
53 TempRecPointer :PtrToPerson;
55
56 PROCEDURE MakeThePerson(VAR ThePerson :PtrToPerson;
57 Name :PersonName;
58 JobLevel :Level;
59 BirthDate :Date;
60 BirthPlace :PlaceName;
61 CountryOfOrigin :PlaceName;
62 DateOfEntry :Date;
63 PortOfEntry :PlaceName );
64 BEGIN
65
67 ThePerson^.Name := Name;
68 ThePerson^.DateOfBirth := BirthDate;
69 ThePerson^.JobLevel := JobLevel;
70 CASE ThePerson^.Origin OF
71 National: ThePerson^.BirthPlace := BirthPlace;
Figure 10-1. Pascal Sample Program (Page 1 of 2)
10-3