projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added the proper quotation marks in the syntax generator when the groups
[pspp-builds.git]
/
src
/
ui
/
gui
/
t-test-independent-samples-dialog.c
diff --git
a/src/ui/gui/t-test-independent-samples-dialog.c
b/src/ui/gui/t-test-independent-samples-dialog.c
index 718709bf23869a3adbaf1459b665b4ff3680bc50..5b3d98f7855139e0d231d34873331d46838e216a 100644
(file)
--- a/
src/ui/gui/t-test-independent-samples-dialog.c
+++ b/
src/ui/gui/t-test-independent-samples-dialog.c
@@
-30,6
+30,7
@@
#include "dict-display.h"
#include "widget-io.h"
#include "t-test-options.h"
#include "dict-display.h"
#include "widget-io.h"
#include "t-test-options.h"
+#include <libpspp/syntax-gen.h>
#include <language/syntax-string-source.h>
#include "syntax-editor.h"
#include <language/syntax-string-source.h>
#include "syntax-editor.h"
@@
-53,6
+54,7
@@
struct tt_indep_samples_dialog
static gchar *
generate_syntax (const struct tt_indep_samples_dialog *d)
{
static gchar *
generate_syntax (const struct tt_indep_samples_dialog *d)
{
+ struct variable *group_variable;
gchar *text;
GtkWidget *entry =
get_widget_assert (d->xml, "indep-samples-t-test-entry");
gchar *text;
GtkWidget *entry =
get_widget_assert (d->xml, "indep-samples-t-test-entry");
@@
-66,17
+68,45
@@
generate_syntax (const struct tt_indep_samples_dialog *d)
g_string_append (str, "\n\t/GROUPS=");
g_string_append (str, "\n\t/GROUPS=");
- g_string_append (str, gtk_entry_get_text (GTK_ENTRY (entry)));
+ group_variable =
+ psppire_dict_lookup_var (d->dict, gtk_entry_get_text (GTK_ENTRY (entry)));
+
+ g_string_append (str, var_get_name (group_variable));
if ( d->groups_defined )
{
GtkWidget *entry1 = get_widget_assert (d->xml, "group1-entry");
GtkWidget *entry2 = get_widget_assert (d->xml, "group2-entry");
if ( d->groups_defined )
{
GtkWidget *entry1 = get_widget_assert (d->xml, "group1-entry");
GtkWidget *entry2 = get_widget_assert (d->xml, "group2-entry");
+ const gchar *val1 = gtk_entry_get_text (GTK_ENTRY (entry1));
+ const gchar *val2 = gtk_entry_get_text (GTK_ENTRY (entry2));
+
g_string_append (str, "(");
g_string_append (str, "(");
- g_string_append (str, gtk_entry_get_text (GTK_ENTRY (entry1)));
+ if ( var_is_alpha (group_variable))
+ {
+ struct string s;
+ ds_init_cstr (&s, val1);
+ gen_quoted_string (&s);
+ g_string_append (str, ds_cstr (&s));
+ ds_destroy (&s);
+ }
+ else
+ {
+ g_string_append (str, val1);
+ }
g_string_append (str, ",");
g_string_append (str, ",");
- g_string_append (str, gtk_entry_get_text (GTK_ENTRY (entry2)));
+ if ( var_is_alpha (group_variable))
+ {
+ struct string s;
+ ds_init_cstr (&s, val2);
+ gen_quoted_string (&s);
+ g_string_append (str, ds_cstr (&s));
+ ds_destroy (&s);
+ }
+ else
+ {
+ g_string_append (str, val2);
+ }
g_string_append (str, ")");
}
g_string_append (str, ")");
}