This is closer to compatibility.
result = CMD_FAILURE;
goto finish;
}
- group_open_item_submit (group_open_item_create (command->name));
+ group_open_item_submit (group_open_item_create_nocopy (
+ utf8_to_title (command->name)));
opened = true;
if (command->function == NULL)
#include "data/settings.h"
#include "libpspp/array.h"
#include "libpspp/assertion.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/llx.h"
#include "libpspp/string-map.h"
output_submit__ (e, item);
}
-const char *
+/* Returns the name of the command currently being parsed, in all uppercase.
+ The caller must free the returned value.
+
+ Returns NULL if no command is being parsed. */
+char *
output_get_command_name (void)
{
struct output_engine *e = engine_stack_top ();
for (size_t i = e->n_groups; i-- > 0; )
if (e->groups[i])
- return e->groups[i];
+ return utf8_to_upper (e->groups[i]);
return NULL;
}
void output_set_subtitle (const char *);
void output_set_filename (const char *);
-const char *output_get_command_name (void);
+char *output_get_command_name (void);
size_t output_get_group_level (void);
struct group_open_item *
group_open_item_create (const char *command_name)
+{
+ return group_open_item_create_nocopy (
+ command_name ? xstrdup (command_name) : NULL);
+}
+
+struct group_open_item *
+group_open_item_create_nocopy (char *command_name)
{
struct group_open_item *item;
item = xmalloc (sizeof *item);
output_item_init (&item->output_item, &group_open_item_class);
- item->command_name = command_name ? xstrdup (command_name) : NULL;
+ item->command_name = command_name;
return item;
}
};
struct group_open_item *group_open_item_create (const char *command_name);
+struct group_open_item *group_open_item_create_nocopy (char *command_name);
/* A group_close item. */
struct group_close_item
m.first_column = lex_get_first_column (lexer, 0);
m.last_column = lex_get_last_column (lexer, 0);
}
- m.command_name = CONST_CAST (char *, output_get_command_name ());
+ m.command_name = output_get_command_name ();
message_item_submit (message_item_create (&m));
+
+ free (m.command_name);
}
void
m.last_line = lex_get_last_line_number (lexer, 0);
}
- m.command_name = CONST_CAST (char *, output_get_command_name ());
+ m.command_name = output_get_command_name ();
message_item_submit (message_item_create (&m));
+
+ free (m.command_name);
}
static void
tests_data_sack_CFLAGS = $(AM_CFLAGS)
tests_libpspp_line_reader_test_SOURCES = tests/libpspp/line-reader-test.c
-tests_libpspp_line_reader_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
+tests_libpspp_line_reader_test_LDADD = src/libpspp-core.la
tests_libpspp_ll_test_SOURCES = \
src/libpspp/ll.c \
tests_libpspp_encoding_guesser_test_SOURCES = \
tests/libpspp/encoding-guesser-test.c
-tests_libpspp_encoding_guesser_test_LDADD = \
- src/libpspp/liblibpspp.la \
- gl/libgl.la
+tests_libpspp_encoding_guesser_test_LDADD = src/libpspp-core.la
tests_libpspp_heap_test_SOURCES = \
tests/libpspp/heap-test.c
tests_libpspp_hmapx_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
tests_libpspp_i18n_test_SOURCES = tests/libpspp/i18n-test.c
-tests_libpspp_i18n_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
+tests_libpspp_i18n_test_LDADD = src/libpspp-core.la
tests_libpspp_abt_test_SOURCES = \
src/libpspp/abt.c \
tests_libpspp_stringi_map_test_SOURCES = \
tests/libpspp/stringi-map-test.c
tests_libpspp_stringi_map_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
-tests_libpspp_stringi_map_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
+tests_libpspp_stringi_map_test_LDADD = src/libpspp-core.la
tests_libpspp_string_set_test_SOURCES = \
src/libpspp/hash-functions.c \
tests_libpspp_stringi_set_test_SOURCES = \
tests/libpspp/stringi-set-test.c
tests_libpspp_stringi_set_test_CPPFLAGS = $(AM_CPPFLAGS) -DASSERT_LEVEL=10
-tests_libpspp_stringi_set_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
+tests_libpspp_stringi_set_test_LDADD = src/libpspp-core.la
tests_libpspp_tower_test_SOURCES = \
tests/libpspp/tower-test.c
tests_libpspp_tower_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
tests_libpspp_u8_istream_test_SOURCES = tests/libpspp/u8-istream-test.c
-tests_libpspp_u8_istream_test_LDADD = src/libpspp/liblibpspp.la gl/libgl.la
+tests_libpspp_u8_istream_test_LDADD = src/libpspp-core.la
tests_libpspp_sparse_array_test_SOURCES = \
tests/libpspp/sparse-array-test.c