Type detection: Difference between revisions
→Dispatch by variant record
Line 1,076:
Pascal has a plethora of dialects, and so I have tried to be as close to ''Algorithms + Data Structures = Programs'' (Wirth) style as I could figure out how, when using the Free Pascal Compiler.
<lang pascal>program
type
builtintext : (i : integer);
filetext : (f : file of char);
end;
var
source :
input : file of char;
c : char;
procedure
begin
case source.kind of
Line 1,110:
kind := builtintext;
i := 1;
i := 2;
kind := filetext;
f := input;
end
end.</lang>
Line 1,123:
<pre>This is text 1.
This is text 2.
program
type
builtintext : (i : integer);
filetext : (f : file of char);
end;
var
source :
input : file of char;
c : char;
procedure
begin
case source.kind of
Line 1,157:
kind := builtintext;
i := 1;
i := 2;
kind := filetext;
f := input;
end
end.</pre>
|