DEFINITION MODULE DuMisc;

(*
        This module has several miscellaneous procedures
        and was separated to keep the main program from getting
        more cluttered than it was. Someday I'll clean it all up.

        Written: 3/21/87 by Greg Browne

        Compiles on TDI's Modula-2 Compiler version 2.20a


*)

FROM SYSTEM             IMPORT  ADR, NULL;
FROM Intuition          IMPORT  IntuiMessagePtr,IDCMPFlagSet,GadgetPtr,
                                IDCMPFlags;
FROM DOSFiles           IMPORT  FileHandle;
FROM DuWindow           IMPORT  GadgetNames;


TYPE
  CharPtr       = POINTER TO CHAR;

VAR
  MyMsg         : IntuiMessagePtr;
  MyClass       : IDCMPFlagSet;
  OutHandle     : FileHandle;
  MyGadPtr      : GadgetPtr;
  GadGot        : GadgetNames;
  MyX,MyY       : INTEGER;
  Gp            : ARRAY[0..255] OF CHAR;

(* ================================*)

PROCEDURE CheckMessages():BOOLEAN;
(*
  Check for messages returns null or message and sets
   all the pertainent stuff above
*)

PROCEDURE DoFileLook():BOOLEAN;
(*
  Goes through the selected files and displays them based on the
  gadget indicated in GadGot - any mouse message aborts
*)

PROCEDURE DuMoveFile(VAR name,name2:ARRAY OF CHAR):LONGINT;
(* renames name to name2 and marks as deleted if ok *)

PROCEDURE DuFileTwiddle(WithCopy,WithDelete:BOOLEAN):LONGINT;
(* Returns IoErr
   goes through list for COPY COPYDEL ZAPFILE and MOVE
   COPYDEL -  BOTH true   (copy then delete source)
   COPY    -  Only WithCopy true
   ZAPFILE -  Only WithDelete true
   MOVE    -  BOTH false
              (rename FileName to Dest path+FileName - not across devices)
*)

PROCEDURE DuExec():LONGINT;
(* Returns IoErr
  either RUN >NIL: or just executes various programs
*)

PROCEDURE ReplaceRSDM(g:GadgetNames;VAR a:ARRAY OF CHAR);
(*
   Replaces the affected gadget 'g' IOString with 'a' text
   and refreshes the gadgets to make sure it shows.
   This one removes - fixes - replaces - refreshes
*)

PROCEDURE StringIt(n:LONGCARD;VAR s:ARRAY OF CHAR):BOOLEAN;
(*
  Just a quick boolean to convert 'n' to a string
*)

PROCEDURE AskForConfirm;
(*
   Displays confirm message
*)

(********)
(* MAIN *)
(********)

END DuMisc.
