| 1 |
(* mcComment.def provides a module to remember the comments. |
| 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 mcComment ; (*!m2pim*) |
| 23 |
|
| 24 |
FROM SYSTEM IMPORT ADDRESS ; |
| 25 |
FROM DynamicStrings IMPORT String ; |
| 26 |
FROM nameKey IMPORT Name ; |
| 27 |
|
| 28 |
TYPE |
| 29 |
commentDesc ; |
| 30 |
|
| 31 |
|
| 32 |
(* |
| 33 |
initComment - the start of a new comment has been seen by the lexical analyser. |
| 34 |
A new comment block is created and all addText contents are placed |
| 35 |
in this block. onlySpaces indicates whether we have only seen |
| 36 |
spaces on this line. The new comment descriptor is returned. |
| 37 |
If onlySpaces is TRUE then an inbody comment is created. |
| 38 |
If onlySpaces is FALSE then an after statement comment is created. |
| 39 |
*) |
| 40 |
|
| 41 |
PROCEDURE initComment (onlySpaces: BOOLEAN) : commentDesc ; |
| 42 |
|
| 43 |
|
| 44 |
(* |
| 45 |
addText - cs is a C string (null terminated) which contains comment text. |
| 46 |
*) |
| 47 |
|
| 48 |
PROCEDURE addText (cd: commentDesc; cs: ADDRESS) ; |
| 49 |
|
| 50 |
|
| 51 |
(* |
| 52 |
getContent - returns the content of comment, cd. |
| 53 |
*) |
| 54 |
|
| 55 |
PROCEDURE getContent (cd: commentDesc) : String ; |
| 56 |
|
| 57 |
|
| 58 |
(* |
| 59 |
getCommentCharStar - returns the contents of the comment, cd. |
| 60 |
*) |
| 61 |
|
| 62 |
PROCEDURE getCommentCharStar (cd: commentDesc) : ADDRESS ; |
| 63 |
|
| 64 |
|
| 65 |
(* |
| 66 |
setProcedureComment - changes the type of comment, cd, to a |
| 67 |
procedure heading comment, |
| 68 |
providing it has the procname as the first word. |
| 69 |
*) |
| 70 |
|
| 71 |
PROCEDURE setProcedureComment (cd: commentDesc; procname: Name) ; |
| 72 |
|
| 73 |
|
| 74 |
(* |
| 75 |
getProcedureComment - returns the procedure comment if available. |
| 76 |
*) |
| 77 |
|
| 78 |
PROCEDURE getProcedureComment (cd: commentDesc) : String ; |
| 79 |
|
| 80 |
|
| 81 |
(* |
| 82 |
getAfterStatementComment - returns the after comment if available. |
| 83 |
*) |
| 84 |
|
| 85 |
PROCEDURE getAfterStatementComment (cd: commentDesc) : String ; |
| 86 |
|
| 87 |
|
| 88 |
(* |
| 89 |
getInbodyStatementComment - returns the statement comment if available. |
| 90 |
*) |
| 91 |
|
| 92 |
PROCEDURE getInbodyStatementComment (cd: commentDesc) : String ; |
| 93 |
|
| 94 |
|
| 95 |
(* |
| 96 |
isProcedureComment - returns TRUE if, cd, is a procedure comment. |
| 97 |
*) |
| 98 |
|
| 99 |
PROCEDURE isProcedureComment (cd: commentDesc) : BOOLEAN ; |
| 100 |
|
| 101 |
|
| 102 |
(* |
| 103 |
isBodyComment - returns TRUE if, cd, is a body comment. |
| 104 |
*) |
| 105 |
|
| 106 |
PROCEDURE isBodyComment (cd: commentDesc) : BOOLEAN ; |
| 107 |
|
| 108 |
|
| 109 |
(* |
| 110 |
isAfterComment - returns TRUE if, cd, is an after comment. |
| 111 |
*) |
| 112 |
|
| 113 |
PROCEDURE isAfterComment (cd: commentDesc) : BOOLEAN ; |
| 114 |
|
| 115 |
|
| 116 |
END mcComment. |