projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
message: Introduce underlining for error message regions.
[pspp]
/
src
/
ui
/
terminal
/
main.c
diff --git
a/src/ui/terminal/main.c
b/src/ui/terminal/main.c
index 1def93fdab623ef8fe4bbe96930f689df5977af6..d2336472bfb98a0b19d6bc10a8f8864dc38788a6 100644
(file)
--- a/
src/ui/terminal/main.c
+++ b/
src/ui/terminal/main.c
@@
-65,7
+65,7
@@
static void add_syntax_reader (struct lexer *, const char *file_name,
const char *encoding, enum segmenter_mode);
static void bug_handler(int sig);
static void fpu_init (void);
const char *encoding, enum segmenter_mode);
static void bug_handler(int sig);
static void fpu_init (void);
-static void output_msg (const struct msg *,
void
*);
+static void output_msg (const struct msg *,
struct lexer
*);
/* Program entry point. */
int
/* Program entry point. */
int
@@
-109,7
+109,7
@@
main (int argc, char **argv)
terminal_opts_done (terminal_opts, argc, argv);
argv_parser_destroy (parser);
terminal_opts_done (terminal_opts, argc, argv);
argv_parser_destroy (parser);
-
msg_set_handler (output_msg, lexer
);
+
lex_set_message_handler (lexer, output_msg
);
session_set_default_syntax_encoding (the_session, syntax_encoding);
/* Add syntax files to source stream. */
session_set_default_syntax_encoding (the_session, syntax_encoding);
/* Add syntax files to source stream. */
@@
-215,15
+215,21
@@
bug_handler(int sig)
}
static void
}
static void
-output_msg (const struct msg *m_,
void *lexer_
)
+output_msg (const struct msg *m_,
struct lexer *lexer
)
{
{
- struct lexer *lexer = lexer_;
+ struct msg_location *location = m_->location;
+ if (!location && lexer)
+ {
+ location = lex_get_location (lexer, 0, 0);
+ msg_location_remove_columns (location);
+ }
+
struct msg m = {
.category = m_->category,
.severity = m_->severity,
struct msg m = {
.category = m_->category,
.severity = m_->severity,
- .
location = (m_->location ? m_->location
- : lexer ? lex_get_lines (lexer, 0, 0)
-
: NULL)
,
+ .
stack = m_->stack,
+ .n_stack = m_->n_stack,
+
.location = location
,
.command_name = output_get_uppercase_command_name (),
.text = m_->text,
};
.command_name = output_get_uppercase_command_name (),
.text = m_->text,
};