Yurttas/PL/IL/Ada-95/F/05/02/00/randomize p.adb

Revision as of 05:47, 5 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="ada" line start="1" enclose="div">-- -- Copyright(C) 1998 -- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. -- -- Permis...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1--
 2-- Copyright(C) 1998
 3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4--
 5-- Permission to use, copy, modify, and distribute this
 6-- software and its documentation for EDUCATIONAL purposes
 7-- and without fee is hereby granted provided that this
 8-- copyright notice appears in all copies.
 9--
10 
11-- date   : December 4, 1989.
12-- author : Michael Nobles.
13
14-- randomize_p.adb
15
16
17package body Randomize_P is
18
19  procedure Randomize(Mode      : in Character;
20                      Data_Name : in Pointer_String;
21                      Rec_Num   : in Integer;
22                      Temp_Rec  : in out Data_Rec;
23                      Size      : in Integer;
24                      Status    : in out Integer) is
25    Offset   : Dir_IO.POSITIVE_COUNT;
26    Position : Integer;
27  begin
28    Position := Rec_Num-1;
29    Position := Position*size;
30    Position := Position+1;
31    Offset := Dir_IO.POSITIVE_COUNT(Position);
32
33    case Mode is
34      when 'w' | 'W' => Dir_IO.Reset(Data_FP, Dir_IO.Out_File);
35                        Dir_IO.Write(Data_FP, Temp_Rec, Offset);
36      when 'r' | 'R' => Dir_IO.Reset(Data_FP, Dir_IO.In_File);
37                        Dir_IO.Read(Data_FP, Temp_Rec, Offset);
38      when others => null;
39    end case;
40  exception
41    when Dir_IO.END_ERROR => Status := 0;
42  end Randomize;
43
44end Randomize_P;