(*************************************************************************

     $RCSfile: ASLUtil.mod $
  Description: Support for clients of asl.library

   Created by: fjc (Frank Copeland)
    $Revision: 3.2 $
      $Author: fjc $
        $Date: 1994/08/08 16:11:17 $

  Copyright © 1994, Frank Copeland.
  This file is part of the Oberon-A Library.
  See Oberon-A.doc for conditions of use and distribution.

*************************************************************************)

MODULE ASLUtil;

(*
** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
** $V- OvflChk       $Z- ZeroVars
*)

IMPORT
  SYS := SYSTEM,
  U   := Utility,
  I   := Intuition,
         ASL;

(*------------------------------------*)
(*
  Simple wrapper for calling the ASL FileRequester.
*)

PROCEDURE RequestFile * (
  window        : I.WindowPtr;
  hail          : ARRAY OF CHAR;
  VAR file      : ARRAY OF CHAR;
  VAR directory : ARRAY OF CHAR )
: BOOLEAN;

  VAR
    fr : ASL.FileRequesterPtr; result : BOOLEAN;

(* $D- disable copying of open arrays *)
BEGIN (* RequestFile *)
  fr := SYS.VAL (ASL.FileRequesterPtr,
    ASL.base.AllocAslRequestTags
      ( ASL.fileRequest,
        ASL.hail,   SYS.ADR (hail),
        ASL.window, window,
        ASL.file,   SYS.ADR (file),
        ASL.dir,    SYS.ADR (directory),
        U.tagEnd ));
  IF fr # NIL THEN
    result := ASL.base.AslRequestTags (fr, U.tagEnd);
    IF result THEN COPY (fr.drawer^, directory); COPY (fr.file^, file) END;
    ASL.base.FreeAslRequest (fr)
  ELSE
    result := FALSE
  END;
  RETURN result
END RequestFile;

END ASLUtil.
