]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | (* mcSearch.def mcSearch provides a mechanism to search selected directories. |
2 | ||
a945c346 | 3 | Copyright (C) 2015-2024 Free Software Foundation, Inc. |
1eee94d3 GM |
4 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
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 mcSearch ; | |
23 | ||
24 | ||
25 | (* mcSearch provides a mechanism to search selected directories | |
26 | in an attempt to locate and open a given source file. *) | |
27 | ||
28 | FROM DynamicStrings IMPORT String ; | |
29 | ||
30 | ||
31 | (* | |
32 | initSearchPath - initialise the compiler search, path. | |
33 | The string path may take the form: | |
34 | ||
35 | Path ::= IndividualPath { ":" IndividualPath } | |
36 | IndividualPath ::= "." | DirectoryPath | |
37 | DirectoryPath ::= [ "/" ] Name { "/" Name } | |
38 | Name ::= Letter { (Letter | Number) } | |
39 | Letter ::= A..Z | a..z | |
40 | Number ::= 0..9 | |
41 | *) | |
42 | ||
43 | PROCEDURE initSearchPath (path: String) ; | |
44 | ||
45 | ||
46 | (* | |
47 | prependSearchPath - prepends a new path to the initial search path. | |
48 | *) | |
49 | ||
50 | PROCEDURE prependSearchPath (path: String) ; | |
51 | ||
52 | ||
53 | (* | |
54 | findSourceFile - attempts to locate the source file FileName. | |
55 | If a file is found then TRUE is returned otherwise | |
56 | FALSE is returned. | |
57 | The parameter FullPath is set indicating the | |
58 | absolute location of source FileName. | |
59 | FullPath will be totally overwritten and should | |
60 | not be initialized by InitString before this function | |
61 | is called. | |
62 | FindSourceFile sets FullPath to a new string if successful. | |
63 | *) | |
64 | ||
65 | PROCEDURE findSourceFile (FileName: String; | |
66 | VAR fullPath: String) : BOOLEAN ; | |
67 | ||
68 | ||
69 | (* | |
70 | findSourceDefFile - attempts to find the definition module for | |
71 | a module, Stem. If successful it returns | |
72 | the full path and returns TRUE. If unsuccessful | |
73 | then FALSE is returned and FullPath is set to NIL. | |
74 | *) | |
75 | ||
76 | PROCEDURE findSourceDefFile (stem: String; VAR fullPath: String) : BOOLEAN ; | |
77 | ||
78 | ||
79 | (* | |
80 | findSourceModFile - attempts to find the implementation module for | |
81 | a module, Stem. If successful it returns | |
82 | the full path and returns TRUE. If unsuccessful | |
83 | then FALSE is returned and FullPath is set to NIL. | |
84 | *) | |
85 | ||
86 | PROCEDURE findSourceModFile (stem: String; VAR fullPath: String) : BOOLEAN ; | |
87 | ||
88 | ||
89 | (* | |
90 | setDefExtension - sets the default extension for definition modules to, ext. | |
91 | The string, ext, should be deallocated by the caller at | |
92 | an appropriate time. | |
93 | *) | |
94 | ||
95 | PROCEDURE setDefExtension (ext: String) ; | |
96 | ||
97 | ||
98 | (* | |
99 | setModExtension - sets the default extension for implementation and program | |
100 | modules to, ext. The string, ext, should be deallocated | |
101 | by the caller at an appropriate time. | |
102 | *) | |
103 | ||
104 | PROCEDURE setModExtension (ext: String) ; | |
105 | ||
106 | ||
107 | END mcSearch. |