comparison anagram/guisupport/errordc.cpp @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * errordc.cpp
7 */
8
9 #include "brt.h"
10 #include "dc.h"
11 #include "error.h"
12 #include "errordc.h"
13 #include "stacks.h"
14 #include "wm1.h"
15
16 //#define INCLUDE_LOGGING
17 #include "log.h"
18
19
20 void error_display_dc::synchCursor(unsigned ln) const {
21 set_text_line(errorList[ln].line, errorList[ln].column, 0);
22 }
23
24 //dc *error_display_cursor(dc *d, int k);
25
26 error_display_dc::error_display_dc(void)
27 : dc("Warnings")
28 {
29 LOGSECTION("error_display_dc::error_display_dc");
30 LOGV((int) this);
31 cint size;
32 unsigned i, dw, n;
33 //extern cint cursor_bar_size;
34 int nerrors = errorList.size();
35 LOGV(nerrors);
36
37 for (i = dw = 0; i < nerrors; i++) {
38 getLine(i);
39 n = rcs();
40 if (n > dw) {
41 dw = n;
42 }
43 }
44 size.x = dw;
45 size.y = nerrors;
46 des->d_size = size;
47 }
48
49 void error_display_dc::getLine(unsigned ln) const {
50 LOGSECTION("error_display_dc::getLine");
51 Error &e=errorList[ln];
52 if (e.file.exists()) {
53 ssprintf("%s: Line %d, Col %d: %s", e.file.pointer(), e.line, e.column,
54 e.message.pointer());
55 }
56 else {
57 ssprintf("Line %d, Col %d: %s", e.line, e.column, e.message.pointer());
58 }
59 }
60
61 AgString error_display_dc::findHelpTopic() {
62 dc_ref window;
63 char *q;
64
65 //update_screen(this);
66 getLine(des->c_loc_doc.y);
67 q = string_base;
68 if (strncmp(q, "Line ", 5) == 0) {
69 q = strchr(q, ':');
70 if (q) {
71 q += 2;
72 }
73 }
74 AgString topic = q;
75 rcs();
76 return topic;
77 }
78