| 1 |
(* mcFileName.def Provides a procedure to calculate a system file name. |
| 2 |
|
| 3 |
Copyright (C) 2015-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 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) |
| 11 |
any later version. |
| 12 |
|
| 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. |
| 17 |
|
| 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/>. *) |
| 21 |
|
| 22 |
DEFINITION MODULE mcFileName ; |
| 23 |
|
| 24 |
FROM DynamicStrings IMPORT String ; |
| 25 |
|
| 26 |
|
| 27 |
(* |
| 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. |
| 34 |
*) |
| 35 |
|
| 36 |
PROCEDURE calculateFileName (module, extension: String) : String ; |
| 37 |
|
| 38 |
|
| 39 |
(* |
| 40 |
calculateStemName - calculates the stem name for given a module. |
| 41 |
This name length will be operating system and |
| 42 |
compiler specific. |
| 43 |
*) |
| 44 |
|
| 45 |
PROCEDURE calculateStemName (module: String) : String ; |
| 46 |
|
| 47 |
|
| 48 |
(* |
| 49 |
extractExtension - given a, filename, return the filename without |
| 50 |
the extension, Ext. |
| 51 |
*) |
| 52 |
|
| 53 |
PROCEDURE extractExtension (filename, ext: String) : String ; |
| 54 |
|
| 55 |
|
| 56 |
(* |
| 57 |
extractModule - given a, filename, return the module name including any |
| 58 |
extension. A new string is returned. |
| 59 |
*) |
| 60 |
|
| 61 |
PROCEDURE extractModule (filename: String) : String ; |
| 62 |
|
| 63 |
|
| 64 |
END mcFileName. |