| 1 |
(* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. *) |
| 2 |
(* This file is part of GNU Modula-2. |
| 3 |
|
| 4 |
GNU Modula-2 is free software; you can redistribute it and/or modify it under |
| 5 |
the terms of the GNU General Public License as published by the Free |
| 6 |
Software Foundation; either version 2, or (at your option) any later |
| 7 |
version. |
| 8 |
|
| 9 |
GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY |
| 10 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 |
for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License along |
| 15 |
with gm2; see the file COPYING. If not, write to the Free Software |
| 16 |
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *) |
| 17 |
MODULE testfunc3 ; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
PROCEDURE WriteLn ; |
| 22 |
BEGIN |
| 23 |
END WriteLn ; |
| 24 |
|
| 25 |
PROCEDURE StartOfIndexInBuffer () : CARDINAL ; |
| 26 |
BEGIN |
| 27 |
RETURN( 0 ) |
| 28 |
END StartOfIndexInBuffer ; |
| 29 |
|
| 30 |
PROCEDURE FindNextLineInBuffer (a, b: CARDINAL) ; |
| 31 |
BEGIN |
| 32 |
END FindNextLineInBuffer ; |
| 33 |
|
| 34 |
PROCEDURE DisplayUpToToken (a, b: CARDINAL) : CARDINAL ; |
| 35 |
BEGIN |
| 36 |
RETURN( a ) |
| 37 |
END DisplayUpToToken ; |
| 38 |
|
| 39 |
PROCEDURE WriteNChars (ch: CHAR; a: CARDINAL) ; |
| 40 |
BEGIN |
| 41 |
END WriteNChars ; |
| 42 |
|
| 43 |
PROCEDURE DisplayRestOfBuffer (a, b: CARDINAL) ; |
| 44 |
BEGIN |
| 45 |
END DisplayRestOfBuffer ; |
| 46 |
|
| 47 |
|
| 48 |
VAR |
| 49 |
BufferOffset, |
| 50 |
TokenLength, |
| 51 |
Indent : CARDINAL ; |
| 52 |
|
| 53 |
|
| 54 |
(* |
| 55 |
WriteBuffer - writes the buffer with the CurrentSymbol underlined. |
| 56 |
*) |
| 57 |
|
| 58 |
PROCEDURE WriteBuffer ; |
| 59 |
VAR |
| 60 |
OffsetIntoSource, |
| 61 |
OffsetIntoBuffer, |
| 62 |
Indent : CARDINAL ; |
| 63 |
BEGIN |
| 64 |
OffsetIntoBuffer := StartOfIndexInBuffer() ; |
| 65 |
OffsetIntoSource := BufferOffset ; |
| 66 |
FindNextLineInBuffer(OffsetIntoBuffer, OffsetIntoSource) ; |
| 67 |
|
| 68 |
(* Found end of first line, now display BufferSource *) |
| 69 |
|
| 70 |
Indent := DisplayUpToToken(OffsetIntoBuffer, OffsetIntoSource) ; |
| 71 |
WriteNChars(' ', Indent) ; |
| 72 |
WriteNChars('^', TokenLength) ; |
| 73 |
WriteLn ; |
| 74 |
DisplayRestOfBuffer(OffsetIntoBuffer, OffsetIntoSource) ; |
| 75 |
WriteLn |
| 76 |
END WriteBuffer ; |
| 77 |
|
| 78 |
|
| 79 |
BEGIN |
| 80 |
WriteBuffer |
| 81 |
END testfunc3. |