M3Extension provides operations on filename extensions.
INTERFACEThere are a number of extensions commonly used by an M3 system, captured by the enumeration typeM3Extension ; TYPE T = {Int, (* interface source *) IntG, (* generic interface source *) PInt, (* pickled interface (AST) *) PIntR, (* pickled interface, reduced AST *) Mod, (* module source *) ModG, (* generic module source *) PMod, (* pickled module (AST) *) PModR, (* pickled module, reduced AST *) IObj, (* (interface) object *) MObj, (* (module) object *) Exe, (* executable *) IC, (* (interface) C intermediate *) MC, (* (module) C intermediate *) IAsm, (* (interface) assembly code *) MAsm, (* (module) assembly code *) IX, (* (interface) pre-linker input *) MX, (* (module) pre-linker input *) ObjLib, (* object library *) ObjLibX, (* pre-linker input library *) Tmp, (* temporary file *) Null}; (* no extension *) TSet = SET OF T;
T. Not all the extension types may be utilised
by a given implementation. The actual characters used to denote a T
may vary between implementations.
CONST
Ints = TSet{T.Int, T.IntG};
Mods = TSet{T.Mod, T.ModG};
All = TSet{FIRST(T)..LAST(T)};
PROCEDURE ToText(t: T): TEXT;
Returns theTEXTcorresponding tot
PROCEDURE FromText(text: TEXT; VAR t: T): BOOLEAN;
Iftextis a valid Modula-3 extension, settand returnTRUE. Otherwise, leavetunchanged and returnFALSE.
PROCEDURE Extend(name: TEXT; t: T): TEXT;
Ift = T.Null, then returnPathname.Base(name)else returnPathname.Join(NIL, Pathname.Base(name), ToText(t)).
PROCEDURE Has(name: TEXT; VAR t: T): BOOLEAN;
Returns FromText(Pathname.LastExt(name), t). END M3Extension.