| 1 |
(* M2FileName.def construct file names. |
| 2 |
|
| 3 |
Copyright (C) 2001-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 M2FileName ; |
| 23 |
|
| 24 |
(* |
| 25 |
Author : Gaius Mulley |
| 26 |
Title : M2FileName |
| 27 |
Date : 3/4/86 [$Date: 2013/07/08 10:27:56 $] |
| 28 |
SYSTEM : UNIX (GNU Modula-2) |
| 29 |
Description: construct file names. |
| 30 |
Version : $Revision: 1.11 $ |
| 31 |
*) |
| 32 |
|
| 33 |
FROM DynamicStrings IMPORT String ; |
| 34 |
EXPORT QUALIFIED CalculateFileName, CalculateStemName, ExtractExtension ; |
| 35 |
|
| 36 |
|
| 37 |
(* |
| 38 |
CalculateFileName - calculates and returns a new string filename |
| 39 |
given a module and an extension. This file name |
| 40 |
length will be operating system specific. |
| 41 |
String, Extension, is concatenated onto |
| 42 |
Module and thus it is safe to Mark the extension |
| 43 |
for garbage collection. |
| 44 |
*) |
| 45 |
|
| 46 |
PROCEDURE CalculateFileName (Module, Extension: String) : String ; |
| 47 |
|
| 48 |
|
| 49 |
(* |
| 50 |
CalculateStemName - calculates the stem name for given a module. |
| 51 |
This name length will be operating system and |
| 52 |
compiler specific. |
| 53 |
*) |
| 54 |
|
| 55 |
PROCEDURE CalculateStemName (Module: String) : String ; |
| 56 |
|
| 57 |
|
| 58 |
(* |
| 59 |
ExtractExtension - given a, filename, return the filename without |
| 60 |
the extension, Ext. |
| 61 |
*) |
| 62 |
|
| 63 |
PROCEDURE ExtractExtension (filename, ext: String) : String ; |
| 64 |
|
| 65 |
|
| 66 |
(* |
| 67 |
ExtractModule - given a, filename, return the module name including any |
| 68 |
extension. A new string is returned. |
| 69 |
*) |
| 70 |
|
| 71 |
PROCEDURE ExtractModule (filename: String) : String ; |
| 72 |
|
| 73 |
|
| 74 |
END M2FileName. |