forked from Xevaquor/Dd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLinkedList.dpr.orig
116 lines (97 loc) · 2.12 KB
/
LinkedList.dpr.orig
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
library LinkedList;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
System,
TOperativeUnit in 'TOperativeUnit.pas';
{$R *.res}
var
gHead : PElem;
procedure Append(item : TElemType); stdcall;
var
newNode : PElem;
iter : PElem;
begin
if gHead = nil then
begin
//if list is empty, create it
New(gHead);
gHead^.Next := nil;
gHead^.Val := item;
Exit;
end;
//otherwise, find tail and append new element to it
iter := gHead;
while(iter^.Next <> nil) do
begin
iter := iter^.Next;
end;
New(newNode);
newNode^.Next := nil;
newNode^.Val := item;
iter^.Next := newNode;
end;
procedure WriteEach; stdcall;
var
iter : PElem;
<<<<<<< HEAD
begin
//check if empty
if gHead = nil then
begin
writeln('Empty');
Exit;
end;
iter := gHead;
while iter <> nil do
begin
writeln(iter^.Val.FirstName);
iter := iter^.Next;
end;
end;
procedure Seed; stdcall;
var
bolek, stokrotka, michau : TOperative;
begin
bolek.FirstName := 'Lech';
stokrotka.FirstName := 'Monika';
michau.FirstName := 'Michau';
Append(bolek);
Append(michau);
Append(stokrotka);
=======
begin
//check if empty
if gHead = nil then
begin
writeln('Empty');
Exit;
end;
iter := gHead;
while iter <> nil do
begin
writeln(iter^.Val.FirstName);
iter := iter^.Next;
end;
>>>>>>> origin/master
end;
exports
Append name 'Append',
<<<<<<< HEAD
WriteEach name 'WriteEach',
Seed name 'Seed';
=======
WriteEach name 'WriteEach';
>>>>>>> origin/master
begin
gHead := nil;
end.