1 (* mcFileName.def Provides a procedure to calculate a system file name.
3 Copyright (C) 2015-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
22 DEFINITION MODULE mcFileName ;
24 FROM DynamicStrings IMPORT String ;
28 calculateFileName - calculates and returns a new string filename
29 given a module and an extension. This file name
30 length will be operating system specific.
31 String, Extension, is concatenated onto
32 Module and thus it is safe to `Mark' the extension
33 for garbage collection.
36 PROCEDURE calculateFileName (module, extension: String) : String ;
40 calculateStemName - calculates the stem name for given a module.
41 This name length will be operating system and
45 PROCEDURE calculateStemName (module: String) : String ;
49 extractExtension - given a, filename, return the filename without
53 PROCEDURE extractExtension (filename, ext: String) : String ;
57 extractModule - given a, filename, return the module name including any
58 extension. A new string is returned.
61 PROCEDURE extractModule (filename: String) : String ;