static const char *parse_options (int argc, char **argv);
static void usage (void) NO_RETURN;
static void read_table (struct lexer *);
-static void output_msg (const struct msg *, void *);
+static void output_msg (const struct msg *, struct lexer *);
int
main (int argc, char **argv)
exit (1);
struct lexer *lexer = lex_create ();
- msg_set_handler (output_msg, lexer);
+ lex_set_message_handler (lexer, output_msg);
lex_include (lexer, reader);
lex_get (lexer);
string_map_insert (&options, "trim", "true");
register_driver (&options, "%s.pdf", output_base);
+ /* Render to <base>-paged.pdf. */
+ register_driver (&options, "%s-paged.pdf", output_base);
+
+ /* Render to <base>.txt. */
string_map_insert (&options, "box", "unicode");
register_driver (&options, "%s.txt", output_base);
+ /* Render to <base>-ascii.txt. */
string_map_insert (&options, "box", "ascii");
register_driver (&options, "%s-ascii.txt", output_base);
+ /* Render additional versions. */
register_driver (&options, "%s.csv", output_base);
register_driver (&options, "%s.odt", output_base);
register_driver (&options, "%s.spv", output_base);
if (ok)
{
- if (!fmt_check_output (&fmt)
- || !fmt_check_type_compat (&fmt, VAL_NUMERIC))
+ if (!fmt_check_output (fmt)
+ || !fmt_check_type_compat (fmt, VAL_NUMERIC))
exit (1);
value->numeric.format = fmt;
return;
}
- lex_error (lexer, "Expecting valid value option");
+ lex_error (lexer, "Syntax error expecting valid value option.");
exit (1);
}
if (lex_match_id (lexer, table_stroke_to_string (stroke)))
return stroke;
- lex_error (lexer, "expecting stroke");
+ lex_error (lexer, "Syntax error expecting stroke.");
exit (1);
}
if (!displayed)
pivot_table_submit (pt);
else
- pivot_table_unshare (pt);
+ pivot_table_unref (pt);
force_match (lexer, T_ENDCMD);
}
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 m = *m_;
-
- if (m.file_name == NULL)
- {
- m.file_name = CONST_CAST (char *, lex_get_file_name (lexer));
- m.first_line = lex_get_first_line_number (lexer, 0);
- m.last_line = lex_get_last_line_number (lexer, 0);
- }
-
- m.command_name = output_get_uppercase_command_name ();
+ struct msg m = {
+ .category = m_->category,
+ .severity = m_->severity,
+ .location = (m_->location ? m_->location
+ : lexer ? lex_get_location (lexer, 0, 0)
+ : NULL),
+ .command_name = output_get_uppercase_command_name (),
+ .text = m_->text,
+ };
output_item_submit (message_item_create (&m));
free (m.command_name);
+ if (m.location != m_->location)
+ msg_location_destroy (m.location);
}