1 (* nameKey.def provides a dynamic binary tree name to key.
3 Copyright (C) 2015-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius@glam.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 nameKey ;
25 FROM SYSTEM IMPORT ADDRESS ;
29 NulName = 0 ; (* No legal name. *)
30 (* NulName is not present in the Tree *)
37 makeKey - returns the Key of the symbol, a. If a is not in the
38 name table then it is added, otherwise the Key of a is returned
39 directly. Note that the name table has no scope - it merely
40 presents a more convienient way of expressing strings. By a Key.
41 These keys last for the duration of compilation.
44 PROCEDURE makeKey (a: ARRAY OF CHAR) : Name ;
48 makekey - returns the Key of the symbol, a. If a is not in the
49 name table then it is added, otherwise the Key of a is returned
50 directly. Note that the name table has no scope - it merely
51 presents a more convienient way of expressing strings. By a Key.
52 These keys last for the duration of compilation.
55 PROCEDURE makekey (a: ADDRESS) : Name ;
59 getKey - returns the name, a, of the key, key.
62 PROCEDURE getKey (key: Name; VAR a: ARRAY OF CHAR) ;
66 lengthKey - returns the length of a Key.
69 PROCEDURE lengthKey (key: Name) : CARDINAL ;
73 isKey - returns TRUE if string, a, is currently a key.
76 PROCEDURE isKey (a: ARRAY OF CHAR) : BOOLEAN ;
80 writeKey - Display the symbol represented by Key.
83 PROCEDURE writeKey (key: Name) ;
87 isSameExcludingCase - returns TRUE if key1 and key2 are
88 the same. It is case insensitive.
91 PROCEDURE isSameExcludingCase (key1, key2: Name) : BOOLEAN ;
95 keyToCharStar - returns the C char * string equivalent for, key.
98 PROCEDURE keyToCharStar (key: Name) : ADDRESS ;