ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE Make;

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

    Module  Make     (Version 1.0)

      Copyright (c) 1992-2006 by Andreas Fischlin, Juerg Thoeny and
      ETH Zurich.

    Purpose   Batch compilation and linking of Modula-2 software.

    Remarks   Is based on the "Dialog Machine" and MacMETH
              and is therefore not portable to other machines
              than the Macintosh.


    Programming

      o Design
        Andreas Fischlin          12/10/1992

      o Implementation
        Andreas Fischlin          12/10/1992
        Juerg Thoeny              16/12/1992


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  16/11/2004  AF

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


  PROCEDURE SetBatchMode(on: BOOLEAN);
  PROCEDURE IsInBatchMode(): BOOLEAN;

  PROCEDURE Ask(question: ARRAY OF CHAR; butTexts: ARRAY OF CHAR;
                butWidth: CARDINAL; VAR answer: INTEGER);
  (* Ineffective in batch mode, i.e. returns default answer = 1 *)

  PROCEDURE GetVersion(prompt:  ARRAY OF CHAR; VAR versStr: ARRAY OF CHAR);
  (* assign versStr before calling GetVersion, because this value
  is used as the default, in particular important if called in batch mode *)

  PROCEDURE SetTerminalProtocolFile (fn : ARRAY OF CHAR) : BOOLEAN;
  PROCEDURE SetReportProtocolFile (fn : ARRAY OF CHAR) : BOOLEAN;
  (* Ineffective in batch mode in case the protocol file is already open *)

  PROCEDURE Message(lnsbefore: INTEGER; s: ARRAY OF CHAR);

  PROCEDURE MessageLn(lnsbefore: INTEGER; s: ARRAY OF CHAR);
  (* writes EOL at end *)

  PROCEDURE StripExtFrom(fn: ARRAY OF CHAR);

  PROCEDURE SetDefltCompiler (obsoleteCompName,newCompName: ARRAY OF CHAR);
  (*
    Define name of compiler which will be replaced by newCompName
    as used by all Compile routines.  This allows to force a
    Compile20 compilation of all modules by calling

      SetDefltCompiler("Compile","Compile20");

    By default this module is initialized to

      SetDefltCompiler("Compile","Compile");
  *)

  PROCEDURE CompCompiler(compName,fn,cmdfn: ARRAY OF CHAR ): BOOLEAN;
  PROCEDURE Compile(fn,cmdfn: ARRAY OF CHAR ): BOOLEAN;
  PROCEDURE Compile20(fn,cmdfn: ARRAY OF CHAR ): BOOLEAN;

  PROCEDURE CompileAndRename(fname,fnext,tail: ARRAY OF CHAR );
  PROCEDURE Compile20AndRename(fname,fnext,tail: ARRAY OF CHAR );
  PROCEDURE CompileLinkAndRename(fname,fnext,tail,lnkcmdfnTail: ARRAY OF CHAR );
  PROCEDURE CompAnyLinkAndRename(compiler,fname,fnext,tail,lnkcmdfnTail: ARRAY OF CHAR );
  PROCEDURE MakeDefault( fn,tail: ARRAY OF CHAR );
  PROCEDURE MakeComp20Default( fn,tail: ARRAY OF CHAR );

  PROCEDURE MakeVariantsFlex(modName, v1,v2,
                             compiler1,compiler2, opt1,opt2: ARRAY OF CHAR;
                             prelink: BOOLEAN);
    (*
       The solution to deal with variants.  Generates 3 modules
       from 2 variants, where v2 is always the default, i.e. the
       target file 'xyz.OBM' is identical with the variant
       'xyz.OBM (v2)'.

       - All sources are expected to have variant designators in
         parantheses, e.g. 'xyz.MOD (No FPU)' and to reside in the
         same folder. modName may have an extension or not (is
         stripped anyway).  It may have a preceeding path,
         otherwise the file is found via the User.Profile.

       - v1, v2 are the variant designators and have to be given
         as a full string to be added after the standard
         extensions (.MOD or .OBM). E.g. if modName is 'Xyz'
         and v1 = ' (No SANE)', then the routine expects to
         find a file with the name 'Xyz.MOD (No SANE)' and
         'Xyz.MOD (No SANE).R' and will construct a target file
         with the name 'Xyz.OBM (No SANE)'.

       - If compiler1 (or compiler2) is the empty string =>
         default compiler 'Compile' is used.

       - opt1 and opt2 are compilation options, e.g. /R.

       - If prelink = TRUE uses a prelinking command file
         "-link.xyz" to prelink the module.  If no "-link.xyz" file
         can be found, the routine expects to find 2 different
         prelink files.  Again the file names are expected to be of
         the form '-link.xyz (v1|2)'.

       - Resources to label the variants are expected to be found
         in files with the same names as the target 'xyz.OBM
         (v1|2)' files but having additional extension ".R" added
         to their names (e.g. 'xyz.OBM (SANE).R').

       Ex.:

         MakeVariantsFlex("RMSDebugHelp"," (No reports)"," (Reports)",
                          "Compile","Compile20","/R","",
                          TRUE);


         MakeVariantsFlex("MathLib", " (No SANE)", " (SANE)", "","","","", FALSE);
         is the same as
         MakeVariants("MathLib", " (No SANE)", " (SANE)", "", FALSE)
     *)

  PROCEDURE ForceRename(oldname,newname: ARRAY OF CHAR);
  PROCEDURE RenameAndAddResource(oldname,newname: ARRAY OF CHAR);

  PROCEDURE CompileAndStripExt(alreadyCompiled: BOOLEAN; modIdent: ARRAY OF CHAR);

  PROCEDURE MakeLinkOptString (optChars, creator: ARRAY OF CHAR;
                               VAR options: ARRAY OF CHAR );
  (* e.g. MakeLinkOptString("QS","ETHM",options); returns string options
  which can be passed as argument in call to LaunchLink (see below) *)

  PROCEDURE LaunchLink(masterfn, cmdfn, newfn, options: ARRAY OF CHAR);

  PROCEDURE Prelink(alreadyCompiled: BOOLEAN; moduleIdent: ARRAY OF CHAR);
  (* conditional compilation and subsequent linking process of module
  given by moduleIdent (extension ignored).  LaunchLink ist actually
  called as follows:
    LaunchLink('{moduleIdent}.OBM', '-link.{moduleIdent}',"","/Q");
  whereby {moduleIdent} is replaced by the actual ident of the module.
  *)

  PROCEDURE CompilePCVariant (mn: ARRAY OF CHAR; pcSBMs: BOOLEAN);
  (* compiles a single module with name mn, but uses PC variant
  of module if pcSBMs = TRUE *)
  PROCEDURE CompileAndLink (mn: ARRAY OF CHAR; pcSBMs: BOOLEAN);
  (* similar to Prelink, but compiles always, but uses PC variant
  of module if pcSBMs = TRUE *)

  PROCEDURE GetFullName (    fn : ARRAY OF CHAR;
                         VAR fullName : ARRAY OF CHAR) : BOOLEAN;

  PROCEDURE GetFilePath (    fn : ARRAY OF CHAR;
                         VAR path : ARRAY OF CHAR) : BOOLEAN;


  PROCEDURE CopyFile(    sourcePath,sourceFn,
                         destPath, destFn: ARRAY OF CHAR;
                     VAR done: BOOLEAN);
  PROCEDURE MoveFile(sourcePath,sourceFn, destPath: ARRAY OF CHAR; VAR ok: BOOLEAN);
  PROCEDURE ForceCopy(sourcePath, sourceFn, destPath, destFn: ARRAY OF CHAR; VAR ok: BOOLEAN);
  PROCEDURE ForceMove(sourcePath,sourceFn, destPath: ARRAY OF CHAR; VAR ok: BOOLEAN);
  (* Force routines delete first the file at target *)
  PROCEDURE ForceDelete (pfn: ARRAY OF CHAR); (* deletes if exists *)

  PROCEDURE UseCustomIcon(pfn: ARRAY OF CHAR);

  PROCEDURE CallSubMake(makename: ARRAY OF CHAR);

  PROCEDURE AnErrEncountered(msgbeg,ins1,msgmiddle,ins2,msgend: ARRAY OF CHAR);
  PROCEDURE AnyErrsEncountered(): BOOLEAN;
  PROCEDURE PlaySuccessMelody(final: BOOLEAN);


  PROCEDURE SetFileTypes(defltCreator, defltType, compCreator,
                         sbmType, obmType, rfmType: ARRAY OF CHAR);
    (*
      defltType is the type and defltCreator the creator for files
      which have names different from any name which has one of the
      folowing extensions SBM, OBM, or RFM. Initial default: type =
      'TEXT', creator = 'RAMS'.  Any file with an extension such as
      SBM, OBM, or RFM, has the creator compCreator.  Depending on
      the particular extension, the file type is equal to sbmType,
      obmType, respectively rfmType.
    *)

END Make.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]