From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6e904ae591b11696,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-27 03:57:01 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!washdc3-snh1.gtei.net!news.gtei.net!portc01.blue.aol.com!audrey05.news.aol.com!not-for-mail X-Admin: news@aol.com From: boobeargrr@aol.com (Joshua Shriver) Newsgroups: comp.lang.ada Date: 27 Feb 2002 11:56:46 GMT Organization: AOL http://www.aol.com Subject: Direct IO Help needed Message-ID: <20020227065646.12931.00000771@mb-me.aol.com> Xref: archiver1.google.com comp.lang.ada:20510 Date: 2002-02-27T11:56:46+00:00 List-Id: Here is the src I've created, now I need to create a main application that uses these procedures, how is this done? it seems this is a "generic package" or something so I can't just use with dfs; use dfs and then do: dfs.switch_file_lines(...); Here is the .adb -- Joshua Shriver -- Lab 2 -- Direct File Stuff package with direct_io; package body dfs is procedure switch_file_lines(source_file: in string; line1: integer; line2: integer) is s_file: dfs_pkg.file_type; buffer1: item; buffer2: item; Begin -- Swap file lines open(s_file, inout_file, source_file); read(s_file, buffer1, positive_count(line1)); read(s_file, buffer2, positive_count(line2)); write(s_file, buffer1, positive_count(line2)); write(s_file, buffer2, positive_count(line1)); close(s_file); end switch_file_lines; procedure swap_head_tail(source_file: in string; lines: integer) is s_file: dfs_pkg.file_type; i: integer; last: count; Begin -- Store file variables open(s_file, inout_file, source_file); last := size(s_file); close(s_file); i := 1; for i in 1.. lines loop switch_file_lines(source_file, i, integer(last)); last := last - 1; end loop; end swap_head_tail; procedure get_middle(source_file: in string; found: out item) is s_file: dfs_pkg.file_type; middle: count; Begin open(s_file, inout_file, source_file); middle := size(s_file) / 2; read(s_file, found, middle); end get_middle; end dfs; Here is the .ads with direct_io; generic type item is private; package dfs is package dfs_pkg is new direct_io(item); use dfs_pkg; procedure switch_file_lines(source_file: in string; line1: integer; line2: integer); procedure swap_head_tail(source_file: in string; lines: integer); procedure get_middle(source_file: in string; found: out item); end dfs; Any help is appreciated. Sincerely, Joshua Shriver jshriver@mix.wvu.edu