f(x) = .5 + erf(x / sqrt(2)) / 2 for x > 0
- f(x) = erfc( -x / sqrt(2)) / 2 for x < 0
+ f(x) = erfc(-x / sqrt(2)) / 2 for x < 0
where f(x) is standard normal c. d. f.
ps = 0.5 - 0.5 * p;
yi = sqrt (log (1.0 / (ps * ps)));
- t = yi + (((( yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0)
- / (((( yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0);
+ t = yi + ((((yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0)
+ / ((((yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0);
if (v < vmax) t += (t * t * t + t) / v / 4.0;
q = c1 - c2 * t;
if (v < vmax) q += -c3 / v + c4 * t / v;
help quiet diag! filter! hints! changes! cplusplus
patch=s copy=s diff=s compat-version=s
list-provided list-unsupported api-info=s
- )) or usage();
+)) or usage();
};
if ($@ and grep /^-/, @ARGV) {
my $rcce = quotemeta $cce;
my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/
- ? ( $1 => {
- ($2 ? ( base => $2 ) : ()),
- ($3 ? ( todo => $3 ) : ()),
- (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()),
- (index($4, 'p') >= 0 ? ( provided => 1 ) : ()),
- (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()),
- } )
+ ? ($1 => {
+ ($2 ? (base => $2) : ()),
+ ($3 ? (todo => $3) : ()),
+ (index($4, 'v') >= 0 ? (varargs => 1) : ()),
+ (index($4, 'p') >= 0 ? (provided => 1) : ()),
+ (index($4, 'n') >= 0 ? (nothxarg => 1) : ()),
+ })
: die "invalid spec: $_" } qw(
AvFILLp|5.004050||p
AvFILL|||
}
my @files;
-my @srcext = qw( xs c h cc cpp );
+my @srcext = qw(xs c h cc cpp);
my $srcext = join '|', @srcext;
if (@ARGV) {
(?:"[^"\\]*(?:\\.[^"\\]*)*" [^"'/]*)+
|
(?:'[^'\\]*(?:\\.[^'\\]*)*' [^"'/]*)+
- )
+)
|
(/ (?:
\*[^*]*\*+(?:[^$ccs][^*]*\*+)* /
|
/[^\r\n]*
- ))
+))
}{
defined $2 and push @ccom, $2;
defined $1 ? $1 : "$ccs$#ccom$cce";
sub usage
{
my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
- my %M = ( 'I' => '*' );
+ my %M = ('I' => '*');
$usage =~ s/^\s*perl\s+\S+/$^X $0/;
$usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
# define sv_uv(sv) SvUVx(sv)
#endif
#ifndef XST_mUV
-# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) )
+# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)))
#endif
#ifndef XSRETURN_UV
* case below uses it to declare the data as static. */
#define START_MY_CXT
-#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
+#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68))
/* Fetches the SV that keeps the per-interpreter data. */
#define dMY_CXT_SV \
SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
break;
}
- if ( ( overflowed && value_nv > 4294967295.0)
+ if ((overflowed && value_nv > 4294967295.0)
#if UVSIZE > 4
- || (!overflowed && value > 0xffffffff )
+ || (!overflowed && value > 0xffffffff)
#endif
) {
warn("Binary number > 0b11111111111111111111111111111111 non-portable");
break;
}
- if ( ( overflowed && value_nv > 4294967295.0)
+ if ((overflowed && value_nv > 4294967295.0)
#if UVSIZE > 4
- || (!overflowed && value > 0xffffffff )
+ || (!overflowed && value > 0xffffffff)
#endif
) {
warn("Hexadecimal number > 0xffffffff non-portable");
break;
}
- if ( ( overflowed && value_nv > 4294967295.0)
+ if ((overflowed && value_nv > 4294967295.0)
#if UVSIZE > 4
- || (!overflowed && value > 0xffffffff )
+ || (!overflowed && value > 0xffffffff)
#endif
) {
warn("Octal number > 037777777777 non-portable");
case_map_dump (const struct case_map *cm)
{
int i;
- for (i = 0 ; i < caseproto_get_n_widths (cm->proto); ++i )
+ for (i = 0 ; i < caseproto_get_n_widths (cm->proto); ++i)
printf ("%d -> %d\n", i, cm->map[i]);
}
{
size_t i;
- for (i = n_values; i-- != 0; )
+ for (i = n_values; i-- != 0;)
value_copy (&dst->values[dst_idx + i], &src->values[src_idx + i],
caseproto_get_width (dst->proto, dst_idx + i));
}
const union value *value = case_data (c, var);
if (var_is_value_missing (var, value, cfm->class))
{
- if ( cfm->n_missing )
+ if (cfm->n_missing)
(*cfm->n_missing)++;
return false;
}
enum rank_error *err,
distinct_func *distinct_callback,
void *aux
- )
+ )
{
struct casereader_append_rank *car = xmalloc (sizeof *car);
car->proto = caseproto_ref (casereader_get_proto (subreader));
const double value = case_data (input, car->var)->f;
- if ( car->prev_value != SYSMIS)
+ if (car->prev_value != SYSMIS)
{
if (car->err && value < car->prev_value)
*car->err |= RANK_ERR_UNSORTED;
}
- if ( car->n_common == 1)
+ if (car->n_common == 1)
{
double vxx = SYSMIS;
casenumber k = 0;
if (car->weight)
{
weight = case_data (input, car->weight)->f;
- if ( car->err && weight < 0 )
+ if (car->err && weight < 0)
*car->err |= RANK_ERR_NEGATIVE_WEIGHT;
}
break;
vxx = case_data (c, car->var)->f;
- if ( vxx == value)
+ if (vxx == value)
{
if (car->weight)
{
double w = case_data (c, car->weight)->f;
- if ( car->err && w < 0 )
+ if (car->err && w < 0)
*car->err |= RANK_ERR_NEGATIVE_WEIGHT;
weight += w;
cdr->n ++;
cdr->cc += weight;
- if ( NULL == next_case)
+ if (NULL == next_case)
goto end;
dir = value_compare_3way (case_data (next_case, cdr->key),
current_value, key_width);
case_unref (next_case);
- if ( dir != 0 )
+ if (dir != 0)
{
/* Insist that the data are sorted */
assert (cdr->direction == 0 || dir == cdr->direction);
cdr->clone = casereader_clone (input);
cdr->direction = 0;
- if ( NULL == cdr->weight )
+ if (NULL == cdr->weight)
output_proto = caseproto_add_width (output_proto, 0);
cdr->proto = output_proto;
{
struct casereader *reader = CONST_CAST (struct casereader *, reader_);
struct casereader *clone;
- if ( reader == NULL )
+ if (reader == NULL)
return NULL;
if (reader->class->clone == NULL)
assert (start_column + n_columns <= datasheet_get_n_columns (ds));
prow = axis_map (ds->rows, lrow);
- for (i = 0; i < n_columns; )
+ for (i = 0; i < n_columns;)
{
struct source *source = columns[i].source;
size_t j;
dict_dump (const struct dictionary *d)
{
int i;
- for (i = 0 ; i < d->var_cnt ; ++i )
+ for (i = 0 ; i < d->var_cnt ; ++i)
{
const struct variable *v = d->var[i].var;
printf ("Name: %s;\tdict_idx: %zu; case_idx: %zu\n",
{
/* FIXME? Should we really clear case_limit, label, documents?
Others are necessarily cleared by deleting all the variables.*/
- while (d->var_cnt > 0 )
+ while (d->var_cnt > 0)
{
dict_delete_var (d, d->var[d->var_cnt - 1].var);
}
vardict->case_index = case_index;
var_set_vardict (v, vardict);
- if ( d->changed ) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->var_added )
+ if (d->changed) d->changed (d, d->changed_data);
+ if (d->callbacks && d->callbacks->var_added)
d->callbacks->var_added (d, var_get_dict_index (v), d->cb_data);
invalidate_proto (d);
hmap_insert_fast (&d->name_map, &vardict->name_node,
vardict->name_node.hash);
- if ( d->changed ) d->changed (d, d->changed_data);
+ if (d->changed) d->changed (d, d->changed_data);
if (old)
{
d->callbacks->var_changed (d, var_get_dict_index (var), VAR_TRAIT_POSITION, old, d->cb_data);
/* Free memory. */
var_clear_vardict (v);
- if ( d->changed ) d->changed (d, d->changed_data);
+ if (d->changed) d->changed (d, d->changed_data);
invalidate_proto (d);
- if (d->callbacks && d->callbacks->var_deleted )
+ if (d->callbacks && d->callbacks->var_deleted)
d->callbacks->var_deleted (d, v, dict_index, case_index, d->cb_data);
var_destroy (v);
details. Deleting consecutive vars will result in less callbacks
compared to iterating over dict_delete_var.
A simple while loop over dict_delete_var will
- produce (d->var_cnt - IDX ) * COUNT variable changed callbacks
+ produce (d->var_cnt - IDX) * COUNT variable changed callbacks
plus COUNT variable delete callbacks.
This here produces d->var_cnt - IDX variable changed callbacks
plus COUNT variable delete callbacks. */
reindex_vars (d, idx, d->var_cnt);
invalidate_proto (d);
- if ( d->changed ) d->changed (d, d->changed_data);
+ if (d->changed) d->changed (d, d->changed_data);
/* Now issue the variable delete callbacks and delete
the variables. The vardict is not valid at this point
{
struct delvar *dv = (struct delvar *) ll_pop_head (&list);
var_clear_vardict (dv->var);
- if (d->callbacks && d->callbacks->var_deleted )
+ if (d->callbacks && d->callbacks->var_deleted)
d->callbacks->var_deleted (d, dv->var, vi, dv->case_index, d->cb_data);
var_destroy (dv->var);
free (dv);
/* FIXME: this can be done in O(count) time, but this algorithm
is O(count**2). */
- for (i = 0; i < d->var_cnt; )
+ for (i = 0; i < d->var_cnt;)
if (var_get_dict_class (d->var[i].var) == DC_SCRATCH)
dict_delete_var (d, d->var[i].var);
else
if (settings_get_algorithm () == ENHANCED)
var_clear_short_names (v);
- if ( d->changed ) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->var_changed )
+ if (d->changed) d->changed (d, d->changed_data);
+ if (d->callbacks && d->callbacks->var_changed)
d->callbacks->var_changed (d, var_get_dict_index (v), VAR_TRAIT_NAME, old, d->cb_data);
var_destroy (old);
d->weight = v;
if (d->changed) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->weight_changed )
+ if (d->callbacks && d->callbacks->weight_changed)
d->callbacks->weight_changed (d,
v ? var_get_dict_index (v) : -1,
d->cb_data);
d->filter = v;
if (d->changed) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->filter_changed )
+ if (d->callbacks && d->callbacks->filter_changed)
d->callbacks->filter_changed (d,
v ? var_get_dict_index (v) : -1,
d->cb_data);
assert (cnt == 0 || split != NULL);
d->split_cnt = cnt;
- if ( cnt > 0 )
+ if (cnt > 0)
{
d->split = xnrealloc (d->split, cnt, sizeof *d->split) ;
memcpy (d->split, split, cnt * sizeof *d->split);
}
if (d->changed) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->split_changed )
+ if (d->callbacks && d->callbacks->split_changed)
d->callbacks->split_changed (d, d->cb_data);
}
const char *s;
dict_clear_documents (d);
- for (s = new_docs; *s != '\0'; )
+ for (s = new_docs; *s != '\0';)
{
size_t len = strcspn (s, "\n");
char *line = xmemdup0 (s, len);
assert (dict_contains_var (dict, var));
- for (i = 0; i < dict->n_mrsets; )
+ for (i = 0; i < dict->n_mrsets;)
{
struct mrset *mrset = dict->mrsets[i];
size_t j;
- for (j = 0; j < mrset->n_vars; )
+ for (j = 0; j < mrset->n_vars;)
if (mrset->vars[j] == var)
remove_element (mrset->vars, mrset->n_vars--,
sizeof *mrset->vars, j);
void
dict_var_changed (const struct variable *v, unsigned int what, struct variable *oldvar)
{
- if ( var_has_vardict (v))
+ if (var_has_vardict (v))
{
const struct vardict_info *vardict = var_get_vardict (v);
struct dictionary *d = vardict->dict;
- if ( NULL == d)
+ if (NULL == d)
return;
- if (d->changed ) d->changed (d, d->changed_data);
- if ( d->callbacks && d->callbacks->var_changed )
+ if (d->changed) d->changed (d, d->changed_data);
+ if (d->callbacks && d->callbacks->var_changed)
d->callbacks->var_changed (d, var_get_dict_index (v), what, oldvar, d->cb_data);
}
var_destroy (oldvar);
HMAP_FOR_EACH_WITH_HASH (lock, struct fh_lock, node, hash, &locks)
{
- if ( 0 == compare_fh_locks (lock, key))
+ if (0 == compare_fh_locks (lock, key))
{
found_lock = true;
break;
}
}
- if ( found_lock )
+ if (found_lock)
{
if (strcmp (lock->type, type))
{
found_lock = false;
HMAP_FOR_EACH_WITH_HASH (lock, struct fh_lock, node, hash, &locks)
{
- if ( 0 == compare_fh_locks (lock, key))
+ if (0 == compare_fh_locks (lock, key))
{
found_lock = true;
break;
HMAP_FOR_EACH_WITH_HASH (k, struct fh_lock, node, hash, &locks)
{
- if ( 0 == compare_fh_locks (k, &key))
+ if (0 == compare_fh_locks (k, &key))
{
is_locked = true;
break;
file = xasprintf ("%s/%s", dir, base_name);
struct stat temp;
- if (( (stat (file, &temp) == 0 ) && ( ! S_ISDIR (temp.st_mode) )))
+ if (((stat (file, &temp) == 0) && (! S_ISDIR (temp.st_mode))))
return file;
free (file);
{
const char *name = fh_get_file_name (fh);
struct stat temp;
- if ( stat (name, &temp) != 0 )
+ if (stat (name, &temp) != 0)
return false;
return ! S_ISDIR (temp.st_mode);
{
static char *path = NULL;
- if ( path == NULL)
+ if (path == NULL)
{
/* Windows NT defines HOMEDRIVE and HOMEPATH. But give preference
to HOME, because the user can change HOME. */
if (dots || commas)
delim_digits++;
}
- else if (c == '.' )
+ else if (c == '.')
{
dots++;
prev_delim = c;
int t;
settings = xzalloc (sizeof *settings);
- for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t )
+ for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t)
fmt_number_style_init (&settings->styles[t]);
fmt_settings_set_decimal (settings, '.');
{
int t;
- for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t )
+ for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t)
fmt_number_style_destroy (&settings->styles[t]);
free (settings->styles);
int t;
new = xmalloc (sizeof *new);
- for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t )
+ for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t)
fmt_number_style_clone (&new->styles[t], &old->styles[t]);
return new;
(gr->sheets[n].stop_col == -1)
&&
(1 == (ret = xmlTextReaderRead (gr->msd.xtr)))
- )
+ )
{
process_node (gr, &gr->msd);
}
{
struct gnumeric_reader *r = r_;
- if ( r == NULL)
+ if (r == NULL)
return ;
state_data_destroy (&r->rsd);
- if (r->first_case && ! r->used_first_case )
+ if (r->first_case && ! r->used_first_case)
case_unref (r->first_case);
if (r->proto)
}
else if (XML_READER_TYPE_TEXT == sd->node_type)
{
- if ( r->sheets [r->spreadsheet.n_sheets - 1].name == NULL)
+ if (r->sheets [r->spreadsheet.n_sheets - 1].name == NULL)
r->sheets [r->spreadsheet.n_sheets - 1].name = CHAR_CAST (char *, xmlTextReaderValue (sd->xtr));
}
break;
}
else if (XML_READER_TYPE_TEXT == sd->node_type)
{
- if ( r->target_sheet != NULL)
+ if (r->target_sheet != NULL)
{
xmlChar *value = xmlTextReaderValue (sd->xtr);
- if ( 0 == xmlStrcmp (value, r->target_sheet))
+ if (0 == xmlStrcmp (value, r->target_sheet))
sd->state = STATE_SHEET_FOUND;
free (value);
}
if (! xmlTextReaderIsEmptyElement (sd->xtr))
sd->state = STATE_CELL;
}
- else if ( (0 == xmlStrcasecmp (name, _xml("gnm:Cells"))) && (XML_READER_TYPE_END_ELEMENT == sd->node_type) )
+ else if ((0 == xmlStrcasecmp (name, _xml("gnm:Cells"))) && (XML_READER_TYPE_END_ELEMENT == sd->node_type))
{
r->sheets[sd->current_sheet].stop_col = sd->col;
r->sheets[sd->current_sheet].stop_row = sd->row;
if (xv == NULL)
value_set_missing (v, var_get_width (var));
- else if ( var_is_alpha (var))
+ else if (var_is_alpha (var))
value_copy_str_rpad (v, var_get_width (var), xv, ' ');
else if (type == VALUE_FLOAT || type == VALUE_INTEGER)
{
errno = 0;
v->f = c_strtod (text, &endptr);
- if ( errno != 0 || endptr == text)
+ if (errno != 0 || endptr == text)
v->f = SYSMIS;
}
else
xtr = xmlReaderForIO ((xmlInputReadCallback) gzread,
(xmlInputCloseCallback) gzclose, gz,
NULL, NULL,
- show_errors ? 0 : (XML_PARSE_NOERROR | XML_PARSE_NOWARNING) );
+ show_errors ? 0 : (XML_PARSE_NOERROR | XML_PARSE_NOWARNING));
if (xtr == NULL)
{
This gives us some confidence that we are actually dealing with a gnumeric
spreadsheet.
*/
- while ( (sd->state != STATE_INIT )
+ while ((sd->state != STATE_INIT)
&& 1 == (ret = xmlTextReaderRead (sd->xtr)))
{
process_node (r, sd);
}
- if ( ret != 1)
+ if (ret != 1)
{
/* Does not seem to be a gnumeric file */
gnumeric_unref (&r->spreadsheet);
const xmlChar *enc = xmlTextReaderConstEncoding (sd->xtr);
xmlCharEncoding xce = xmlParseCharEncoding (CHAR_CAST (const char *, enc));
- if ( XML_CHAR_ENCODING_UTF8 != xce)
+ if (XML_CHAR_ENCODING_UTF8 != xce)
{
/* I have been told that ALL gnumeric files are UTF8 encoded. If that is correct, this
can never happen. */
r = gnumeric_reopen (r, NULL, true);
- if ( opts->cell_range )
+ if (opts->cell_range)
{
- if ( ! convert_cell_ref (opts->cell_range,
+ if (! convert_cell_ref (opts->cell_range,
&r->start_col, &r->start_row,
&r->stop_col, &r->stop_row))
{
r->proto = NULL;
/* Advance to the start of the cells for the target sheet */
- while ( (r->rsd.state != STATE_CELL || r->rsd.row < r->start_row )
+ while ((r->rsd.state != STATE_CELL || r->rsd.row < r->start_row)
&& 1 == (ret = xmlTextReaderRead (r->rsd.xtr)))
{
xmlChar *value ;
process_node (r, &r->rsd);
value = xmlTextReaderValue (r->rsd.xtr);
- if ( r->rsd.state == STATE_MAXROW && r->rsd.node_type == XML_READER_TYPE_TEXT)
+ if (r->rsd.state == STATE_MAXROW && r->rsd.node_type == XML_READER_TYPE_TEXT)
{
n_cases = 1 + _xmlchar_to_int (value) ;
}
/* If a range has been given, then use that to calculate the number
of cases */
- if ( opts->cell_range)
+ if (opts->cell_range)
{
n_cases = MIN (n_cases, r->stop_row - r->start_row + 1);
}
- if ( opts->read_names )
+ if (opts->read_names)
{
r->start_row++;
n_cases --;
/* Read in the first row of cells,
including the headers if read_names was set */
while (
- (( r->rsd.state == STATE_CELLS_START && r->rsd.row <= r->start_row) || r->rsd.state == STATE_CELL )
+ ((r->rsd.state == STATE_CELLS_START && r->rsd.row <= r->start_row) || r->rsd.state == STATE_CELL)
&& (ret = xmlTextReaderRead (r->rsd.xtr))
- )
+ )
{
int idx;
process_node (r, &r->rsd);
- if ( r->rsd.row > r->start_row )
+ if (r->rsd.row > r->start_row)
{
xmlChar *attr =
xmlTextReaderGetAttribute (r->rsd.xtr, _xml ("ValueType"));
break;
}
- if ( r->rsd.col < r->start_col ||
+ if (r->rsd.col < r->start_col ||
(r->stop_col != -1 && r->rsd.col > r->stop_col))
continue;
idx = r->rsd.col - r->start_col;
- if ( idx >= n_var_specs )
+ if (idx >= n_var_specs)
{
int i;
var_spec = xrealloc (var_spec, sizeof (*var_spec) * (idx + 1));
var_spec [idx].first_type = type;
- if ( r->rsd.node_type == XML_READER_TYPE_TEXT )
+ if (r->rsd.node_type == XML_READER_TYPE_TEXT)
{
xmlChar *value = xmlTextReaderValue (r->rsd.xtr);
const char *text = CHAR_CAST (const char *, value);
- if ( r->rsd.row < r->start_row)
+ if (r->rsd.row < r->start_row)
{
- if ( opts->read_names )
+ if (opts->read_names)
{
var_spec [idx].name = xstrdup (text);
}
{
var_spec [idx].first_value = xmlStrdup (value);
- if (-1 == var_spec [idx].width )
+ if (-1 == var_spec [idx].width)
var_spec [idx].width = (opts->asw == -1) ?
ROUND_UP (strlen(text), SPREADSHEET_DEFAULT_WIDTH) : opts->asw;
}
free (value);
}
- else if ( r->rsd.node_type == XML_READER_TYPE_ELEMENT
+ else if (r->rsd.node_type == XML_READER_TYPE_ELEMENT
&& r->rsd.state == STATE_CELL)
{
- if ( r->rsd.row == r->start_row )
+ if (r->rsd.row == r->start_row)
{
xmlChar *attr =
xmlTextReaderGetAttribute (r->rsd.xtr, _xml ("ValueType"));
- if ( NULL == attr || VALUE_STRING != _xmlchar_to_int (attr))
+ if (NULL == attr || VALUE_STRING != _xmlchar_to_int (attr))
var_spec [idx].width = 0;
free (attr);
{
const xmlChar *enc = xmlTextReaderConstEncoding (r->rsd.xtr);
- if ( enc == NULL)
+ if (enc == NULL)
goto error;
/* Create the dictionary and populate it */
spreadsheet->dict = r->dict = dict_create (CHAR_CAST (const char *, enc));
}
- for (i = 0 ; i < n_var_specs ; ++i )
+ for (i = 0 ; i < n_var_specs ; ++i)
{
char *name;
- if ( (var_spec[i].name == NULL) && (var_spec[i].first_value == NULL))
+ if ((var_spec[i].name == NULL) && (var_spec[i].first_value == NULL))
continue;
/* Probably no data exists for this variable, so allocate a
default width */
- if ( var_spec[i].width == -1 )
+ if (var_spec[i].width == -1)
var_spec[i].width = SPREADSHEET_DEFAULT_WIDTH;
name = dict_make_unique_var_name (r->dict, var_spec[i].name, &vstart);
/* Create the first case, and cache it */
r->used_first_case = false;
- if ( n_var_specs == 0 )
+ if (n_var_specs == 0)
{
msg (MW, _("Selected sheet or range of spreadsheet `%s' is empty."),
spreadsheet->file_name);
case_set_missing (r->first_case);
- for ( i = 0 ; i < n_var_specs ; ++i )
+ for (i = 0 ; i < n_var_specs ; ++i)
{
const struct variable *var;
- if ( (var_spec[i].name == NULL) && (var_spec[i].first_value == NULL))
+ if ((var_spec[i].name == NULL) && (var_spec[i].first_value == NULL))
continue;
var = dict_get_var (r->dict, x++);
r->rsd.row - 1);
}
- for ( i = 0 ; i < n_var_specs ; ++i )
+ for (i = 0 ; i < n_var_specs ; ++i)
{
free (var_spec[i].first_value);
free (var_spec[i].name);
error:
- for ( i = 0 ; i < n_var_specs ; ++i )
+ for (i = 0 ; i < n_var_specs ; ++i)
{
free (var_spec[i].first_value);
free (var_spec[i].name);
struct gnumeric_reader *r = r_;
int current_row = r->rsd.row;
- if ( !r->used_first_case )
+ if (!r->used_first_case)
{
r->used_first_case = true;
return r->first_case;
r->start_col = r->rsd.min_col;
- while ((r->rsd.state == STATE_CELL || r->rsd.state == STATE_CELLS_START )
+ while ((r->rsd.state == STATE_CELL || r->rsd.state == STATE_CELLS_START)
&& r->rsd.row == current_row && (ret = xmlTextReaderRead (r->rsd.xtr)))
{
process_node (r, &r->rsd);
xmlFree (attr);
}
- if ( r->rsd.col < r->start_col || (r->stop_col != -1 &&
+ if (r->rsd.col < r->start_col || (r->stop_col != -1 &&
r->rsd.col > r->stop_col))
continue;
- if ( r->rsd.col - r->start_col >= caseproto_get_n_widths (r->proto))
+ if (r->rsd.col - r->start_col >= caseproto_get_n_widths (r->proto))
continue;
- if ( r->stop_row != -1 && r->rsd.row > r->stop_row)
+ if (r->stop_row != -1 && r->rsd.row > r->stop_row)
break;
- if ( r->rsd.node_type == XML_READER_TYPE_TEXT )
+ if (r->rsd.node_type == XML_READER_TYPE_TEXT)
{
xmlChar *value = xmlTextReaderValue (r->rsd.xtr);
const int idx = r->rsd.col - r->start_col;
TOKEN_TYPE(ASTERISK) /* * */ \
TOKEN_TYPE(SLASH) /* / */ \
TOKEN_TYPE(EQUALS) /* = */ \
- TOKEN_TYPE(LPAREN) /* ( */ \
- TOKEN_TYPE(RPAREN) /* ) */ \
+ TOKEN_TYPE(LPAREN) /* (*/ \
+ TOKEN_TYPE(RPAREN) /*) */ \
TOKEN_TYPE(LBRACK) /* [ */ \
TOKEN_TYPE(RBRACK) /* ] */ \
TOKEN_TYPE(COMMA) /* , */ \
{
if (r->target_sheet_name != NULL)
{
- if ( 0 == xmlStrcmp (r->target_sheet_name, msd->current_sheet_name))
+ if (0 == xmlStrcmp (r->target_sheet_name, msd->current_sheet_name))
return true;
}
while (
(r->n_allocated_sheets <= n)
|| or->state != STATE_SPREADSHEET
- )
+ )
{
int ret = xmlTextReaderRead (or->xtr);
- if ( ret != 1)
+ if (ret != 1)
break;
process_node (r, or);
(r->n_allocated_sheets <= n)
|| (r->sheets[n].stop_row == -1)
|| or->state != STATE_SPREADSHEET
- )
+ )
{
int ret = xmlTextReaderRead (or->xtr);
- if ( ret != 1)
+ if (ret != 1)
break;
process_node (r, or);
ods_file_casereader_destroy (struct casereader *reader UNUSED, void *r_)
{
struct ods_reader *r = r_;
- if ( r == NULL)
+ if (r == NULL)
return ;
state_data_destroy (&r->rsd);
- if ( ! ds_is_empty (&r->ods_errs))
+ if (! ds_is_empty (&r->ods_errs))
msg (ME, "%s", ds_cstr (&r->ods_errs));
ds_destroy (&r->ods_errs);
- if ( r->first_case && ! r->used_first_case )
+ if (r->first_case && ! r->used_first_case)
case_unref (r->first_case);
}
break;
case STATE_ROW:
- if ( (0 == xmlStrcasecmp (name, _xml ("table:table-cell")))
+ if ((0 == xmlStrcasecmp (name, _xml ("table:table-cell")))
&&
(XML_READER_TYPE_ELEMENT == r->node_type))
{
xmlFree (value);
}
- else if ( (0 == xmlStrcasecmp (name, _xml ("table:table-row")))
+ else if ((0 == xmlStrcasecmp (name, _xml ("table:table-row")))
&&
(XML_READER_TYPE_END_ELEMENT == r->node_type))
{
}
break;
case STATE_CELL:
- if ( (0 == xmlStrcasecmp (name, _xml("text:p")))
+ if ((0 == xmlStrcasecmp (name, _xml("text:p")))
&&
- ( XML_READER_TYPE_ELEMENT == r->node_type))
+ (XML_READER_TYPE_ELEMENT == r->node_type))
{
if (! xmlTextReaderIsEmptyElement (r->xtr))
r->state = STATE_CELL_CONTENT;
}
else if
- ( (0 == xmlStrcasecmp (name, _xml("table:table-cell")))
+ ((0 == xmlStrcasecmp (name, _xml("table:table-cell")))
&&
(XML_READER_TYPE_END_ELEMENT == r->node_type)
- )
+ )
{
r->state = STATE_ROW;
}
(or->sheets[r->current_sheet].start_col == -1)
||
(or->sheets[r->current_sheet].start_col >= r->col - 1)
- )
+ )
or->sheets[r->current_sheet].start_col = r->col - 1;
or->sheets[r->current_sheet].stop_row = r->row - 1;
- if ( or->sheets[r->current_sheet].stop_col < r->col - 1)
+ if (or->sheets[r->current_sheet].stop_col < r->col - 1)
or->sheets[r->current_sheet].stop_col = r->col - 1;
if (XML_READER_TYPE_END_ELEMENT == r->node_type)
if (xmv->type != NULL && 0 != xmlStrcmp (xmv->type, _xml("string")))
return 0;
- if ( fallback != -1)
+ if (fallback != -1)
return fallback;
- if ( xmv->value )
+ if (xmv->value)
width = ROUND_UP (xmlStrlen (xmv->value),
SPREADSHEET_DEFAULT_WIDTH);
- else if ( xmv->text)
+ else if (xmv->text)
width = ROUND_UP (xmlStrlen (xmv->text),
SPREADSHEET_DEFAULT_WIDTH);
if (xmv->value == NULL && xmv->text == NULL)
value_set_missing (v, var_get_width (var));
- else if ( var_is_alpha (var))
+ else if (var_is_alpha (var))
/* Use the text field, because it seems that there is no
value field for strings */
value_copy_str_rpad (v, var_get_width (var), xmv->text, ' ');
const struct fmt_spec *fmt = var_get_write_format (var);
enum fmt_category fc = fmt_get_category (fmt->type);
- assert ( fc != FMT_CAT_STRING);
+ assert (fc != FMT_CAT_STRING);
- if ( 0 == xmlStrcmp (xmv->type, _xml("float")))
+ if (0 == xmlStrcmp (xmv->type, _xml("float")))
{
v->f = c_strtod (CHAR_CAST (const char *, xmv->value), NULL);
}
struct zip_member *meta = NULL;
meta = zip_member_open (zreader, "meta.xml");
- if ( meta == NULL)
+ if (meta == NULL)
return -1;
mxtr = xmlReaderForIO (xml_reader_for_zip_member, NULL, meta, NULL, NULL, 0);
while (1 == xmlTextReaderRead (mxtr))
{
xmlChar *name = xmlTextReaderName (mxtr);
- if ( 0 == xmlStrcmp (name, _xml("meta:document-statistic")))
+ if (0 == xmlStrcmp (name, _xml("meta:document-statistic")))
{
xmlChar *attr = xmlTextReaderGetAttribute (mxtr, _xml ("meta:table-count"));
- if ( attr != NULL)
+ if (attr != NULL)
{
int s = _xmlchar_to_int (attr);
xmlFreeTextReader (mxtr);
struct zip_member *content = zip_member_open (r->zreader, "content.xml");
xmlTextReaderPtr xtr;
- if ( content == NULL)
+ if (content == NULL)
return NULL;
xtr = xmlReaderForIO (xml_reader_for_zip_member, NULL, content, NULL, NULL,
- report_errors ? 0 : (XML_PARSE_NOERROR | XML_PARSE_NOWARNING) );
+ report_errors ? 0 : (XML_PARSE_NOERROR | XML_PARSE_NOWARNING));
- if ( xtr == NULL)
+ if (xtr == NULL)
return false;
*state = (struct state_data) { .xtr = xtr,
if (opts->cell_range)
{
- if ( ! convert_cell_ref (opts->cell_range,
+ if (! convert_cell_ref (opts->cell_range,
&r->start_col, &r->start_row,
&r->stop_col, &r->stop_row))
{
r->target_sheet_index = opts->sheet_index;
/* Advance to the start of the cells for the target sheet */
- while ( ! reading_target_sheet (r, &r->rsd)
- || r->rsd.state != STATE_ROW || r->rsd.row <= r->start_row )
+ while (! reading_target_sheet (r, &r->rsd)
+ || r->rsd.state != STATE_ROW || r->rsd.row <= r->start_row)
{
if (1 != (ret = xmlTextReaderRead (r->rsd.xtr)))
break;
goto error;
}
- if ( opts->read_names)
+ if (opts->read_names)
{
while (1 == xmlTextReaderRead (r->rsd.xtr))
{
int idx;
process_node (r, &r->rsd);
- if ( ! reading_target_sheet (r, &r->rsd) )
+ if (! reading_target_sheet (r, &r->rsd))
break;
/* If the row is finished then stop for now */
if (r->stop_col != -1 && idx > r->stop_col - r->start_col)
continue;
- if ( r->rsd.state == STATE_CELL &&
+ if (r->rsd.state == STATE_CELL &&
XML_READER_TYPE_ELEMENT == r->rsd.node_type)
{
type = xmlTextReaderGetAttribute (r->rsd.xtr, _xml ("office:value-type"));
val_string = xmlTextReaderGetAttribute (r->rsd.xtr, _xml ("office:value"));
}
- if ( r->rsd.state == STATE_CELL_CONTENT &&
+ if (r->rsd.state == STATE_CELL_CONTENT &&
XML_READER_TYPE_TEXT == r->rsd.node_type)
{
if (idx >= n_var_specs)
r->spreadsheet.dict = r->dict = dict_create (
CHAR_CAST (const char *, xmlTextReaderConstEncoding (r->rsd.xtr)));
- for (i = 0; i < n_var_specs ; ++i )
+ for (i = 0; i < n_var_specs ; ++i)
{
struct fmt_spec fmt;
struct variable *var = NULL;
var = dict_get_var (r->dict, i);
- if ( 0 == xmlStrcmp (var_spec[i].firstval.type, _xml("date")))
+ if (0 == xmlStrcmp (var_spec[i].firstval.type, _xml("date")))
{
fmt.type = FMT_DATE;
fmt.d = 0;
var_set_both_formats (var, &fmt);
}
- if ( n_var_specs == 0 )
+ if (n_var_specs == 0)
{
msg (MW, _("Selected sheet or range of spreadsheet `%s' is empty."),
spreadsheet->file_name);
}
- for ( i = 0 ; i < n_var_specs ; ++i )
+ for (i = 0 ; i < n_var_specs ; ++i)
{
free (var_spec[i].firstval.type);
free (var_spec[i].firstval.value);
error:
- for ( i = 0 ; i < n_var_specs ; ++i )
+ for (i = 0 ; i < n_var_specs ; ++i)
{
free (var_spec[i].firstval.type);
free (var_spec[i].firstval.value);
/* Advance to the start of a row. (If there is one) */
while (r->rsd.state != STATE_ROW
&& 1 == xmlTextReaderRead (r->rsd.xtr)
- )
+ )
{
process_node (r, &r->rsd);
}
- if ( ! reading_target_sheet (r, &r->rsd)
+ if (! reading_target_sheet (r, &r->rsd)
|| r->rsd.state < STATE_TABLE
|| (r->stop_row != -1 && r->rsd.row > r->stop_row + 1)
- )
+)
{
return NULL;
}
{
process_node (r, &r->rsd);
- if ( r->stop_row != -1 && r->rsd.row > r->stop_row + 1)
+ if (r->stop_row != -1 && r->rsd.row > r->stop_row + 1)
break;
if (r->rsd.state == STATE_CELL &&
const int idx = r->rsd.col - col - r->start_col - 1;
if (idx < 0)
continue;
- if (r->stop_col != -1 && idx > r->stop_col - r->start_col )
+ if (r->stop_col != -1 && idx > r->stop_col - r->start_col)
break;
if (idx >= dict_get_var_cnt (r->dict))
break;
xmlFree (xmv->type);
free (xmv);
}
- if ( r->rsd.state <= STATE_TABLE)
+ if (r->rsd.state <= STATE_TABLE)
break;
}
value -= chunk;
/* Append the chunk, in base 30, to trigs[]. */
- for (trigs_left = CHUNK_SIZE; chunk > 0 && trigs_left > 0; )
+ for (trigs_left = CHUNK_SIZE; chunk > 0 && trigs_left > 0;)
{
trigs[trig_cnt + --trigs_left] = chunk % 30;
chunk /= 30;
int i;
const unsigned char *in = in_;
unsigned char *out = out_;
- for (i = 0 ; i < len ; ++i )
+ for (i = 0 ; i < len ; ++i)
out[i] = in[i];
}
#else
int i;
const unsigned char *in = in_;
unsigned char *out = out_;
- for (i = 0 ; i < len ; ++i )
+ for (i = 0 ; i < len ; ++i)
out[len - i - 1] = in[i];
}
#endif
for (i = 0; i < l ; ++i)
{
- if ( isprint (x[i]))
+ if (isprint (x[i]))
printf ("%c ", x[i]);
else
printf (" ");
var_set_both_formats (var, fmt);
- if ( col != -1)
+ if (col != -1)
{
r->vmap = xrealloc (r->vmap, (col + 1) * sizeof (*r->vmap));
struct string query ;
r->conn = PQconnectdb (info->conninfo);
- if ( NULL == r->conn)
+ if (NULL == r->conn)
{
msg (ME, _("Memory error whilst opening psql source"));
goto error;
}
- if ( PQstatus (r->conn) != CONNECTION_OK )
+ if (PQstatus (r->conn) != CONNECTION_OK)
{
msg (ME, _("Error opening psql source: %s."),
PQerrorMessage (r->conn));
sscanf (vers, "%d", &ver_num);
- if ( ver_num < 8)
+ if (ver_num < 8)
{
msg (ME,
_("Postgres server is version %s."
{
const char *dt = PQparameterStatus (r->conn, "integer_datetimes");
- r->integer_datetimes = ( 0 == c_strcasecmp (dt, "on"));
+ r->integer_datetimes = (0 == c_strcasecmp (dt, "on"));
}
#if USE_SSL
- if ( PQgetssl (r->conn) == NULL)
+ if (PQgetssl (r->conn) == NULL)
#endif
{
if (! info->allow_clear)
qres = PQexec (r->conn, ds_cstr (&query));
ds_destroy (&query);
- if ( PQresultStatus (qres) != PGRES_COMMAND_OK )
+ if (PQresultStatus (qres) != PGRES_COMMAND_OK)
{
msg (ME, _("Error from psql source: %s."),
PQresultErrorMessage (qres));
qres = PQexec (r->conn, ds_cstr (&query));
ds_destroy (&query);
- if ( PQresultStatus (qres) != PGRES_TUPLES_OK )
+ if (PQresultStatus (qres) != PGRES_TUPLES_OK)
{
msg (ME, _("Error from psql source: %s."),
PQresultErrorMessage (qres));
PQclear (qres);
qres = PQexec (r->conn, "FETCH FIRST FROM pspp");
- if ( PQresultStatus (qres) != PGRES_TUPLES_OK )
+ if (PQresultStatus (qres) != PGRES_TUPLES_OK)
{
msg (ME, _("Error from psql source: %s."),
PQresultErrorMessage (qres));
r->vmap = NULL;
r->vmapsize = 0;
- for (i = 0 ; i < n_fields ; ++i )
+ for (i = 0 ; i < n_fields ; ++i)
{
struct variable *var;
struct fmt_spec fmt = {FMT_F, 8, 2};
/* If there are no data then make a finger in the air
guess at the contents */
- if ( n_tuples > 0 )
+ if (n_tuples > 0)
length = PQgetlength (qres, 0, i);
else
length = PSQL_DEFAULT_WIDTH;
break;
}
- if ( width == 0 && fmt_is_string (fmt.type))
+ if (width == 0 && fmt_is_string (fmt.type))
fmt.w = width = PSQL_DEFAULT_WIDTH;
var = create_var (r, &fmt, width, PQfname (qres, i), i);
- if ( type == NUMERICOID && n_tuples > 0)
+ if (type == NUMERICOID && n_tuples > 0)
{
const uint8_t *vptr = (const uint8_t *) PQgetvalue (qres, 0, i);
struct fmt_spec fmt;
PQclear (qres);
qres = PQexec (r->conn, "MOVE BACKWARD 1 FROM pspp");
- if ( PQresultStatus (qres) != PGRES_COMMAND_OK)
+ if (PQresultStatus (qres) != PGRES_COMMAND_OK)
{
PQclear (qres);
goto error;
{
struct psql_reader *r = r_;
- if ( NULL == r->res || r->tuple >= r->cache_size)
+ if (NULL == r->res || r->tuple >= r->cache_size)
{
- if ( ! reload_cache (r) )
+ if (! reload_cache (r))
return false;
}
n_vars = PQnfields (r->res);
- if ( r->tuple >= PQntuples (r->res))
+ if (r->tuple >= PQntuples (r->res))
return NULL;
c = case_create (r->proto);
case_set_missing (c);
- for (i = 0 ; i < n_vars ; ++i )
+ for (i = 0 ; i < n_vars ; ++i)
{
Oid type = PQftype (r->res, i);
const struct variable *v = r->vmap[i];
case INTERVALOID:
{
- if ( r->integer_datetimes )
+ if (r->integer_datetimes)
{
uint32_t months;
uint32_t days;
case TIMEOID:
{
- if ( r->integer_datetimes)
+ if (r->integer_datetimes)
{
uint64_t x;
GET_VALUE (&vptr, x);
case TIMETZOID:
{
int32_t zone;
- if ( r->integer_datetimes)
+ if (r->integer_datetimes)
{
uint64_t x;
case TIMESTAMPOID:
case TIMESTAMPTZOID:
{
- if ( r->integer_datetimes)
+ if (r->integer_datetimes)
{
int64_t x;
x /= 1000000;
- val->f = (x + r->postgres_epoch * 24 * 3600 );
+ val->f = (x + r->postgres_epoch * 24 * 3600);
}
else
{
GET_VALUE (&vptr, x);
- val->f = (x + r->postgres_epoch * 24 * 3600 );
+ val->f = (x + r->postgres_epoch * 24 * 3600);
}
}
break;
f += x * pow (10000, weight--);
}
- if ( sign == 0x4000)
+ if (sign == 0x4000)
f *= -1.0;
- if ( sign == 0xC000)
+ if (sign == 0xC000)
val->f = SYSMIS;
else
val->f = f;
/* Sets the floating-point format used for RB and RBHEX input to
FORMAT. */
void
-settings_set_input_float_format ( enum float_format format)
+settings_set_input_float_format (enum float_format format)
{
the_settings.input_float_format = format;
}
/* Sets the integer format used for IB and PIB input to
FORMAT. */
void
-settings_set_input_integer_format ( enum integer_format format)
+settings_set_input_integer_format (enum integer_format format)
{
the_settings.input_integer_format = format;
}
/* Sets the output float format to FLOAT_FORMAT. */
void
-settings_set_output_float_format ( enum float_format float_format)
+settings_set_output_float_format (enum float_format float_format)
{
the_settings.output_float_format = float_format;
}
/* Sets the view length. */
void
-settings_set_viewlength ( int viewlength_)
+settings_set_viewlength (int viewlength_)
{
the_settings.viewlength = viewlength_;
}
/* Sets the screen width. */
void
-settings_set_viewwidth ( int viewwidth_)
+settings_set_viewwidth (int viewwidth_)
{
the_settings.viewwidth = viewwidth_;
}
/* Set include file echo. */
void
-settings_set_include ( bool include)
+settings_set_include (bool include)
{
the_settings.include = include;
}
/* Sets the year that starts the epoch. */
void
-settings_set_epoch ( int epoch)
+settings_set_epoch (int epoch)
{
if (epoch < 0)
{
/* Set system file default compression. */
void
-settings_set_scompression ( bool scompress)
+settings_set_scompression (bool scompress)
{
the_settings.scompress = scompress;
}
/* Set whether to warn on undefined values. */
void
-settings_set_undefined ( bool undefined)
+settings_set_undefined (bool undefined)
{
the_settings.undefined = undefined;
}
/* Set the value that blank numeric fields are set to when read
in. */
void
-settings_set_blanks ( double blanks)
+settings_set_blanks (double blanks)
{
the_settings.blanks = blanks;
}
if (severity == MSG_S_WARNING)
{
- if ( max == 0)
+ if (max == 0)
{
msg (MW,
_("MXWARNS set to zero. No further warnings will be given even when potentially problematic situations are encountered."));
msg_ui_disable_warnings (true);
}
- else if ( the_settings.max_messages [MSG_S_WARNING] == 0)
+ else if (the_settings.max_messages [MSG_S_WARNING] == 0)
{
msg_ui_disable_warnings (false);
the_settings.max_messages[MSG_S_WARNING] = max;
/* Sets whether the commands generated by macro invocations are
displayed. */
void
-settings_set_mprint ( bool mprint)
+settings_set_mprint (bool mprint)
{
the_settings.mprint = mprint;
}
/* Set implied limit of unbounded loop. */
void
-settings_set_mxloops ( int mxloops)
+settings_set_mxloops (int mxloops)
{
the_settings.mxloops = mxloops;
}
/* Set default format for variables created by transformations
and by DATA LIST {FREE,LIST}. */
void
-settings_set_format ( const struct fmt_spec *default_format)
+settings_set_format (const struct fmt_spec *default_format)
{
the_settings.default_format = *default_format;
}
/* Set testing mode. */
void
-settings_set_testing_mode ( bool testing_mode)
+settings_set_testing_mode (bool testing_mode)
{
the_settings.testing_mode = testing_mode;
}
/* Set the algorithm option for this command only */
void
-settings_set_cmd_algorithm ( enum behavior_mode mode)
+settings_set_cmd_algorithm (enum behavior_mode mode)
{
the_settings.cmd_algorithm = mode;
}
/* Set the syntax option */
void
-settings_set_syntax ( enum behavior_mode mode)
+settings_set_syntax (enum behavior_mode mode)
{
the_settings.syntax = mode;
}
fns = fmt_settings_get_style (the_settings.styles, fmt->type);
ds_put_byte (&str, '$');
- for (c = MAX (fmt->w - fmt->d - 1, 0); c > 0; )
+ for (c = MAX (fmt->w - fmt->d - 1, 0); c > 0;)
{
ds_put_byte (&str, '#');
if (--c % 4 == 0 && c > 0)
void settings_destroy (struct settings *);
enum float_format settings_get_input_float_format (void);
-void settings_set_input_float_format ( enum float_format);
+void settings_set_input_float_format (enum float_format);
/* Returns the integer format used for IB and PIB input. */
enum integer_format settings_get_input_integer_format (void);
/* Sets the integer format used for IB and PIB input to
FORMAT. */
-void settings_set_input_integer_format ( enum integer_format);
+void settings_set_input_integer_format (enum integer_format);
/* Returns the current output integer format. */
int settings_get_viewlength (void);
-void settings_set_viewlength ( int);
+void settings_set_viewlength (int);
int settings_get_viewwidth (void);
-void settings_set_viewwidth ( int);
+void settings_set_viewwidth (int);
bool settings_get_safer_mode (void);
void settings_set_safer_mode (void);
bool settings_get_include (void);
-void settings_set_include ( bool);
+void settings_set_include (bool);
int settings_get_epoch (void);
-void settings_set_epoch ( int);
+void settings_set_epoch (int);
bool settings_get_scompression (void);
void settings_set_scompression (bool);
void settings_set_mprint (bool);
int settings_get_mxloops (void);
-void settings_set_mxloops ( int);
+void settings_set_mxloops (int);
size_t settings_get_workspace (void);
size_t settings_get_workspace_cases (const struct caseproto *);
void settings_set_workspace (size_t);
const struct fmt_spec *settings_get_format (void);
-void settings_set_format ( const struct fmt_spec *);
+void settings_set_format (const struct fmt_spec *);
bool settings_get_testing_mode (void);
void settings_set_testing_mode (bool);
spreadsheet_make_reader (struct spreadsheet *s,
const struct spreadsheet_read_options *opts)
{
- if ( s->type == SPREADSHEET_ODS)
+ if (s->type == SPREADSHEET_ODS)
return ods_make_reader (s, opts);
- if ( s->type == SPREADSHEET_GNUMERIC)
+ if (s->type == SPREADSHEET_GNUMERIC)
return gnumeric_make_reader (s, opts);
return NULL;
const char *
spreadsheet_get_sheet_name (struct spreadsheet *s, int n)
{
- if ( s->type == SPREADSHEET_ODS)
+ if (s->type == SPREADSHEET_ODS)
return ods_get_sheet_name (s, n);
- if ( s->type == SPREADSHEET_GNUMERIC)
+ if (s->type == SPREADSHEET_GNUMERIC)
return gnumeric_get_sheet_name (s, n);
return NULL;
char *
spreadsheet_get_sheet_range (struct spreadsheet *s, int n)
{
- if ( s->type == SPREADSHEET_ODS)
+ if (s->type == SPREADSHEET_ODS)
return ods_get_sheet_range (s, n);
- if ( s->type == SPREADSHEET_GNUMERIC)
+ if (s->type == SPREADSHEET_GNUMERIC)
return gnumeric_get_sheet_range (s, n);
return NULL;
char *cs0 ;
char *s ;
- if ( col0 < 0) return NULL;
- if ( row0 < 0) return NULL;
+ if (col0 < 0) return NULL;
+ if (row0 < 0) return NULL;
cs0 = int_to_ps26 (col0);
s = c_xasprintf ("%s%d", cs0, row0 + 1);
int n = sscanf (ref, "%4[a-zA-Z]%d:%4[a-zA-Z]%d",
startcol, &startrow,
stopcol, &stoprow);
- if ( n != 4)
+ if (n != 4)
return false;
str_uppercase (startcol);
if (!read_int (r, &r->case_cnt))
return false;
- if ( r->case_cnt > INT_MAX / 2)
+ if (r->case_cnt > INT_MAX / 2)
r->case_cnt = -1;
/* Identify floating-point format and obtain compression bias. */
struct sfm_var_record *rec;
int n_warnings = 0;
- for (rec = var_recs; rec < &var_recs[n_var_recs]; )
+ for (rec = var_recs; rec < &var_recs[n_var_recs];)
{
struct variable *var;
size_t n_values;
if (time (&t) == (time_t) -1)
{
creation_date = xstrdup ("01 Jan 70");
- creation_time = xstrdup ( "00:00:00");
+ creation_time = xstrdup ("00:00:00");
}
else
{
size_t i;
assert (chain->finalized);
- for (i = start < 0 ? 0 : start; i < chain->trns_cnt; )
+ for (i = start < 0 ? 0 : start; i < chain->trns_cnt;)
{
struct transformation *trns = &chain->trns[i];
int retval = trns->execute (trns->aux, c, case_nr);
}
else if (state == CMD_STATE_INPUT_PROGRAM)
msg (SE, _("%s is not allowed inside %s."),
- command->name, "INPUT PROGRAM" );
+ command->name, "INPUT PROGRAM");
else if (state == CMD_STATE_FILE_TYPE)
msg (SE, _("%s is not allowed inside %s."), command->name, "FILE TYPE");
The correct thing to do would be to convert to an encoding
which can cope with all the input files (eg UTF-8).
*/
- if ( 0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m)))
+ if (0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m)))
msg (MW, _("Combining files with incompatible encodings. String data may "
"not be represented correctly."));
size_t i;
output = create_output_case (proc);
- for (i = proc->n_files; i-- > 0; )
+ for (i = proc->n_files; i-- > 0;)
{
struct comb_file *file = &proc->files[i];
if (file->type == COMB_FILE)
{
r->flags &= ~DFM_ADVANCE;
- if (r->eof_cnt == 0 && read_record (r) )
+ if (r->eof_cnt == 0 && read_record (r))
{
r->pos = 0;
return 0;
goto error;
struct spreadsheet *spreadsheet = NULL;
- if ( 0 == strncasecmp (tok, "GNM", 3))
+ if (0 == strncasecmp (tok, "GNM", 3))
spreadsheet = gnumeric_probe (filename, true);
- else if ( 0 == strncasecmp (tok, "ODS", 3))
+ else if (0 == strncasecmp (tok, "ODS", 3))
spreadsheet = ods_probe (filename, true);
if (spreadsheet == NULL)
lex_get (lexer);
- while (lex_match (lexer, T_SLASH) )
+ while (lex_match (lexer, T_SLASH))
{
- if ( lex_match_id (lexer, "ASSUMEDSTRWIDTH"))
+ if (lex_match_id (lexer, "ASSUMEDSTRWIDTH"))
{
lex_match (lexer, T_EQUALS);
if (lex_force_int (lexer))
lex_get (lexer);
}
}
- else if ( lex_match_id (lexer, "BSIZE"))
+ else if (lex_match_id (lexer, "BSIZE"))
{
lex_match (lexer, T_EQUALS);
if (lex_force_int (lexer))
lex_get (lexer);
}
}
- else if ( lex_match_id (lexer, "UNENCRYPTED"))
+ else if (lex_match_id (lexer, "UNENCRYPTED"))
{
psql.allow_clear = true;
}
else if (lex_match_id (lexer, "SQL"))
{
lex_match (lexer, T_EQUALS);
- if ( ! lex_force_string (lexer) )
+ if (! lex_force_string (lexer))
goto error;
ds_put_substring (&psql.sql, lex_tokss (lexer));
struct dictionary *dict = NULL;
struct casereader *reader = psql_open_reader (&psql, &dict);
- if ( reader )
+ if (reader)
{
dataset_set_dict (ds, dict);
dataset_set_source (ds, reader);
lex_get (lexer);
- while (lex_match (lexer, T_SLASH) )
+ while (lex_match (lexer, T_SLASH))
{
- if ( lex_match_id (lexer, "ASSUMEDSTRWIDTH"))
+ if (lex_match_id (lexer, "ASSUMEDSTRWIDTH"))
{
lex_match (lexer, T_EQUALS);
if (lex_force_int (lexer))
lex_match (lexer, T_EQUALS);
if (lex_match_id (lexer, "NAME"))
{
- if ( ! lex_force_string (lexer) )
+ if (! lex_force_string (lexer))
goto error;
opts->sheet_name = ss_xstrdup (lex_tokss (lexer));
}
else if (lex_match_id (lexer, "RANGE"))
{
- if ( ! lex_force_string (lexer) )
+ if (! lex_force_string (lexer))
goto error;
opts->cell_range = ss_xstrdup (lex_tokss (lexer));
{
lex_match (lexer, T_EQUALS);
- if ( lex_match_id (lexer, "ON"))
+ if (lex_match_id (lexer, "ON"))
{
opts->read_names = true;
}
while (lex_token (lexer) != T_ENDCMD)
{
lex_match (lexer, T_SLASH);
- if (lex_match_id (lexer, "VARIABLES") )
+ if (lex_match_id (lexer, "VARIABLES"))
{
lex_match (lexer, T_EQUALS);
- if (! parse_variables_const (lexer, dict, &cmd.v_variables, &cmd.n_variables, 0 ))
+ if (! parse_variables_const (lexer, dict, &cmd.v_variables, &cmd.n_variables, 0))
{
msg (SE, _("No variables specified."));
return CMD_FAILURE;
}
}
- else if (lex_match_id (lexer, "FORMAT") )
+ else if (lex_match_id (lexer, "FORMAT"))
{
lex_match (lexer, T_EQUALS);
- if (lex_match_id (lexer, "NUMBERED") )
+ if (lex_match_id (lexer, "NUMBERED"))
{
cmd.numbering = format_numbered;
}
- else if (lex_match_id (lexer, "UNNUMBERED") )
+ else if (lex_match_id (lexer, "UNNUMBERED"))
{
cmd.numbering = format_unnumbered;
}
lex_get (lexer);
}
}
- else if (! parse_variables_const (lexer, dict, &cmd.v_variables, &cmd.n_variables, 0 ))
+ else if (! parse_variables_const (lexer, dict, &cmd.v_variables, &cmd.n_variables, 0))
{
return CMD_FAILURE;
}
}
struct ccase *c;
- for ( ; (c = casereader_read (group) ); case_unref (c))
+ for (; (c = casereader_read (group)); case_unref (c))
{
const union value *uv = case_data (c, mr->rowtype);
const char *row_type = CHAR_CAST (const char *, uv->s);
int fc, lc;
size_t i;
- if ( !parse_column_range (lexer, 1, &fc, &lc, NULL) )
+ if (!parse_column_range (lexer, 1, &fc, &lc, NULL))
return false;
/* Divide columns evenly. */
"not be given in conjunction with the %s "
"subcommand."),
"DROP", "KEEP"
- );
+ );
goto done;
}
already_encountered |= 4;
if (!parse_format_specifier (lexer, &f))
goto fail;
- if ( ! fmt_check_output (&f))
+ if (! fmt_check_output (&f))
goto fail;
if (fmt_is_string (f.type))
size_t n;
/* For now, ignore SEPARATE and LAYERED. */
- (void) ( lex_match_id (lexer, "SEPARATE") || lex_match_id (lexer, "LAYERED") );
+ (void) (lex_match_id (lexer, "SEPARATE") || lex_match_id (lexer, "LAYERED"));
lex_match (lexer, T_BY);
if (!parse_variables (lexer, dataset_dict (ds), &v, &n, PV_NO_DUPLICATE))
if (!parse_variables (lexer, dataset_dict (ds), &v, &nv, PV_NONE))
return CMD_FAILURE;
- if ( lex_force_match (lexer, T_LPAREN) )
+ if (lex_force_match (lexer, T_LPAREN))
{
- if ( lex_match_id (lexer, "LEFT"))
+ if (lex_match_id (lexer, "LEFT"))
align = ALIGN_LEFT;
- else if ( lex_match_id (lexer, "RIGHT"))
+ else if (lex_match_id (lexer, "RIGHT"))
align = ALIGN_RIGHT;
- else if ( lex_match_id (lexer, "CENTER"))
+ else if (lex_match_id (lexer, "CENTER"))
align = ALIGN_CENTRE;
else
{
return CMD_FAILURE;
}
- for( i = 0 ; i < nv ; ++i )
+ for(i = 0 ; i < nv ; ++i)
var_set_alignment (v[i], align);
while (lex_token (lexer) == T_SLASH)
}
width = MIN (width, 2 * MAX_STRING);
- for( i = 0 ; i < nv ; ++i )
+ for(i = 0 ; i < nv ; ++i)
var_set_display_width (v[i], width);
while (lex_token (lexer) == T_SLASH)
if (!parse_variables (lexer, dataset_dict (ds), &v, &nv, PV_NONE))
return CMD_FAILURE;
- if ( lex_force_match (lexer, T_LPAREN) )
+ if (lex_force_match (lexer, T_LPAREN))
{
- if ( lex_match_id (lexer, "SCALE"))
+ if (lex_match_id (lexer, "SCALE"))
level = MEASURE_SCALE;
- else if ( lex_match_id (lexer, "ORDINAL"))
+ else if (lex_match_id (lexer, "ORDINAL"))
level = MEASURE_ORDINAL;
- else if ( lex_match_id (lexer, "NOMINAL"))
+ else if (lex_match_id (lexer, "NOMINAL"))
level = MEASURE_NOMINAL;
else
{
return CMD_FAILURE;
}
- for( i = 0 ; i < nv ; ++i )
+ for(i = 0 ; i < nv ; ++i)
var_set_measure (v[i], level);
enum var_role role;
size_t i;
- if ( lex_match_id (lexer, "INPUT"))
+ if (lex_match_id (lexer, "INPUT"))
role = ROLE_INPUT;
- else if ( lex_match_id (lexer, "TARGET"))
+ else if (lex_match_id (lexer, "TARGET"))
role = ROLE_TARGET;
- else if ( lex_match_id (lexer, "BOTH"))
+ else if (lex_match_id (lexer, "BOTH"))
role = ROLE_BOTH;
- else if ( lex_match_id (lexer, "NONE"))
+ else if (lex_match_id (lexer, "NONE"))
role = ROLE_NONE;
- else if ( lex_match_id (lexer, "PARTITION"))
+ else if (lex_match_id (lexer, "PARTITION"))
role = ROLE_PARTITION;
- else if ( lex_match_id (lexer, "SPLIT"))
+ else if (lex_match_id (lexer, "SPLIT"))
role = ROLE_SPLIT;
else
{
goto done;
}
- if ( ds == NULL )
+ if (ds == NULL)
{
ds = dataset_create (NULL, "");
d = dataset_dict (ds);
case T_POS_NUM:
case T_NEG_NUM:
{
- union any_node *node = expr_allocate_number (e, lex_tokval (lexer) );
+ union any_node *node = expr_allocate_number (e, lex_tokval (lexer));
lex_get (lexer);
return node;
}
}
skip_token (':');
- if ( sbc->type == SBC_ARRAY && token == T_ID )
+ if (sbc->type == SBC_ARRAY && token == T_ID)
{
spec->varname = xstrdup (st_lower (tokstr));
spec->index = sbc->narray;
}
sbc->arity = ARITY_ONCE_ONLY;
- if ( match_token('+'))
+ if (match_token('+'))
sbc->arity = ARITY_MANY;
else if (match_token('^'))
sbc->arity = ARITY_ONCE_EXACTLY ;
sbc->type = SBC_PINT;
else if (match_id ("DOUBLE"))
{
- if ( match_id ("LIST") )
+ if (match_id ("LIST"))
sbc->type = SBC_DBL_LIST;
else
sbc->type = SBC_DBL;
int f = 0;
dump (0, "p->sbc_%s = 0;", st_lower (sbc->name));
- if ( ! persistent )
+ if (! persistent)
{
switch (sbc->type)
{
sbc->type == SBC_INT_LIST ? "int" : "double",
sbc->type == SBC_INT_LIST ? 'i' : 'd',
st_lower (sbc->name)
- );
+ );
dump (-2, "}");
break;
dump (0, "p->%s%s = %s%s;", sbc->prefix, spec->varname,
st_upper (prefix), find_symbol (s->con)->name);
- if ( sbc->type == SBC_ARRAY )
+ if (sbc->type == SBC_ARRAY)
dump (0, "p->a_%s[%s%s%s] = 1;",
st_lower (sbc->name),
st_upper (prefix), st_upper (sbc->prefix),
dump (1, "if (!lex_force_string (lexer))");
dump (0, "return false;");
outdent ();
- dump (0, "free(p->s_%s);", st_lower(sbc->name) );
+ dump (0, "free(p->s_%s);", st_lower(sbc->name));
dump (0, "p->s_%s = ss_xstrdup (lex_tokss (lexer));",
st_lower (sbc->name));
dump (0, "lex_get (lexer);");
dump (1, "if (!lex_force_num (lexer))");
dump (0, "goto lossage;");
dump (-1, "p->n_%s[p->sbc_%s - 1] = lex_number (lexer);",
- st_lower (sbc->name), st_lower (sbc->name) );
+ st_lower (sbc->name), st_lower (sbc->name));
dump (0, "lex_get(lexer);");
}
else if (sbc->type == SBC_INT)
dump (0, "goto lossage;");
dump (-1, "x = lex_integer (lexer);");
dump (0, "lex_get(lexer);");
- dump (0, "p->n_%s[p->sbc_%s - 1] = x;", st_lower (sbc->name), st_lower(sbc->name) );
+ dump (0, "p->n_%s[p->sbc_%s - 1] = x;", st_lower (sbc->name), st_lower(sbc->name));
dump (-1,"}");
}
else if (sbc->type == SBC_PINT)
}
else if (sbc->type == SBC_DBL_LIST || sbc->type == SBC_INT_LIST)
{
- dump (0, "if ( p->sbc_%s > MAXLISTS)",st_lower(sbc->name));
+ dump (0, "if (p->sbc_%s > MAXLISTS)",st_lower(sbc->name));
dump (1, "{");
dump (0, "subc_list_error (lexer, \"%s\", MAXLISTS);",
st_lower(sbc->name));
dump (0, "static int");
dump (0, "parse_%s (struct lexer *lexer, struct dataset *ds%s, struct cmd_%s *p, void *aux UNUSED)",
make_identifier (cmdname),
- (def && ( def->type == SBC_VARLIST || def->type == SBC_CUSTOM))?"":" UNUSED",
+ (def && (def->type == SBC_VARLIST || def->type == SBC_CUSTOM))?"":" UNUSED",
make_identifier (cmdname));
dump (1, "{");
/* Now deal with the /ALGORITHM subcommand implicit to all commands */
- dump(1,"else if ( settings_get_syntax () != COMPATIBLE && lex_match_id(lexer, \"ALGORITHM\"))");
+ dump(1,"else if (settings_get_syntax () != COMPATIBLE && lex_match_id(lexer, \"ALGORITHM\"))");
dump(1,"{");
dump (0, "lex_match (lexer, T_EQUALS);");
for (sbc = subcommands; sbc; sbc = sbc->next)
{
- if ( sbc->arity == ARITY_ONCE_EXACTLY )
+ if (sbc->arity == ARITY_ONCE_EXACTLY)
{
- dump (0, "if ( 0 == p->sbc_%s)", st_lower (sbc->name));
+ dump (0, "if (0 == p->sbc_%s)", st_lower (sbc->name));
dump (1, "{");
dump (0, "lex_sbc_missing (\"%s\");", sbc->name);
dump (0, "goto lossage;");
indent = 0;
used = 0;
- if ( ! persistent )
+ if (! persistent)
{
for (sbc = subcommands; sbc; sbc = sbc->next)
used = (sbc->type == SBC_STRING
make_identifier (cmdname), used ? "" : " UNUSED");
dump (1, "{");
- if ( ! persistent )
+ if (! persistent)
{
for (sbc = subcommands; sbc; sbc = sbc->next)
{
l->data[l->n_data++] = d;
- if (l->n_data >= l->sz )
+ if (l->n_data >= l->sz)
{
l->sz += CHUNKSIZE;
l->data = xnrealloc (l->data, l->sz, sizeof *l->data);
{
l->data[l->n_data++] = d;
- if (l->n_data >= l->sz )
+ if (l->n_data >= l->sz)
{
l->sz += CHUNKSIZE;
l->data = xnrealloc (l->data, l->sz, sizeof *l->data);
*var = parse_variable_const (lexer, dict);
- if ( *var == NULL)
+ if (*var == NULL)
return false;
return true;
}
assert (v);
- if ( *iact == NULL)
+ if (*iact == NULL)
*iact = interaction_create (v);
else
interaction_add_variable (*iact, v);
- if ( lex_match (lexer, T_ASTERISK) || lex_match (lexer, T_BY))
+ if (lex_match (lexer, T_ASTERISK) || lex_match (lexer, T_BY))
{
return parse_internal_interaction (lexer, dict, iact, iact);
}
static inline void
const_var_set_destroy (struct const_var_set *vs)
{
- var_set_destroy ( (struct var_set *) vs);
+ var_set_destroy ((struct var_set *) vs);
}
/* Match a variable.
goto error;
}
- if ( agr.add_variables )
+ if (agr.add_variables)
agr.dict = dict_clone (dict);
else
agr.dict = dict_create (dict_get_encoding (dict));
initialize_aggregate_info (&agr);
- if ( agr.add_variables )
+ if (agr.add_variables)
placeholder = casereader_clone (group);
{
{
struct ccase *c = case_create (dict_get_proto (agr->dict));
- if ( agr->add_variables)
+ if (agr->add_variables)
{
case_copy (c, 0, break_case, 0, dict_get_var_cnt (agr->src_dict));
}
break;
case MEDIAN:
{
- if ( i->writer)
+ if (i->writer)
{
struct percentile *median = percentile_create (0.5, i->cc);
struct order_stats *os = &median->parent;
proto = caseproto_add_width (proto, 0);
proto = caseproto_add_width (proto, 0);
- if ( ! iter->subject)
+ if (! iter->subject)
iter->subject = dict_create_internal_var (0, 0);
- if ( ! iter->weight)
+ if (! iter->weight)
iter->weight = dict_create_internal_var (1, 0);
subcase_init_var (&ordering, iter->subject, SC_ASCEND);
calculate_binomial (double n1, double n2, double p)
{
const double n = n1 + n2;
- const bool test_reversed = (n1 / n > p ) ;
- if ( test_reversed )
+ const bool test_reversed = (n1 / n > p) ;
+ if (test_reversed)
{
p = 1 - p ;
swap (&n1, &n2);
double sig1tailed = gsl_cdf_binomial_P (n1, p, n1 + n2);
- if ( p == 0.5 )
+ if (p == 0.5)
return sig1tailed > 0.5 ? 1.0 :sig1tailed * 2.0;
return sig1tailed ;
struct freq *cat1,
struct freq *cat2,
enum mv_class exclude
- )
+ )
{
const struct binomial_test *bst = UP_CAST (ost, const struct binomial_test, parent);
bool warn = true;
int v;
double w = dict_get_case_weight (dict, c, &warn);
- for (v = 0 ; v < ost->n_vars ; ++v )
+ for (v = 0 ; v < ost->n_vars ; ++v)
{
const struct variable *var = ost->vars[v];
double value = case_num (c, var);
if (bst->cutpoint != SYSMIS)
{
- if ( cat1[v].values[0].f >= value )
+ if (cat1[v].values[0].f >= value)
cat1[v].count += w;
else
cat2[v].count += w;
}
else
{
- if ( SYSMIS == cat1[v].values[0].f )
+ if (SYSMIS == cat1[v].values[0].f)
{
cat1[v].values[0].f = value;
cat1[v].count = w;
}
- else if ( cat1[v].values[0].f == value )
+ else if (cat1[v].values[0].f == value)
cat1[v].count += w;
- else if ( SYSMIS == cat2[v].values[0].f )
+ else if (SYSMIS == cat2[v].values[0].f)
{
cat2[v].values[0].f = value;
cat2[v].count = w;
}
- else if ( cat2[v].values[0].f == value )
+ else if (cat2[v].values[0].f == value)
cat2[v].count += w;
- else if ( bst->category1 == SYSMIS)
+ else if (bst->category1 == SYSMIS)
msg (ME, _("Variable %s is not dichotomous"), var_get_name (var));
}
}
/* Populate the hash with zero entries */
entries = xnmalloc (hi - lo + 1, sizeof *entries);
- for (i_d = lo; i_d <= hi; i_d += 1.0 )
+ for (i_d = lo; i_d <= hi; i_d += 1.0)
{
size_t ofs = i_d - lo;
union value value = { i_d };
double *xsq = xzalloc (sizeof (*df) * ost->n_vars);
bool ok;
- for ( i = 0 ; i < cst->n_expected ; ++i )
+ for (i = 0 ; i < cst->n_expected ; ++i)
total_expected += cst->expected[i];
- if ( cst->ranged == false )
+ if (cst->ranged == false)
{
- for ( v = 0 ; v < ost->n_vars ; ++v )
+ for (v = 0 ; v < ost->n_vars ; ++v)
{
const struct variable *var = ost->vars[v];
struct pivot_dimension *var_dim
= pivot_dimension_create (table, PIVOT_AXIS_COLUMN, N_("Variable"));
- for ( size_t i = 0 ; i < ost->n_vars ; ++i )
+ for (size_t i = 0 ; i < ost->n_vars ; ++i)
pivot_category_create_leaf (var_dim->root,
pivot_value_new_variable (ost->vars[i]));
struct pivot_dimension *category_dim
= pivot_dimension_create (table, PIVOT_AXIS_ROW, N_("Category"));
size_t n_cells = cst->hi - cst->lo + 1;
- for (size_t i = 0 ; i < n_cells; ++i )
+ for (size_t i = 0 ; i < n_cells; ++i)
pivot_category_create_leaf (category_dim->root,
pivot_value_new_integer (i + 1));
pivot_category_create_leaves (category_dim->root, N_("Total"));
- for ( size_t v = 0 ; v < ost->n_vars ; ++v )
+ for (size_t v = 0 ; v < ost->n_vars ; ++v)
{
const struct variable *var = ost->vars[v];
struct casereader *reader =
struct freq **ff = freq_hmap_sort (&freq_hash, var_get_width (var));
double total_obs = 0.0;
- for ( size_t i = 0 ; i < hmap_count (&freq_hash) ; ++i )
+ for (size_t i = 0 ; i < hmap_count (&freq_hash) ; ++i)
total_obs += ff[i]->count;
xsq[v] = 0.0;
- for ( size_t i = 0 ; i < hmap_count (&freq_hash) ; ++i )
+ for (size_t i = 0 ; i < hmap_count (&freq_hash) ; ++i)
{
/* Category. */
pivot_table_put3 (table, 0, v, i,
struct pivot_dimension *variables = pivot_dimension_create (
table, PIVOT_AXIS_ROW, N_("Variable"));
- for ( size_t v = 0 ; v < ost->n_vars ; ++v )
+ for (size_t v = 0 ; v < ost->n_vars ; ++v)
{
const struct variable *var = ost->vars[v];
const struct variable *var = ct->vars[v];
const union value *val = case_data (c, var);
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val, exclude))
continue;
- if ( ch.success == SYSMIS)
+ if (ch.success == SYSMIS)
{
ch.success = val->f;
}
{
ch.failure = val->f;
}
- if ( ch.success == val->f)
+ if (ch.success == val->f)
{
ch.hits[v] += w;
case_hits += w;
}
- else if ( ch.failure == val->f)
+ else if (ch.failure == val->f)
{
ch.misses[v] += w;
}
true);
struct casereader *rc = casereader_clone (r);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
covariance_accumulate_pass1 (cov, c);
}
- for ( ; (c = casereader_read (rc) ); case_unref (c))
+ for (; (c = casereader_read (rc)); case_unref (c))
{
covariance_accumulate_pass2 (cov, c);
}
corr_matrix = correlation_from_covariance (cov_matrix, var_matrix);
- if ( opts->statistics & STATS_DESCRIPTIVES)
+ if (opts->statistics & STATS_DESCRIPTIVES)
output_descriptives (corr, opts, mean_matrix, var_matrix, samples_matrix);
output_correlation (corr, opts, corr_matrix,
lex_match (lexer, T_EQUALS);
while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
- if ( lex_match_id (lexer, "TWOTAIL"))
+ if (lex_match_id (lexer, "TWOTAIL"))
opts.tails = 2;
else if (lex_match_id (lexer, "ONETAIL"))
opts.tails = 1;
lex_match (lexer, T_EQUALS);
while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
- if ( lex_match_id (lexer, "DESCRIPTIVES"))
+ if (lex_match_id (lexer, "DESCRIPTIVES"))
opts.statistics = STATS_DESCRIPTIVES;
else if (lex_match_id (lexer, "XPROD"))
opts.statistics = STATS_XPROD;
corr = xrealloc (corr, sizeof (*corr) * (n_corrs + 1));
corr[n_corrs].n_vars_total = corr[n_corrs].n_vars1 = 0;
- if ( ! parse_variables_const (lexer, dict, &corr[n_corrs].vars,
+ if (! parse_variables_const (lexer, dict, &corr[n_corrs].vars,
&corr[n_corrs].n_vars_total,
PV_NUMERIC))
{
corr[n_corrs].n_vars1 = corr[n_corrs].n_vars_total;
- if ( lex_match (lexer, T_WITH))
+ if (lex_match (lexer, T_WITH))
{
- if ( ! parse_variables_const (lexer, dict,
+ if (! parse_variables_const (lexer, dict,
&corr[n_corrs].vars, &corr[n_corrs].n_vars_total,
PV_NUMERIC | PV_APPEND))
{
/* FIXME: No need to iterate the data multiple times */
struct casereader *r = casereader_clone (group);
- if ( opts.missing_type == CORR_LISTWISE)
+ if (opts.missing_type == CORR_LISTWISE)
r = casereader_create_filter_missing (r, all_vars, n_all_vars,
opts.exclude, NULL, NULL);
else
{
enum dsc_statistic s = match_statistic (lexer);
- if (s == DSC_NONE )
+ if (s == DSC_NONE)
{
lex_error (lexer, NULL);
goto error;
else
{
dsc->sort_by_stat = match_statistic (lexer);
- if (dsc->sort_by_stat == DSC_NONE )
+ if (dsc->sort_by_stat == DSC_NONE)
dsc->sort_by_stat = DSC_MEAN;
}
if (lex_match (lexer, T_LPAREN))
t->z_score_cnt = cnt;
t->missing_type = dsc->missing_type;
t->exclude = dsc->exclude;
- if ( t->missing_type == DSC_LISTWISE )
+ if (t->missing_type == DSC_LISTWISE)
{
t->var_cnt = dsc->var_cnt;
t->vars = xnmalloc (t->var_cnt, sizeof *t->vars);
append_value_name (const struct variable *var, const union value *val, struct string *str)
{
var_append_value_name (var, val, str);
- if ( var_is_value_missing (var, val, MV_ANY))
+ if (var_is_value_missing (var, val, MV_ANY))
ds_put_cstr (str, _(" (missing)"));
}
const struct exploratory_stats *es =
categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp);
- if ( y_min > es[v].minimum)
+ if (y_min > es[v].minimum)
y_min = es[v].minimum;
- if ( y_max < es[v].maximum)
+ if (y_max < es[v].maximum)
y_max = es[v].maximum;
}
const struct exploratory_stats *es =
categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp);
- if ( y_min > es[v].minimum)
+ if (y_min > es[v].minimum)
y_min = es[v].minimum;
- if ( y_max < es[v].maximum)
+ if (y_max < es[v].maximum)
y_max = es[v].maximum;
}
- if ( iact->n_vars == 0)
+ if (iact->n_vars == 0)
ds_put_format (&title, _("Boxplot"));
else
{
ds_init_cstr (&label,
var_to_string (cmd->dep_vars[v]));
- if ( iact->n_vars > 0)
+ if (iact->n_vars > 0)
{
ds_put_cstr (&label, " (");
for (ivar_idx = 0; ivar_idx < iact->n_vars; ++ivar_idx)
ds_init_cstr (&label,
var_to_string (cmd->dep_vars[v]));
- if ( iact->n_vars > 0)
+ if (iact->n_vars > 0)
{
ds_put_cstr (&label, " (");
for (ivar_idx = 0; ivar_idx < iact->n_vars; ++ivar_idx)
moments_calculate (es[v].mom, &n, &mean, &var, NULL, NULL);
chart_item_submit
- ( histogram_chart_create (es[v].histogram->gsl_hist,
+ (histogram_chart_create (es[v].histogram->gsl_hist,
ds_cstr (&label), n, mean,
sqrt (var), false));
const struct interaction *iact,
struct pivot_footnote *missing_footnote)
{
- for (size_t i = iact->n_vars; i-- > 0; )
+ for (size_t i = iact->n_vars; i-- > 0;)
{
const struct variable *var = iact->vars[i];
struct pivot_dimension *d = pivot_dimension_create__ (
const struct variable *v = NULL;
struct interaction *iact = NULL;
- if ( lex_match_variable (lexer, ex->dict, &v))
+ if (lex_match_variable (lexer, ex->dict, &v))
{
iact = interaction_create (v);
lex_match (lexer, T_SLASH);
if (lex_match_id (lexer, "VARIABLES"))
{
- if (! lex_force_match (lexer, T_EQUALS) )
+ if (! lex_force_match (lexer, T_EQUALS))
goto error;
}
{
double p = lex_number (lexer);
- if ( p <= 0 || p >= 100.0)
+ if (p <= 0 || p >= 100.0)
{
lex_error (lexer,
_("Percentiles must lie in the range (0, 100)"));
}
else if (lex_match_id (lexer, "CINTERVAL"))
{
- if ( !lex_force_num (lexer))
+ if (!lex_force_num (lexer))
goto error;
examine.conf = lex_number (lexer);
}
- if ( totals_seen && nototals_seen)
+ if (totals_seen && nototals_seen)
{
msg (SE, _("%s and %s are mutually exclusive"), "TOTAL", "NOTOTAL");
goto error;
/* If totals have been requested or if there are no factors
in this analysis, then the totals need to be included. */
- if ( !nototals_seen || examine.n_iacts == 1)
+ if (!nototals_seen || examine.n_iacts == 1)
{
examine.iacts = &iacts_mem[0];
}
}
- if ( examine.id_var )
+ if (examine.id_var)
{
examine.id_idx = var_get_case_index (examine.id_var);
examine.id_width = var_get_width (examine.id_var);
typedef void (*rotation_coefficients) (double *x, double *y,
double a, double b, double c, double d,
- const gsl_matrix *loadings );
+ const gsl_matrix *loadings);
static void
varimax_coefficients (double *x, double *y,
double a, double b, double c, double d,
- const gsl_matrix *loadings )
+ const gsl_matrix *loadings)
{
*x = d - 2 * a * b / loadings->size1;
*y = c - (a * a - b * b) / loadings->size1;
static void
equamax_coefficients (double *x, double *y,
double a, double b, double c, double d,
- const gsl_matrix *loadings )
+ const gsl_matrix *loadings)
{
*x = d - loadings->size2 * a * b / loadings->size1;
*y = c - loadings->size2 * (a * a - b * b) / (2 * loadings->size1);
for (i = 0; i < m->size1; ++i)
{
- if (i == j ) continue;
+ if (i == j) continue;
ss += pow2 (gsl_matrix_get (m, i, j));
}
int i;
/* If there is a cached value, then return that. */
- if ( idata->n_extractions != 0)
+ if (idata->n_extractions != 0)
return idata->n_extractions;
/* Otherwise, if the number of factors has been explicitly requested,
gsl_vector_view row = gsl_matrix_row (mat, p->data[n - 1 - i]);
size_t maxindex = gsl_vector_max_index (&row.vector);
- if ( maxindex > column_n )
+ if (maxindex > column_n)
break;
/* All subsequent elements of this row, are of no interest.
gsl_permutation_free (p);
gsl_matrix_free (mat);
- assert ( 0 == gsl_permutation_valid (perm));
+ assert (0 == gsl_permutation_valid (perm));
/* We want the biggest value to be first */
gsl_permutation_reverse (perm);
l4s += lambda_4;
l2s += lambda_sq;
}
- sv += ( fm->size1 * l4s - (l2s * l2s) ) / (fm->size1 * fm->size1 );
+ sv += (fm->size1 * l4s - (l2s * l2s)) / (fm->size1 * fm->size1);
}
return sv;
}
phi = atan2 (x, y) / 4.0 ;
/* Don't bother rotating if the angle is small */
- if ( fabs (sin (phi) ) <= pow (10.0, -15.0))
+ if (fabs (sin (phi)) <= pow (10.0, -15.0))
continue;
for (p = 0; p < normalised->size1; ++p)
l2s += lambda_sq;
}
}
- sv += ( normalised->size1 * l4s - (l2s * l2s) ) / (normalised->size1 * normalised->size1 );
+ sv += (normalised->size1 * l4s - (l2s * l2s)) / (normalised->size1 * normalised->size1);
}
- if ( fabs (sv - prev_sv) <= cf->rconverge)
+ if (fabs (sv - prev_sv) <= cf->rconverge)
break;
prev_sv = sv;
gsl_vector_set (rotated_loadings, i, ssq);
- if ( sum < 0 )
+ if (sum < 0)
for (j = 0 ; j < result->size1; ++j)
{
double *lambda = gsl_matrix_ptr (result, j, i);
{
if (lex_match_id (lexer, "FACTORS"))
{
- if ( lex_force_match (lexer, T_LPAREN)
+ if (lex_force_match (lexer, T_LPAREN)
&& lex_force_int (lexer))
{
factor.n_factors = lex_integer (lexer);
}
else if (lex_match_id (lexer, "MINEIGEN"))
{
- if ( lex_force_match (lexer, T_LPAREN)
+ if (lex_force_match (lexer, T_LPAREN)
&& lex_force_num (lexer))
{
factor.min_eigen = lex_number (lexer);
}
else if (lex_match_id (lexer, "ECONVERGE"))
{
- if ( lex_force_match (lexer, T_LPAREN)
+ if (lex_force_match (lexer, T_LPAREN)
&& lex_force_num (lexer))
{
factor.econverge = lex_number (lexer);
}
else if (lex_match_id (lexer, "ITERATE"))
{
- if ( lex_force_match (lexer, T_LPAREN)
+ if (lex_force_match (lexer, T_LPAREN)
&& lex_force_int (lexer))
{
n_iterations = lex_integer (lexer);
}
else if (lex_match_id (lexer, "BLANK"))
{
- if ( lex_force_match (lexer, T_LPAREN)
+ if (lex_force_match (lexer, T_LPAREN)
&& lex_force_num (lexer))
{
factor.blank = lex_number (lexer);
}
}
- if ( factor.rotation == ROT_NONE )
+ if (factor.rotation == ROT_NONE)
factor.print &= ~PRINT_ROTATION;
if (factor.n_vars < 2)
idata_free (id);
}
else
- if ( ! run_factor (ds, &factor))
+ if (! run_factor (ds, &factor))
goto error;
while (casegrouper_get_next_group (grouper, &group))
{
- if ( factor->missing_type == MISS_LISTWISE )
+ if (factor->missing_type == MISS_LISTWISE)
group = casereader_create_filter_missing (group, factor->vars, factor->n_vars,
factor->exclude,
NULL, NULL);
struct scree *s;
const char *label ;
- if ( !(f->plot & PLOT_SCREE) )
+ if (!(f->plot & PLOT_SCREE))
return;
/* Initialise to the identity permutation */
gsl_permutation *perm = gsl_permutation_calloc (factor->n_vars);
- if ( factor->sort)
+ if (factor->sort)
sort_matrix_indirect (fm, perm);
for (size_t i = 0 ; i < factor->n_vars; ++i)
for (size_t j = 0 ; j < n_factors; ++j)
{
double x = gsl_matrix_get (fm, matrix_row, j);
- if ( fabs (x) < factor->blank)
+ if (fabs (x) < factor->blank)
continue;
pivot_table_put2 (table, j, var_idx, pivot_value_new_number (x));
idata->cvm = covariance_1pass_create (factor->n_vars, factor->vars,
factor->wv, factor->exclude, true);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
covariance_accumulate (idata->cvm, c);
}
gsl_matrix_free (tmp);
}
- if ( factor->print & PRINT_UNIVARIATE)
+ if (factor->print & PRINT_UNIVARIATE)
{
struct pivot_table *table = pivot_table_create (
N_("Descriptive Statistics"));
struct factor_matrix_workspace *fmw = factor_matrix_workspace_alloc (idata->msr->size, idata->n_extractions);
gsl_matrix *factor_matrix = gsl_matrix_calloc (factor->n_vars, fmw->n_factors);
- if ( factor->extraction == EXTRACTION_PAF)
+ if (factor->extraction == EXTRACTION_PAF)
{
gsl_vector *diff = gsl_vector_alloc (idata->msr->size);
struct smr_workspace *ws = ws_create (idata->analysis_matrix);
gsl_vector_minmax (diff, &min, &max);
- if ( fabs (min) < factor->econverge && fabs (max) < factor->econverge)
+ if (fabs (min) < factor->econverge && fabs (max) < factor->econverge)
break;
}
gsl_vector_free (diff);
show_aic (factor, idata);
show_communalities (factor, initial_communalities, extracted_communalities);
- if ( factor->rotation != ROT_NONE)
+ if (factor->rotation != ROT_NONE)
{
rotated_factors = gsl_matrix_calloc (factor_matrix->size1, factor_matrix->size2);
rotated_loadings = gsl_vector_calloc (factor_matrix->size2);
? N_("Component Matrix") : N_("Factor Matrix")),
factor_matrix);
- if ( factor->rotation == ROT_PROMAX)
+ if (factor->rotation == ROT_PROMAX)
{
show_factor_matrix (factor, idata, N_("Pattern Matrix"),
pattern_matrix);
gsl_matrix_free (pattern_matrix);
}
- if ( factor->rotation != ROT_NONE)
+ if (factor->rotation != ROT_NONE)
{
show_factor_matrix (factor, idata,
(factor->rotation == ROT_PROMAX
gsl_matrix_free (rotated_factors);
}
- if ( factor->rotation == ROT_PROMAX)
+ if (factor->rotation == ROT_PROMAX)
{
show_factor_correlation (factor, fcm);
gsl_matrix_free (fcm);
return false;
}
- for (case_idx = 0; case_idx < flip->n_cases; )
+ for (case_idx = 0; case_idx < flip->n_cases;)
{
unsigned long read_cases = MIN (flip->n_cases - case_idx,
case_capacity);
/* Summary statistics. */
ft->valid_cases = 0.0;
- for(i = 0 ; i < ft->n_valid ; ++i )
+ for(i = 0 ; i < ft->n_valid ; ++i)
{
f = &ft->valid[i];
ft->valid_cases += f->count;
}
ft->total_cases = ft->valid_cases ;
- for(i = 0 ; i < ft->n_missing ; ++i )
+ for(i = 0 ; i < ft->n_missing ; ++i)
{
f = &ft->missing[i];
ft->total_cases += f->count;
histogram = freq_tab_to_hist (frq, &vf->tab, vf->var);
- if ( histogram)
+ if (histogram)
{
chart_item_submit (histogram_chart_create (
histogram->gsl_hist, var_to_string(vf->var),
lex_match (lexer, T_SLASH);
if (lex_match_id (lexer, "VARIABLES"))
{
- if (! lex_force_match (lexer, T_EQUALS) )
+ if (! lex_force_match (lexer, T_EQUALS))
goto error;
}
}
else if (lex_match_id (lexer, "FREQ"))
{
- if ( lex_match (lexer, T_LPAREN))
+ if (lex_match (lexer, T_LPAREN))
{
if (lex_force_num (lexer))
{
}
else if (lex_match_id (lexer, "PERCENT"))
{
- if ( lex_match (lexer, T_LPAREN))
+ if (lex_match (lexer, T_LPAREN))
{
if (lex_force_num (lexer))
{
histogram = histogram_create (bin_width, x_min, x_max);
- if ( histogram == NULL)
+ if (histogram == NULL)
return NULL;
for (i = 0; i < ft->n_valid; i++)
{
double x = row[v].x;
/* Replace value by the Rank */
- if ( prev_x == x)
+ if (prev_x == x)
{
/* Deal with ties */
int i;
else
{
row[v].x = v + 1;
- if ( run_length > 0)
+ if (run_length > 0)
{
double t = run_length + 1;
sigma_t += w * (pow3 (t) - t);
}
prev_x = x;
}
- if ( run_length > 0)
+ if (run_length > 0)
{
double t = run_length + 1;
- sigma_t += w * (pow3 (t) - t );
+ sigma_t += w * (pow3 (t) - t);
}
qsort (row, ost->n_vars, sizeof *row, cmp_posn);
rsq = numerator;
- numerator *= 12.0 / (fr.cc * ost->n_vars * ( ost->n_vars + 1));
- numerator -= 3 * fr.cc * ( ost->n_vars + 1);
+ numerator *= 12.0 / (fr.cc * ost->n_vars * (ost->n_vars + 1));
+ numerator -= 3 * fr.cc * (ost->n_vars + 1);
- denominator = 1 - sigma_t / ( fr.cc * ost->n_vars * ( pow2 (ost->n_vars) - 1));
+ denominator = 1 - sigma_t / (fr.cc * ost->n_vars * (pow2 (ost->n_vars) - 1));
fr.chi_sq = numerator / denominator;
- if ( ft->kendalls_w)
+ if (ft->kendalls_w)
{
fr.w = 12 * rsq ;
fr.w -= 3 * pow2 (fr.cc) *
glm.alpha = lex_number (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
else if (lex_match_id (lexer, "METHOD"))
{
lex_match (lexer, T_EQUALS);
- if ( !lex_force_match_id (lexer, "SSTYPE"))
+ if (!lex_force_match_id (lexer, "SSTYPE"))
{
lex_error (lexer, NULL);
goto error;
}
- if ( ! lex_force_match (lexer, T_LPAREN))
+ if (! lex_force_match (lexer, T_LPAREN))
{
lex_error (lexer, NULL);
goto error;
}
- if ( ! lex_force_int (lexer))
+ if (! lex_force_int (lexer))
{
lex_error (lexer, NULL);
goto error;
}
glm.ss_type = lex_integer (lexer);
- if (1 > glm.ss_type || 3 < glm.ss_type )
+ if (1 > glm.ss_type || 3 < glm.ss_type)
{
msg (ME, _("Only types 1, 2 & 3 sums of squares are currently implemented"));
goto error;
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
}
}
- if ( ! design )
+ if (! design)
{
design_full (&glm);
}
const struct interaction * x =
categoricals_get_interaction_by_subscript (cats, i - cmd->n_dep_vars);
- if ( x == cmd->interactions [k])
+ if (x == cmd->interactions [k])
{
model_dropped[i] = false;
n_dropped_model--;
gsl_vector_set (ssq, k + 1,
gsl_matrix_get (submodel_cov, 0, 0) - gsl_matrix_get (model_cov, 0, 0)
- );
+ );
gsl_matrix_free (model_cov);
gsl_matrix_free (submodel_cov);
n_dropped_submodel++;
submodel_dropped[i] = true;
- if ( cmd->interactions [k]->n_vars < x->n_vars)
+ if (cmd->interactions [k]->n_vars < x->n_vars)
{
assert (n_dropped_model < covariance_dim (cov));
n_dropped_model++;
gsl_vector_set (ssq, k + 1,
gsl_matrix_get (submodel_cov, 0, 0) - gsl_matrix_get (model_cov, 0, 0)
- );
+ );
gsl_matrix_free (model_cov);
gsl_matrix_free (submodel_cov);
model_dropped[i] = false;
- if ( cmd->interactions [k] == x)
+ if (cmd->interactions [k] == x)
{
assert (n_dropped_model < covariance_dim (cov));
n_dropped_model++;
parse_nested_variable (struct lexer *lexer, struct glm_spec *glm)
{
const struct variable *v = NULL;
- if ( ! lex_match_variable (lexer, glm->dict, &v))
+ if (! lex_match_variable (lexer, glm->dict, &v))
return false;
if (lex_match (lexer, T_LPAREN))
{
- if ( ! parse_nested_variable (lexer, glm))
+ if (! parse_nested_variable (lexer, glm))
return false;
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
return false;
}
return true;
}
- if ( parse_nested_variable (lexer, glm))
+ if (parse_nested_variable (lexer, glm))
return true;
return false;
if (lex_token (lexer) == T_ENDCMD || lex_token (lexer) == T_SLASH)
return true;
- if ( ! parse_design_term (lexer, glm))
+ if (! parse_design_term (lexer, glm))
return false;
lex_match (lexer, T_COMMA);
moments_calculate (cmd->es[0].mom, &n, &mean, &var, NULL, NULL);
chart_item_submit
- ( histogram_chart_create (histogram->gsl_hist,
+ (histogram_chart_create (histogram->gsl_hist,
ds_cstr (&label), n, mean,
sqrt (var), cmd->normal));
struct casereader *group;
double ccc = 0.0;
- if ( cmd->missing_pw == false)
+ if (cmd->missing_pw == false)
input = casereader_create_filter_missing (input,
cmd->dep_vars,
cmd->n_dep_vars,
/* Always remove cases listwise. This is correct for */
/* the histogram because there is only one variable */
/* and a simple bivariate scatterplot */
- /* if ( cmd->missing_pw == false) */
+ /* if (cmd->missing_pw == false) */
input = casereader_create_filter_missing (input,
cmd->dep_vars,
cmd->n_dep_vars,
else
{
#if 1
- usum += w0 * ( (grp1->cc - prev_cc1) / 2.0);
+ usum += w0 * ((grp1->cc - prev_cc1) / 2.0);
#else
usum += w0 * (grp1->cc - (prev_cc1 + cc1) / 2.0);
#endif
jt.levels = 0;
jt.n = 0;
for (; casegrouper_get_next_group (grouper, &group);
- casereader_destroy (group) )
+ casereader_destroy (group))
{
struct casewriter *writer = autopaging_writer_create (proto);
struct ccase *c;
const struct npar_test *test,
bool exact,
double timer
- );
+ );
#endif
const size_t group_var_width = var_get_width (nst->indep_var);
struct rank_entry *rank = find_rank_entry (&kw[i].map, group, group_var_width);
- if ( NULL == rank)
+ if (NULL == rank)
{
rank = xzalloc (sizeof *rank);
value_clone (&rank->group, group, group_var_width);
total_n_groups ++;
}
- kw[i].h *= 12 / (n * ( n + 1));
+ kw[i].h *= 12 / (n * (n + 1));
kw[i].h -= 3 * (n + 1) ;
kw[i].h /= 1 - tiebreaker/ (pow3 (n) - n);
const struct npar_test *test,
bool exact,
double timer
- );
+ );
#endif
/*
- Return the probability beta_hat (that is the estimator logit(y) )
+ Return the probability beta_hat (that is the estimator logit(y))
corresponding to the coefficient estimator for case C
*/
static double
}
casereader_destroy (reader);
- if ( max_w < cmd->min_epsilon)
+ if (max_w < cmd->min_epsilon)
{
*converged = true;
msg (MN, _("All predicted values are either 1 or 0"));
}
else if (!v1set)
{
- if ( !value_equal (&res->y0, depval, width))
+ if (!value_equal (&res->y0, depval, width))
{
value_clone (&res->y1, depval, width);
v1set = true;
if (! value_equal (&res->y0, depval, width)
&&
! value_equal (&res->y1, depval, width)
- )
+ )
{
msg (ME, _("Dependent variable's values are not dichotomous."));
case_unref (c);
work.hessian = gsl_matrix_calloc (work.beta_hat->size, work.beta_hat->size);
/* Start the Newton Raphson iteration process... */
- for( i = 0 ; i < cmd->max_iter ; ++i)
+ for(i = 0 ; i < cmd->max_iter ; ++i)
{
double min, max;
gsl_vector *v ;
gsl_vector_minmax (delta, &min, &max);
- if ( fabs (min) < cmd->bcon && fabs (max) < cmd->bcon)
+ if (fabs (min) < cmd->bcon && fabs (max) < cmd->bcon)
{
msg (MN, _("Estimation terminated at iteration number %d because parameter estimates changed by less than %g"),
i + 1, cmd->bcon);
- if ( ! converged)
- msg (MW, _("Estimation terminated at iteration number %d because maximum iterations has been reached"), i );
+ if (! converged)
+ msg (MW, _("Estimation terminated at iteration number %d because maximum iterations has been reached"), i);
output_model_summary (&work, initial_log_likelihood, log_likelihood);
}
lr.confidence = lex_number (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
}
lr.bcon = lex_number (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
}
lr.max_iter = lex_integer (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
}
lr.lcon = lex_number (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
}
lr.min_epsilon = lex_number (lexer);
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
goto error;
}
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
{
lex_error (lexer, NULL);
goto error;
double entries[] = {
-2 * log_likelihood,
cox,
- cox / ( 1.0 - exp(initial_log_likelihood * (2 / res->cc)))
+ cox / (1.0 - exp(initial_log_likelihood * (2 / res->cc)))
};
for (size_t i = 0; i < sizeof entries / sizeof *entries; i++)
pivot_table_put2 (table, i, 0, pivot_value_new_number (entries[i]));
const union value *group = case_data (c, nst->indep_var);
const size_t group_var_width = var_get_width (nst->indep_var);
- if ( value_equal (group, &nst->val1, group_var_width))
+ if (value_equal (group, &nst->val1, group_var_width))
return true;
- if ( value_equal (group, &nst->val2, group_var_width))
+ if (value_equal (group, &nst->val2, group_var_width))
return true;
return false;
const size_t group_var_width = var_get_width (nst->indep_var);
const double rank = case_data_idx (c, rank_idx)->f;
- if ( value_equal (group, &nst->val1, group_var_width))
+ if (value_equal (group, &nst->val1, group_var_width))
{
mw[i].rank_sum[0] += rank;
mw[i].n[0] += dict_get_case_weight (dict, c, &warn);
}
- else if ( value_equal (group, &nst->val2, group_var_width))
+ else if (value_equal (group, &nst->val2, group_var_width))
{
mw[i].rank_sum[1] += rank;
mw[i].n[1] += dict_get_case_weight (dict, c, &warn);
mwv->u -= mwv->rank_sum[0];
mwv->w = mwv->rank_sum[1];
- if ( mwv->u > mwv->n[0] * mwv->n[1] / 2.0)
+ if (mwv->u > mwv->n[0] * mwv->n[1] / 2.0)
{
mwv->u = mwv->n[0] * mwv->n[1] - mwv->u;
mwv->w = mwv->rank_sum[0];
const struct npar_test *test,
bool exact,
double timer
- );
+ );
#endif
struct mcnemar *mc = xcalloc (t2s->n_pairs, sizeof *mc);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
mc[i].val0.f = mc[i].val1.f = SYSMIS;
}
{
const double weight = dict_get_case_weight (dict, c, &warn);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
variable_pair *vp = &t2s->pairs[i];
const union value *value0 = case_data (c, (*vp)[0]);
continue;
- if ( mc[i].val0.f == SYSMIS)
+ if (mc[i].val0.f == SYSMIS)
{
if (mc[i].val1.f != value0->f)
mc[i].val0.f = value0->f;
mc[i].val0.f = value1->f;
}
- if ( mc[i].val1.f == SYSMIS)
+ if (mc[i].val1.f == SYSMIS)
{
if (mc[i].val0.f != value1->f)
mc[i].val1.f = value1->f;
{
mc[i].n00 += weight;
}
- else if ( mc[i].val0.f == value0->f && mc[i].val1.f == value1->f)
+ else if (mc[i].val0.f == value0->f && mc[i].val1.f == value1->f)
{
mc[i].n10 += weight;
}
- else if ( mc[i].val1.f == value0->f && mc[i].val0.f == value1->f)
+ else if (mc[i].val1.f == value0->f && mc[i].val0.f == value1->f)
{
mc[i].n01 += weight;
}
- else if ( mc[i].val1.f == value0->f && mc[i].val1.f == value1->f)
+ else if (mc[i].val1.f == value0->f && mc[i].val1.f == value1->f)
{
mc[i].n11 += weight;
}
\f
/* HARMONIC MEAN: The reciprocal of the sum of the reciprocals:
- 1 / ( 1/(x_0) + 1/(x_1) + ... + 1/(x_{n-1}) ) */
+ 1 / (1/(x_0) + 1/(x_1) + ... + 1/(x_{n-1})) */
struct harmonic_mean
{
tstr = lex_next_tokcstr (lexer, n);
- if (NULL == dict_lookup_var (dict, tstr) )
+ if (NULL == dict_lookup_var (dict, tstr))
return false;
return true;
/* Look ahead to see if there are more tables to be parsed */
more_tables = false;
- if ( T_SLASH == lex_next_token (lexer, 0) )
+ if (T_SLASH == lex_next_token (lexer, 0))
{
- if (lex_is_variable (lexer, means->dict, 1) )
+ if (lex_is_variable (lexer, means->dict, 1))
{
more_tables = true;
lex_match (lexer, T_SLASH);
var_get_width (nst->indep_var), 0));
}
- if ( median == SYSMIS)
+ if (median == SYSMIS)
{
struct percentile *ptl;
struct order_stats *os;
rr = casereader_clone (r);
writer = sort_create_writer (&sc, casereader_get_proto (rr));
- for (; (c = casereader_read (rr)) != NULL; )
+ for (; (c = casereader_read (rr)) != NULL;)
{
- if ( var_is_value_missing (var, case_data (c, var), exclude))
+ if (var_is_value_missing (var, case_data (c, var), exclude))
{
case_unref (c);
continue;
const union value *val = case_data (c, var);
const union value *indep_val = case_data (c, nst->indep_var);
- if ( var_is_value_missing (var, case_data (c, var), exclude))
+ if (var_is_value_missing (var, case_data (c, var), exclude))
{
continue;
}
value_compare_3way (indep_val, &nst->val1, width) < 0
||
value_compare_3way (indep_val, &nst->val2, width) > 0
- )
+ )
{
continue;
}
}
vn = find_value (&map, indep_val, nst->indep_var);
- if ( vn == NULL)
+ if (vn == NULL)
{
- if ( n_sample_test == true)
+ if (n_sample_test == true)
{
int width = var_get_width (nst->indep_var);
vn = xzalloc (sizeof *vn);
const struct npar_test *test,
bool exact,
double timer
- );
+ );
#endif
/* Command parsing functions. */
static int parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests *p,
- struct npar_specs *npar_specs );
+ struct npar_specs *npar_specs);
static int
parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests *npt,
lex_match (lexer, T_COMMA);
}
}
- else if ( settings_get_syntax () != COMPATIBLE && lex_match_id (lexer, "ALGORITHM"))
+ else if (settings_get_syntax () != COMPATIBLE && lex_match_id (lexer, "ALGORITHM"))
{
lex_match (lexer, T_EQUALS);
if (lex_match_id (lexer, "COMPATIBLE"))
int t;
struct descriptives *summary_descriptives = NULL;
- for ( t = 0 ; t < specs->n_tests; ++t )
+ for (t = 0 ; t < specs->n_tests; ++t)
{
const struct npar_test *test = specs->test[t];
- if ( NULL == test->execute )
+ if (NULL == test->execute)
{
msg (SW, _("%s subcommand not currently implemented."), "NPAR");
continue;
specs->filter);
}
- if ( (specs->descriptives || specs->quartiles)
- && !taint_has_tainted_successor (casereader_get_taint (input)) )
+ if ((specs->descriptives || specs->quartiles)
+ && !taint_has_tainted_successor (casereader_get_taint (input)))
do_summary_box (summary_descriptives, specs->vv, specs->n_vars,
dict_get_weight_format (dataset_dict (ds)));
npar_specs.n_vars = -1;
npar_specs.vv = NULL;
- if ( ! parse_npar_tests (lexer, ds, &cmd, &npar_specs) )
+ if (! parse_npar_tests (lexer, ds, &cmd, &npar_specs))
{
pool_destroy (npar_specs.pool);
return CMD_FAILURE;
}
- for (i = 0; i < npar_specs.n_tests; ++i )
+ for (i = 0; i < npar_specs.n_tests; ++i)
{
const struct npar_test *test = npar_specs.test[i];
test->insert_variables (test, &var_map);
sort (npar_specs.vv, npar_specs.n_vars, sizeof (*npar_specs.vv),
compare_var_ptrs_by_name, NULL);
- if ( cmd.statistics )
+ if (cmd.statistics)
{
int i;
- for ( i = 0 ; i < NPAR_ST_count; ++i )
+ for (i = 0 ; i < NPAR_ST_count; ++i)
{
- if ( cmd.a_statistics[i] )
+ if (cmd.a_statistics[i])
{
- switch ( i )
+ switch (i)
{
case NPAR_ST_DESCRIPTIVES:
npar_specs.descriptives = true;
}
input = proc_open (ds);
- if ( cmd.miss == MISS_LISTWISE )
+ if (cmd.miss == MISS_LISTWISE)
{
input = casereader_create_filter_missing (input,
npar_specs.vv,
nt->execute = runs_execute;
nt->insert_variables = one_sample_insert_variables;
- if ( lex_force_match (lexer, T_LPAREN) )
+ if (lex_force_match (lexer, T_LPAREN))
{
- if ( lex_match_id (lexer, "MEAN"))
+ if (lex_match_id (lexer, "MEAN"))
{
rt->cp_mode = CP_MEAN;
}
cstp->ranged = false;
- if ( lex_match (lexer, T_LPAREN))
+ if (lex_match (lexer, T_LPAREN))
{
cstp->ranged = true;
- if ( ! lex_force_num (lexer)) return 0;
+ if (! lex_force_num (lexer)) return 0;
cstp->lo = lex_number (lexer);
lex_get (lexer);
if (! lex_force_match (lexer, T_COMMA)) return 0;
- if (! lex_force_num (lexer) ) return 0;
+ if (! lex_force_num (lexer)) return 0;
cstp->hi = lex_number (lexer);
- if ( cstp->lo >= cstp->hi )
+ if (cstp->lo >= cstp->hi)
{
msg (ME,
_("The specified value of HI (%d) is "
if (lex_match_phrase (lexer, "/EXPECTED"))
{
if (! lex_force_match (lexer, T_EQUALS)) return 0;
- if (! lex_match_id (lexer, "EQUAL") )
+ if (! lex_match_id (lexer, "EQUAL"))
{
double f;
int n;
- while ( lex_is_number (lexer) )
+ while (lex_is_number (lexer))
{
int i;
n = 1;
f = lex_number (lexer);
lex_get (lexer);
- if ( lex_match (lexer, T_ASTERISK))
+ if (lex_match (lexer, T_ASTERISK))
{
n = f;
if (!lex_force_num (lexer))
cstp->expected,
sizeof (double) *
cstp->n_expected);
- for ( i = cstp->n_expected - n ;
+ for (i = cstp->n_expected - n ;
i < cstp->n_expected;
- ++i )
+ ++i)
cstp->expected[i] = f;
}
}
}
- if ( cstp->ranged && cstp->n_expected > 0 &&
- cstp->n_expected != cstp->hi - cstp->lo + 1 )
+ if (cstp->ranged && cstp->n_expected > 0 &&
+ cstp->n_expected != cstp->hi - cstp->lo + 1)
{
msg (ME,
_("%d expected values were given, but the specified "
btp->p = 0.5;
- if ( lex_match (lexer, T_LPAREN) )
+ if (lex_match (lexer, T_LPAREN))
{
equals = false;
- if ( lex_force_num (lexer) )
+ if (lex_force_num (lexer))
{
btp->p = lex_number (lexer);
lex_get (lexer);
{
if (parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&tp->vars, &tp->n_vars,
- PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
+ PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE))
{
if (lex_match (lexer, T_LPAREN))
{
return 2;
btp->category1 = lex_number (lexer);
lex_get (lexer);
- if ( lex_match (lexer, T_COMMA))
+ if (lex_match (lexer, T_COMMA))
{
- if ( ! lex_force_num (lexer) ) return 2;
+ if (! lex_force_num (lexer)) return 2;
btp->category2 = lex_number (lexer);
lex_get (lexer);
}
kst->p[0] = lex_number (lexer);
lex_get (lexer);
- if ( params == 2)
+ if (params == 2)
{
lex_match (lexer, T_COMMA);
if (lex_force_num (lexer))
if (! parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
&tp->vars, &tp->n_vars,
- PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
+ PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE))
return 2;
specs->n_tests++;
if (!parse_variables_const_pool (lexer, pool,
dict,
&vlist1, &n_vlist1,
- PV_NUMERIC | PV_NO_SCRATCH | PV_DUPLICATE) )
+ PV_NUMERIC | PV_NO_SCRATCH | PV_DUPLICATE))
return false;
- if ( lex_match (lexer, T_WITH))
+ if (lex_match (lexer, T_WITH))
{
with = true;
- if ( !parse_variables_const_pool (lexer, pool, dict,
+ if (!parse_variables_const_pool (lexer, pool, dict,
&vlist2, &n_vlist2,
- PV_NUMERIC | PV_NO_SCRATCH | PV_DUPLICATE) )
+ PV_NUMERIC | PV_NO_SCRATCH | PV_DUPLICATE))
return false;
paired = (lex_match (lexer, T_LPAREN) &&
}
- if ( with )
+ if (with)
{
if (paired)
{
- if ( n_vlist1 != n_vlist2)
+ if (n_vlist1 != n_vlist2)
{
msg (SE, _("PAIRED was specified but the number of variables "
"preceding WITH (%zu) did not match the number "
}
test_parameters->pairs =
- pool_alloc (pool, sizeof ( variable_pair) * test_parameters->n_pairs);
+ pool_alloc (pool, sizeof (variable_pair) * test_parameters->n_pairs);
- if ( with )
+ if (with)
{
if (paired)
{
int i;
assert (n_vlist1 == n_vlist2);
- for ( i = 0 ; i < n_vlist1; ++i )
+ for (i = 0 ; i < n_vlist1; ++i)
{
test_parameters->pairs[n][0] = vlist1[i];
test_parameters->pairs[n][1] = vlist2[i];
else
{
int i,j;
- for ( i = 0 ; i < n_vlist1; ++i )
+ for (i = 0 ; i < n_vlist1; ++i)
{
- for ( j = 0 ; j < n_vlist2; ++j )
+ for (j = 0 ; j < n_vlist2; ++j)
{
test_parameters->pairs[n][0] = vlist1[i];
test_parameters->pairs[n][1] = vlist2[j];
else
{
int i,j;
- for ( i = 0 ; i < n_vlist1 - 1; ++i )
+ for (i = 0 ; i < n_vlist1 - 1; ++i)
{
- for ( j = i + 1 ; j < n_vlist1; ++j )
+ for (j = i + 1 ; j < n_vlist1; ++j)
{
- assert ( n < test_parameters->n_pairs);
+ assert (n < test_parameters->n_pairs);
test_parameters->pairs[n][0] = vlist1[i];
test_parameters->pairs[n][1] = vlist1[j];
n++;
}
}
- assert ( n == test_parameters->n_pairs);
+ assert (n == test_parameters->n_pairs);
return true;
}
const struct dictionary *dict,
struct n_sample_test *nst,
struct pool *pool
- )
+ )
{
if (!parse_variables_const_pool (lexer, pool,
dict,
&nst->vars, &nst->n_vars,
- PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
+ PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE))
return false;
- if ( ! lex_force_match (lexer, T_BY))
+ if (! lex_force_match (lexer, T_BY))
return false;
nst->indep_var = parse_variable_const (lexer, dict);
if (!nst->indep_var)
return false;
- if ( ! lex_force_match (lexer, T_LPAREN))
+ if (! lex_force_match (lexer, T_LPAREN))
return false;
value_init (&nst->val1, var_get_width (nst->indep_var));
- if ( ! parse_value (lexer, &nst->val1, nst->indep_var))
+ if (! parse_value (lexer, &nst->val1, nst->indep_var))
{
value_destroy (&nst->val1, var_get_width (nst->indep_var));
return false;
lex_match (lexer, T_COMMA);
value_init (&nst->val2, var_get_width (nst->indep_var));
- if ( ! parse_value (lexer, &nst->val2, nst->indep_var))
+ if (! parse_value (lexer, &nst->val2, nst->indep_var))
{
value_destroy (&nst->val2, var_get_width (nst->indep_var));
return false;
}
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
return false;
return true;
static int
npar_wilcoxon (struct lexer *lexer,
struct dataset *ds,
- struct npar_specs *specs )
+ struct npar_specs *specs)
{
struct two_sample_test *tp = pool_alloc (specs->pool, sizeof (*tp));
struct npar_test *nt = &tp->parent;
nt->execute = wilcoxon_execute;
if (!parse_two_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
static int
npar_mann_whitney (struct lexer *lexer,
struct dataset *ds,
- struct npar_specs *specs )
+ struct npar_specs *specs)
{
struct n_sample_test *tp = pool_alloc (specs->pool, sizeof (*tp));
struct npar_test *nt = &tp->parent;
nt->execute = mann_whitney_execute;
if (!parse_n_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
mt->median = SYSMIS;
- if ( lex_match (lexer, T_LPAREN) && lex_force_num (lexer))
+ if (lex_match (lexer, T_LPAREN) && lex_force_num (lexer))
{
mt->median = lex_number (lexer);
lex_get (lexer);
nt->execute = median_execute;
if (!parse_n_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
nt->execute = sign_execute;
if (!parse_two_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
nt->execute = mcnemar_execute;
if (!parse_two_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
nt->execute = jonckheere_terpstra_execute;
if (!parse_n_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
nt->execute = kruskal_wallis_execute;
if (!parse_n_sample_related_test (lexer, dataset_dict (ds),
- tp, specs->pool) )
+ tp, specs->pool))
return 0;
specs->n_tests++;
HMAPX_FOR_EACH_WITH_HASH (v, node, hash, var_map)
{
- if ( v == var)
+ if (v == var)
return ;
}
int i;
const struct one_sample_test *ost = UP_CAST (test, const struct one_sample_test, parent);
- for ( i = 0 ; i < ost->n_vars ; ++i )
+ for (i = 0 ; i < ost->n_vars ; ++i)
insert_variable_into_map (var_map, ost->vars[i]);
}
int i;
const struct two_sample_test *tst = UP_CAST (test, const struct two_sample_test, parent);
- for ( i = 0 ; i < tst->n_pairs ; ++i )
+ for (i = 0 ; i < tst->n_pairs ; ++i)
{
variable_pair *pair = &tst->pairs[i];
int i;
const struct n_sample_test *tst = UP_CAST (test, const struct n_sample_test, parent);
- for ( i = 0 ; i < tst->n_vars ; ++i )
+ for (i = 0 ; i < tst->n_vars ; ++i)
insert_variable_into_map (var_map, tst->vars[i]);
insert_variable_into_map (var_map, tst->indep_var);
static int
npar_method (struct lexer *lexer, struct npar_specs *specs)
{
- if ( lex_match_id (lexer, "EXACT") )
+ if (lex_match_id (lexer, "EXACT"))
{
specs->exact = true;
specs->timer = 0.0;
{
specs->timer = 5.0;
- if ( lex_match (lexer, T_LPAREN))
+ if (lex_match (lexer, T_LPAREN))
{
- if (lex_force_num (lexer) )
+ if (lex_force_num (lexer))
{
specs->timer = lex_number (lexer);
lex_get (lexer);
moments1_calculate (mom_i, &n_i, NULL, &var_i, 0, 0);
moments1_calculate (mom_j, &n_j, NULL, &var_j, 0, 0);
- if ( n_i <= 1.0 || n_j <= 1.0)
+ if (n_i <= 1.0 || n_j <= 1.0)
return SYSMIS;
nom = pow2 (var_i/n_i + var_j/n_j);
static double sidak_pinv (double std_err, double alpha, double df, int k, const struct moments1 *mom_i UNUSED, const struct moments1 *mom_j UNUSED)
{
const double m = k * (k - 1) / 2;
- double lp = 1.0 - exp (log (1.0 - alpha) / m ) ;
+ double lp = 1.0 - exp (log (1.0 - alpha) / m) ;
return std_err * gsl_cdf_tdist_Pinv (1.0 - lp / 2.0, df);
}
static double tukey_pinv (double std_err, double alpha, double df, int k, const struct moments1 *mom_i UNUSED, const struct moments1 *mom_j UNUSED)
{
- if ( k < 2 || df < 2)
+ if (k < 2 || df < 2)
return SYSMIS;
return std_err / sqrt (2.0) * qtukey (1 - alpha, 1.0, k, df, 1, 0);
m = sqrt ((var_i/n_i + var_j/n_j) / 2.0);
- if ( k < 2 || df < 2)
+ if (k < 2 || df < 2)
return SYSMIS;
return m * qtukey (1 - alpha, 1.0, k, df, 1, 0);
int k = pvw->n_groups;
double df = ph->dff (pvw, dd_i->mom, dd_j->mom);
double ts = ph->tsf (k, dd_i->mom, dd_j->mom, std_err);
- if ( df == SYSMIS)
+ if (df == SYSMIS)
return SYSMIS;
return ph->p1f (ts, k - 1, df);
}
{
int k = pvw->n_groups;
double df = ph->dff (pvw, dd_i->mom, dd_j->mom);
- if ( df == SYSMIS)
+ if (df == SYSMIS)
return SYSMIS;
return ph->pinv (std_err, cmd->alpha, df, k, dd_i->mom, dd_j->mom);
ll_init (&oneway.contrast_list);
- if ( lex_match (lexer, T_SLASH))
+ if (lex_match (lexer, T_SLASH))
{
if (!lex_force_match_id (lexer, "VARIABLES"))
{
break;
}
}
- if ( method == false)
+ if (method == false)
{
if (lex_match_id (lexer, "ALPHA"))
{
- if ( !lex_force_match (lexer, T_LPAREN))
+ if (!lex_force_match (lexer, T_LPAREN))
goto error;
if (! lex_force_num (lexer))
goto error;
oneway.alpha = lex_number (lexer);
lex_get (lexer);
- if ( !lex_force_match (lexer, T_RPAREN))
+ if (!lex_force_match (lexer, T_RPAREN))
goto error;
}
else
while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
{
- if ( lex_is_number (lexer))
+ if (lex_is_number (lexer))
{
struct coeff_node *cc = xmalloc (sizeof *cc);
cc->coeff = lex_number (lexer);
}
}
- if ( ll_count (coefficient_list) <= 0)
+ if (ll_count (coefficient_list) <= 0)
{
destroy_coeff_list (cl);
goto error;
const struct variable *v = cmd->vars[i];
const union value *val = case_data (c, v);
- if ( MISS_ANALYSIS == cmd->missing_type)
+ if (MISS_ANALYSIS == cmd->missing_type)
{
- if ( var_is_value_missing (v, val, cmd->exclude))
+ if (var_is_value_missing (v, val, cmd->exclude))
continue;
}
casereader_destroy (reader);
reader = casereader_clone (input);
- for ( ; (c = casereader_read (reader) ); case_unref (c))
+ for (; (c = casereader_read (reader)); case_unref (c))
{
int i;
double w = dict_get_case_weight (dict, c, NULL);
const struct variable *v = cmd->vars[i];
const union value *val = case_data (c, v);
- if ( MISS_ANALYSIS == cmd->missing_type)
+ if (MISS_ANALYSIS == cmd->missing_type)
{
- if ( var_is_value_missing (v, val, cmd->exclude))
+ if (var_is_value_missing (v, val, cmd->exclude))
continue;
}
casereader_destroy (reader);
reader = casereader_clone (input);
- for ( ; (c = casereader_read (reader) ); case_unref (c))
+ for (; (c = casereader_read (reader)); case_unref (c))
{
int i;
double w = dict_get_case_weight (dict, c, NULL);
const struct variable *v = cmd->vars[i];
const union value *val = case_data (c, v);
- if ( MISS_ANALYSIS == cmd->missing_type)
+ if (MISS_ANALYSIS == cmd->missing_type)
{
- if ( var_is_value_missing (v, val, cmd->exclude))
+ if (var_is_value_missing (v, val, cmd->exclude))
continue;
}
const struct categoricals *cats = covariance_get_categoricals (pvw->cov);
const bool ok = categoricals_sane (cats);
- if ( ! ok)
+ if (! ok)
{
msg (MW,
_("Dependent variable %s has no non-missing values. No analysis for this variable will be done."),
{
const struct categoricals *cats = covariance_get_categoricals (ws.vws[v].cov);
- if ( ! categoricals_is_complete (cats))
+ if (! categoricals_is_complete (cats))
{
continue;
}
ll_for_each (cn, struct coeff_node, ll, cl)
sum += cn->coeff;
- if ( sum != 0.0 )
+ if (sum != 0.0)
msg (SW, _("Coefficients for contrast %zu do not total zero"), i);
}
show_contrast_tests (cmd, ws);
}
- if ( cmd->posthoc )
+ if (cmd->posthoc)
{
int v;
for (v = 0 ; v < cmd->n_vars; ++v)
{
const struct categoricals *cats = covariance_get_categoricals (ws->vws[v].cov);
- if ( categoricals_is_complete (cats))
+ if (categoricals_is_complete (cats))
show_comparisons (cmd, ws, v);
}
}
double diff = 0;
for (j = 0; j < m1->size2; ++j)
{
- diff += pow2 (gsl_matrix_get (m1,i,j) - gsl_matrix_get (m2,i,j) );
+ diff += pow2 (gsl_matrix_get (m1,i,j) - gsl_matrix_get (m2,i,j));
}
if (diff > max_diff)
max_diff = diff;
for (j = 0; j < qc->n_vars; j++)
{
const union value *val = case_data (c, qc->vars[j]);
- if ( var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val, qc->exclude))
NOT_REACHED ();
dist += pow2 (gsl_matrix_get (kmeans->centers, which, j) - val->f);
for (j = 0; j < qc->n_vars; ++j)
{
const union value *val = case_data (c, qc->vars[j]);
- if ( var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val, qc->exclude))
{
missing = true;
break;
for (j = 0; j < qc->n_vars; j++)
{
const union value *val = case_data (c, qc->vars[j]);
- if ( var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val, qc->exclude))
continue;
dist += pow2 (gsl_matrix_get (kmeans->centers, i, j) - val->f);
for (j = 0; j < qc->n_vars; j++)
{
const union value *val = case_data (c, qc->vars[j]);
- if ( var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val, qc->exclude))
missing = true;
}
for (j = 0; j < qc->n_vars; ++j)
{
const union value *val = case_data (c, qc->vars[j]);
- if ( var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val, qc->exclude))
continue;
double *x = gsl_matrix_ptr (kmeans->updated_centers, group, j);
*x += val->f * (qc->wv ? case_data (c, qc->wv)->f : 1.0);
for (j = 0; j < qc->n_vars; ++j)
{
const union value *val = case_data (c, qc->vars[j]);
- if ( var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val, qc->exclude))
continue;
double *x = gsl_matrix_ptr (kmeans->updated_centers, group, j);
while (casegrouper_get_next_group (grouper, &group))
{
- if ( qc.missing_type == MISS_LISTWISE )
+ if (qc.missing_type == MISS_LISTWISE)
{
group = casereader_create_filter_missing (group, qc.vars, qc.n_vars,
qc.exclude,
}
else if (lex_match_id (lexer, "NTILES"))
{
- if ( !lex_force_match (lexer, T_LPAREN))
+ if (!lex_force_match (lexer, T_LPAREN))
return false;
- if (! lex_force_int (lexer) )
+ if (! lex_force_int (lexer))
return false;
cmd->k_ntiles = lex_integer (lexer);
lex_get (lexer);
- if ( !lex_force_match (lexer, T_RPAREN))
+ if (!lex_force_match (lexer, T_RPAREN))
return false;
rs->rfunc = NTILES;
if (lex_match_id (lexer, "INTO"))
{
- while( lex_token (lexer) == T_ID )
+ while(lex_token (lexer) == T_ID)
{
const char *name = lex_tokcstr (lexer);
- if ( var_count >= subcase_get_n_fields (&cmd->sc) )
+ if (var_count >= subcase_get_n_fields (&cmd->sc))
msg (SE, _("Too many variables in %s clause."), "INTO");
- else if ( dict_lookup_var (cmd->dict, name) != NULL )
+ else if (dict_lookup_var (cmd->dict, name) != NULL)
msg (SE, _("Variable %s already exists."), name);
else if (string_set_contains (new_names, name))
msg (SE, _("Duplicate variable name %s."), name);
{
double rank;
- if ( c >= 1.0 )
+ if (c >= 1.0)
{
switch (cmd->ties)
{
double f;
- switch ( cmd->fraction )
+ switch (cmd->fraction)
{
case FRAC_BLOM:
f = (r - 3.0/8.0) / (w + 0.25);
f = (r - 1.0/3.0) / (w + 1.0/3.0);
break;
case FRAC_VW:
- f = r / ( w + 1.0);
+ f = r / (w + 1.0);
break;
default:
NOT_REACHED ();
double r = rank_rank (cmd, c, cc, cc_1, i, w);
- return ( floor (( r * cmd->k_ntiles) / ( w + 1) ) + 1);
+ return (floor ((r * cmd->k_ntiles) / (w + 1)) + 1);
}
/* Expected value of the order statistics from an exponential distribution */
double sum = 0.0;
for (k = 1 ; k <= j; k++)
- sum += 1.0 / ( w_star + 1 - k );
+ sum += 1.0 / (w_star + 1 - k);
return sum;
}
const int i_1 = floor (cc_1);
const int i_2 = floor (cc);
- const double w_star = (modf (w, &int_part) == 0 ) ? w : floor (w) + 1;
+ const double w_star = (modf (w, &int_part) == 0) ? w : floor (w) + 1;
const double g_1 = cc_1 - i_1;
const double g_2 = cc - i_2;
/* The second factor is infinite, when the first is zero.
Therefore, evaluate the second, only when the first is non-zero */
- const double expr1 = (1 - g_1) ? (1 - g_1) * ee(i_1+1, w_star) : ( 1 - g_1);
+ const double expr1 = (1 - g_1) ? (1 - g_1) * ee(i_1+1, w_star) : (1 - g_1);
const double expr2 = g_2 ? g_2 * ee (i_2+1, w_star) : g_2 ;
- if ( i_1 == i_2 )
+ if (i_1 == i_2)
return ee (i_1 + 1, w_star) - 1;
- if ( i_1 + 1 == i_2 )
- return ( ( expr1 + expr2 )/c ) - 1;
+ if (i_1 + 1 == i_2)
+ return ((expr1 + expr2)/c) - 1;
- if ( i_1 + 2 <= i_2 )
+ if (i_1 + 2 <= i_2)
{
int j;
double sigma = 0.0;
- for (j = i_1 + 2 ; j <= i_2; ++j )
+ for (j = i_1 + 2 ; j <= i_2; ++j)
sigma += ee (j, w_star);
- return ( (expr1 + expr2 + sigma) / c) -1;
+ return ((expr1 + expr2 + sigma) / c) -1;
}
NOT_REACHED();
static const char *
fraction_name (const struct rank *cmd)
{
- switch (cmd->fraction )
+ switch (cmd->fraction)
{
case FRAC_BLOM: return "BLOM";
case FRAC_RANKIT: return "RANKIT";
ds_init_empty (&label);
- if ( cmd->n_group_vars > 0 )
+ if (cmd->n_group_vars > 0)
{
struct string group_var_str;
int g;
ds_init_empty (&group_var_str);
- for (g = 0 ; g < cmd->n_group_vars ; ++g )
+ for (g = 0 ; g < cmd->n_group_vars ; ++g)
{
- if ( g > 0 ) ds_put_cstr (&group_var_str, " ");
+ if (g > 0) ds_put_cstr (&group_var_str, " ");
ds_put_cstr (&group_var_str, var_get_name (cmd->group_vars[g]));
}
rank.n_vars = rank.sc.n_fields;
- if (lex_match (lexer, T_BY) )
+ if (lex_match (lexer, T_BY))
{
- if ( ! parse_variables_const (lexer, rank.dict,
+ if (! parse_variables_const (lexer, rank.dict,
&rank.group_vars, &rank.n_group_vars,
PV_NO_DUPLICATE | PV_NO_SCRATCH))
goto error;
}
- while (lex_token (lexer) != T_ENDCMD )
+ while (lex_token (lexer) != T_ENDCMD)
{
if (! lex_force_match (lexer, T_SLASH))
goto error;
/* If no rank specs are given, then apply a default */
- if ( rank.n_rs == 0)
+ if (rank.n_rs == 0)
{
struct rank_spec *rs;
{
rs->dest_labels = pool_calloc (rank.pool, rank.n_vars,
sizeof *rs->dest_labels);
- for (int v = 0 ; v < rank.n_vars ; v ++ )
+ for (int v = 0 ; v < rank.n_vars ; v ++)
{
const char **dst_name = &rs->dest_names[v];
- if ( *dst_name == NULL )
+ if (*dst_name == NULL)
{
*dst_name = rank_choose_dest_name (rank.dict, &new_names,
rs->rfunc,
}
}
- if ( rank.print )
+ if (rank.print)
{
struct pivot_table *table = pivot_table_create (
N_("Variables Created by RANK"));
N_("Existing Variable"));
variables->root->show_label = true;
- for (size_t i = 0 ; i < rank.n_rs ; ++i )
+ for (size_t i = 0 ; i < rank.n_rs ; ++i)
{
- for (size_t v = 0 ; v < rank.n_vars ; v ++ )
+ for (size_t v = 0 ; v < rank.n_vars ; v ++)
{
int row_idx = pivot_category_create_leaf (
variables->root, pivot_value_new_variable (rank.vars[v]));
struct string group_vars = DS_EMPTY_INITIALIZER;
- for (int g = 0 ; g < rank.n_group_vars ; ++g )
+ for (int g = 0 ; g < rank.n_group_vars ; ++g)
{
if (g)
ds_put_byte (&group_vars, ' ');
/* Open the active file and make one pass per input variable. */
input = proc_open (ds);
input = casereader_create_filter_weight (input, d, NULL, NULL);
- for (i = 0 ; i < cmd->n_vars ; ++i )
+ for (i = 0 ; i < cmd->n_vars ; ++i)
{
const struct variable *input_var = cmd->vars[i];
struct casereader *input_pass;
if (lex_match_id (lexer, "SCALE"))
{
struct const_var_set *vs;
- if ( ! lex_force_match (lexer, T_LPAREN))
+ if (! lex_force_match (lexer, T_LPAREN))
goto error;
- if ( ! lex_force_string (lexer) )
+ if (! lex_force_string (lexer))
goto error;
ds_assign_substring (&reliability.scale_name, lex_tokss (lexer));
lex_get (lexer);
- if ( ! lex_force_match (lexer, T_RPAREN))
+ if (! lex_force_match (lexer, T_RPAREN))
goto error;
lex_match (lexer, T_EQUALS);
reliability.model = MODEL_SPLIT;
reliability.split_point = -1;
- if ( lex_match (lexer, T_LPAREN)
+ if (lex_match (lexer, T_LPAREN)
&& lex_force_num (lexer))
{
reliability.split_point = lex_number (lexer);
}
}
- if ( reliability.model == MODEL_SPLIT)
+ if (reliability.model == MODEL_SPLIT)
{
int i;
const struct cronbach *s;
- if ( reliability.split_point >= reliability.n_variables)
+ if (reliability.split_point >= reliability.n_variables)
{
msg (ME, _("The split point must be less than the number of variables"));
goto error;
}
}
- if ( reliability.summary & SUMMARY_TOTAL)
+ if (reliability.summary & SUMMARY_TOTAL)
{
int i;
const int base_sc = reliability.n_sc;
reliability.sc = xrealloc (reliability.sc, sizeof (struct cronbach) * reliability.n_sc);
- for (i = 0 ; i < reliability.sc[0].n_items; ++i )
+ for (i = 0 ; i < reliability.sc[0].n_items; ++i)
{
int v_src;
int v_dest = 0;
s->items = xzalloc (sizeof (struct variable *) * s->n_items);
for (v_src = 0 ; v_src < reliability.sc[0].n_items ; ++v_src)
{
- if ( v_src != i)
+ if (v_src != i)
s->items[v_dest++] = reliability.sc[0].items[v_src];
}
}
}
- if ( ! run_reliability (ds, &reliability))
+ if (! run_reliability (ds, &reliability))
goto error;
reliability_destroy (&reliability);
s->m = xzalloc (sizeof *s->m * s->n_items);
s->total = moments1_create (MOMENT_VARIANCE);
- for (i = 0 ; i < s->n_items ; ++i )
+ for (i = 0 ; i < s->n_items ; ++i)
s->m[i] = moments1_create (MOMENT_VARIANCE);
}
reliability_statistics (reliability);
- if (reliability->summary & SUMMARY_TOTAL )
+ if (reliability->summary & SUMMARY_TOTAL)
reliability_summary_total (reliability);
}
static double
alpha (int k, double sum_of_variances, double variance_of_sums)
{
- return k / ( k - 1.0) * ( 1 - sum_of_variances / variance_of_sums);
+ return k / (k - 1.0) * (1 - sum_of_variances / variance_of_sums);
}
static void
moments1_clear (s->total);
- for (i = 0 ; i < s->n_items ; ++i )
+ for (i = 0 ; i < s->n_items ; ++i)
moments1_clear (s->m[i]);
}
{
struct cronbach *s = &rel->sc[si];
- for (i = 0 ; i < s->n_items ; ++i )
+ for (i = 0 ; i < s->n_items ; ++i)
moments1_add (s->m[i], case_data (c, s->items[i])->f, weight);
moments1_add (s->total, case_data_idx (c, s->totals_idx)->f, weight);
struct cronbach *s = &rel->sc[si];
s->sum_of_variances = 0;
- for (i = 0 ; i < s->n_items ; ++i )
+ for (i = 0 ; i < s->n_items ; ++i)
{
double weight, mean, variance;
moments1_calculate (s->m[i], &weight, &mean, &variance, NULL, NULL);
rel->sc[1].n_items + rel->sc[2].n_items,
r1,
2 * r1 / (1.0 + r1),
- (sqrt ( pow4 (r1) + 4 * pow2 (r1) * tmp) - pow2 (r1)) / (2 * tmp),
+ (sqrt (pow4 (r1) + 4 * pow2 (r1) * tmp) - pow2 (r1)) / (2 * tmp),
g,
};
for (size_t i = 0; i < sizeof entries / sizeof *entries; i++)
PV_APPEND | PV_NO_DUPLICATE | PV_NUMERIC))
goto error;
- if ( ! lex_force_match (lexer, T_BY))
+ if (! lex_force_match (lexer, T_BY))
{
goto error;
}
goto error;
}
- if ( !lex_force_match (lexer, T_LPAREN))
+ if (!lex_force_match (lexer, T_LPAREN))
{
goto error;
}
parse_value (lexer, &roc.state_value, roc.state_var);
- if ( !lex_force_match (lexer, T_RPAREN))
+ if (!lex_force_match (lexer, T_RPAREN))
{
goto error;
}
}
}
- if ( ! run_roc (ds, &roc))
+ if (! run_roc (ds, &roc))
goto error;
- if ( roc.state_var)
+ if (roc.state_var)
value_destroy (&roc.state_value, roc.state_var_width);
free (roc.vars);
return CMD_SUCCESS;
error:
- if ( roc.state_var)
+ if (roc.state_var)
value_destroy (&roc.state_value, roc.state_var_width);
free (roc.vars);
return CMD_FAILURE;
struct ccase *c;
struct casereader *r = casereader_clone (reader);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
int i;
for (i = 0 ; i < case_get_value_cnt (c); ++i)
const double weight = wv ? case_data (c, wv)->f : 1.0;
const bool positive =
- ( 0 == value_compare_3way (case_data (c, roc->state_var), &roc->state_value,
+ (0 == value_compare_3way (case_data (c, roc->state_var), &roc->state_value,
var_get_width (roc->state_var)));
- if ( positive )
+ if (positive)
{
roc->pos++;
roc->pos_weighted += weight;
struct ccase *cpc;
double prev_cp = SYSMIS;
- for ( ; (cpc = casereader_read (input) ); case_unref (cpc))
+ for (; (cpc = casereader_read (input)); case_unref (cpc))
{
struct ccase *new_case;
const double cp = case_data_idx (cpc, ROC_CUTPOINT)->f;
assert (cp != SYSMIS);
/* We don't want duplicates here */
- if ( cp == prev_cp )
+ if (cp == prev_cp)
continue;
new_case = case_clone (cpc);
- if ( pos_cond (result, cp))
+ if (pos_cond (result, cp))
case_data_rw_idx (new_case, true_index)->f += weight;
else
case_data_rw_idx (new_case, false_index)->f += weight;
*cc = 0;
- for ( ; (c1 = casereader_read (r1) ); case_unref (c1))
+ for (; (c1 = casereader_read (r1)); case_unref (c1))
{
struct ccase *new_case = case_create (proto);
struct ccase *c2;
*cc += weight1;
- for ( ; (c2 = casereader_read (r2) ); case_unref (c2))
+ for (; (c2 = casereader_read (r2)); case_unref (c2))
{
const double d2 = case_data (c2, var)->f;
const double weight2 = case_data_idx (c2, weight_idx)->f;
- if ( d1 == d2 )
+ if (d1 == d2)
{
n_eq += weight2;
continue;
}
- else if ( pred (d2, d1))
+ else if (pred (d2, d1))
{
n_pred += weight2;
}
const union value *v = case_data (c, roc->vars[i]);
const double result = v->f;
- if ( mv_is_value_missing (var_get_missing_values (roc->vars[i]), v, roc->exclude))
+ if (mv_is_value_missing (var_get_missing_values (roc->vars[i]), v, roc->exclude))
continue;
minimize (&rs[i].min, result);
maximize (&rs[i].max, result);
- if ( rs[i].prev_result != SYSMIS && rs[i].prev_result != result )
+ if (rs[i].prev_result != SYSMIS && rs[i].prev_result != result)
{
- const double mean = (result + rs[i].prev_result ) / 2.0;
+ const double mean = (result + rs[i].prev_result) / 2.0;
append_cutpoint (rs[i].cutpoint_wtr, mean);
}
struct casereader *n_pos_reader =
process_positive_group (var, pos, dict, &rs[i]);
- if ( negatives == NULL)
+ if (negatives == NULL)
{
negatives = casewriter_make_reader (neg_wtr);
}
/* Merge the n_pos and n_neg casereaders */
w = sort_create_writer (&up_ordering, n_proto);
- for ( ; (cpos = casereader_read (n_pos_reader) ); case_unref (cpos))
+ for (; (cpos = casereader_read (n_pos_reader)); case_unref (cpos))
{
struct ccase *pos_case = case_create (n_proto);
struct ccase *cneg;
casewriter_write (w, nc);
case_unref (cneg);
- if ( jneg > jpos)
+ if (jneg > jpos)
break;
}
double prev_pos_gt = rs[i].n1;
w = sort_create_writer (&down_ordering, n_proto);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double n_pos_gt = case_data_idx (c, N_POS_GT)->f;
struct ccase *nc = case_clone (c);
- if ( n_pos_gt == SYSMIS)
+ if (n_pos_gt == SYSMIS)
{
n_pos_gt = prev_pos_gt;
case_data_rw_idx (nc, N_POS_GT)->f = n_pos_gt;
double prev_neg_lt = rs[i].n2;
w = sort_create_writer (&up_ordering, n_proto);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double n_neg_lt = case_data_idx (c, N_NEG_LT)->f;
struct ccase *nc = case_clone (c);
- if ( n_neg_lt == SYSMIS)
+ if (n_neg_lt == SYSMIS)
{
n_neg_lt = prev_neg_lt;
case_data_rw_idx (nc, N_NEG_LT)->f = n_neg_lt;
{
struct ccase *prev_case = NULL;
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
struct ccase *next_case = casereader_peek (r, 0);
double n_neg_eq = case_data_idx (c, N_NEG_EQ)->f;
double n_neg_lt = case_data_idx (c, N_NEG_LT)->f;
- if ( prev_case && j == case_data_idx (prev_case, VALUE)->f)
+ if (prev_case && j == case_data_idx (prev_case, VALUE)->f)
{
- if ( 0 == case_data_idx (c, N_POS_EQ)->f)
+ if (0 == case_data_idx (c, N_POS_EQ)->f)
{
n_pos_eq = case_data_idx (prev_case, N_POS_EQ)->f;
n_pos_gt = case_data_idx (prev_case, N_POS_GT)->f;
}
- if ( 0 == case_data_idx (c, N_NEG_EQ)->f)
+ if (0 == case_data_idx (c, N_NEG_EQ)->f)
{
n_neg_eq = case_data_idx (prev_case, N_NEG_EQ)->f;
n_neg_lt = case_data_idx (prev_case, N_NEG_LT)->f;
}
}
- if ( NULL == next_case || j != case_data_idx (next_case, VALUE)->f)
+ if (NULL == next_case || j != case_data_idx (next_case, VALUE)->f)
{
rs[i].auc += n_pos_gt * n_neg_eq + (n_pos_eq * n_neg_eq) / 2.0;
rs[i].q1hat +=
- n_neg_eq * ( pow2 (n_pos_gt) + n_pos_gt * n_pos_eq + pow2 (n_pos_eq) / 3.0);
+ n_neg_eq * (pow2 (n_pos_gt) + n_pos_gt * n_pos_eq + pow2 (n_pos_eq) / 3.0);
rs[i].q2hat +=
- n_pos_eq * ( pow2 (n_neg_lt) + n_neg_lt * n_neg_eq + pow2 (n_neg_eq) / 3.0);
+ n_pos_eq * (pow2 (n_neg_lt) + n_neg_lt * n_neg_eq + pow2 (n_neg_eq) / 3.0);
}
case_unref (prev_case);
rs[i].auc /= rs[i].n1 * rs[i].n2;
- if ( roc->invert )
+ if (roc->invert)
rs[i].auc = 1 - rs[i].auc;
- if ( roc->bi_neg_exp )
+ if (roc->bi_neg_exp)
{
- rs[i].q1hat = rs[i].auc / ( 2 - rs[i].auc);
- rs[i].q2hat = 2 * pow2 (rs[i].auc) / ( 1 + rs[i].auc);
+ rs[i].q1hat = rs[i].auc / (2 - rs[i].auc);
+ rs[i].q2hat = 2 * pow2 (rs[i].auc) / (1 + rs[i].auc);
}
else
{
table, PIVOT_AXIS_ROW, N_("Variable under test"));
variables->root->show_label = true;
- for (size_t i = 0 ; i < roc->n_vars ; ++i )
+ for (size_t i = 0 ; i < roc->n_vars ; ++i)
{
int var_idx = pivot_category_create_leaf (
variables->root, pivot_value_new_variable (roc->vars[i]));
pivot_table_put2 (table, 0, var_idx, pivot_value_new_number (rs[i].auc));
- if ( roc->print_se )
+ if (roc->print_se)
{
double se = (rs[i].auc * (1 - rs[i].auc)
+ (rs[i].n1 - 1) * (rs[i].q1hat - pow2 (rs[i].auc))
{
show_summary (roc);
- if ( roc->curve )
+ if (roc->curve)
{
struct roc_chart *rc;
size_t i;
show_auc (rs, roc);
- if ( roc->print_coords )
+ if (roc->print_coords)
show_coords (rs, roc);
}
z = rs->runs - mu;
- if ( rs->n < 50)
+ if (rs->n < 50)
{
if (z <= -0.5)
z += 0.5;
struct runs_test *rt = UP_CAST (otp, struct runs_test, parent);
struct run_state *rs = xcalloc (otp->n_vars, sizeof (*rs));
- switch ( rt->cp_mode)
+ switch (rt->cp_mode)
{
case CP_MODE:
{
{
const double w = weight ? case_data (c, weight)->f: 1.0;
const union value *val = case_data (c, var);
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val, exclude))
continue;
x = val->f;
cc += w;
}
- if ( cc > last_cc)
+ if (cc > last_cc)
{
run->cutpoint = x;
}
- else if ( cc == last_cc)
+ else if (cc == last_cc)
{
multimodal = true;
- if ( x > run->cutpoint)
+ if (x > run->cutpoint)
run->cutpoint = x;
}
last_cc = cc;
subcase_init_var (&sc, var, SC_ASCEND);
writer = sort_create_writer (&sc, casereader_get_proto (reader));
- for (; (c = casereader_read (reader)); )
+ for (; (c = casereader_read (reader));)
{
const union value *val = case_data (c, var);
const double w = weight ? case_data (c, weight)->f: 1.0;
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val, exclude))
{
case_unref (c);
continue;
const double x = val->f;
struct run_state *run = &rs[v];
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val, exclude))
continue;
run->cutpoint += x * w;
double d = x - run->cutpoint;
short sign = 0;
- if ( var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val, exclude))
continue;
if (d >= 0)
{
const double weight = dict_get_case_weight (dict, c, &warn);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
variable_pair *vp = &t2s->pairs[i];
const union value *value0 = case_data (c, (*vp)[0]);
if (var_is_value_missing ((*vp)[1], value1, exclude))
continue;
- if ( diff > 0)
+ if (diff > 0)
stp[i].pos += weight;
else if (diff < 0)
stp[i].neg += weight;
casereader_destroy (r);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
int r = MIN (stp[i].pos, stp[i].neg);
stp[i].one_tailed_sig = gsl_cdf_binomial_P (r,
{
int width = var_get_width (is->gvar);
int cmp = value_compare_3way (v, is->gval0, width);
- if ( is->cut )
+ if (is->cut)
return (cmp < 0);
if (cmp == 0)
is.cut = cut;
r = casereader_clone (reader);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
const union value *gv = case_data (c, gvar);
int grp = which_group (gv, &is);
- if ( grp < 0)
+ if (grp < 0)
continue;
for (v = 0; v < tt->n_vars; ++v)
casereader_destroy (r);
r = casereader_clone (reader);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
const union value *gv = case_data (c, gvar);
int grp = which_group (gv, &is);
- if ( grp < 0)
+ if (grp < 0)
continue;
for (v = 0; v < tt->n_vars; ++v)
casereader_destroy (r);
r = reader;
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
const union value *gv = case_data (c, gvar);
int grp = which_group (gv, &is);
- if ( grp < 0)
+ if (grp < 0)
continue;
for (v = 0; v < tt->n_vars; ++v)
struct casereader *r = casereader_clone (reader);
struct ccase *c;
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
for (size_t i = 0; i < os.n_stats; i++)
casereader_destroy (r);
r = reader;
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
for (size_t i = 0; i < os.n_stats; i++)
}
r = casereader_clone (reader);
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
casereader_destroy (r);
r = reader;
- for ( ; (c = casereader_read (r) ); case_unref (c))
+ for (; (c = casereader_read (r)); case_unref (c))
{
double w = dict_get_case_weight (tt->dict, c, NULL);
lex_match (lexer, T_EQUALS);
- for (; lex_token (lexer) != T_ENDCMD; )
+ for (; lex_token (lexer) != T_ENDCMD;)
{
lex_match (lexer, T_SLASH);
if (lex_match_id (lexer, "TESTVAL"))
PV_NO_DUPLICATE | PV_NUMERIC))
goto exit;
- if ( lex_match (lexer, T_WITH))
+ if (lex_match (lexer, T_WITH))
{
with = true;
if (!parse_variables_const (lexer, dict,
{
int i;
- if ( !with )
+ if (!with)
n_pairs = (n_v1 * (n_v1 - 1)) / 2.0;
- else if ( paired )
+ else if (paired)
n_pairs = n_v1;
else
n_pairs = n_v1 * n_v2;
pairs = xcalloc (n_pairs, sizeof *pairs);
- if ( with)
+ if (with)
{
int x = 0;
if (paired)
}
else if (lex_match_id (lexer, "VARIABLES"))
{
- if ( tt.mode == MODE_PAIRED)
+ if (tt.mode == MODE_PAIRED)
{
msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
goto exit;
PV_NO_DUPLICATE | PV_NUMERIC))
goto exit;
}
- else if ( lex_match_id (lexer, "MISSING"))
+ else if (lex_match_id (lexer, "MISSING"))
{
lex_match (lexer, T_EQUALS);
while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
else if (lex_match_id (lexer, "CRITERIA"))
{
lex_match (lexer, T_EQUALS);
- if ( lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI"))
- if ( lex_force_match (lexer, T_LPAREN))
+ if (lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI"))
+ if (lex_force_match (lexer, T_LPAREN))
{
if (!lex_force_num (lexer))
goto exit;
}
}
- if ( mode_count != 1)
+ if (mode_count != 1)
{
msg (SE, _("Exactly one of TESTVAL, GROUPS and PAIRS subcommands "
"must be specified."));
while (casegrouper_get_next_group (grouper, &group))
{
- if ( tt.mode == MODE_SINGLE)
+ if (tt.mode == MODE_SINGLE)
{
- if ( tt.missing_type == MISS_LISTWISE )
+ if (tt.missing_type == MISS_LISTWISE)
group = casereader_create_filter_missing (group,
tt.vars, tt.n_vars,
tt.exclude,
NULL, NULL);
one_sample_run (&tt, testval, group);
}
- else if ( tt.mode == MODE_PAIRED)
+ else if (tt.mode == MODE_PAIRED)
{
- if ( tt.missing_type == MISS_LISTWISE )
+ if (tt.missing_type == MISS_LISTWISE)
{
group = casereader_create_filter_missing (group,
v1, n_v1,
}
else /* tt.mode == MODE_INDEP */
{
- if ( tt.missing_type == MISS_LISTWISE )
+ if (tt.missing_type == MISS_LISTWISE)
{
group = casereader_create_filter_missing (group,
tt.vars, tt.n_vars,
if (weight != NULL)
proto = caseproto_add_width (proto, 0);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
struct casereader *r = casereader_clone (input);
struct casewriter *writer;
}
caseproto_unref (proto);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
struct casereader *rr ;
struct ccase *c;
rr = casereader_create_append_rank (ws[i].reader, ws[i].absdiff,
weight ? weightx : NULL, &err,
distinct_callback, &ws[i]
- );
+ );
for (; (c = casereader_read (rr)) != NULL; case_unref (c))
{
if (weight)
w = case_data (c, weightx)->f;
- if ( sign > 0 )
+ if (sign > 0)
{
ws[i].positives.sum += rank * w;
ws[i].positives.n += w;
show_ranks_box (ws, t2s, dict);
show_tests_box (ws, t2s, exact, timer);
- for (i = 0 ; i < t2s->n_pairs; ++i )
+ for (i = 0 ; i < t2s->n_pairs; ++i)
{
dict_destroy_internal_var (ws[i].sign);
dict_destroy_internal_var (ws[i].absdiff);
const struct npar_test *test,
bool exact,
double timer
- );
+ );
{
char *path = 0;
- if ( ! lex_force_string (lexer))
+ if (! lex_force_string (lexer))
goto error;
path = utf8_to_filename (lex_tokcstr (lexer));
- if ( -1 == chdir (path) )
+ if (-1 == chdir (path))
{
int err = errno;
msg (SE, _("Cannot change directory to %s: %s "), path,
filename = include_path_search (relative_name);
free (relative_name);
- if ( ! filename)
+ if (! filename)
{
msg (SE, _("Can't find `%s' in include file search path."),
lex_tokcstr (lexer));
status = CMD_FAILURE;
encoding = xstrdup (session_get_default_syntax_encoding (
dataset_session (ds)));
- while ( T_ENDCMD != lex_token (lexer))
+ while (T_ENDCMD != lex_token (lexer))
{
if (lex_match_id (lexer, "ENCODING"))
{
else if (variant == INSERT && lex_match_id (lexer, "SYNTAX"))
{
lex_match (lexer, T_EQUALS);
- if ( lex_match_id (lexer, "INTERACTIVE") )
+ if (lex_match_id (lexer, "INTERACTIVE"))
syntax_mode = LEX_SYNTAX_INTERACTIVE;
- else if ( lex_match_id (lexer, "BATCH"))
+ else if (lex_match_id (lexer, "BATCH"))
syntax_mode = LEX_SYNTAX_BATCH;
- else if ( lex_match_id (lexer, "AUTO"))
+ else if (lex_match_id (lexer, "AUTO"))
syntax_mode = LEX_SYNTAX_AUTO;
else
{
else if (variant == INSERT && lex_match_id (lexer, "CD"))
{
lex_match (lexer, T_EQUALS);
- if ( lex_match_id (lexer, "YES") )
+ if (lex_match_id (lexer, "YES"))
{
cd = true;
}
- else if ( lex_match_id (lexer, "NO"))
+ else if (lex_match_id (lexer, "NO"))
{
cd = false;
}
else if (variant == INSERT && lex_match_id (lexer, "ERROR"))
{
lex_match (lexer, T_EQUALS);
- if ( lex_match_id (lexer, "CONTINUE") )
+ if (lex_match_id (lexer, "CONTINUE"))
{
error_mode = LEX_ERROR_CONTINUE;
}
- else if ( lex_match_id (lexer, "STOP"))
+ else if (lex_match_id (lexer, "STOP"))
{
error_mode = LEX_ERROR_STOP;
}
}
status = lex_end_of_command (lexer);
- if ( status == CMD_SUCCESS)
+ if (status == CMD_SUCCESS)
{
struct lex_reader *reader;
lex_discard_rest_of_command (lexer);
lex_include (lexer, reader);
- if ( cd )
+ if (cd)
{
char *directory = dir_name (filename);
chdir (directory);
lex_match (lexer, T_SLASH);
- if ( ! lex_match_id (lexer, "PERMISSIONS"))
+ if (! lex_match_id (lexer, "PERMISSIONS"))
goto error;
lex_match (lexer, T_EQUALS);
- if ( lex_match_id (lexer, "READONLY"))
+ if (lex_match_id (lexer, "READONLY"))
{
if (! change_permissions (fn, PER_RO))
goto error;
}
else if (lex_match_id (lexer, "WRITEABLE"))
{
- if (! change_permissions (fn, PER_RW ))
+ if (! change_permissions (fn, PER_RW))
goto error;
}
else
}
locale_file_name = utf8_to_filename (file_name);
- if ( -1 == stat(locale_file_name, &buf) )
+ if (-1 == stat(locale_file_name, &buf))
{
const int errnum = errno;
msg (SE, _("Cannot stat %s: %s"), file_name, strerror(errnum));
return 0;
}
- if ( per == PER_RW )
+ if (per == PER_RW)
mode = buf.st_mode | 0200;
else
mode = buf.st_mode & ~0222;
- if ( -1 == chmod(locale_file_name, mode))
+ if (-1 == chmod(locale_file_name, mode))
{
const int errnum = errno;
as the widest destination variable. */
if (trns->dst_type == VAL_STRING)
{
- if ( ! enlarge_dst_widths (trns))
+ if (! enlarge_dst_widths (trns))
{
recode_trns_free (trns);
return CMD_FAILURE;
find_by_position (struct abt *abt, int position)
{
struct abt_node *p;
- for (p = abt->root; p != NULL; )
+ for (p = abt->root; p != NULL;)
{
int p_pos = p->down[0] ? node_to_element (p->down[0])->count : 0;
if (position == p_pos)
if (ferror (ea->file))
msg_error (errno, _("reading temporary file"));
else if (feof (ea->file))
- msg_error ( 0, _("unexpected end of file reading temporary file"));
+ msg_error (0, _("unexpected end of file reading temporary file"));
else
NOT_REACHED ();
return false;
{
struct substring out;
- if ( text == NULL )
+ if (text == NULL)
return NULL;
- if ( length == -1 )
+ if (length == -1)
length = strlen (text);
out = recode_substring_pool (to, from, ss_buffer (text, length), pool);
conv = create_iconv (to, from);
- if ( NULL == conv )
+ if (NULL == conv)
{
if (fallbackchar)
{
loc_encoding = xstrdup (locale_charset ());
- if ( 0 == strcmp (loc_encoding, c_encoding))
+ if (0 == strcmp (loc_encoding, c_encoding))
{
ok = false;
}
{
iconv_t conv = iconv_open (UTF8, enc);
- if ( conv == (iconv_t) -1)
+ if (conv == (iconv_t) -1)
return false;
iconv_close (conv);
a b c d e f g h i j k l m
n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9
- ! " # % & ' ( ) * + , - . / :
+ ! " # % & ' () * + , - . / :
; < = > ? [ \ ] ^ _ { | } ~
space \a \b \r \n \t \v \f \0
size_t count;
count = 0;
- for (x = r0; x != r1; )
+ for (x = r0; x != r1;)
if (compare (x, target, aux) == 0)
{
x = ll_remove (x);
size_t count;
count = 0;
- for (x = r0; x != r1; )
+ for (x = r0; x != r1;)
if (predicate (x, aux))
{
x = ll_remove (x);
{
struct llx *llx;
- for (llx = r0; llx != r1; )
+ for (llx = r0; llx != r1;)
llx = llx_remove (llx, manager);
}
size_t count;
count = 0;
- for (x = r0; x != r1; )
+ for (x = r0; x != r1;)
if (compare (llx_data (x), target, aux) == 0)
{
x = llx_remove (x, manager);
size_t count;
count = 0;
- for (x = r0; x != r1; )
+ for (x = r0; x != r1;)
if (predicate (llx_data (x), aux))
{
x = llx_remove (x, manager);
ship_message (struct msg *m)
{
entrances++;
- if ( ! m->shipped )
+ if (! m->shipped)
{
if (msg_handler && entrances <= 1)
msg_handler (m, msg_aux);
if (too_many_errors
|| (too_many_notes && m->severity == MSG_S_NOTE)
- || (warnings_off && m->severity == MSG_S_WARNING) )
+ || (warnings_off && m->severity == MSG_S_WARNING))
return;
ship_message (m);
#else
"Unknown"
#endif
- );
+);
fprintf (stderr, "******************************************************\n");
}
const char *orig = ds_cstr (st);
const char *rel = relocate (orig);
- if ( orig != rel)
+ if (orig != rel)
{
ds_clear (st);
ds_put_cstr (st, rel);
bool
taint_destroy (struct taint *taint)
{
- if ( taint )
+ if (taint)
{
bool was_tainted = taint_is_tainted (taint);
if (--taint->ref_cnt == 0)
#ifndef ZIP_PRIVATE_H
#define ZIP_PRIVATE_H 1
-#define MAGIC_EOCD ( (uint32_t) 0x06054b50) /* End of directory */
-#define MAGIC_SOCD ( (uint32_t) 0x02014b50) /* Start of directory */
-#define MAGIC_LHDR ( (uint32_t) 0x04034b50) /* Local Header */
-#define MAGIC_DDHD ( (uint32_t) 0x08074b50) /* Data Descriptor Header */
+#define MAGIC_EOCD ((uint32_t) 0x06054b50) /* End of directory */
+#define MAGIC_SOCD ((uint32_t) 0x02014b50) /* Start of directory */
+#define MAGIC_LHDR ((uint32_t) 0x04034b50) /* Local Header */
+#define MAGIC_DDHD ((uint32_t) 0x08074b50) /* Data Descriptor Header */
#endif
ds_clear (zm->errmsgs);
- if ( bytes > zm->bytes_unread)
+ if (bytes > zm->bytes_unread)
bytes = zm->bytes_unread;
bytes_read = zm->decompressor->read (zm, buf, bytes);
- if ( bytes_read < 0)
+ if (bytes_read < 0)
return bytes_read;
zm->bytes_unread -= bytes_read;
uint32_t eattr;
uint16_t comp_type;
- if ( ! check_magic (file, file_name, MAGIC_SOCD, errs))
+ if (! check_magic (file, file_name, MAGIC_SOCD, errs))
return false;
if (! get_u16 (file, &v)) return false;
struct zip_reader *zr = xzalloc (sizeof *zr);
zr->errs = errs;
- if ( zr->errs)
+ if (zr->errs)
ds_init_empty (zr->errs);
FILE *file = fopen (file_name, "rb");
return NULL;
}
- if ( ! check_magic (file, file_name, MAGIC_LHDR, zr->errs))
+ if (! check_magic (file, file_name, MAGIC_LHDR, zr->errs))
{
fclose (file);
free (zr);
return NULL;
}
- if ( ! find_eocd (file, &offset))
+ if (! find_eocd (file, &offset))
{
ds_put_format (zr->errs, _("%s: cannot find central directory"),
file_name);
return NULL;
}
- if ( 0 != fseeko (file, offset, SEEK_SET))
+ if (0 != fseeko (file, offset, SEEK_SET))
{
ds_put_format (zr->errs, _("%s: seek failed (%s)"),
file_name, strerror (errno));
}
- if ( ! check_magic (file, file_name, MAGIC_EOCD, zr->errs))
+ if (! check_magic (file, file_name, MAGIC_EOCD, zr->errs))
{
fclose (file);
free (zr);
return NULL;
}
- if ( 0 != fseeko (file, central_dir_start, SEEK_SET))
+ if (0 != fseeko (file, central_dir_start, SEEK_SET))
{
ds_put_format (zr->errs, _("%s: seek failed (%s)"),
file_name, strerror (errno));
zip_member_open (struct zip_reader *zr, const char *member)
{
struct zip_entry *ze = zip_entry_find (zr, member);
- if ( ze == NULL)
+ if (ze == NULL)
{
ds_put_format (zr->errs, _("%s: unknown member \"%s\""),
zr->file_name, member);
zm->errmsgs = zr->errs;
zm->aux = NULL;
- if ( 0 != fseeko (zm->fp, zm->offset, SEEK_SET))
+ if (0 != fseeko (zm->fp, zm->offset, SEEK_SET))
{
ds_put_format (zr->errs, _("%s: seek failed (%s)"),
ze->name, strerror (errno));
goto error;
}
- if ( ! check_magic (zm->fp, zr->file_name, MAGIC_LHDR, zr->errs))
+ if (! check_magic (zm->fp, zr->file_name, MAGIC_LHDR, zr->errs))
goto error;
uint16_t v, nlen, extra_len;
skip_bytes (zm->fp, extra_len);
- if (!zm->decompressor->init (zm) )
+ if (!zm->decompressor->init (zm))
goto error;
return zm;
because that is the minimum length of the EndOfCentralDirectory
record.
*/
- if ( 0 > fseeko (fp, -22, SEEK_END))
+ if (0 > fseeko (fp, -22, SEEK_END))
{
return false;
}
{
found = probe_magic (fp, magic, start, stop, off);
/* FIXME: For extra confidence lookup the directory start record here*/
- if ( start == 0)
+ if (start == 0)
break;
stop = start + sizeof (magic);
start >>= 1;
}
- while (!found );
+ while (!found);
return found;
}
unsigned char seq[4];
unsigned char byte;
- if ( 0 > fseeko (fp, start, SEEK_SET))
+ if (0 > fseeko (fp, start, SEEK_SET))
{
return -1;
}
if (1 != fread (&byte, 1, 1, fp))
break;
- if ( byte == seq[state])
+ if (byte == seq[state])
state++;
else
state = 0;
- if ( state == 4)
+ if (state == 4)
{
*off = ftello (fp) - 4;
return true;
}
start++;
- if ( start >= stop)
+ if (start >= stop)
break;
}
while (!feof (fp));
cmf |= cinfo << 4; /* Put cinfo into the high nibble */
/* make these into a 16 bit word */
- inf->cmf_flg = (cmf << 8 ) | flg;
+ inf->cmf_flg = (cmf << 8) | flg;
/* Set the check bits */
inf->cmf_flg += 31 - (inf->cmf_flg % 31);
inf->zss.opaque = Z_NULL;
r = inflateInit (&inf->zss);
- if ( Z_OK != r)
+ if (Z_OK != r)
{
ds_put_format (zm->errmsgs,
_("%s: cannot initialize inflator (%s)"),
int bytes_to_read;
int pad = 0;
- if ( inf->state == 0)
+ if (inf->state == 0)
{
inf->ucomp[1] = inf->cmf_flg ;
inf->ucomp[0] = inf->cmf_flg >> 8 ;
inf->zss.next_out = buf;
r = inflate (&inf->zss, Z_NO_FLUSH);
- if ( Z_OK == r)
+ if (Z_OK == r)
{
return n - inf->zss.avail_out;
}
struct order_stats *os = &bw->parent;
struct ll *ll;
- for (ll = ll_head (&bw->outliers); ll != ll_null (&bw->outliers); )
+ for (ll = ll_head (&bw->outliers); ll != ll_null (&bw->outliers);)
{
struct outlier *e = ll_data (ll, struct outlier, ll);
bool extreme;
struct outlier *o;
- if ( y > bw->hinges[2] + bw->step) /* Upper outlier */
+ if (y > bw->hinges[2] + bw->step) /* Upper outlier */
{
extreme = (y > bw->hinges[2] + 2 * bw->step) ;
}
cov->exclude = exclude;
- cov->n_cm = (n_vars * (n_vars - 1) ) / 2;
+ cov->n_cm = (n_vars * (n_vars - 1)) / 2;
cov->cm = xcalloc (cov->n_cm, sizeof *cov->cm);
assert (i >= 0);
assert (j < cov->dim);
- if ( i == 0)
+ if (i == 0)
return -1;
if (j >= cov->dim - 1)
return -1;
- if ( i <= j)
+ if (i <= j)
return -1 ;
as = nj * (nj + 1) ;
static double
get_val (const struct covariance *cov, int i, const struct ccase *c)
{
- if ( i < cov->n_vars)
+ if (i < cov->n_vars)
{
const struct variable *var = cov->vars[i];
{
double v1 = get_val (cov, i, c);
- if ( is_missing (cov, i, c))
+ if (is_missing (cov, i, c))
continue;
for (j = 0 ; j < cov->dim; ++j)
{
double pwr = 1.0;
- if ( is_missing (cov, j, c))
+ if (is_missing (cov, j, c))
continue;
for (m = 0 ; m <= MOMENT_MEAN; ++m)
if (cov->categoricals)
cov->dim += categoricals_df_total (cov->categoricals);
- cov->n_cm = (cov->dim * (cov->dim - 1) ) / 2;
+ cov->n_cm = (cov->dim * (cov->dim - 1)) / 2;
cov->cm = xcalloc (cov->n_cm, sizeof *cov->cm);
/* Grow the moment matrices so that they're large enough to accommodate the
{
double v1 = get_val (cov, i, c);
- if ( is_missing (cov, i, c))
+ if (is_missing (cov, i, c))
continue;
for (j = 0 ; j < cov->dim; ++j)
const double s = pow2 (v1 - gsl_matrix_get (cov->moments[MOMENT_MEAN], i, j)) * weight;
- if ( is_missing (cov, j, c))
+ if (is_missing (cov, j, c))
continue;
{
assert (cov->passes == 1);
- if ( !cov->pass_one_first_case_seen)
+ if (!cov->pass_one_first_case_seen)
{
- assert ( cov->state == 0);
+ assert (cov->state == 0);
cov->state = 1;
}
{
const union value *val1 = case_data (c, cov->vars[i]);
- if ( is_missing (cov, i, c))
+ if (is_missing (cov, i, c))
continue;
for (j = 0 ; j < cov->dim; ++j)
int idx;
const union value *val2 = case_data (c, cov->vars[j]);
- if ( is_missing (cov, j, c))
+ if (is_missing (cov, j, c))
continue;
idx = cm_idx (cov, i, j);
gsl_matrix *m = gsl_matrix_calloc (cov->dim, cov->dim);
/* Copy the non-diagonal elements from cov->cm */
- for ( j = 0 ; j < cov->dim - 1; ++j)
+ for (j = 0 ; j < cov->dim - 1; ++j)
{
for (i = j+1 ; i < cov->dim; ++i)
{
*x /= gsl_matrix_get (cov->moments[MOMENT_NONE], i, j);
idx = cm_idx (cov, i, j);
- if ( idx >= 0)
+ if (idx >= 0)
{
x = &cov->cm [idx];
*x /= gsl_matrix_get (cov->moments[MOMENT_NONE], i, j);
for (m = 0; m < n_MOMENTS; ++m)
{
/* Divide the moments by the number of samples */
- if ( m > 0)
+ if (m > 0)
{
for (i = 0 ; i < cov->dim; ++i)
{
double *x = gsl_matrix_ptr (cov->moments[m], i, j);
*x /= gsl_matrix_get (cov->moments[0], i, j);
- if ( m == MOMENT_VARIANCE)
+ if (m == MOMENT_VARIANCE)
*x -= pow2 (gsl_matrix_get (cov->moments[1], i, j));
}
}
if (cov->centered)
{
/* Centre the moments */
- for ( j = 0 ; j < cov->dim - 1; ++j)
+ for (j = 0 ; j < cov->dim - 1; ++j)
{
for (i = j + 1 ; i < cov->dim; ++i)
{
gsl_matrix *
covariance_calculate (struct covariance *cov)
{
- if ( cov->state <= 0 )
+ if (cov->state <= 0)
return NULL;
switch (cov->passes)
}
}
- for ( j = 0 ; j < cov->dim - 1; ++j)
+ for (j = 0 ; j < cov->dim - 1; ++j)
{
for (i = j + 1 ; i < cov->dim; ++i)
{
const gsl_matrix *
covariance_calculate_unnormalized (struct covariance *cov)
{
- if ( cov->state <= 0 )
+ if (cov->state <= 0)
return NULL;
if (cov->unnormalised != NULL)
const struct extremum *a = ll_data (a_, struct extremum, ll);
const struct extremum *b = ll_data (b_, struct extremum, ll);
- if ( a->value > b->value) return -1;
+ if (a->value > b->value) return -1;
return (a->value < b->value);
}
const struct extremum *a = ll_data (a_, struct extremum, ll);
const struct extremum *b = ll_data (b_, struct extremum, ll);
- if ( a->value < b->value) return -1;
+ if (a->value < b->value) return -1;
return (a->value > b->value);
}
struct extrema *extrema = xzalloc (sizeof *extrema);
extrema->capacity = n;
- if ( end == EXTREME_MAXIMA )
+ if (end == EXTREME_MAXIMA)
extrema->cmp_func = cmp_descending;
else
extrema->cmp_func = cmp_ascending;
e->location = location;
e->weight = weight;
- if ( val == SYSMIS)
+ if (val == SYSMIS)
{
free (e);
return;
ll_insert_ordered (ll_head (&extrema->list), ll_null (&extrema->list),
&e->ll, extrema->cmp_func, NULL);
- if ( extrema->n++ > extrema->capacity)
+ if (extrema->n++ > extrema->capacity)
{
struct ll *tail = ll_tail (&extrema->list);
struct extremum *et = ll_data (tail, struct extremum, ll);
{
const struct extremum *top;
- if ( ll_is_empty (&ex->list))
+ if (ll_is_empty (&ex->list))
return false;
top = (const struct extremum *)
struct interaction *iact = xmalloc (sizeof *iact);
iact->vars = xmalloc (sizeof *iact->vars);
iact->n_vars = 0;
- if ( v )
+ if (v)
{
iact->vars[0] = v;
iact->n_vars = 1;
int y = value_compare_3way (val1, nl->cutpoint, nl->gvw);
- if ( x == 0) x = 1;
- if ( y == 0) y = 1;
+ if (x == 0) x = 1;
+ if (y == 0) y = 1;
- return ( x == y);
+ return (x == y);
}
{
struct lev *lev = find_group (nl, gv);
- if ( nl->pass == 0 )
+ if (nl->pass == 0)
{
nl->pass = 1;
}
assert (nl->pass == 1);
- if ( NULL == lev)
+ if (NULL == lev)
{
struct lev *l = xzalloc (sizeof *l);
value_clone (&l->group, gv, nl->gvw);
{
struct lev *lev = NULL;
- if ( nl->pass == 1 )
+ if (nl->pass == 1)
{
struct lev *next;
struct lev *l;
double z;
struct lev *lev = NULL;
- if ( nl->pass == 2 )
+ if (nl->pass == 2)
{
struct lev *next;
struct lev *l;
*/
assert (nl->pass == 0 || nl->pass == 3);
- if ( nl->pass == 0 )
+ if (nl->pass == 0)
return SYSMIS;
nl->denominator *= hmap_count (&nl->hmap) - 1;
}
double
-linreg_dfmodel ( const struct linreg *c)
+linreg_dfmodel (const struct linreg *c)
{
return c->dfm;
}
double
-linreg_dferror ( const struct linreg *c)
+linreg_dferror (const struct linreg *c)
{
return c->dfe;
}
double
-linreg_dftotal ( const struct linreg *c)
+linreg_dftotal (const struct linreg *c)
{
return c->dft;
}
taint_propagate (casereader_get_taint (m->inputs[i].reader),
casewriter_get_taint (w));
- for (i = 0; i < m->input_cnt; )
+ for (i = 0; i < m->input_cnt;)
if (read_input_case (m, i))
i++;
while (m->input_cnt > 0)
struct np *np = UP_CAST (s, struct np, parent.parent);
double rank = np->prev_cc + (c + 1) / 2.0;
- double ns = gsl_cdf_ugaussian_Pinv (rank / ( np->n + 1 ));
+ double ns = gsl_cdf_ugaussian_Pinv (rank / (np->n + 1));
double z = (y - np->mean) / np->stddev;
update_k_lower (struct k *kk,
double y_i, double c_i, double cc_i)
{
- if ( cc_i <= kk->tc )
+ if (cc_i <= kk->tc)
{
kk->cc = cc_i;
kk->c = c_i;
update_k_upper (struct k *kk,
double y_i, double c_i, double cc_i)
{
- if ( cc_i > kk->tc && kk->c_p1 == 0)
+ if (cc_i > kk->tc && kk->c_p1 == 0)
{
kk->cc_p1 = cc_i;
kk->c_p1 = c_i;
update_k_upper (myk, y_i, c_i, cc_i);
}
- if ( stat->accumulate )
+ if (stat->accumulate)
stat->accumulate (stat, cx, c_i, cc_i, y_i);
tos->cc = cc_i;
/* The casereader MUST be sorted */
assert (this_value >= prev_value);
- if ( prev_value == -DBL_MAX || prev_value == this_value)
+ if (prev_value == -DBL_MAX || prev_value == this_value)
c_i += weight;
- if ( prev_value > -DBL_MAX && this_value > prev_value)
+ if (prev_value > -DBL_MAX && this_value > prev_value)
{
update_k_values (prev_cx, prev_value, c_i, cc_i, os, nos);
c_i = weight;
struct percentile *mutable = CONST_CAST (struct percentile *, ptl);
const struct order_stats *os = &ptl->parent;
- if ( ptl->g1 == SYSMIS)
+ if (ptl->g1 == SYSMIS)
mutable->g1 = (os->k[0].tc - os->k[0].cc) / os->k[0].c_p1;
- if ( ptl->g1_star == SYSMIS)
+ if (ptl->g1_star == SYSMIS)
mutable->g1_star = os->k[0].tc - os->k[0].cc;
- if ( ptl->g2 == SYSMIS)
+ if (ptl->g2 == SYSMIS)
{
- if ( os->k[1].c == 0 )
+ if (os->k[1].c == 0)
mutable->g2 = os->k[1].tc / os->k[1].c_p1;
- else if ( os->k[1].c_p1 == 0 )
+ else if (os->k[1].c_p1 == 0)
mutable->g2 = 0;
else
mutable->g2 = (os->k[1].tc - os->k[1].cc) / os->k[1].c_p1;
}
- if ( ptl->g2_star == SYSMIS)
+ if (ptl->g2_star == SYSMIS)
{
- if ( os->k[1].c == 0 )
+ if (os->k[1].c == 0)
mutable->g2_star = os->k[1].tc;
- else if ( os->k[1].c_p1 == 0 )
+ else if (os->k[1].c_p1 == 0)
mutable->g2_star = 0;
else
mutable->g2_star = os->k[1].tc - os->k[1].cc;
switch (alg)
{
case PC_WAVERAGE:
- if ( ptl->g1_star >= 1.0)
+ if (ptl->g1_star >= 1.0)
return os->k[0].y_p1;
else
{
- double a = ( os->k[0].y == SYSMIS ) ? 0 : os->k[0].y;
+ double a = (os->k[0].y == SYSMIS) ? 0 : os->k[0].y;
if (os->k[0].c_p1 >= 1.0)
return (1 - ptl->g1_star) * a + ptl->g1_star * os->k[0].y_p1;
case PC_ROUND:
{
- double a = ( os->k[0].y == SYSMIS ) ? 0 : os->k[0].y;
+ double a = (os->k[0].y == SYSMIS) ? 0 : os->k[0].y;
if (os->k[0].c_p1 >= 1.0)
return (ptl->g1_star < 0.5) ? a : os->k[0].y_p1;
break;
case PC_EMPIRICAL:
- if ( ptl->g1_star == 0 )
+ if (ptl->g1_star == 0)
return os->k[0].y;
else
return os->k[0].y_p1;
break;
case PC_HAVERAGE:
- if ( ptl->g2_star >= 1.0)
+ if (ptl->g2_star >= 1.0)
{
return os->k[1].y_p1;
}
else
{
- double a = ( os->k[1].y == SYSMIS ) ? 0 : os->k[1].y;
+ double a = (os->k[1].y == SYSMIS) ? 0 : os->k[1].y;
- if ( os->k[1].c_p1 >= 1.0)
+ if (os->k[1].c_p1 >= 1.0)
{
- if ( ptl->g2_star == 0)
+ if (ptl->g2_star == 0)
return os->k[1].y;
return (1 - ptl->g2_star) * a + ptl->g2_star * os->k[1].y_p1;
break;
case PC_AEMPIRICAL:
- if ( ptl->g1_star == 0 )
+ if (ptl->g1_star == 0)
return (os->k[0].y + os->k[0].y_p1)/ 2.0;
else
return os->k[0].y_p1;
struct trimmed_mean *tm = UP_CAST (s, struct trimmed_mean, parent.parent);
struct order_stats *os = &tm->parent;
- if ( cc > os->k[0].tc && cc <= os->k[1].tc)
+ if (cc > os->k[0].tc && cc <= os->k[1].tc)
tm->sum += c * y;
- if ( tm->cyk1p1 == SYSMIS && cc > os->k[0].tc)
+ if (tm->cyk1p1 == SYSMIS && cc > os->k[0].tc)
tm->cyk1p1 = c * y;
}
(tm->w - os->k[1].cc - os->k[0].tc) * os->k[1].y_p1
+
tm->sum
- )
+)
/ ((1.0 - tm->tail * 2) * tm->w);
}
if (a_star[i] < 1)
{
- if (os->k[i].c_p1 >= 1 )
+ if (os->k[i].c_p1 >= 1)
{
hinge[i] = (1 - a_star[i]) * os->k[i].y
+ a_star[i] * os->k[i].y_p1;
os->n_k = 3;
os->k = xcalloc (3, sizeof (*os->k));
- if ( c_min >= 1.0)
+ if (c_min >= 1.0)
{
d = floor ((W + 3) / 2.0) / 2.0;
int ofs;
ofs = width = 0;
- for (ofs = 0; ofs < n; )
+ for (ofs = 0; ofs < n;)
{
ucs4_t uc;
int mblen;
size_t graph_ofs;
size_t ofs;
- for (ofs = 0; ofs < n; )
+ for (ofs = 0; ofs < n;)
{
ucs4_t uc;
int mblen;
{
struct ascii_driver *a = ascii_driver_cast (driver);
- for (size_t i = a->allocated_lines; i-- > 0; )
+ for (size_t i = a->allocated_lines; i-- > 0;)
if (a->lines[i].width)
{
ascii_output_lines (a, i + 1);
if (orientation == SCALE_ABSCISSA)
{
- if ( rotated)
+ if (rotated)
xrchart_label_rotate (cr, 'l', 'c', geom->font_size, s, -G_PI_4);
else
xrchart_label (cr, 'c', 't', geom->font_size, s);
const int swatch = 20;
const int legend_top = geom->axis[SCALE_ORDINATE].data_max;
const int legend_bottom = legend_top -
- (vstep * geom->n_datasets + 2 * ypad );
+ (vstep * geom->n_datasets + 2 * ypad);
cairo_save (cr);
legend_bottom - legend_top);
cairo_stroke (cr);
- for (i = 0 ; i < geom->n_datasets ; ++i )
+ for (i = 0 ; i < geom->n_datasets ; ++i)
{
const int ypos = legend_top - vstep * (i + 1);
const int xpos = geom->legend_left + xpad;
double x1, y1;
double x2, y2;
- if ( lim_dim == XRCHART_DIM_Y )
+ if (lim_dim == XRCHART_DIM_Y)
{
- x1 = ( limit1 - intercept ) / slope;
- x2 = ( limit2 - intercept ) / slope;
+ x1 = (limit1 - intercept) / slope;
+ x2 = (limit2 - intercept) / slope;
y1 = limit1;
y2 = limit2;
}
}
/* rgb(r,g,b) */
- if (sscanf (s, "rgb (%"SCNi8" , %"SCNi8" , %"SCNi8" ) %n",
+ if (sscanf (s, "rgb (%"SCNi8" , %"SCNi8" , %"SCNi8") %n",
&r, &g, &b, &len) == 3
&& !s[len])
{
}
/* rgba(r,g,b,a), ignoring a. */
- if (sscanf (s, "rgba (%"SCNi8" , %"SCNi8" , %"SCNi8", %*f ) %n",
+ if (sscanf (s, "rgba (%"SCNi8" , %"SCNi8" , %"SCNi8", %*f) %n",
&r, &g, &b, &len) == 3
&& !s[len])
{
xrchart_write_xlabel (cr, geom, chart_item_get_title (chart_item));
if (bc->percent)
- xrchart_write_yscale (cr, geom, 0, bc->largest * 100.0 / bc->total_count );
+ xrchart_write_yscale (cr, geom, 0, bc->largest * 100.0 / bc->total_count);
else
xrchart_write_yscale (cr, geom, 0, bc->largest);
box_whisker_whiskers (bw, whisker);
box_whisker_hinges (bw, hinge);
- box_bottom = geom->axis[SCALE_ORDINATE].data_min + (hinge[0] - geom->axis[SCALE_ORDINATE].min ) * geom->axis[SCALE_ORDINATE].scale;
+ box_bottom = geom->axis[SCALE_ORDINATE].data_min + (hinge[0] - geom->axis[SCALE_ORDINATE].min) * geom->axis[SCALE_ORDINATE].scale;
- box_top = geom->axis[SCALE_ORDINATE].data_min + (hinge[2] - geom->axis[SCALE_ORDINATE].min ) * geom->axis[SCALE_ORDINATE].scale;
+ box_top = geom->axis[SCALE_ORDINATE].data_min + (hinge[2] - geom->axis[SCALE_ORDINATE].min) * geom->axis[SCALE_ORDINATE].scale;
bottom_whisker = geom->axis[SCALE_ORDINATE].data_min + (whisker[0] - geom->axis[SCALE_ORDINATE].min) *
geom->axis[SCALE_ORDINATE].scale;
cairo_stroke (cr);
/* Draw top whisker */
- if (! isnan (top_whisker) )
+ if (! isnan (top_whisker))
{
cairo_move_to (cr, box_left, top_whisker);
cairo_line_to (cr, box_right, top_whisker);
/* Draw the segments */
angle = 0.0;
- for (i = 0; i < pie->n_slices ; ++i )
+ for (i = 0; i < pie->n_slices ; ++i)
{
const double segment_angle =
pie->slices[i].magnitude / total_magnitude * 2 * M_PI ;
obscure them.
*/
angle = 0.0;
- for (i = 0; i < pie->n_slices ; ++i )
+ for (i = 0; i < pie->n_slices ; ++i)
{
const double segment_angle =
pie->slices[i].magnitude / total_magnitude * 2 * M_PI ;
const double label_y = centre_y +
radius * sin (angle + segment_angle/2.0);
- if ( label_x < centre_x )
+ if (label_x < centre_x)
{
cairo_move_to (cr, label_x, label_y);
cairo_line_to (cr, left_label, label_y);
ds_init_empty (&dst->label);
- if ( var_is_value_missing (var, &src->values[0], MV_ANY))
+ if (var_is_value_missing (var, &src->values[0], MV_ANY))
ds_assign_cstr (&dst->label, _("*MISSING*"));
else
var_append_value_name (var, &src->values[0], &dst->label);
double lower;
double height;
- assert ( 0 == gsl_histogram_get_range (h, bar, &lower, &upper));
- assert ( upper >= lower);
+ assert (0 == gsl_histogram_get_range (h, bar, &lower, &upper));
+ assert (upper >= lower);
const double x_pos =
(lower - geom->axis[SCALE_ABSCISSA].min) * geom->axis[SCALE_ABSCISSA].scale
xrchart_write_xscale (cr, geom, 0, 1);
xrchart_write_yscale (cr, geom, 0, 1);
- if ( rc->reference )
+ if (rc->reference)
{
xrchart_line (cr, geom, 1.0, 0,
0.0, 1.0,
gsl_vector_minmax (rc->eval, &min, &max);
- if ( fabs (max) > fabs (min))
+ if (fabs (max) > fabs (min))
max = fabs (max);
else
max = fabs (min);
{
struct spreadlevel_plot_chart *sl = to_spreadlevel_plot_chart (ci);
- if ( sl->tx_pwr == 0)
+ if (sl->tx_pwr == 0)
{
spread = log (spread);
level = log (level);
if (e == NULL)
return NULL;
- for (size_t i = e->n_groups; i-- > 0; )
+ for (size_t i = e->n_groups; i-- > 0;)
if (e->groups[i])
return utf8_to_upper (e->groups[i]);
struct output_engine *e = engine_stack_top ();
struct string dst = DS_EMPTY_INITIALIZER;
ds_extend (&dst, strlen (src));
- for (const char *p = src; *p; )
+ for (const char *p = src; *p;)
{
if (!strncmp (p, "&[", 6))
{
fputs ("<META HTTP-EQUIV=\"Content-Type\" "
"CONTENT=\"text/html; charset=utf-8\">\n", html->file);
- if ( html->css)
+ if (html->css)
{
fputs ("<META http-equiv=\"Content-Style-Type\" content=\"text/css\">\n",
html->file);
html->chart_cnt++,
&html->fg,
&html->bg
- );
+ );
if (file_name != NULL)
{
const char *title = chart_item_get_title (chart_item);
int x;
fputs (" <TR>\n", html->file);
- for (x = 0; x < table_nc (t); )
+ for (x = 0; x < table_nc (t);)
{
struct table_cell cell;
const char *tag;
{
struct journal_driver *j = journal_driver_cast (driver);
- if ( !j->destroyed)
+ if (!j->destroyed)
journal_close ();
j->destroyed = true;
static void
journal_output (struct journal_driver *j, const char *s)
{
- if ( j->file == NULL)
+ if (j->file == NULL)
return;
fprintf (j->file, "%s\n", s);
_xml ("urn:oasis:names:tc:opendocument:xmlns:style:1.0"));
xmlTextWriterWriteAttribute (w, _xml ("xmlns:fo"),
- _xml ("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0") );
+ _xml ("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"));
xmlTextWriterWriteAttribute (w, _xml ("office:version"), _xml ("1.1"));
xmlTextWriterStartElement (odt->content_wtr, _xml("text:h"));
xmlTextWriterWriteFormatAttribute (odt->content_wtr,
_xml("text:outline-level"), "%d", 2);
- xmlTextWriterWriteString (odt->content_wtr, _xml (text->content) );
+ xmlTextWriterWriteString (odt->content_wtr, _xml (text->content));
for (size_t i = 0; i < text->n_footnotes; i++)
write_footnote (odt, text->footnotes[i]);
xmlTextWriterEndElement (odt->content_wtr);
xmlTextWriterStartElement (odt->content_wtr, _xml("text:h"));
xmlTextWriterWriteFormatAttribute (odt->content_wtr,
_xml("text:outline-level"), "%d", 2);
- xmlTextWriterWriteString (odt->content_wtr, _xml (layer->content) );
+ xmlTextWriterWriteString (odt->content_wtr, _xml (layer->content));
for (size_t i = 0; i < layer->n_footnotes; i++)
write_footnote (odt, layer->footnotes[i]);
xmlTextWriterEndElement (odt->content_wtr);
/* Deal with row headers */
- if ( table_ht (tab) > 0)
+ if (table_ht (tab) > 0)
xmlTextWriterStartElement (odt->content_wtr, _xml("table:table-header-rows"));
xmlTextWriterStartElement (odt->content_wtr, _xml("text:p"));
- if ( r < table_ht (tab) || c < table_hl (tab) )
+ if (r < table_ht (tab) || c < table_hl (tab))
xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Heading"));
else
xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Contents"));
xmlTextWriterEndElement (odt->content_wtr); /* row */
- if ( table_ht (tab) > 0 && r == table_ht (tab) - 1)
+ if (table_ht (tab) > 0 && r == table_ht (tab) - 1)
xmlTextWriterEndElement (odt->content_wtr); /* table-header-rows */
}
for (int row_ofs = 0; row_ofs < d->label_depth; row_ofs++)
{
- for (size_t x1 = 0; x1 < n_columns; )
+ for (size_t x1 = 0; x1 < n_columns;)
{
const struct pivot_category *c = find_category (
d, dim_index, column_enumeration + x1 * stride, row_ofs);
}, \
}
static const struct area_style default_area_styles[PIVOT_N_AREAS] = {
- [PIVOT_AREA_TITLE] = STYLE( true, CENTER, CENTER, 8,11,1,8),
+ [PIVOT_AREA_TITLE] = STYLE(true, CENTER, CENTER, 8,11,1,8),
[PIVOT_AREA_CAPTION] = STYLE(false, LEFT, TOP, 8,11,1,1),
[PIVOT_AREA_FOOTER] = STYLE(false, LEFT, TOP, 11, 8,2,3),
[PIVOT_AREA_CORNER] = STYLE(false, LEFT, BOTTOM, 8,11,1,1),
names[n_names++] = c->name;
}
- for (size_t i = n_names; i-- > 0; )
+ for (size_t i = n_names; i-- > 0;)
{
putchar (' ');
pivot_value_dump (names[i]);
enum settings_value_show show_variables,
struct string *out)
{
- pivot_value_format_body ( value, show_values, show_variables, out);
+ pivot_value_format_body (value, show_values, show_variables, out);
if (value->n_subscripts)
{
breaks out of the loop prematurely, it needs to free it with free(). */
#define PIVOT_AXIS_FOR_EACH(INDEXES, AXIS) \
for ((INDEXES) = NULL; \
- ((INDEXES) = pivot_axis_iterator_next (INDEXES, AXIS)) != NULL; )
+ ((INDEXES) = pivot_axis_iterator_next (INDEXES, AXIS)) != NULL;)
size_t *pivot_axis_iterator_next (size_t *indexes, const struct pivot_axis *);
\f
/* Dimensions.
for (int i = 0; i < 2; i++)
columns[i] = xzalloc (nc * sizeof *columns[i]);
for (int y = 0; y < nr; y++)
- for (int x = 0; x < nc; )
+ for (int x = 0; x < nc;)
{
struct table_cell cell;
for (int x = 0; x < nc; x++)
columns[i][x].width = columns[i][x].unspanned;
for (int y = 0; y < nr; y++)
- for (int x = 0; x < nc; )
+ for (int x = 0; x < nc;)
{
struct table_cell cell;
/* Calculate heights of cells that do not span multiple rows. */
struct render_row *rows = xzalloc (nr * sizeof *rows);
for (int y = 0; y < nr; y++)
- for (int x = 0; x < nc; )
+ for (int x = 0; x < nc;)
{
struct render_row *r = &rows[y];
struct table_cell cell;
/* Distribute heights of spanned rows. */
for (int y = 0; y < nr; y++)
- for (int x = 0; x < nc; )
+ for (int x = 0; x < nc;)
{
struct table_cell cell;
this string with "output-direction-rtl". Otherwise either leave it
untranslated or copy it verbatim. */
const char *dir = _("output-direction-ltr");
- if ( 0 == strcmp ("output-direction-rtl", dir))
+ if (0 == strcmp ("output-direction-rtl", dir))
return true;
- if ( 0 != strcmp ("output-direction-ltr", dir))
+ if (0 != strcmp ("output-direction-ltr", dir))
fprintf (stderr, "This localisation has been incorrectly translated. "
"Complain to the translator.\n");
int ofs[TABLE_N_AXES], int bb[TABLE_N_AXES][2])
{
for (int y = bb[V][0]; y < bb[V][1]; y++)
- for (int x = bb[H][0]; x < bb[H][1]; )
+ for (int x = bb[H][0]; x < bb[H][1];)
if (!is_rule (x) && !is_rule (y))
{
struct table_cell cell;
number of pixels available, which might look bad e.g. because
it breaks in the middle of a line of text. */
if (axis == TABLE_VERT && page->params->adjust_break)
- for (int x = 0; x < page->n[H]; )
+ for (int x = 0; x < page->n[H];)
{
struct table_cell cell;
};
if (!page->h[a][0] || z0 > page->h[a][0] || p0)
- for (int z = 0; z < page->n[b]; )
+ for (int z = 0; z < page->n[b];)
{
int d[TABLE_N_AXES];
d[a] = z0;
}
if (!page->h[a][1] || z1 < page->n[a] - page->h[a][1] || p1)
- for (int z = 0; z < page->n[b]; )
+ for (int z = 0; z < page->n[b];)
{
int d[TABLE_N_AXES];
d[a] = z1 - 1;
series[j]->n_index = max_cat + 1;
series[j]->index_to_category = xcalloc (
max_cat + 1, sizeof *series[j]->index_to_category);
- for (size_t cat1 = 0; cat1 < n_cats; )
+ for (size_t cat1 = 0; cat1 < n_cats;)
{
/* Find a sequence of categories cat1...cat2 (exclusive), that all
have the same value in series 'j'. (This might be only a single
return NULL;
struct spv_series **series = xnmalloc (nest->n_vars, sizeof *series);
- for (size_t i = 0; i < nest->n_vars; )
+ for (size_t i = 0; i < nest->n_vars;)
{
size_t n;
for (n = 0; i + n < nest->n_vars; n++)
return NULL;
struct spv_series **series = xnmalloc (n_layers, sizeof *series);
- for (size_t i = 0; i < n_layers; )
+ for (size_t i = 0; i < n_layers;)
{
size_t n;
for (n = 0; i + n < n_layers; n++)
while (n_nodes > 0)
{
bool progress = false;
- for (size_t i = 0; i < n_nodes; )
+ for (size_t i = 0; i < n_nodes;)
{
error = (spvdx_is_source_variable (nodes[i])
? decode_spvdx_source_variable (nodes[i], data, &series_map)
else
{
uint8_t r, g, b;
- if (sscanf (color, "rgb (%"SCNu8", %"SCNu8", %"SCNu8" )",
+ if (sscanf (color, "rgb (%"SCNu8", %"SCNu8", %"SCNu8")",
&r, &g, &b) == 3)
{
char color2[8];
Do the same for U+2007 FIGURE SPACE, which also crops out weirdly
sometimes. */
ds_extend (s, ds_length (s) + xmlStrlen (node->content));
- for (const uint8_t *p = node->content; *p; )
+ for (const uint8_t *p = node->content; *p;)
{
int c;
if (p[0] == 0xc2 && p[1] == 0xa0)
#define SPV_ITEM_FOR_EACH(ITER, ROOT) \
for ((ITER) = (ROOT); (ITER) != NULL; (ITER) = spv_item_next(ITER))
#define SPV_ITEM_FOR_EACH_SKIP_ROOT(ITER, ROOT) \
- for ((ITER) = (ROOT); ((ITER) = spv_item_next(ITER)) != NULL; )
+ for ((ITER) = (ROOT); ((ITER) = spv_item_next(ITER)) != NULL;)
struct spv_item *spv_item_next (const struct spv_item *);
const struct spv_item *spv_item_get_parent (const struct spv_item *);
if (name)
ds_put_format (&s, "%s: ", name);
ds_put_cstr (&s, "parse error decoding ");
- for (size_t i = input->n_errors; i-- > 0; )
+ for (size_t i = input->n_errors; i-- > 0;)
if (i < SPVBIN_MAX_ERRORS)
ds_put_format (&s, "/%s@%#zx", input->errors[i].name,
input->errors[i].start);
GtkBuilder *builder = gtk_builder_new ();
GError *err = NULL;
- if ( ! gtk_builder_add_from_file (builder, name, &err))
+ if (! gtk_builder_add_from_file (builder, name, &err))
{
g_critical ("Couldn\'t open user interface file %s: %s", name, err->message);
g_clear_error (&err);
o = gtk_builder_get_object (builder, name);
- if ( !o )
+ if (!o)
g_critical ("Object `%s' could not be found\n", name);
- else if ( ! g_type_is_a (G_OBJECT_TYPE (o), type))
+ else if (! g_type_is_a (G_OBJECT_TYPE (o), type))
{
g_critical ("Object `%s' was expected to have type %s, but in fact has type %s",
name, g_type_name (type), G_OBJECT_TYPE_NAME (o));
get_base_tree_path (GtkTreeModel *m, GtkTreePath *op)
{
GtkTreePath *p = gtk_tree_path_copy (op);
- while ( ! PSPPIRE_IS_DICT (m))
+ while (! PSPPIRE_IS_DICT (m))
{
GtkTreePath *oldp = p;
g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
g_list_free (list);
- if ( retval == FALSE )
+ if (retval == FALSE)
return FALSE;
/* now deal with the dest widget */
const struct variable *v;
gtk_tree_model_get (model, &iter, 0, &v, -1);
- if ( have_type && var_get_type (v) != type )
+ if (have_type && var_get_type (v) != type)
{
retval = FALSE;
break;
const struct variable *v = psppire_dict_get_variable (dict, idx[0]);
gtk_tree_path_free (p);
- if ( var_is_alpha (v))
+ if (var_is_alpha (v))
{
retval = FALSE;
break;
{
*model = top_model;
- if ( iter)
+ if (iter)
*iter = *top_iter;
- while ( ! PSPPIRE_IS_DICT (*model))
+ while (! PSPPIRE_IS_DICT (*model))
{
GtkTreeIter parent_iter;
if (iter)
parent_iter = *iter;
- if ( GTK_IS_TREE_MODEL_FILTER (*model))
+ if (GTK_IS_TREE_MODEL_FILTER (*model))
{
GtkTreeModelFilter *parent_model = GTK_TREE_MODEL_FILTER (*model);
GtkWidget *dest,
GtkTreeModel *model,
gpointer data
- )
+ )
{
GtkTreePath *path;
GtkTreeModel *dict;
gtk_tree_path_free (path);
- result = ( 0 == strcmp (text, var_get_name (var) ));
+ result = (0 == strcmp (text, var_get_name (var)));
return result;
}
GtkWidget *dest,
GtkTreeModel *source_model,
gpointer data
- );
+ );
struct dataset *ds = session_active_dataset (the_session);
enum cmd_result result = cmd_parse (lexer, ds);
- if ( cmd_result_is_failure (result))
+ if (cmd_result_is_failure (result))
{
retval = FALSE;
- if ( lex_get_error_mode (lexer) == LEX_ERROR_STOP )
+ if (lex_get_error_mode (lexer) == LEX_ERROR_STOP)
break;
}
- if ( result == CMD_EOF || result == CMD_FINISH)
+ if (result == CMD_EOF || result == CMD_FINISH)
break;
}
find_value (fd, row, &x, &column);
- if ( x != -1)
+ if (x != -1)
{
SswSheet *sheet = SSW_SHEET (fd->de->data_editor->data_sheet);
gtk_notebook_set_current_page (GTK_NOTEBOOK (fd->de->data_editor),
static void
forward_wrap (casenumber *i, struct datasheet *data)
{
- if ( ++*i >= datasheet_get_n_rows (data) ) *i = 0;
+ if (++*i >= datasheet_get_n_rows (data)) *i = 0;
}
static void
static void
backward_wrap (casenumber *i, struct datasheet *data)
{
- if ( --*i < 0 )
+ if (--*i < 0)
*i = datasheet_get_n_rows (data) - 1;
}
gboolean reverse = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (get_widget_assert (fd->xml, "find-backwards")));
- if ( wrap )
+ if (wrap)
{
- if ( reverse )
+ if (reverse)
return &ip[REVERSE_WRAP];
else
return &ip[FORWARD_WRAP];
}
else
{
- if ( reverse )
+ if (reverse)
return &ip[REVERSE];
else
return &ip[FORWARD];
width = strlen (text);
- assert ( cmptr->flags & STR_CMP_LABELS);
+ assert (cmptr->flags & STR_CMP_LABELS);
g_return_val_if_fail (width > 0, false);
- if ( cmptr->flags & STR_CMP_SUBSTR)
+ if (cmptr->flags & STR_CMP_SUBSTR)
return (NULL != g_strstr_len (text, width, ssc->pattern));
else
return (0 == strncmp (text, ssc->pattern, width));
int width = var_get_width (cmptr->var);
g_return_val_if_fail (width > 0, false);
- assert ( ! (cmptr->flags & STR_CMP_LABELS));
+ assert (! (cmptr->flags & STR_CMP_LABELS));
text = value_to_text (*val, cmptr->var);
- if ( cmptr->flags & STR_CMP_SUBSTR)
+ if (cmptr->flags & STR_CMP_SUBSTR)
found = (NULL != g_strstr_len (text, width, ssc->pattern));
else
found = (0 == strncmp (text, ssc->pattern, width));
int width = var_get_width (cmptr->var);
- assert ( ! (cmptr->flags & STR_CMP_LABELS) );
+ assert (! (cmptr->flags & STR_CMP_LABELS));
g_return_val_if_fail (width > 0, false);
int width ;
- assert ( cmptr->flags & STR_CMP_LABELS);
+ assert (cmptr->flags & STR_CMP_LABELS);
text = var_lookup_value_label (cmptr->var, val);
width = strlen (text);
cmptr->flags = flags;
cmptr->var = var;
- if ( flags & STR_CMP_LABELS)
+ if (flags & STR_CMP_LABELS)
cmptr->compare = string_label_compare;
else
cmptr->compare = string_value_compare;
cmptr->destroy = regexp_destroy;
code = regcomp (&rec->re, target, 0);
- if ( code != 0 )
+ if (code != 0)
{
char *errbuf = NULL;
size_t errbuf_size = regerror (code, &rec->re, errbuf, 0);
msg (ME, _("Bad regular expression: %s"), errbuf);
- free ( cmptr);
+ free (cmptr);
free (errbuf);
return NULL;
}
static void
comparator_destroy (struct comparator *cmptr)
{
- if ( ! cmptr )
+ if (! cmptr)
return ;
- if ( cmptr->destroy )
+ if (cmptr->destroy)
cmptr->destroy (cmptr);
free (cmptr);
comparator_factory (const struct variable *var, const char *str,
enum string_cmp_flags flags)
{
- if ( flags & STR_CMP_REGEXP )
+ if (flags & STR_CMP_REGEXP)
return regexp_comparator_create (var, str, flags);
- if ( flags & (STR_CMP_SUBSTR | STR_CMP_LABELS) )
+ if (flags & (STR_CMP_SUBSTR | STR_CMP_LABELS))
return string_comparator_create (var, str, flags);
return value_comparator_create (var, str);
enum string_cmp_flags flags = 0;
var = dict_lookup_var (fd->dict->dict, var_name);
- if ( ! var )
+ if (! var)
return ;
width = var_get_width (var);
*column = var_get_dict_index (var);
*row = -1;
- if ( gtk_toggle_button_get_active
+ if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (fd->match_substring_checkbox)))
flags |= STR_CMP_SUBSTR;
- if ( gtk_toggle_button_get_active
+ if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (fd->match_regexp_checkbox)))
flags |= STR_CMP_REGEXP;
- if ( gtk_toggle_button_get_active
+ if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (fd->value_labels_checkbox)))
flags |= STR_CMP_LABELS;
comparator_factory (var, target_string, flags);
value_init (&val, width);
- if ( ! cmptr)
+ if (! cmptr)
goto finish;
for (i = ip->start (current_row, fd->data);
{
datasheet_get_value (fd->data, i, var_get_case_index (var), &val);
- if ( comparator_compare (cmptr, &val))
+ if (comparator_compare (cmptr, &val))
{
*row = i;
break;
/* TRANSLATORS: Do not translate this string. Instead, put the names of the people
who have helped in the translation. */
_("translator-credits")
- );
+);
gtk_window_set_transient_for (GTK_WINDOW (about), parent);
NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, &htmlerr))
#endif
- )
+)
{
msg (ME, _("Cannot open reference manual via yelp: %s. "
"Cannot open via html: %s "
{
int width = fmt_var_width (format);
- if ( format->type != FMT_A)
+ if (format->type != FMT_A)
{
- if ( ! text ) return NULL;
+ if (! text) return NULL;
{
const gchar *s = text;
while (*s)
{
- if ( !isspace (*s))
+ if (!isspace (*s))
break;
s++;
}
- if ( !*s) return NULL;
+ if (!*s) return NULL;
}
}
GSList *helps = gtk_builder_get_objects (xml);
GSList *i;
- for ( i = helps; i ; i = g_slist_next (i))
+ for (i = helps; i ; i = g_slist_next (i))
{
GObject *o = i->data;
- if ( GTK_IS_WIDGET (o) )
+ if (GTK_IS_WIDGET (o))
{
const gchar *name = gtk_buildable_get_name (GTK_BUILDABLE (o));
gchar s[12] = {0};
- if ( name)
+ if (name)
strncpy (s, name, 11);
s[11] = '\0';
- if ( 0 == strcmp ("help_button", s))
+ if (0 == strcmp ("help_button", s))
{
g_signal_connect (o, "clicked", give_help, 0);
}
int row = 0;
GtkListStore *dest;
- for (i = 0 ; i < n_cols; ++i )
+ for (i = 0 ; i < n_cols; ++i)
types[i] = gtk_tree_model_get_column_type (GTK_TREE_MODEL (src), i);
dest = gtk_list_store_newv (n_cols, types);
GtkTreeIter dest_iter;
gtk_list_store_append (dest, &dest_iter);
- for (i = 0 ; i < n_cols; ++i )
+ for (i = 0 ; i < n_cols; ++i)
{
GValue val = {0};
GtkTextBuffer *buffer = NULL;
- if ( NULL == the_syntax_pasteboard)
+ if (NULL == the_syntax_pasteboard)
{
the_syntax_pasteboard = psppire_syntax_window_new (NULL);
g_signal_connect (the_syntax_pasteboard, "delete-event", G_CALLBACK (on_delete),
PsppireMissingValDialog *dialog = data;
int var_width = fmt_var_width (&dialog->format);
- if ( gtk_toggle_button_get_active (dialog->button_discrete))
+ if (gtk_toggle_button_get_active (dialog->button_discrete))
{
gint nvals = 0;
gint i;
mv_clear(&dialog->mvl);
- for(i = 0 ; i < 3 ; ++i )
+ for(i = 0 ; i < 3 ; ++i)
{
gchar *text =
g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->mv[i])));
union value v;
- if ( !text || strlen (g_strstrip (text)) == 0 )
+ if (!text || strlen (g_strstrip (text)) == 0)
{
g_free (text);
continue;
g_free (text);
value_destroy (&v, var_width);
}
- if ( nvals == 0 )
+ if (nvals == 0)
{
err_dialog (_("At least one value must be specified"),
GTK_WINDOW (dialog));
discrete_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->discrete)));
- if ( discrete_text && strlen (g_strstrip (discrete_text)) > 0 )
+ if (discrete_text && strlen (g_strstrip (discrete_text)) > 0)
{
union value discrete_val;
if (!try_missing_value (dialog, discrete_text, &discrete_val))
gint i;
PsppireMissingValDialog *dialog = data;
- for (i = 0 ; i < 3 ; ++i )
+ for (i = 0 ; i < 3 ; ++i)
{
gtk_widget_set_sensitive (dialog->mv[i],
gtk_toggle_button_get_active (button));
if (var == NULL)
return;
- for (i = 0 ; i < 3 ; ++i )
+ for (i = 0 ; i < 3 ; ++i)
{
gtk_entry_set_text (GTK_ENTRY (dialog->mv[i]), "");
gtk_widget_set_sensitive (dialog->mv[i], FALSE);
}
- if ( mv_has_range (&dialog->mvl))
+ if (mv_has_range (&dialog->mvl))
{
union value low, high;
gchar *low_text;
g_free (low_text);
g_free (high_text);
- if ( mv_has_value (&dialog->mvl))
+ if (mv_has_value (&dialog->mvl))
{
gchar *text;
text = value_to_text__ (*mv_get_value (&dialog->mvl, 0),
gtk_widget_set_sensitive (dialog->discrete, TRUE);
}
- else if ( mv_has_value (&dialog->mvl))
+ else if (mv_has_value (&dialog->mvl))
{
const int n = mv_n_values (&dialog->mvl);
- for (i = 0 ; i < 3 ; ++i )
+ for (i = 0 ; i < 3 ; ++i)
{
- if ( i < n)
+ if (i < n)
{
gchar *text ;
}
gtk_toggle_button_set_active (dialog->button_discrete, TRUE);
}
- else if ( mv_is_empty (&dialog->mvl))
+ else if (mv_is_empty (&dialog->mvl))
{
gtk_toggle_button_set_active (dialog->button_none, TRUE);
}
++i)
{
static GValue value;
- if ( ! acr->get_value (i, &value, acr->get_value_data) )
+ if (! acr->get_value (i, &value, acr->get_value_data))
continue;
gtk_list_store_set_value (acr->list_store, &iter,
++i)
{
static GValue value;
- if ( ! acr->get_value (i, &value, acr->get_value_data) )
+ if (! acr->get_value (i, &value, acr->get_value_data))
continue;
gtk_list_store_set_value (acr->list_store, &iter,
g_list_foreach (l, (GFunc) gtk_tree_path_free, NULL);
g_list_free (l);
- if ( acr->update) acr->update (acr->update_data);
+ if (acr->update) acr->update (acr->update_data);
}
gtk_widget_set_sensitive (acr->change_button,
row_is_selected (acr)
- );
+ );
}
{
int i;
- for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i )
+ for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i)
if (bb->def == (1 << i))
{
gtk_widget_set_can_default (bb->button[i], TRUE);
{
case PROP_BUTTONS:
flags = g_value_get_flags (value);
- for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i )
+ for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i)
g_object_set (bb->button[i], "visible", 0x01 & (flags >> i) , NULL);
break;
switch (prop_id)
{
case PROP_BUTTONS:
- for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i )
+ for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i)
{
gboolean visibility;
g_object_get (bb->button[i], "visible", &visibility, NULL);
- if ( visibility )
+ if (visibility)
flags |= (0x01 << i);
}
/* If we're not in a psppire dialog (for example when in glade)
then do nothing */
- if ( ! PSPPIRE_IS_DIALOG (toplevel))
+ if (! PSPPIRE_IS_DIALOG (toplevel))
return;
dialog = PSPPIRE_DIALOG (toplevel);
GtkWidget *toplevel = gtk_widget_get_toplevel (w);
PsppireDialog *dialog;
- if ( ! PSPPIRE_IS_DIALOG (toplevel))
+ if (! PSPPIRE_IS_DIALOG (toplevel))
return;
dialog = PSPPIRE_DIALOG (toplevel);
GtkWidget *toplevel = gtk_widget_get_toplevel (w);
PsppireDialog *dialog;
- if ( ! PSPPIRE_IS_DIALOG (toplevel))
+ if (! PSPPIRE_IS_DIALOG (toplevel))
return;
dialog = PSPPIRE_DIALOG (toplevel);
flags = g_value_get_flags (&value);
- for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i )
+ for (i = 0 ; i < n_PsppireButtonboxButtons ; ++i)
g_object_set (bb->button[i], "visible", 0x01 & (flags >> i) , NULL);
g_value_unset (&value);
gchar *kf = g_key_file_to_data (conf->keyfile, &length, NULL);
- if ( ! g_file_set_contents (conf->filename, kf, length, NULL) )
+ if (! g_file_set_contents (conf->filename, kf, length, NULL))
{
g_warning ("Cannot open %s for writing", conf->filename);
}
static void
conf_write (PsppireConf *conf)
{
- if ( conf->idle == 0)
+ if (conf->idle == 0)
conf->idle = g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) flush_conf, conf, NULL);
}
name, &err);
ok = (err == NULL);
- if ( err != NULL )
+ if (err != NULL)
g_error_free (err);
return ok;
name, &err);
ok = (err == NULL);
- if ( err != NULL )
+ if (err != NULL)
g_error_free (err);
if (ok)
name, &err);
ok = (err == NULL);
- if ( err != NULL )
+ if (err != NULL)
g_error_free (err);
if (ok)
name, &err);
ok = (err == NULL);
- if ( err != NULL )
+ if (err != NULL)
g_error_free (err);
if (ok)
name, &err);
ok = (err == NULL);
- if ( err != NULL )
+ if (err != NULL)
g_error_free (err);
if (ok)
if (psppire_conf_get_int (conf, base, "height", &height)
&&
- psppire_conf_get_int (conf, base, "width", &width) )
+ psppire_conf_get_int (conf, base, "width", &width))
{
gtk_window_set_default_size (window, width, height);
}
- if ( psppire_conf_get_int (conf, base, "x", &x)
+ if (psppire_conf_get_int (conf, base, "x", &x)
&&
- psppire_conf_get_int (conf, base, "y", &y) )
+ psppire_conf_get_int (conf, base, "y", &y))
{
gtk_window_move (window, x, y);
}
- if ( psppire_conf_get_boolean (conf, base, "maximize", &maximize))
+ if (psppire_conf_get_boolean (conf, base, "maximize", &maximize))
{
if (maximize)
gtk_window_maximize (window);
g_object_set (de->var_sheet, "split", de->split, NULL);
break;
case PROP_DATA_STORE:
- if ( de->data_store)
+ if (de->data_store)
{
g_signal_handlers_disconnect_by_func (de->data_store,
G_CALLBACK (refresh_entry),
g_param_spec_pointer ("data-store",
"Data Store",
"A pointer to the data store associated with this editor",
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE );
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE);
g_object_class_install_property (object_class,
PROP_DATA_STORE,
g_param_spec_pointer ("dictionary",
"Dictionary",
"A pointer to the dictionary associated with this editor",
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE );
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE);
g_object_class_install_property (object_class,
PROP_DICTIONARY,
if (psppire_conf_get_string (psppire_conf_new (),
"Data Editor", "font",
- &fontname) )
+ &fontname))
{
de->font = pango_font_description_from_string (fontname);
g_free (fontname);
g_object_unref (cssp);
- if ( GTK_IS_CONTAINER (w))
+ if (GTK_IS_CONTAINER (w))
gtk_container_foreach (GTK_CONTAINER (w), set_font_recursively, font_desc);
}
GtkWidget* psppire_data_editor_new (PsppireDict *, PsppireDataStore *);
void psppire_data_editor_show_grid (PsppireDataEditor *, gboolean);
void psppire_data_editor_set_font (PsppireDataEditor *, PangoFontDescription *);
-void psppire_data_editor_split_window (PsppireDataEditor *, gboolean );
+void psppire_data_editor_split_window (PsppireDataEditor *, gboolean);
void psppire_data_editor_goto_variable (PsppireDataEditor *, gint dict_index);
void psppire_data_editor_data_delete_variables (PsppireDataEditor *de);
{
gint i;
gint old_n = 0;
- if ( ds->datasheet)
+ if (ds->datasheet)
{
old_n = datasheet_get_n_rows (ds->datasheet);
datasheet_destroy (ds->datasheet);
gint new_n = datasheet_get_n_rows (ds->datasheet);
- if ( ds->dict )
- for (i = 0 ; i < n_dict_signals; ++i )
+ if (ds->dict)
+ for (i = 0 ; i < n_dict_signals; ++i)
{
- if ( ds->dict_handler_id [i] > 0)
+ if (ds->dict_handler_id [i] > 0)
{
g_signal_handler_unblock (ds->dict,
ds->dict_handler_id[i]);
int i;
/* Disconnect any existing handlers */
- if ( data_store->dict )
- for (i = 0 ; i < n_dict_signals; ++i )
+ if (data_store->dict)
+ for (i = 0 ; i < n_dict_signals; ++i)
{
g_signal_handler_disconnect (data_store->dict,
data_store->dict_handler_id[i]);
data_store->dict = dict;
- if ( dict != NULL)
+ if (dict != NULL)
{
data_store->dict_handler_id [VARIABLE_INSERTED] =
/* The entire model has changed */
- if ( data_store->dict )
- for (i = 0 ; i < n_dict_signals; ++i )
+ if (data_store->dict)
+ for (i = 0 ; i < n_dict_signals; ++i)
{
- if ( data_store->dict_handler_id [i] > 0)
+ if (data_store->dict_handler_id [i] > 0)
{
g_signal_handler_block (data_store->dict,
data_store->dict_handler_id[i]);
int i;
struct casereader *reader ;
- if ( ds->dict )
- for (i = 0 ; i < n_dict_signals; ++i )
+ if (ds->dict)
+ for (i = 0 ; i < n_dict_signals; ++i)
{
g_signal_handler_block (ds->dict,
ds->dict_handler_id[i]);
cc = case_ref (cc);
result = datasheet_insert_rows (ds->datasheet, posn, &cc, 1);
- if ( result )
+ if (result)
{
g_signal_emit (ds, signals[ITEMS_CHANGED], 0, posn, 0, 1);
}
g_return_val_if_fail (ds->datasheet, FALSE);
n_cases = psppire_data_store_get_case_count (ds);
- if ( casenum > n_cases)
+ if (casenum > n_cases)
return FALSE;
if (casenum == n_cases)
g_assert (width >= 0);
- if ( ! ds->datasheet )
+ if (! ds->datasheet)
ds->datasheet = datasheet_create (NULL);
value_init (&value, width);
const struct dictionary *dict;
const struct variable *filter;
- if ( row < 0 || row >= datasheet_get_n_rows (ds->datasheet))
+ if (row < 0 || row >= datasheet_get_n_rows (ds->datasheet))
return FALSE;
dict = ds->dict->dict;
g_return_val_if_fail (dict, FALSE);
filter = dict_get_filter (dict);
- if ( ! filter)
+ if (! filter)
return FALSE;
g_return_val_if_fail (var_is_numeric (filter), FALSE);
value_init (&val, 0);
- if ( ! datasheet_get_value (ds->datasheet, row,
+ if (! datasheet_get_value (ds->datasheet, row,
var_get_case_index (filter),
- &val) )
+ &val))
return FALSE;
return (val.f == 0.0);
transformations_pending);
}
- if ( transformations_pending)
+ if (transformations_pending)
gtk_label_set_text (GTK_LABEL (status_label),
_("Transformations Pending"));
else
GtkWidget *filter_status_area =
get_widget_assert (de->builder, "filter-use-status-area");
- if ( filter_index == -1 )
+ if (filter_index == -1)
{
gtk_label_set_text (GTK_LABEL (filter_status_area), _("Filter off"));
}
GtkWidget *split_status_area =
get_widget_assert (de->builder, "split-file-status-area");
- if ( n_split_vars == 0 )
+ if (n_split_vars == 0)
{
gtk_label_set_text (GTK_LABEL (split_status_area), _("No Split"));
}
text = g_string_new (_("Split by "));
- for (i = 0 ; i < n_split_vars - 1; ++i )
+ for (i = 0 ; i < n_split_vars - 1; ++i)
{
g_string_append_printf (text, "%s, ", var_get_name (split_vars[i]));
}
GtkWidget *weight_status_area =
get_widget_assert (de->builder, "weight-status-area");
- if ( weight_index == -1 )
+ if (weight_index == -1)
{
gtk_label_set_text (GTK_LABEL (weight_status_area), _("Weights off"));
}
gtk_recent_info_get_mime_type (ri),
gtk_recent_info_get_description (ri),
gtk_recent_info_get_uri (ri)
- );
+ );
gtk_recent_info_unref (ri);
fnx = g_string_new (file_name);
- if ( ! name_has_suffix (fnx->str))
+ if (! name_has_suffix (fnx->str))
g_string_append (fnx, psppire_data_window_format_to_string (de->format));
ds_init_empty (&filename);
{
GtkWidget *dialog = psppire_window_file_chooser_dialog (PSPPIRE_WINDOW (de));
- if ( GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
+ if (GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog)))
{
struct string filename;
gchar *file_name =
g_string_new
(
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog))
- );
+ );
GtkTreeIter iter;
int format;
-1);
de->format = format;
- if ( ! name_has_suffix (filename->str))
+ if (! name_has_suffix (filename->str))
g_string_append (filename,
psppire_data_window_format_to_string (format));
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel));
- if ( GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)) )
+ if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog)))
{
PangoFontDescription* font_desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (dialog));
free (encoding);
- if ( psppire_window_load (PSPPIRE_WINDOW (se), file, encoding, NULL) )
+ if (psppire_window_load (PSPPIRE_WINDOW (se), file, encoding, NULL))
gtk_widget_show (se);
else
gtk_widget_destroy (se);
{
g_string_append (string, "\n\t/KOLMOGOROV-SMIRNOV");
- g_string_append (string, " ( ");
+ g_string_append (string, " (");
g_string_append (string, dist);
- g_string_append (string, " ) = ");
+ g_string_append (string, ") = ");
psppire_var_view_append_names (vv, 0, string);
}
GString *string = g_string_new ("NPAR TEST");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_NORMAL])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_NORMAL])))
append_fragment (string, "NORMAL", PSPPIRE_VAR_VIEW (rd->variables));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_UNIFORM])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_UNIFORM])))
append_fragment (string, "UNIFORM", PSPPIRE_VAR_VIEW (rd->variables));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_POISSON])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_POISSON])))
append_fragment (string, "POISSON", PSPPIRE_VAR_VIEW (rd->variables));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_EXPONENTIAL])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_EXPONENTIAL])))
append_fragment (string, "EXPONENTIAL", PSPPIRE_VAR_VIEW (rd->variables));
g_string_append (string, ".\n");
for (i = 0; i < 4; ++i)
{
- if ( TRUE == gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->cb[i])))
+ if (TRUE == gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->cb[i])))
break;
}
- if ( i >= 4)
+ if (i >= 4)
return FALSE;
return TRUE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogAction1sks *act = PSPPIRE_DIALOG_ACTION_1SKS (a);
- GtkBuilder *xml = builder_new ( "ks-one-sample.ui");
+ GtkBuilder *xml = builder_new ("ks-one-sample.ui");
pda->dialog = get_widget_assert (xml, "ks-one-sample-dialog");
pda->source = get_widget_assert (xml, "dict-view");
for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (acr_model), &iter);
ok ;
ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (acr_model), &iter)
- )
+)
{
g_string_append (string, "\n\t/");
static void
append_destination_filename (const PsppireDialogActionAggregate *agg, GString *gs)
{
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (agg->filename_radiobutton)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (agg->filename_radiobutton)))
{
struct string ss;
const gchar *s = gtk_label_get_text (GTK_LABEL (agg->filename_label));
{
g_string_append (gs, "* ");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (agg->replace_radiobutton)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (agg->replace_radiobutton)))
g_string_append (gs, "MODE=REPLACE");
else
g_string_append (gs, "MODE=ADDVARIABLES");
append_destination_filename (agg, string);
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (agg->sorted_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (agg->sorted_button)))
g_string_append (string, "\n\t/PRESORTED");
g_string_append (string, "\n\t/BREAK=");
GtkTreeModel *liststore =
gtk_tree_view_get_model (GTK_TREE_VIEW (agg->break_variables));
- if ( ! gtk_tree_model_get_iter_first (liststore, &iter))
+ if (! gtk_tree_model_get_iter_first (liststore, &iter))
return FALSE;
liststore = GTK_TREE_MODEL (PSPPIRE_ACR (agg->summary_acr)->list_store);
- if ( ! gtk_tree_model_get_iter_first (liststore, &iter))
+ if (! gtk_tree_model_get_iter_first (liststore, &iter))
return FALSE;
return TRUE;
gboolean ok;
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (agg->function_combo));
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (agg->summary_var_name_entry))))
+ if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (agg->summary_var_name_entry))))
return FALSE;
ok = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (agg->function_combo), &iter);
COMBO_MODEL_COL_SRC_VARS, &src_vars,
-1);
- if ( src_vars == AGR_SV_YES )
+ if (src_vars == AGR_SV_YES)
{
if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (agg->summary_sv_entry))))
return FALSE;
}
- if ( n_args >= 2)
+ if (n_args >= 2)
{
if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (agg->summary_arg2_entry))))
return FALSE;
}
- if ( n_args >= 1)
+ if (n_args >= 1)
{
if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (agg->summary_arg1_entry))))
return FALSE;
gboolean ok = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (agg->function_combo), &iter);
- if ( ok)
+ if (ok)
{
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (agg->function_combo));
int n_args;
g_signal_connect (act->filename_radiobutton, "toggled",
- G_CALLBACK (set_sensitivity_from_toggle), act->filename_box );
+ G_CALLBACK (set_sensitivity_from_toggle), act->filename_box);
g_signal_connect_swapped (act->filename_button, "clicked",
G_CALLBACK (choose_filename), act);
g_string_append_printf (string, " = %s", funcname);
- if ( has_src_vars != AGR_SV_NO)
+ if (has_src_vars != AGR_SV_NO)
{
struct string dss;
ds_init_cstr (&dss, " (");
ds_put_cstr (&dss, srcvar);
- if ( arity > 0)
+ if (arity > 0)
ds_put_c_format (&dss, ", %.*g", DBL_DIG + 1, arg1);
- if ( arity > 1)
+ if (arity > 1)
ds_put_c_format (&dss, ", %.*g", DBL_DIG + 1, arg2);
ds_put_cstr (&dss, ")");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->group), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->blank), FALSE);
- if (rd->varmap )
+ if (rd->varmap)
g_hash_table_remove_all (rd->varmap);
gtk_list_store_clear (GTK_LIST_STORE (target_list));
nlp->label = NULL;
- if ( label != NULL && 0 != strcmp ("", label))
+ if (label != NULL && 0 != strcmp ("", label))
nlp->label = g_strdup (label);
return nlp;
nlp_destroy (gpointer data)
{
struct nlp *nlp = data ;
- if ( ! nlp )
+ if (! nlp)
return;
g_free (nlp->name);
g_string_append (string, nlp->name);
}
- if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->ascending)))
+ if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->ascending)))
g_string_append (string, "\n\t/DESCENDING");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->group)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->group)))
g_string_append (string, "\n\t/GROUP");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->blank)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->blank)))
g_string_append (string, "\n\t/BLANK = MISSING");
g_string_append (string, ".\n");
const gchar *dest_var_name =
gtk_entry_get_text (GTK_ENTRY (rd->new_name_entry));
- if ( NULL == rows || rows->next != NULL)
+ if (NULL == rows || rows->next != NULL)
goto finish;
gtk_tree_model_get_iter (model, &iter, rows->data);
gboolean valid = TRUE;
const char *text = gtk_entry_get_text (GTK_ENTRY (rd->new_name_entry));
- if ( 0 == strcmp ("", text))
+ if (0 == strcmp ("", text))
valid = FALSE;
else if (psppire_dict_lookup_var (rd->dict, text))
valid = FALSE;
{
struct nlp *nlp = value;
- if ( 0 == strcmp (nlp->name, text))
+ if (0 == strcmp (nlp->name, text))
{
valid = FALSE;
break;
GList *rows = gtk_tree_selection_get_selected_rows (selection, &model);
- if ( rows && !rows->next)
+ if (rows && !rows->next)
{
/* Exactly one row is selected */
struct nlp *nlp;
nlp = g_hash_table_lookup (rd->varmap, var);
- if ( nlp )
+ if (nlp)
g_object_set (cell, "text", nlp->name, NULL);
else
g_object_set (cell, "text", "", NULL);
{
PsppireDialogActionBarchart *rd = PSPPIRE_DIALOG_ACTION_BARCHART (rd_);
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->button_summary_func)) )
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->button_summary_func)))
{
if (0 == g_strcmp0 ("", gtk_entry_get_text (GTK_ENTRY (rd->var))))
return FALSE;
PsppireDialogActionBarchart *act = PSPPIRE_DIALOG_ACTION_BARCHART (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "barchart.ui");
+ GtkBuilder *xml = builder_new ("barchart.ui");
pda->dialog = get_widget_assert (xml, "barchart-dialog");
pda->source = get_widget_assert (xml, "dict-view");
GtkTreeIter notused;
- if ( !gtk_tree_model_get_iter_first (vars, ¬used) )
+ if (!gtk_tree_model_get_iter_first (vars, ¬used))
return FALSE;
- if ( ! get_proportion (act, &prop))
+ if (! get_proportion (act, &prop))
return FALSE;
if (prop < 0 || prop > 1.0)
PsppireDialogActionBinomial *act = PSPPIRE_DIALOG_ACTION_BINOMIAL (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "binomial.ui");
+ GtkBuilder *xml = builder_new ("binomial.ui");
pda->dialog = get_widget_assert (xml, "binomial-dialog");
pda->source = get_widget_assert (xml, "dict-view");
ds_init_cstr (&str, "NPAR TEST\n\t/BINOMIAL");
- if ( get_proportion (scd, &prop))
+ if (get_proportion (scd, &prop))
ds_put_c_format (&str, "(%.*g)", DBL_DIG + 1, prop);
ds_put_cstr (&str, " =");
psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (scd->var_view), 0, &str);
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->cutpoint_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->cutpoint_button)))
{
const gchar *cutpoint = gtk_entry_get_text (GTK_ENTRY (scd->cutpoint_entry));
ds_put_c_format (&str, "(%s)", cutpoint);
psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (scd->var_view), 0, &dss);
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->range_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->range_button)))
{
ds_put_cstr (&dss, "(");
ds_put_cstr (&dss, ")");
}
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->values_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->values_button)))
{
GtkListStore *ls = scd->expected_list;
GtkTreeIter iter;
GtkTreeModel *vars =
gtk_tree_view_get_model (GTK_TREE_VIEW (act->var_view));
- if ( !gtk_tree_model_get_iter_first (vars, ¬used) )
+ if (!gtk_tree_model_get_iter_first (vars, ¬used))
return FALSE;
return TRUE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionChisquare *act = PSPPIRE_DIALOG_ACTION_CHISQUARE (a);
- GtkBuilder *xml = builder_new ( "chi-square.ui");
+ GtkBuilder *xml = builder_new ("chi-square.ui");
GtkWidget *range_table = get_widget_assert (xml, "range-table");
GtkWidget *values_acr = get_widget_assert (xml, "psppire-acr1");
g_string_append (str, "ADD DOCUMENT\n");
- for (i = 0 ; i < gtk_text_buffer_get_line_count (buffer) ; ++i )
+ for (i = 0 ; i < gtk_text_buffer_get_line_count (buffer) ; ++i)
{
struct string tmp;
GtkTextIter start;
g_string_append (str, " .\n");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->check)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->check)))
g_string_append (str, "DISPLAY DOCUMENTS.\n");
text = str->str;
gtk_text_buffer_set_text (buffer, "", 0);
- for ( i = 0 ; i < dict_get_document_line_cnt (pda->dict->dict); ++i )
+ for (i = 0 ; i < dict_get_document_line_cnt (pda->dict->dict); ++i)
add_line_to_buffer (buffer, dict_get_document_line (pda->dict->dict, i));
}
GtkLabel *label = data;
gchar *text ;
- text = g_strdup_printf ( _("Column Number: %d"),
+ text = g_strdup_printf (_("Column Number: %d"),
1 + gtk_text_iter_get_line_offset (iter));
gtk_label_set_text (label, text);
{
gint chars = gtk_text_iter_get_chars_in_line (iter);
- if ( chars > DOC_LINE_LENGTH )
+ if (chars > DOC_LINE_LENGTH)
{
GtkTextIter line_fold = *iter;
{
PsppireDialogActionComments *act = PSPPIRE_DIALOG_ACTION_COMMENTS (pda);
- GtkBuilder *xml = builder_new ( "comments.ui");
+ GtkBuilder *xml = builder_new ("comments.ui");
pda->dialog = get_widget_assert (xml, "comments-dialog");
act->textview = get_widget_assert (xml, "comments-textview1");
string = g_string_sized_new (64);
- if ( cd->use_type &&
- NULL == psppire_dict_lookup_var (act->dict, target_name ))
+ if (cd->use_type &&
+ NULL == psppire_dict_lookup_var (act->dict, target_name))
{
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->str_btn)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->str_btn)))
{
const char *w = gtk_entry_get_text (GTK_ENTRY (cd->width_entry));
g_string_append_printf (string,
g_string_append_printf (string, "NUMERIC %s.\n", target_name);
}
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->user_label)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->user_label)))
label = gtk_entry_get_text (GTK_ENTRY (cd->entry));
else
label = expression;
- if ( strlen (label) > 0 )
+ if (strlen (label) > 0)
g_string_append_printf (string, "VARIABLE LABEL %s '%s'.\n",
target_name,
label);
g_string_append_printf (string, "COMPUTE %s = %s.\n",
target_name,
expression
- );
+ );
g_string_append (string, "EXECUTE.\n");
target_name = gtk_entry_get_text (GTK_ENTRY (cd->target));
- if ( (target_var = psppire_dict_lookup_var (pda->dict, target_name)) )
+ if ((target_var = psppire_dict_lookup_var (pda->dict, target_name)))
{
/* Existing Variable */
const gchar *label = var_get_label (target_var);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cd->user_label), TRUE);
- if ( label )
+ if (label)
{
gtk_entry_set_text (GTK_ENTRY (cd->entry), label);
}
gtk_widget_set_sensitive (cd->width_entry, FALSE);
- if ( var_is_numeric (target_var))
+ if (var_is_numeric (target_var))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cd->numeric_target),
TRUE);
else
reset_type_label_dialog (cd);
response = psppire_dialog_run (PSPPIRE_DIALOG (cd->subdialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE)
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
cd->use_type = TRUE;
}
on_type_toggled (GtkToggleButton *button, gpointer data)
{
PsppireDialogActionCompute *cd = PSPPIRE_DIALOG_ACTION_COMPUTE (data);
- if ( gtk_toggle_button_get_active (button))
+ if (gtk_toggle_button_get_active (button))
{
gtk_widget_set_sensitive (cd->width_entry, TRUE);
gtk_widget_grab_focus (cd->width_entry);
PsppireDialogActionCompute *cd = PSPPIRE_DIALOG_ACTION_COMPUTE (data);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (data);
- if ( gtk_toggle_button_get_active (button))
+ if (gtk_toggle_button_get_active (button))
{
gtk_entry_set_text (GTK_ENTRY (cd->entry), "");
gtk_widget_set_sensitive (cd->entry, FALSE);
{
const gchar *target_name = gtk_entry_get_text (GTK_ENTRY (cd->target));
const struct variable *target_var = psppire_dict_lookup_var (pda->dict, target_name);
- if ( target_var )
+ if (target_var)
{
const char *label = var_get_label (target_var);
- if ( label )
+ if (label)
gtk_entry_set_text (GTK_ENTRY (cd->entry), label);
}
else
string = g_string_new (g_value_get_string (&name_value));
g_string_append (string, "(");
- for ( i = 0 ; i < arity -1 ; ++i )
+ for (i = 0 ; i < arity -1 ; ++i)
{
g_string_append (string, "?,");
}
GtkTextIter selectbound;
GtkTextMark *cursor = gtk_text_buffer_get_insert (buffer);
gtk_text_buffer_get_iter_at_mark (buffer, &insert, cursor);
- for ( i = 0 ; i < arity ; ++i )
+ for (i = 0 ; i < arity ; ++i)
{
gtk_text_iter_backward_cursor_position (&insert);
gtk_text_iter_backward_cursor_position (&insert);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionCompute *act = PSPPIRE_DIALOG_ACTION_COMPUTE (a);
- GtkBuilder *xml = builder_new ( "compute.ui");
+ GtkBuilder *xml = builder_new ("compute.ui");
pda->dialog = get_widget_assert (xml, "compute-variable-dialog");
pda->source = get_widget_assert (xml, "compute-treeview1");
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionCorrelation *act = PSPPIRE_DIALOG_ACTION_CORRELATION (a);
- GtkBuilder *xml = builder_new ( "correlation.ui");
+ GtkBuilder *xml = builder_new ("correlation.ui");
pda->dialog = get_widget_assert (xml, "correlation-dialog");
pda->source = get_widget_assert (xml, "dict-view");
if (! cnt->value_list)
return FALSE;
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list), &iter) )
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list), &iter))
return FALSE;
if (!gtk_tree_model_get_iter_first (gtk_tree_view_get_model (GTK_TREE_VIEW (cnt->variable_treeview)), &iter))
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionCount *act = PSPPIRE_DIALOG_ACTION_COUNT (a);
- GtkBuilder *xml = builder_new ( "count.ui");
+ GtkBuilder *xml = builder_new ("count.ui");
GtkWidget *selector = get_widget_assert (xml, "count-selector1");
GtkWidget *button = get_widget_assert (xml, "button1");
PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (data);
GValue ov_value = {0};
- if ( ! gtk_tree_selection_get_selected (selection, &model, &iter) )
+ if (! gtk_tree_selection_get_selected (selection, &model, &iter))
return;
gtk_tree_model_get_value (GTK_TREE_MODEL (model), &iter,
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
g_object_unref (cd->value_list);
cd->value_list = local_store;
ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->format_dialog));
- if ( ret == PSPPIRE_RESPONSE_CONTINUE )
+ if (ret == PSPPIRE_RESPONSE_CONTINUE)
{
cd->format_options_avalue =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->avalue_button));
gint ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->cell_dialog));
- if ( ret == PSPPIRE_RESPONSE_CONTINUE )
+ if (ret == PSPPIRE_RESPONSE_CONTINUE)
{
g_object_unref (liststore);
}
gint ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->stat_dialog));
- if ( ret == PSPPIRE_RESPONSE_CONTINUE )
+ if (ret == PSPPIRE_RESPONSE_CONTINUE)
{
g_object_unref (liststore);
}
PsppireDialogActionCrosstabs *act = PSPPIRE_DIALOG_ACTION_CROSSTABS (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "crosstabs.ui");
+ GtkBuilder *xml = builder_new ("crosstabs.ui");
pda->dialog = get_widget_assert (xml, "crosstabs-dialog");
pda->source = get_widget_assert (xml, "dict-treeview");
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionDescriptives *act = PSPPIRE_DIALOG_ACTION_DESCRIPTIVES (a);
- GtkBuilder *xml = builder_new ( "descriptives.ui");
+ GtkBuilder *xml = builder_new ("descriptives.ui");
GtkWidget *stats_treeview = get_widget_assert (xml, "statistics");
psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview),
response = psppire_dialog_run (PSPPIRE_DIALOG (ed->stats_dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
ed->stats = 0;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->descriptives_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->descriptives_button)))
ed->stats |= STAT_DESCRIPTIVES;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->extremes_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->extremes_button)))
ed->stats |= STAT_EXTREMES;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->percentiles_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->percentiles_button)))
ed->stats |= STAT_PERCENTILES;
}
}
response = psppire_dialog_run (PSPPIRE_DIALOG (ed->opts_dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->listwise)))
ed->opts = OPT_LISTWISE;
g_string_append (str, "\n\t/VARIABLES=");
psppire_var_view_append_names (PSPPIRE_VAR_VIEW (ed->variables), 0, str);
- if ( 0 < gtk_tree_model_iter_n_children
+ if (0 < gtk_tree_model_iter_n_children
(gtk_tree_view_get_model (GTK_TREE_VIEW (ed->factors)), NULL))
{
g_string_append (str, "\n\tBY ");
}
label = gtk_entry_get_text (GTK_ENTRY (ed->id_var));
- if ( 0 != strcmp (label, "") )
+ if (0 != strcmp (label, ""))
{
g_string_append (str, "\n\t/ID = ");
g_string_append (str, label);
}
- if ( ed->stats & (STAT_DESCRIPTIVES | STAT_EXTREMES))
+ if (ed->stats & (STAT_DESCRIPTIVES | STAT_EXTREMES))
{
g_string_append (str, "\n\t/STATISTICS =");
- if ( ed->stats & STAT_DESCRIPTIVES)
+ if (ed->stats & STAT_DESCRIPTIVES)
g_string_append (str, " DESCRIPTIVES");
- if ( ed->stats & STAT_EXTREMES)
+ if (ed->stats & STAT_EXTREMES)
g_string_append (str, " EXTREME");
}
- if ( ed->stats & STAT_PERCENTILES)
+ if (ed->stats & STAT_PERCENTILES)
g_string_append (str, "\n\t/PERCENTILES");
ds_put_cstr (&str, "\n\t/CRITERIA = ");
- if ( rd->extraction.explicit_nfactors )
+ if (rd->extraction.explicit_nfactors)
ds_put_c_format (&str, "FACTORS (%d)", rd->extraction.n_factors);
else
ds_put_c_format (&str, "MINEIGEN (%.*g)",
ds_put_cstr (&str, "\n\t/EXTRACTION =");
- if ( rd->extraction.paf)
+ if (rd->extraction.paf)
ds_put_cstr (&str, "PAF");
else
ds_put_cstr (&str, "PC");
ds_put_cstr (&str, "\n\t/METHOD = ");
- if ( rd->extraction.covariance )
+ if (rd->extraction.covariance)
ds_put_cstr (&str, "COVARIANCE");
else
ds_put_cstr (&str, "CORRELATION");
- if ( rd->extraction.scree )
+ if (rd->extraction.scree)
{
ds_put_cstr (&str, "\n\t/PLOT = ");
ds_put_cstr (&str, "EIGEN");
ds_put_cstr (&str, "\n\t/PRINT = ");
ds_put_cstr (&str, "INITIAL ");
- if ( rd->extraction.unrotated )
+ if (rd->extraction.unrotated)
ds_put_cstr (&str, "EXTRACTION ");
- if ( rd->rotation.rotated_solution )
+ if (rd->rotation.rotated_solution)
ds_put_cstr (&str, "ROTATION");
/* The CRITERIA = ITERATE subcommand is overloaded.
It applies to the next /ROTATION and/or EXTRACTION command whatever comes first.
*/
- ds_put_c_format (&str, "\n\t/CRITERIA = ITERATE (%d)", rd->rotation.iterations );
+ ds_put_c_format (&str, "\n\t/CRITERIA = ITERATE (%d)", rd->rotation.iterations);
ds_put_cstr (&str, "\n\t/ROTATION = ");
ds_put_cstr (&str, rot_method_syntax[rd->rotation.method]);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->scree_button), p->scree);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->unrotated_button), p->unrotated);
- if ( p->paf )
+ if (p->paf)
gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 1);
else
gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 0);
p->rotated_solution = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->display_rotated_solution));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_none)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_none)))
p->method = ROT_NONE;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_varimax)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_varimax)))
p->method = ROT_VARIMAX;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_quartimax)))
p->method = ROT_QUARTIMAX;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_equimax)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->rotation_equimax)))
p->method = ROT_EQUIMAX;
}
gint response = psppire_dialog_run (PSPPIRE_DIALOG (act->extraction_dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
/* Set the parameters from their respective widgets */
set_extraction_parameters (act, ex);
gint response = psppire_dialog_run (PSPPIRE_DIALOG (act->rotation_dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
/* Set the parameters from their respective widgets */
set_rotation_parameters (act, rot);
GtkWidget *extraction_button ;
GtkWidget *rotation_button ;
- GtkBuilder *xml = builder_new ( "factor.ui");
+ GtkBuilder *xml = builder_new ("factor.ui");
pda->dialog = get_widget_assert (xml, "factor-dialog");
pda->source = get_widget_assert (xml, "dict-view");
text = gtk_entry_get_text (GTK_ENTRY (rd->entry));
- if ( text)
+ if (text)
g_string_append_printf (string, " /NEWNAME = %s", text);
g_string_append (string, ".\n");
gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
- if ( n_rows == 0 )
+ if (n_rows == 0)
return FALSE;
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (act->entry))))
+ if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (act->entry))))
return FALSE;
return TRUE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionFlip *act = PSPPIRE_DIALOG_ACTION_FLIP (a);
- GtkBuilder *xml = builder_new ( "transpose.ui");
+ GtkBuilder *xml = builder_new ("transpose.ui");
pda->dialog = get_widget_assert (xml, "transpose-dialog");
pda->source = get_widget_assert (xml, "source-treeview");
ret = psppire_dialog_run (PSPPIRE_DIALOG (fd->charts_dialog));
- if ( ret == PSPPIRE_RESPONSE_CONTINUE )
+ if (ret == PSPPIRE_RESPONSE_CONTINUE)
{
fd->charts_opts_use_min = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->min));
fd->charts_opts_min = gtk_spin_button_get_value (GTK_SPIN_BUTTON (fd->min_spin));
PsppireDialogActionFrequencies *act = PSPPIRE_DIALOG_ACTION_FREQUENCIES (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "frequencies.ui");
+ GtkBuilder *xml = builder_new ("frequencies.ui");
GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview");
const gchar *var_name = gtk_entry_get_text (GTK_ENTRY (rd->variable));
const struct variable *var = psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION (rd)->dict, var_name);
- if ( var == NULL)
+ if (var == NULL)
return FALSE;
PsppireDialogActionHistogram *act = PSPPIRE_DIALOG_ACTION_HISTOGRAM (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "histogram.ui");
+ GtkBuilder *xml = builder_new ("histogram.ui");
pda->dialog = get_widget_assert (xml, "histogram-dialog");
pda->source = get_widget_assert (xml, "dict-view");
psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->dg_grp_entry[1]), act->grp_var);
psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->dg_cut_point_entry), act->grp_var);
- if (act->group_defn != GROUPS_CUT_POINT )
+ if (act->group_defn != GROUPS_CUT_POINT)
{
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (act->dg_cut_point_toggle_button), TRUE);
PsppireDialogActionIndepSamps *act = PSPPIRE_DIALOG_ACTION_INDEP_SAMPS (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "indep-samples.ui");
+ GtkBuilder *xml = builder_new ("indep-samples.ui");
pda->dialog = get_widget_assert (xml,"independent-samples-dialog");
pda->source = get_widget_assert (xml, "indep-samples-treeview1");
{
g_string_append (string, "\n\t");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (kid->checkbutton[i])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (kid->checkbutton[i])))
{
g_string_append_printf (string, "/%s = ", keyword[i]);
psppire_var_view_append_names (PSPPIRE_VAR_VIEW (kid->vars_treeview),
GtkTreeIter notused;
- if ( !gtk_tree_model_get_iter_first (vars, ¬used) )
+ if (!gtk_tree_model_get_iter_first (vars, ¬used))
return FALSE;
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (kid->groupvar_entry))))
+ if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (kid->groupvar_entry))))
return FALSE;
gboolean method_set = FALSE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (a);
- GtkBuilder *xml = builder_new ( "k-independent.ui");
+ GtkBuilder *xml = builder_new ("k-independent.ui");
pda->dialog = get_widget_assert (xml, "k-independent-dialog");
pda->source = get_widget_assert (xml, "k-independent-treeview1");
GString *string = g_string_new ("NPAR TEST");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->friedman)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->friedman)))
{
g_string_append (string, "\n\t/FRIEDMAN = ");
psppire_var_view_append_names (PSPPIRE_VAR_VIEW (krd->var_view), 0, string);
}
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->kendal)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->kendal)))
{
g_string_append (string, "\n\t/KENDALL = ");
psppire_var_view_append_names (PSPPIRE_VAR_VIEW (krd->var_view), 0, string);
}
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->cochran)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->cochran)))
{
g_string_append (string, "\n\t/COCHRAN = ");
psppire_var_view_append_names (PSPPIRE_VAR_VIEW (krd->var_view), 0, string);
! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->kendal))
&&
! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (krd->cochran))
- )
+)
return FALSE;
return TRUE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionKRelated *act = PSPPIRE_DIALOG_ACTION_K_RELATED (a);
- GtkBuilder *xml = builder_new ( "k-related.ui");
+ GtkBuilder *xml = builder_new ("k-related.ui");
pda->dialog = get_widget_assert (xml, "k-related-dialog");
pda->source = get_widget_assert (xml, "dict-view");
PsppireDialogActionKmeans *act = PSPPIRE_DIALOG_ACTION_KMEANS (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "k-means.ui");
+ GtkBuilder *xml = builder_new ("k-means.ui");
pda->dialog = get_widget_assert (xml, "k-means-dialog");
pda->source = get_widget_assert (xml, "dict-view");
ret = psppire_dialog_run (PSPPIRE_DIALOG (act->opts_dialog));
- if ( ret == PSPPIRE_RESPONSE_CONTINUE )
+ if (ret == PSPPIRE_RESPONSE_CONTINUE)
{
act->conf = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->conf_checkbox));
act->conf_level = gtk_spin_button_get_value (GTK_SPIN_BUTTON (act->conf_entry));
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
GtkWidget *opts_button;
- GtkBuilder *xml = builder_new ( "logistic.ui");
+ GtkBuilder *xml = builder_new ("logistic.ui");
pda->dialog = get_widget_assert (xml, "logistic-dialog");
pda->source = get_widget_assert (xml, "dict-view");
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionMeans *act = PSPPIRE_DIALOG_ACTION_MEANS (a);
- GtkBuilder *xml = builder_new ( "means.ui");
+ GtkBuilder *xml = builder_new ("means.ui");
GtkWidget *vb = get_widget_assert (xml, "frame2");
act->layer = psppire_means_layer_new ();
if (ow->posthoc)
{
ds_put_cstr (&dss, "\n\t/POSTHOC=");
- if ( ow->posthoc & POSTHOC_BONFERRONI)
+ if (ow->posthoc & POSTHOC_BONFERRONI)
ds_put_cstr (&dss, "BONFERRONI ");
- if ( ow->posthoc & POSTHOC_GH)
+ if (ow->posthoc & POSTHOC_GH)
ds_put_cstr (&dss, "GH ");
- if ( ow->posthoc & POSTHOC_LSD)
+ if (ow->posthoc & POSTHOC_LSD)
ds_put_cstr (&dss, "LSD ");
- if ( ow->posthoc & POSTHOC_SCHEFFE)
+ if (ow->posthoc & POSTHOC_SCHEFFE)
ds_put_cstr (&dss, "SCHEFFE ");
- if ( ow->posthoc & POSTHOC_SIDAK)
+ if (ow->posthoc & POSTHOC_SIDAK)
ds_put_cstr (&dss, "SIDAK ");
- if ( ow->posthoc & POSTHOC_TUKEY)
+ if (ow->posthoc & POSTHOC_TUKEY)
ds_put_cstr (&dss, "TUKEY ");
}
- for (i = 0 ; i < ow->contrasts_array->len ; ++i )
+ for (i = 0 ; i < ow->contrasts_array->len ; ++i)
{
GtkListStore *ls = g_array_index (ow->contrasts_array, GtkListStore*, i);
GtkTreeIter iter;
GtkTreeIter notused;
- if ( !gtk_tree_model_get_iter_first (vars, ¬used) )
+ if (!gtk_tree_model_get_iter_first (vars, ¬used))
return FALSE;
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (ow->factor_entry))))
+ if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (ow->factor_entry))))
return FALSE;
gtk_widget_set_sensitive (csd->prev, csd->c > 1);
- if ( csd->c > 0 )
+ if (csd->c > 0)
ls = g_array_index (csd->temp_contrasts, GtkTreeModel*, csd->c - 1);
psppire_acr_set_model (PSPPIRE_ACR (csd->acr), GTK_LIST_STORE (ls));
for (ok = gtk_tree_model_get_iter_first (ls, &iter);
ok;
ok = gtk_tree_model_iter_next (ls, &iter)
- )
+)
{
gdouble v;
gtk_tree_model_get (ls, &iter, 0, &v, -1);
g_array_sized_new (FALSE, FALSE, sizeof (GtkListStore *),
src_array->len);
- for (i = 0 ; i < src_array->len ; ++i )
+ for (i = 0 ; i < src_array->len ; ++i)
{
GtkTreeIter src_iter;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionOneway *act = PSPPIRE_DIALOG_ACTION_ONEWAY (a);
- GtkBuilder *xml = builder_new ( "oneway.ui");
+ GtkBuilder *xml = builder_new ("oneway.ui");
GtkWidget *contrasts_button = get_widget_assert (xml, "contrasts-button");
/* Posthoc button */
response = psppire_dialog_run (PSPPIRE_DIALOG (ow->posthoc_dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
ow->posthoc= 0;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->bonferroni_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->bonferroni_button)))
ow->posthoc |= POSTHOC_BONFERRONI;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->gh_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->gh_button)))
ow->posthoc |= POSTHOC_GH;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->lsd_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->lsd_button)))
ow->posthoc |= POSTHOC_LSD;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->scheffe_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->scheffe_button)))
ow->posthoc |= POSTHOC_SCHEFFE;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->sidak_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->sidak_button)))
ow->posthoc |= POSTHOC_SIDAK;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->tukey_button) ))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ow->tukey_button)))
ow->posthoc |= POSTHOC_TUKEY;
}
}\f
response = psppire_dialog_run (PSPPIRE_DIALOG (csd->contrasts_dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
csd->contrasts_array = clone_contrasts_array (csd->temp_contrasts);
}
static void
prev (GtkWidget *widget, PsppireDialogActionOneway *csd)
{
- if ( csd->c > 0 )
+ if (csd->c > 0)
--csd->c;
list_store_changed (csd);
struct variable *v = NULL;
GtkTreeIter dest_iter;
- if ( n_rows == 0 )
+ if (n_rows == 0)
return FALSE;
/* Get the last row */
if (v == NULL)
return FALSE;
- /* if ( NULL == pd->valid) */
+ /* if (NULL == pd->valid) */
/* return TRUE; */
return TRUE;
n_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (tt_d->list_store), NULL);
- if ( n_rows > 0 )
+ if (n_rows > 0)
{
gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
else
v1 = NULL;
- if ( n_rows == 0 || v1 != NULL)
+ if (n_rows == 0 || v1 != NULL)
{
gtk_list_store_append (tt_d->list_store, &dest_iter);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (a);
- GtkBuilder *xml = builder_new ( "paired-samples.ui");
+ GtkBuilder *xml = builder_new ("paired-samples.ui");
GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_toggle_button_get_active (rd->ascending_togglebutton)
?'A':'D');
- if ( gtk_tree_model_get_iter_first (gs, ¬used) )
+ if (gtk_tree_model_get_iter_first (gs, ¬used))
{
g_string_append (str, "\n\tBY ");
{
g_string_append (str, "\n\t/FRACTION=");
- if ( gtk_toggle_button_get_active (rd->blom))
+ if (gtk_toggle_button_get_active (rd->blom))
g_string_append (str, "BLOM");
- else if ( gtk_toggle_button_get_active (rd->tukey))
+ else if (gtk_toggle_button_get_active (rd->tukey))
g_string_append (str, "TUKEY");
- else if ( gtk_toggle_button_get_active (rd->rankit))
+ else if (gtk_toggle_button_get_active (rd->rankit))
g_string_append (str, "RANKIT");
- else if ( gtk_toggle_button_get_active (rd->vw))
+ else if (gtk_toggle_button_get_active (rd->vw))
g_string_append (str, "VW");
}
g_string_append (str, "\n\t/TIES=");
- if ( gtk_toggle_button_get_active (rd->mean))
+ if (gtk_toggle_button_get_active (rd->mean))
g_string_append (str, "MEAN");
- else if ( gtk_toggle_button_get_active (rd->low))
+ else if (gtk_toggle_button_get_active (rd->low))
g_string_append (str, "LOW");
- else if ( gtk_toggle_button_get_active (rd->high))
+ else if (gtk_toggle_button_get_active (rd->high))
g_string_append (str, "HIGH");
- else if ( gtk_toggle_button_get_active (rd->condense))
+ else if (gtk_toggle_button_get_active (rd->condense))
g_string_append (str, "CONDENSE");
{
gint i;
- for (i = 0 ; i < n_RANK_FUNCS ; ++i )
+ for (i = 0 ; i < n_RANK_FUNCS ; ++i)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->func_button [i]),
FALSE);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionRank *act = PSPPIRE_DIALOG_ACTION_RANK (a);
- GtkBuilder *xml = builder_new ( "rank.ui");
+ GtkBuilder *xml = builder_new ("rank.ui");
GtkWidget *types_button = get_widget_assert (xml, "button1");
GtkWidget *ties_button = get_widget_assert (xml, "button2");
PsppireDialogActionRecodeDifferent *rdd = PSPPIRE_DIALOG_ACTION_RECODE_DIFFERENT (rd);
GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variable_treeview));
- if (g_hash_table_size (rdd->varmap) != gtk_tree_model_iter_n_children (model, NULL) )
+ if (g_hash_table_size (rdd->varmap) != gtk_tree_model_iter_n_children (model, NULL))
return FALSE;
return TRUE;
PsppireDialogActionRecode *rd = data;
GtkTreeIter not_used;
- if ( ! rd->value_map )
+ if (! rd->value_map)
return FALSE;
- if ( ! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rd->value_map),
- ¬_used) )
+ if (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rd->value_map),
+ ¬_used))
return FALSE;
nlp->label = NULL;
- if ( 0 != strcmp ("", label))
+ if (0 != strcmp ("", label))
nlp->label = g_strdup (label);
return nlp;
nlp_destroy (gpointer data)
{
struct nlp *nlp = data ;
- if ( ! nlp )
+ if (! nlp)
return;
g_free (nlp->name);
nlp = g_hash_table_lookup (rdd->varmap, var);
- if ( nlp )
+ if (nlp)
g_object_set (cell, "text", nlp->name, NULL);
else
g_object_set (cell, "text", "", NULL);
const gchar *dest_var_label =
gtk_entry_get_text (GTK_ENTRY (rd->new_label_entry));
- if ( NULL == rows || rows->next != NULL)
+ if (NULL == rows || rows->next != NULL)
goto finish;
gtk_tree_model_get_iter (model, &iter, rows->data);
GList *rows = gtk_tree_selection_get_selected_rows (selection, &model);
- if ( rows && !rows->next)
+ if (rows && !rows->next)
{
/* Exactly one row is selected */
struct nlp *nlp;
GtkTreeModel *vars =
gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variable_treeview));
- if ( !gtk_tree_model_get_iter_first (vars, ¬_used))
+ if (!gtk_tree_model_get_iter_first (vars, ¬_used))
return FALSE;
return TRUE;
PsppireDialogActionRecode *rd = data;
GtkTreeIter not_used;
- if ( ! rd->value_map )
+ if (! rd->value_map)
return FALSE;
- if ( ! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rd->value_map),
- ¬_used) )
+ if (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rd->value_map),
+ ¬_used))
return FALSE;
return difx_variable_treeview_is_populated (rd);
{
struct new_value *copy = g_memdup (nv, sizeof (*copy));
- if ( nv->type == NV_STRING )
+ if (nv->type == NV_STRING)
copy->v.s = xstrdup (nv->v.s);
return copy;
static void
new_value_free (struct new_value *nv)
{
- if ( nv->type == NV_STRING )
+ if (nv->type == NV_STRING)
g_free (nv->v.s);
g_free (nv);
{
static GType t = 0;
- if (t == 0 )
+ if (t == 0)
{
t = g_boxed_type_register_static ("psppire-recode-new-values",
(GBoxedCopyFunc) new_value_copy,
on_string_toggled (GtkToggleButton *b, PsppireDialogActionRecode *rd)
{
gboolean active;
- if (! rd->input_var_is_string )
+ if (! rd->input_var_is_string)
return ;
active = gtk_toggle_button_get_active (b);
static void
focus_value_entry (GtkWidget *w, PsppireDialogActionRecode *rd)
{
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
gtk_widget_grab_focus (rd->new_value_entry);
}
{
const gchar *text;
- if ( !gtk_toggle_button_get_active
+ if (!gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (rd->toggle[BUTTON_NEW_VALUE])))
{
psppire_acr_set_enabled (PSPPIRE_ACR (rd->acr), TRUE);
struct old_value *ov = NULL;
struct new_value *nv = NULL;
- if ( ! gtk_tree_selection_get_selected (selection, &model, &iter) )
+ if (! gtk_tree_selection_get_selected (selection, &model, &iter))
return;
if (PSPPIRE_DIALOG_ACTION_RECODE_CLASS (G_OBJECT_GET_CLASS (rd))->target_is_string (rd))
nv.type = NV_STRING;
- if ( nv.type == NV_STRING )
+ if (nv.type == NV_STRING)
nv.v.s = g_strdup (text);
else
nv.v.v = g_strtod (text, 0);
{
PsppireDialogActionRecode *rd = data;
- switch ( col )
+ switch (col)
{
case COL_VALUE_OLD:
set_old_value (val, rd);
psppire_acr_set_model (PSPPIRE_ACR (rd->acr), NULL);
- if ( response == PSPPIRE_RESPONSE_CONTINUE )
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
g_object_unref (rd->value_map);
rd->value_map = clone_list_store (local_store);
ds_put_cstr (&dds, "\n\t");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->convert_button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->convert_button)))
{
ds_put_cstr (&dds, "(CONVERT) ");
}
void psppire_dialog_action_recode_refresh (PsppireDialogAction *);
GtkBuilder * psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act,
- void (*populate_treeview) (PsppireDialogActionRecode *) );
+ void (*populate_treeview) (PsppireDialogActionRecode *));
GType new_value_get_type (void);
ret = psppire_dialog_run (PSPPIRE_DIALOG (rd->stat_dialog));
- if ( ret != PSPPIRE_RESPONSE_CONTINUE )
+ if (ret != PSPPIRE_RESPONSE_CONTINUE)
{
/* If the user chose to abandon his changes, then replace the model, from the backup */
gtk_tree_view_set_model (GTK_TREE_VIEW (rd->stat_view) , GTK_TREE_MODEL (backup_model));
ret = psppire_dialog_run (PSPPIRE_DIALOG (rd->save_dialog));
- if ( ret == PSPPIRE_RESPONSE_CONTINUE )
+ if (ret == PSPPIRE_RESPONSE_CONTINUE)
{
rd->pred = (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->pred_button)) == TRUE)
? TRUE : FALSE;
PsppireDialogActionRegression *act = PSPPIRE_DIALOG_ACTION_REGRESSION (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "regression.ui");
+ GtkBuilder *xml = builder_new ("regression.ui");
GtkWidget *stat_button = get_widget_assert (xml, "stat-button");
GtkWidget *save_button = get_widget_assert (xml, "save-button");
g_string_append (string, "\n\t/MODEL=");
- if ( ALPHA == gtk_combo_box_get_active (GTK_COMBO_BOX (rd->model_combo)))
+ if (ALPHA == gtk_combo_box_get_active (GTK_COMBO_BOX (rd->model_combo)))
g_string_append (string, "ALPHA");
else
g_string_append_printf (string, "SPLIT (%d)",
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rd->split_spinbutton))
- );
+ );
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->scale_if_item_deleted_checkbutton)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->scale_if_item_deleted_checkbutton)))
g_string_append (string, "\n\t/SUMMARY = TOTAL");
g_string_append (string, ".\n");
0, n_vars - 1);
gtk_widget_set_sensitive (pda->split_point_hbox,
- ( SPLIT == gtk_combo_box_get_active (GTK_COMBO_BOX (pda->model_combo))));
+ (SPLIT == gtk_combo_box_get_active (GTK_COMBO_BOX (pda->model_combo))));
}
PsppireDialogActionReliability *act = PSPPIRE_DIALOG_ACTION_RELIABILITY (a);
GtkTreeModel *liststore ;
- GtkBuilder *xml = builder_new ( "reliability.ui");
+ GtkBuilder *xml = builder_new ("reliability.ui");
pda->dialog = get_widget_assert (xml, "reliability-dialog");
pda->source = get_widget_assert (xml, "dict-view");
var = psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION (rd)->dict, var_name);
- if ( var == NULL)
+ if (var == NULL)
return FALSE;
width = var_get_width (var);
static void
on_curve_button_toggle (GtkCheckButton *curve, PsppireDialogActionRoc *rd)
{
- if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve)))
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (curve)))
{
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
g_object_set (rd->reference, "inconsistent", TRUE, NULL);
g_object_set (rd->reference, "sensitive", FALSE, NULL);
}
const struct variable *var =
psppire_dict_lookup_var (PSPPIRE_DIALOG_ACTION(act)->dict, var_name);
- if ( var == NULL)
+ if (var == NULL)
return;
psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->state_value), var);
PsppireDialogActionRoc *act = PSPPIRE_DIALOG_ACTION_ROC (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "roc.ui");
+ GtkBuilder *xml = builder_new ("roc.ui");
pda->dialog = get_widget_assert (xml, "roc-dialog");
pda->source = get_widget_assert (xml, "dict-view");
/* The /PLOT subcommand */
g_string_append (string, "\n\t/PLOT ");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->curve)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->curve)))
{
g_string_append (string, "CURVE");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->reference)))
g_string_append (string, " (REFERENCE)");
}
else
/* The /PRINT subcommand */
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)) ||
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)) )
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)) ||
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)))
{
g_string_append (string, "\n\t/PRINT");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->standard_error)))
g_string_append (string, " SE");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->coordinates)))
g_string_append (string, " COORDINATES");
}
{
g_string_append (string, "\n\t/RUNS");
- g_string_append (string, " ( ");
+ g_string_append (string, " (");
g_string_append (string, cut);
- g_string_append (string, " ) = ");
+ g_string_append (string, ") = ");
psppire_var_view_append_names (vv, 0, string);
}
GString *string = g_string_new ("NPAR TEST");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_MEAN])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_MEAN])))
append_fragment (string, "MEAN", PSPPIRE_VAR_VIEW (rd->variables));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_MEDIAN])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_MEDIAN])))
append_fragment (string, "MEDIAN", PSPPIRE_VAR_VIEW (rd->variables));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_MODE])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_MODE])))
append_fragment (string, "MODE", PSPPIRE_VAR_VIEW (rd->variables));
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_CUSTOM])))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->cb[CB_CUSTOM])))
{
const char *text = gtk_entry_get_text (GTK_ENTRY (rd->entry));
append_fragment (string, text, PSPPIRE_VAR_VIEW (rd->variables));
for (i = 0; i < 4; ++i)
{
- if ( TRUE == gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->cb[i])))
+ if (TRUE == gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fd->cb[i])))
break;
}
- if ( i >= 4)
+ if (i >= 4)
return FALSE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionRuns *act = PSPPIRE_DIALOG_ACTION_RUNS (a);
- GtkBuilder *xml = builder_new ( "runs.ui");
+ GtkBuilder *xml = builder_new ("runs.ui");
pda->dialog = get_widget_assert (xml, "runs-dialog");
pda->source = get_widget_assert (xml, "dict-view");
const char *xvar = gtk_entry_get_text (GTK_ENTRY (ow->x_axis));
const char *yvar = gtk_entry_get_text (GTK_ENTRY (ow->y_axis));
- if ( 0 == strcmp ("", xvar))
+ if (0 == strcmp ("", xvar))
return FALSE;
- if ( 0 == strcmp ("", yvar))
+ if (0 == strcmp ("", yvar))
return FALSE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionScatterplot *act = PSPPIRE_DIALOG_ACTION_SCATTERPLOT (a);
- GtkBuilder *xml = builder_new ( "scatterplot.ui");
+ GtkBuilder *xml = builder_new ("scatterplot.ui");
pda->dialog = get_widget_assert (xml, "scatterplot-dialog");
pda->source = get_widget_assert (xml, "scatterplot-treeview1");
response = psppire_dialog_run (PSPPIRE_DIALOG (scd->rsample_dialog));
- if ( response != PSPPIRE_RESPONSE_CONTINUE)
+ if (response != PSPPIRE_RESPONSE_CONTINUE)
{
g_signal_handlers_disconnect_by_func
(G_OBJECT (scd->percent),
{
gchar *text;
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent)))
{
text = widget_printf (gettext(label1), scd->spinbutton);
gtk_label_set_text (GTK_LABEL (scd->l0), text);
GTK_WINDOW (pda->dialog));
response = psppire_dialog_run (PSPPIRE_DIALOG (scd->range_subdialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE)
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
gchar *text = widget_printf (_("%d thru %d"), scd->first, scd->last);
gtk_label_set_text (GTK_LABEL (scd->l1), text);
PsppireDialogActionSelect *act = PSPPIRE_DIALOG_ACTION_SELECT (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GtkBuilder *xml = builder_new ( "select-cases.ui");
+ GtkBuilder *xml = builder_new ("select-cases.ui");
pda->dialog = get_widget_assert (xml, "select-cases-dialog");
pda->source = get_widget_assert (xml, "select-cases-treeview");
ds_put_cstr (&dss, "EXECUTE.\n");
}
- else if ( gtk_toggle_button_get_active
+ else if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (scd->radiobutton_sample)))
{
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent)))
{
const double percentage =
gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton));
ds_put_c_format (&dss,
"COMPUTE %s = RV.UNIFORM (0,1) < %.*g.\n",
filter,
- DBL_DIG + 1, percentage / 100.0 );
+ DBL_DIG + 1, percentage / 100.0);
}
else
{
ds_put_c_format (&dss,
"COMPUTE %s = $CASENUM.\n",
- filter );
+ filter);
ds_put_c_format (&dss,
"COMPUTE %s = %s <= %d\n",
filter,
filter,
- n_cases );
+ n_cases);
ds_put_cstr (&dss, "EXECUTE.\n");
gchar *text = NULL;
struct string dss;
- if ( gtk_toggle_button_get_active
+ if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (scd->radiobutton_all)))
{
return xstrdup ("\n");
ds_init_empty (&dss);
- if ( gtk_toggle_button_get_active
+ if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (scd->radiobutton_sample)))
{
ds_put_cstr (&dss, "SAMPLE ");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->percent)))
{
const double percentage =
gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton));
}
}
- else if ( gtk_toggle_button_get_active
+ else if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (scd->radiobutton_range)))
{
ds_put_c_format (&dss,
PsppireDialogActionSelect *scd = PSPPIRE_DIALOG_ACTION_SELECT (a);
/* In the simple case, all we need to do is cancel any existing filter */
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->radiobutton_all)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->radiobutton_all)))
{
return g_strdup ("FILTER OFF.\n");
}
/* Are we filtering or deleting ? */
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->radiobutton_delete)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->radiobutton_delete)))
{
return generate_syntax_delete (a);
}
PsppireVarView *var_view = PSPPIRE_VAR_VIEW (scd->variables);
gint n_vars = psppire_var_view_append_names (var_view, 0, string);
- if ( n_vars == 0 )
+ if (n_vars == 0)
{
g_string_assign (string, "");
}
gint n_rows = gtk_tree_model_iter_n_children (model, NULL);
- if ( n_rows == 0 )
+ if (n_rows == 0)
return FALSE;
return TRUE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionSort *act = PSPPIRE_DIALOG_ACTION_SORT (a);
- GtkBuilder *xml = builder_new ( "sort.ui");
+ GtkBuilder *xml = builder_new ("sort.ui");
pda->dialog = get_widget_assert (xml, "sort-cases-dialog");
pda->source = get_widget_assert (xml, "sort-cases-treeview1");
GString *string = g_string_new ("SPLIT FILE OFF.");
- if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->off)))
+ if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->off)))
{
GString * varlist = g_string_sized_new (80);
gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (act->tv), 0, varlist);
- if ( n_vars > 0 )
+ if (n_vars > 0)
{
g_string_assign (string, "");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->sort)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->sort)))
{
g_string_append (string, "SORT CASES BY");
g_string_append (string, varlist->str);
g_string_append (string, "SPLIT FILE ");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->layered)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->layered)))
g_string_append (string, "LAYERED ");
else
g_string_append (string, "SEPARATE ");
gtk_list_store_clear (GTK_LIST_STORE (liststore));
- if ( n_vars == 0 )
+ if (n_vars == 0)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (act->off), TRUE);
else
{
gint i;
const struct variable *const *vars = dict_get_split_vars (pda->dict->dict);
- for (i = 0 ; i < n_vars; ++i )
+ for (i = 0 ; i < n_vars; ++i)
{
gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
{
PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda);
- GtkBuilder *xml = builder_new ( "split-file.ui");
+ GtkBuilder *xml = builder_new ("split-file.ui");
pda->dialog = get_widget_assert (xml, "split-file-dialog");
pda->source = get_widget_assert (xml, "split-file-dict-treeview");
text = gtk_entry_get_text (GTK_ENTRY (tt_d->test_value_entry));
- if ( 0 == strcmp ("", text))
+ if (0 == strcmp ("", text))
return FALSE;
/* Check to see if the entry is numeric */
return FALSE;
- if ( 0 == gtk_tree_model_get_iter_first (vars, ¬used))
+ if (0 == gtk_tree_model_get_iter_first (vars, ¬used))
return FALSE;
return TRUE;
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionTt1s *act = PSPPIRE_DIALOG_ACTION_TT1S (a);
- GtkBuilder *xml = builder_new ( "t-test.ui");
+ GtkBuilder *xml = builder_new ("t-test.ui");
GtkWidget *options_button = get_widget_assert (xml, "button1");
pda->dialog = get_widget_assert (xml, "t-test-one-sample-dialog");
struct variable *v = NULL;
GtkTreeIter dest_iter;
- if ( n_rows == 0 )
+ if (n_rows == 0)
return FALSE;
/* Get the last row */
n_rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (tt_d->list_store), NULL);
- if ( n_rows > 0 )
+ if (n_rows > 0)
{
gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
else
v1 = NULL;
- if ( n_rows == 0 || v1 != NULL)
+ if (n_rows == 0 || v1 != NULL)
{
gtk_list_store_append (tt_d->list_store, &dest_iter);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionTwoSample *act = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (a);
- GtkBuilder *xml = builder_new ( "paired-samples.ui");
+ GtkBuilder *xml = builder_new ("paired-samples.ui");
/* NPAR Specific options */
GtkWidget *frame = gtk_frame_new (_("Test Type"));
GtkTreeModel *vars;
GtkTreeIter notused;
- if ( 0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (ud->dep_entry))))
+ if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (ud->dep_entry))))
return false;
vars =
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionUnivariate *act = PSPPIRE_DIALOG_ACTION_UNIVARIATE (a);
- GtkBuilder *xml = builder_new ( "univariate.ui");
+ GtkBuilder *xml = builder_new ("univariate.ui");
pda->dialog = get_widget_assert (xml, "univariate-dialog");
pda->source = get_widget_assert (xml, "dict-view");
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionVarInfo *act = PSPPIRE_DIALOG_ACTION_VAR_INFO (pda);
- GtkBuilder *xml = builder_new ( "variable-info.ui");
+ GtkBuilder *xml = builder_new ("variable-info.ui");
act->output =
psppire_output_view_new (GTK_LAYOUT (get_widget_assert (xml, "layout1")),
const struct variable *var = psppire_dict_lookup_var (pda->dict, text);
- if ( var == NULL)
+ if (var == NULL)
syntax = g_strdup ("WEIGHT OFF.\n");
else
syntax = g_strdup_printf ("WEIGHT BY %s.\n",
const struct variable *var = dict_get_weight (pda->dict->dict);
- if ( ! var )
+ if (! var)
{
gtk_entry_set_text (GTK_ENTRY (wcd->entry), "");
gtk_label_set_text (GTK_LABEL (wcd->status), _("Do not weight cases"));
{
PsppireDialogActionWeight *act = PSPPIRE_DIALOG_ACTION_WEIGHT (pda);
- GtkBuilder *xml = builder_new ( "weight.ui");
+ GtkBuilder *xml = builder_new ("weight.ui");
pda->dialog = get_widget_assert (xml, "weight-cases-dialog");
pda->source = get_widget_assert (xml, "weight-cases-treeview");
response = psppire_dialog_run (PSPPIRE_DIALOG (act->dialog));
- if ( class->generate_syntax )
+ if (class->generate_syntax)
{
switch (response)
{
void
psppire_dialog_notify_change (PsppireDialog *dialog)
{
- if ( dialog->contents_are_valid )
+ if (dialog->contents_are_valid)
{
gboolean valid = dialog->contents_are_valid (dialog->validity_data);
{
PsppireDialog *dialog = data;
- if ( PSPPIRE_IS_BUTTONBOX (w))
+ if (PSPPIRE_IS_BUTTONBOX (w))
return;
- if ( GTK_IS_CONTAINER (w))
+ if (GTK_IS_CONTAINER (w))
{
gtk_container_foreach (GTK_CONTAINER (w),
connect_notify_signal,
"user-modified-state-changed" signal. Instead, we have to try and
predict what widgets and signals are likely to exist in our dialogs. */
- if ( GTK_IS_TOGGLE_BUTTON (w))
+ if (GTK_IS_TOGGLE_BUTTON (w))
{
g_signal_connect_swapped (w, "toggled",
G_CALLBACK (psppire_dialog_notify_change),
dialog);
}
- if ( PSPPIRE_IS_SELECTOR (w))
+ if (PSPPIRE_IS_SELECTOR (w))
{
g_signal_connect_swapped (w, "selected",
G_CALLBACK (psppire_dialog_notify_change),
psppire_selector_update_subjects (PSPPIRE_SELECTOR (w));
}
- if ( GTK_IS_EDITABLE (w))
+ if (GTK_IS_EDITABLE (w))
{
g_signal_connect_swapped (w, "changed",
G_CALLBACK (psppire_dialog_notify_change),
dialog);
}
- if ( GTK_IS_CELL_EDITABLE (w))
+ if (GTK_IS_CELL_EDITABLE (w))
{
g_signal_connect_swapped (w, "editing-done",
G_CALLBACK (psppire_dialog_notify_change),
dialog);
}
- if ( GTK_IS_TEXT_VIEW (w))
+ if (GTK_IS_TEXT_VIEW (w))
{
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
dialog);
}
- if ( GTK_IS_TREE_VIEW (w))
+ if (GTK_IS_TREE_VIEW (w))
{
gint i = 0;
GtkTreeView *tv = GTK_TREE_VIEW (w);
GtkTreeViewColumn *col;
GtkTreeModel *model = gtk_tree_view_get_model (tv);
- if ( model)
+ if (model)
{
g_signal_connect_swapped (model, "row-changed",
G_CALLBACK (psppire_dialog_notify_change),
GList *start = renderers;
while (renderers)
{
- if ( GTK_IS_CELL_RENDERER_TOGGLE (renderers->data))
+ if (GTK_IS_CELL_RENDERER_TOGGLE (renderers->data))
g_signal_connect_swapped (renderers->data, "toggled",
G_CALLBACK (psppire_dialog_notify_change), dialog);
renderers = renderers->next;
if (title == NULL)
g_warning ("PsppireDialog %s has no title", gtk_widget_get_name (GTK_WIDGET (dialog)));
- if ( dialog->contents_are_valid != NULL )
+ if (dialog->contents_are_valid != NULL)
gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child(GTK_BIN(dialog))),
connect_notify_signal,
dialog);
gint psppire_dialog_run (PsppireDialog *);
void psppire_dialog_set_valid_predicate (PsppireDialog *,
ContentsAreValid,
- gpointer );
+ gpointer);
void psppire_dialog_set_accept_predicate (PsppireDialog *,
ContentsAreValid,
- gpointer );
+ gpointer);
gboolean psppire_dialog_is_acceptable (const PsppireDialog *);
void psppire_dialog_notify_change (PsppireDialog *);
{
PsppireDict *dict = PSPPIRE_DICT (pd);
- if ( ! dict->disable_insert_signal)
+ if (! dict->disable_insert_signal)
{
g_signal_emit (dict, signals [VARIABLE_INSERTED], 0, idx);
g_signal_emit_by_name (dict, "items-changed", idx, 1, 1);
g_assert (d);
g_assert (PSPPIRE_IS_DICT (d));
- if ( ! dict_id_is_valid (d->dict, name, false))
+ if (! dict_id_is_valid (d->dict, name, false))
return FALSE;
- if ( idx < dict_get_var_cnt (d->dict))
+ if (idx < dict_get_var_cnt (d->dict))
{
/* This is an existing variable? */
var = dict_get_var (d->dict, idx);
g_return_val_if_fail (d, NULL);
g_return_val_if_fail (d->dict, NULL);
- if ( dict_get_var_cnt (d->dict) <= idx )
+ if (dict_get_var_cnt (d->dict) <= idx)
return NULL;
return dict_get_var (d->dict, idx);
psppire_dict_check_name (const PsppireDict *dict,
const gchar *name, gboolean report)
{
- if ( ! dict_id_is_valid (dict->dict, name, report ) )
+ if (! dict_id_is_valid (dict->dict, name, report))
return FALSE;
if (psppire_dict_lookup_var (dict, name))
{
- if ( report )
+ if (report)
msg (ME, _("Duplicate variable name."));
return FALSE;
}
n = indices [0];
- if ( n < 0 || n >= psppire_dict_get_var_cnt (dict))
+ if (n < 0 || n >= psppire_dict_get_var_cnt (dict))
{
iter->stamp = 0;
iter->user_data = NULL;
struct variable *var;
gint idx;
- if ( iter == NULL || iter->user_data == NULL)
+ if (iter == NULL || iter->user_data == NULL)
return FALSE;
g_return_val_if_fail (iter->stamp == dict->stamp, FALSE);
idx = var_get_dict_index (var);
- if ( idx + 1 >= psppire_dict_get_var_cnt (dict))
+ if (idx + 1 >= psppire_dict_get_var_cnt (dict))
{
iter->user_data = NULL;
iter->stamp = 0;
dict = PSPPIRE_DICT (model);
- if ( parent )
+ if (parent)
return FALSE;
- if ( n >= psppire_dict_get_var_cnt (dict) )
+ if (n >= psppire_dict_get_var_cnt (dict))
return FALSE;
iter->stamp = dict->stamp;
iter->user_data = psppire_dict_get_variable (dict, n);
- if ( !iter->user_data)
+ if (!iter->user_data)
return FALSE;
return TRUE;
psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
const gchar *name)
{
- if ( ! dict_id_is_valid (dict->dict, name, false))
+ if (! dict_id_is_valid (dict->dict, name, false))
return FALSE;
/* Make sure no other variable has this name */
- if ( NULL != psppire_dict_lookup_var (dict, name))
+ if (NULL != psppire_dict_lookup_var (dict, name))
return FALSE;
dict_rename_var (dict->dict, v, name);
{
GtkTreeModel *model = NULL;
- if ( dict_view->dict == NULL)
+ if (dict_view->dict == NULL)
return;
dict_view->sorted_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (dict_view->dict));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dict_view->sorted_model),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
- if ( dict_view->predicate )
+ if (dict_view->predicate)
{
model = gtk_tree_model_filter_new (dict_view->sorted_model, NULL);
gtk_tree_model_get (tree_model, &iter, DICT_TVM_COL_VAR, &var, -1);
- if ( ! var_has_label (var))
+ if (! var_has_label (var))
return FALSE;
{
get_base_model (tree_model, NULL, &m, NULL);
- if ( use_labels (PSPPIRE_DICT_VIEW (treeview)))
+ if (use_labels (PSPPIRE_DICT_VIEW (treeview)))
tip = var_get_name (var);
else
tip = var_get_label (var);
const gchar *s = g_hash_table_lookup (kp->frag_table, b);
- if ( s )
+ if (s)
g_signal_emit (kp, keypad_signals [INSERT_SYNTAX], 0, s);
else
g_signal_emit (kp, keypad_signals [ERASE], 0);
30 * cols / (float) rows);
g_hash_table_insert (kp->frag_table, *button,
- (void *) keypad_insert_text[(button - &kp->digit[0])] );
+ (void *) keypad_insert_text[(button - &kp->digit[0])]);
g_signal_connect (*button, "clicked",
G_CALLBACK (button_click), kp);
GdkEventKey *event,
gpointer user_data)
{
- if ( ! gtk_widget_has_focus (widget))
+ if (! gtk_widget_has_focus (widget))
return FALSE;
switch (event->keyval)
g_snprintf (buf, 5, "%d", i);
kp->digit[i] = gtk_button_new_with_label (buf);
- if ( i == 0 )
+ if (i == 0)
add_button (kp, &kp->digit[i],
digit_hoffset + 0, digit_hoffset + 2,
digit_voffset + 3, digit_voffset + 4);
| |
| / >= 0 . |
+ +
- | y != = ( ) |
+ | y != = () |
|x |
+---+---+---+---+---+
int offset = gtk_text_iter_get_offset (&iter);
int end_offset = gtk_text_iter_get_offset (&r->stop);
- if ( end_offset - offset < n)
+ if (end_offset - offset < n)
n_chars = end_offset - offset;
gtk_text_iter_set_offset (&iter, offset + n_chars);
GList *rows = gtk_tree_selection_get_selected_rows (sel, &model);
GList *n = rows;
- if ( n == NULL)
+ if (n == NULL)
return;
if (path_search (dirname, sizeof dirname, NULL, NULL, true)
n = n->next;
}
- if ( driver->class->flush)
+ if (driver->class->flush)
driver->class->flush (driver);
output_driver_destroy (driver);
driver = NULL;
- if ( g_file_get_contents (filename, &text, &length, NULL) )
+ if (g_file_get_contents (filename, &text, &length, NULL))
{
gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data),
8,
complete. Don't let that screw up printing. */
return TRUE;
}
- else if ( view->print_item < view->n_items )
+ else if (view->print_item < view->n_items)
{
xr_driver_output_item (view->print_xrd,
view->items[view->print_item++].item);
else
{
gint i;
- if ( x != 0 )
+ if (x != 0)
sensitive = TRUE;
for (i = 1 ; i < N_EXTENSIONS ; ++i)
{
- if ( g_str_has_suffix (fn, ft[i].ext))
+ if (g_str_has_suffix (fn, ft[i].ext))
{
sensitive = TRUE;
break;
GtkFileChooser *chooser = data;
const gchar *name = g_param_spec_get_name (pspec);
- if ( ! gtk_widget_get_realized (GTK_WIDGET (chooser)))
+ if (! gtk_widget_get_realized (GTK_WIDGET (chooser)))
return;
/* Ignore this one. It causes recursion. */
- if ( 0 == strcmp ("tooltip-text", name))
+ if (0 == strcmp ("tooltip-text", name))
return;
on_combo_change (chooser);
static void
iterate_widgets (GtkWidget *w, gpointer data)
{
- if ( GTK_IS_CONTAINER (w))
+ if (GTK_IS_CONTAINER (w))
gtk_container_forall (GTK_CONTAINER (w), iterate_widgets, data);
else
g_signal_connect (w, "notify", G_CALLBACK (on_file_chooser_change), data);
{
/* Create text cell renderer */
GtkCellRenderer *cell = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, FALSE );
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, FALSE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell, "text", 0);
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
- if ( response == GTK_RESPONSE_ACCEPT )
+ if (response == GTK_RESPONSE_ACCEPT)
{
gint file_type = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
gchar *filename = gtk_file_chooser_get_filename (chooser);
gint i;
for (i = 1 ; i < N_EXTENSIONS ; ++i)
{
- if ( g_str_has_suffix (filename, ft[i].ext))
+ if (g_str_has_suffix (filename, ft[i].ext))
{
file_type = i;
break;
GtkWidget *label ;
GString *str = g_string_new (*s);
- if ( dirs)
+ if (dirs)
{
char_directive dir = dirs->dir[dir_idx];
int n = 0;
- while (dir_idx < dirs->count && dir.conversion == '%' )
+ while (dir_idx < dirs->count && dir.conversion == '%')
{
g_string_erase (str, dir.dir_start - *s, 1);
dir = dirs->dir[++dir_idx];
g_string_truncate (str, dir.dir_start - *s - n);
- if ( dir_idx >= dirs->count)
+ if (dir_idx >= dirs->count)
*s = NULL;
else
*s = dir.dir_end;
/* Get the number of args into D */
g_return_if_fail (0 == printf_parse (scanf->format, &scanf->d, &a));
- if ( scanf->d.count > 0)
+ if (scanf->d.count > 0)
scanf->widgets = xcalloc (scanf->d.count, sizeof (*scanf->widgets));
/* A is not used, so get rid of it */
if (a.arg != a.direct_alloc_arg)
free (a.arg);
- for (i = 0 ; i < scanf->d.count ; ++i )
+ for (i = 0 ; i < scanf->d.count ; ++i)
{
GtkWidget **w;
char_directive dir = scanf->d.dir[i];
int precision = 0;
int width = 0;
- if ( dir.precision_start && dir.precision_end)
+ if (dir.precision_start && dir.precision_end)
precision = strtol (dir.precision_start + 1,
(char **) &dir.precision_end, 10);
- if ( dir.width_start && dir.width_end )
+ if (dir.width_start && dir.width_end)
width = strtol (dir.width_start, (char **) &dir.width_end, 10);
- if ( dir.dir_start > s )
+ if (dir.dir_start > s)
ship_label (scanf, &s, &scanf->d, i);
- if ( dir.conversion == '%')
+ if (dir.conversion == '%')
{
if (s) s++;
continue;
gtk_widget_show (*w);
}
- if ( s && *s )
+ if (s && *s)
ship_label (scanf, &s, NULL, 0);
}
GList *l = gtk_container_get_children (GTK_CONTAINER (scanf));
while (l)
{
- if ( GTK_IS_LABEL (l->data))
+ if (GTK_IS_LABEL (l->data))
{
const gchar *t = gtk_label_get_label (l->data);
- if ( g_strstr_len (t, -1, "_"))
+ if (g_strstr_len (t, -1, "_"))
{
g_object_set (l->data,
"use-underline", TRUE,
gchar
psppire_get_conversion_char (PsppireScanf *w, gint n)
{
- g_return_val_if_fail ( n < w->d.count, '\0');
+ g_return_val_if_fail (n < w->d.count, '\0');
return w->d.dir[n].conversion;
}
GtkWidget *
psppire_scanf_get_child (PsppireScanf *w, gint n)
{
- g_return_val_if_fail ( n < w->d.count, NULL);
+ g_return_val_if_fail (n < w->d.count, NULL);
return w->widgets[n];
}
va_start (ap, fmt);
- for (i = 0 ; i < n ; ++i )
+ for (i = 0 ; i < n ; ++i)
{
GtkWidget **field;
- if ( psppire_get_conversion_char (PSPPIRE_SCANF (w), i) == '%')
+ if (psppire_get_conversion_char (PSPPIRE_SCANF (w), i) == '%')
continue;
field = va_arg (ap, GtkWidget **);
set_direction (selector, PSPPIRE_SELECTOR_SOURCE_TO_DEST);
- if ( selector->allow_selection )
+ if (selector->allow_selection)
{
gtk_widget_set_sensitive (GTK_WIDGET (selector),
selector->allow_selection (selector->source, selector->dest));
}
- else if ( GTK_IS_ENTRY (selector->dest) )
+ else if (GTK_IS_ENTRY (selector->dest))
{
gtk_widget_set_sensitive (GTK_WIDGET (selector),
gtk_tree_selection_count_selected_rows
- (treeselection) <= 1 );
+ (treeselection) <= 1);
}
}
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (w);
- if ( NULL == list)
+ if (NULL == list)
return;
- if ( g_list_first (list)->data == selector)
+ if (g_list_first (list)->data == selector)
{
- if ( selector->row_activate_id )
+ if (selector->row_activate_id)
g_signal_handler_disconnect (selector->source, selector->row_activate_id);
selector->row_activate_id =
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source));
- if ( selector->source_select_id )
+ if (selector->source_select_id)
g_signal_handler_disconnect (selection, selector->source_select_id);
selector->source_select_id =
/* FIXME: Need to reverse the arrow direction if an RTL locale is in
effect */
- if ( d == PSPPIRE_SELECTOR_SOURCE_TO_DEST )
+ if (d == PSPPIRE_SELECTOR_SOURCE_TO_DEST)
{
switch (selector->orientation)
{
de_select_selection_tree_view (PsppireSelector *selector)
{
GtkTreeSelection* selection =
- gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->dest));
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->dest));
GtkTreeModel *model =
gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest));
{
selector->selecting = TRUE;
- if ( GTK_IS_TREE_VIEW (selector->dest ) )
+ if (GTK_IS_TREE_VIEW (selector->dest))
de_select_selection_tree_view (selector);
- else if ( GTK_IS_ENTRY (selector->dest))
+ else if (GTK_IS_ENTRY (selector->dest))
de_select_selection_entry (selector);
- else if ( PSPPIRE_IS_MEANS_LAYER (selector->dest))
+ else if (PSPPIRE_IS_MEANS_LAYER (selector->dest))
de_select_selection_means_layer (selector);
else
{
GList *item ;
GtkTreeSelection* selection =
- gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->source));
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->source));
GList *selected_rows = gtk_tree_selection_get_selected_rows (selection, NULL);
selector->dest,
childmodel,
selector->select_user_data
- );
+ );
}
g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
{
PsppireSelector *selector = list->data;
- if ( selector->filter && selector->filter (childmodel, iter, selector))
+ if (selector->filter && selector->filter (childmodel, iter, selector))
return FALSE;
list = list->next;
PsppireSelectorClass *class = g_type_class_peek (PSPPIRE_SELECTOR_TYPE);
- if ( ! (list = g_hash_table_lookup (class->source_hash, selector->source)))
+ if (! (list = g_hash_table_lookup (class->source_hash, selector->source)))
{
/* Base case: This widget is currently not the source of
any selector. Create a hash entry and make this selector
{ /* Append this selector to the list and push the <source,list>
pair onto the hash table */
- if ( NULL == g_list_find (list, selector) )
+ if (NULL == g_list_find (list, selector))
{
- if ( selector->primary_requested )
+ if (selector->primary_requested)
{
list = g_list_prepend (list, selector);
selector->source_litem = list;
GtkTreeView *source,
GParamSpec *psp,
PsppireSelector *selector
- )
+)
{
GtkTreeModel *model = gtk_tree_view_get_model (source);
{
PsppireSelector *selector = user_data;
- if ( selector->selecting) return;
+ if (selector->selecting) return;
refilter (selector);
}
{
PsppireSelector *selector = user_data;
- if ( selector->selecting ) return;
+ if (selector->selecting) return;
refilter (selector);
}
g_signal_connect (selector, "destroy", G_CALLBACK (remove_selector_handlers), model);
- if ( selector->selecting ) return;
+ if (selector->selecting) return;
refilter (selector);
}
static void
set_default_filter (PsppireSelector *selector)
{
- if ( selector->filter == NULL)
+ if (selector->filter == NULL)
{
if (GTK_IS_TREE_VIEW (selector->dest))
selector->filter = is_item_in_dest;
void
psppire_selector_update_subjects (PsppireSelector *selector)
{
- if ( NULL == selector->dest )
+ if (NULL == selector->dest)
return;
set_default_filter (selector);
- if ( NULL == selector->source )
+ if (NULL == selector->source)
return;
- if ( GTK_IS_TREE_VIEW (selector->source))
+ if (GTK_IS_TREE_VIEW (selector->source))
{
set_tree_view_source (selector);
else
g_error ("Unsupported source widget: %s", G_OBJECT_TYPE_NAME (selector->source));
- if ( NULL == selector->dest)
+ if (NULL == selector->dest)
;
- else if ( GTK_IS_TREE_VIEW (selector->dest))
+ else if (GTK_IS_TREE_VIEW (selector->dest))
{
set_tree_view_dest (selector, GTK_TREE_VIEW (selector->dest));
}
- else if ( GTK_IS_ENTRY (selector->dest))
+ else if (GTK_IS_ENTRY (selector->dest))
{
set_entry_dest (selector, GTK_ENTRY (selector->dest));
}
g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (selector->dest));
- if ( PSPPIRE_IS_DICT_VIEW (selector->source) && selector->select_items == NULL)
+ if (PSPPIRE_IS_DICT_VIEW (selector->source) && selector->select_items == NULL)
{
GObjectClass *class = G_OBJECT_GET_CLASS (selector);
GType type = G_OBJECT_TYPE (selector->dest);
SelectItemsFunc *func =
g_hash_table_lookup (PSPPIRE_SELECTOR_CLASS (class)->default_selection_funcs, (gpointer) type);
- if ( func )
+ if (func)
psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
func, NULL);
}
GtkTextIter begin, end;
GtkTextBuffer *buffer = GTK_TEXT_BUFFER (sw->buffer);
- if ( gtk_text_buffer_get_selection_bounds (buffer, &begin, &end) )
+ if (gtk_text_buffer_get_selection_bounds (buffer, &begin, &end))
gtk_text_buffer_delete (buffer, &begin, &end);
}
GtkClipboard *clipboard ;
GtkTextBuffer *buffer = GTK_TEXT_BUFFER (sw->buffer);
- if ( ! gtk_text_buffer_get_selection_bounds (buffer, begin, end) )
+ if (! gtk_text_buffer_get_selection_bounds (buffer, begin, end))
return FALSE;
g_free (sw->cliptext);
{
GtkTextIter begin, end;
- if ( set_clip (sw, &begin, &end))
+ if (set_clip (sw, &begin, &end))
gtk_text_buffer_delete (GTK_TEXT_BUFFER (sw->buffer), &begin, &end);
}
for (i = 0 ; i < sizeof (targets) / sizeof (targets[0]) ; ++i)
{
GdkAtom atom = gdk_atom_intern (targets[i].target, TRUE);
- if ( gtk_clipboard_wait_is_target_available (clip, atom))
+ if (gtk_clipboard_wait_is_target_available (clip, atom))
{
compatible_target = TRUE;
break;
{
GtkTextIter begin, end;
- if ( gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (se->buffer), &begin, &end) )
+ if (gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (se->buffer), &begin, &end))
editor_execute_syntax (se, begin, end);
}
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (se->buffer),
&here,
gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (se->buffer))
- );
+ );
line = gtk_text_iter_get_line (&here) ;
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (se->buffer),
&here,
gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (se->buffer))
- );
+ );
line = gtk_text_iter_get_line (&here) ;
static gchar *
append_suffix (const gchar *filename)
{
- if ( ! g_str_has_suffix (filename, ".sps" ) &&
- ! g_str_has_suffix (filename, ".SPS" ) )
+ if (! g_str_has_suffix (filename, ".sps") &&
+ ! g_str_has_suffix (filename, ".SPS"))
{
return g_strdup_printf ("%s.sps", filename);
}
ss_dealloc (&text_locale);
g_free (suffixedname);
- if ( result )
+ if (result)
{
char *fn = g_filename_display_name (filename);
gchar *msg = g_strdup_printf (_("Saved file `%s'"), fn);
response = gtk_dialog_run (GTK_DIALOG (dialog));
- if ( response == GTK_RESPONSE_ACCEPT )
+ if (response == GTK_RESPONSE_ACCEPT)
{
gchar *encoding;
char *filename;
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog) );
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
psppire_window_set_filename (window, filename);
free (filename);
const gchar *filename = psppire_window_get_filename (se);
GError *err = NULL;
save_editor_to_file (PSPPIRE_SYNTAX_WINDOW (se), filename, &err);
- if ( err )
+ if (err)
{
msg (ME, "%s", err->message);
g_error_free (err);
ok = psppire_window_load (PSPPIRE_WINDOW (se), filename, encoding, NULL);
gtk_source_buffer_end_not_undoable_action (PSPPIRE_SYNTAX_WINDOW (se)->buffer);
- if (ok )
+ if (ok)
gtk_widget_show (se);
else
gtk_widget_destroy (se);
{
GtkWidget *se = psppire_syntax_window_new (NULL);
- if ( file_name)
+ if (file_name)
load_and_show_syntax_window (se, file_name, encoding);
return GTK_WINDOW (se);
GtkTextBuffer *buffer = GTK_TEXT_BUFFER (sw->buffer);
/* FIXME: What if it's a very big file ? */
- if ( ! g_file_get_contents (filename, &text_locale, &len_locale, &err) )
+ if (! g_file_get_contents (filename, &text_locale, &len_locale, &err))
{
error_dialog (GTK_WINDOW (window), filename, err);
g_clear_error (&err);
NULL).string;
free (text_locale);
- if ( text_utf8 == NULL )
+ if (text_utf8 == NULL)
{
error_dialog (GTK_WINDOW (window), filename, err);
g_clear_error (&err);
{
const gchar *text = gtk_entry_get_text (rw->e1);
- if ( vr->input_var_is_string)
+ if (vr->input_var_is_string)
{
ov->type = OV_STRING;
ov->v.s = g_strdup (text);
{
struct old_value *copy = g_memdup (ov, sizeof (*copy));
- if ( ov->type == OV_STRING )
+ if (ov->type == OV_STRING)
copy->v.s = g_strdup (ov->v.s);
return copy;
{
static GType t = 0;
- if (t == 0 )
+ if (t == 0)
{
t = g_boxed_type_register_static ("psppire-recode-old-values",
(GBoxedCopyFunc) old_value_copy,
for (i = 0; i < n_VAL_CHOOSER_BUTTONS; ++i)
{
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vr->rw[i].rb)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vr->rw[i].rb)))
{
range_opt[i].set (vr, ov, &vr->rw[i]);
break;
psppire_val_chooser_set_status (PsppireValChooser *vr, const struct old_value *ov)
{
gint i;
- if ( !ov )
+ if (!ov)
return;
for (i = 0; i < n_VAL_CHOOSER_BUTTONS; ++i)
{
const struct variable *v = g_value_get_boxed (src);
- if ( v == NULL)
+ if (v == NULL)
g_value_set_string (dest, "");
else
g_value_set_string (dest, var_get_name (v));
{
const struct variable *v = g_value_get_boxed (src);
- if ( v == NULL)
+ if (v == NULL)
g_value_set_int (dest, -1);
else
g_value_set_int (dest, var_get_dict_index (v));
{
static GType t = 0;
- if (t == 0 )
+ if (t == 0)
{
t = g_boxed_type_register_static ("psppire-var-ptr",
(GBoxedCopyFunc) variable_copy,
GValue value = {0};
gtk_tree_model_get_value (model, iter, column, &value);
- if ( G_VALUE_TYPE (&value) == PSPPIRE_VAR_PTR_TYPE)
+ if (G_VALUE_TYPE (&value) == PSPPIRE_VAR_PTR_TYPE)
var = g_value_get_boxed (&value);
else
g_critical ("Unsupported type `%s', in variable name treeview.",
gint n_vars = 0;
GtkTreeIter iter;
- if ( psppire_var_view_get_iter_first (vv, &iter) )
+ if (psppire_var_view_get_iter_first (vv, &iter))
{
do
{
GtkTreeIter iter;
GSList *list = NULL;
- if ( psppire_var_view_get_iter_first (vv, &iter) )
+ if (psppire_var_view_get_iter_first (vv, &iter))
{
do
{
gint n_vars = 0;
GtkTreeIter iter;
- if ( psppire_var_view_get_iter_first (vv, &iter) )
+ if (psppire_var_view_get_iter_first (vv, &iter))
{
do
{
{
PsppireWindow *window = PSPPIRE_WINDOW (data);
- if ( NULL != g_hash_table_lookup (window->menuitem_table, key))
+ if (NULL != g_hash_table_lookup (window->menuitem_table, key))
return;
insert_menuitem_into_menu (window, key);
{
PsppireWindowRegister *reg = psppire_window_register_new ();
- if ( w->dirty )
+ if (w->dirty)
{
gint response = psppire_window_query_save (w);
}
}
- if ( 1 == psppire_window_register_n_items (reg))
+ if (1 == psppire_window_register_n_items (reg))
gtk_main_quit ();
return FALSE;
void
psppire_window_set_unsaved (PsppireWindow *w)
{
- if ( w->dirty == FALSE)
+ if (w->dirty == FALSE)
g_get_current_time (&w->savetime);
w->dirty = TRUE;
ok = i->load (w, file, encoding, hint);
- if ( ok )
+ if (ok)
{
psppire_window_set_filename (w, file);
w->dirty = FALSE;
const gchar *filename = toplevel->filename;
gchar *dir_name;
- if ( ! g_path_is_absolute (filename))
+ if (! g_path_is_absolute (filename))
{
gchar *path =
g_build_filename (g_get_current_dir (), filename, NULL);
const char *mime_type, const char *encoding)
{
gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
- if ( uri )
+ if (uri)
{
GtkRecentData recent_data;
gchar *full_mime_type;
{
gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
- if ( uri )
+ if (uri)
gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uri, NULL);
g_free (uri);
bind_textdomain_codeset (PACKAGE, "UTF-8");
break;
case 8:
- if ( ! gtk_parse_args (is->argc, is->argv) )
+ if (! gtk_parse_args (is->argc, is->argv))
{
perror ("Error parsing arguments");
exit (1);
int
-main (int argc, char *argv[] )
+main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *hbox;
gtk_init (&argc, &argv);
- if ( argc < 2)
+ if (argc < 2)
g_error ("Usage: prog file\n");
msg_set_handler (print_msg, 0);
{
gint response;
- if ( tto->excl == EXCL_ANALYSIS)
+ if (tto->excl == EXCL_ANALYSIS)
gtk_toggle_button_set_active (tto->analysis, TRUE);
else
gtk_toggle_button_set_active (tto->listwise, TRUE);
response = psppire_dialog_run (PSPPIRE_DIALOG (tto->dialog));
- if ( response == PSPPIRE_RESPONSE_CONTINUE)
+ if (response == PSPPIRE_RESPONSE_CONTINUE)
{
tto->non_default_options = TRUE;
tto->confidence_interval = gtk_spin_button_get_value (tto->conf_percent);
- if ( gtk_toggle_button_get_active (tto->analysis) )
+ if (gtk_toggle_button_get_active (tto->analysis))
tto->excl = EXCL_ANALYSIS;
else
tto->excl = EXCL_LISTWISE;
v.f = g_value_get_double (&gvalue);
- if ( 0 == memcmp (&v, val, sizeof (union value)))
+ if (0 == memcmp (&v, val, sizeof (union value)))
{
break;
}
}
path = gtk_tree_model_get_path (model, &iter);
- if ( path )
+ if (path)
{
gtk_tree_view_set_cursor (treeview, path, 0, 0);
gtk_tree_path_free (path);
gtk_entry_set_text (GTK_ENTRY (dialog->label_entry),"");
- if ( (s = val_labs_find (dialog->labs, &v)) )
+ if ((s = val_labs_find (dialog->labs, &v)))
{
gtk_entry_set_text (GTK_ENTRY (dialog->label_entry), s);
gtk_widget_set_sensitive (dialog->add_button, FALSE);
{
if (val_labs_add (dialog->labs, &v,
gtk_entry_get_text
- ( GTK_ENTRY (dialog->label_entry)) ) )
+ (GTK_ENTRY (dialog->label_entry))))
{
gtk_widget_set_sensitive (dialog->add_button, FALSE);
{
gchar *s;
const struct missing_values *miss = var_get_missing_values (pv);
- if ( mv_is_empty (miss))
+ if (mv_is_empty (miss))
return xstrdup (gettext (none));
else
{
- if ( ! mv_has_range (miss))
+ if (! mv_has_range (miss))
{
GString *gstr = g_string_sized_new (10);
const int n = mv_n_values (miss);
gchar *mv[4] = {0,0,0,0};
gint i;
- for (i = 0 ; i < n; ++i )
+ for (i = 0 ; i < n; ++i)
{
mv[i] = value_to_text (*mv_get_value (miss, i), pv);
- if ( i > 0 )
+ if (i > 0)
g_string_append (gstr, ", ");
g_string_append (gstr, mv[i]);
g_free (mv[i]);
g_free (l);
g_free (h);
- if ( mv_has_value (miss))
+ if (mv_has_value (miss))
{
gchar *ss = NULL;
{
PsppireVarTypeDialog *dialog = dialog_;
- if ( gtk_toggle_button_get_active (togglebutton) == TRUE)
+ if (gtk_toggle_button_get_active (togglebutton) == TRUE)
refresh_active_button (dialog);
}
PsppireVarTypeDialog *dialog = data;
- if ( dialog->active_button != BUTTON_CUSTOM )
+ if (dialog->active_button != BUTTON_CUSTOM)
return;
text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_decimals));
dialog->fmt_l.w = atoi (text);
msg_disable ();
- if ( ! fmt_check_output (&dialog->fmt_l))
+ if (! fmt_check_output (&dialog->fmt_l))
{
gtk_label_set_text (GTK_LABEL (dialog->label_psample), "---");
gtk_label_set_text (GTK_LABEL (dialog->label_nsample), "---");
add_to_group, sizeGroup);
- for (i = 0 ; i < num_BUTTONS; ++i )
+ for (i = 0 ; i < num_BUTTONS; ++i)
g_signal_connect (dialog->radioButton[i], "toggled",
G_CALLBACK (on_toggle), dialog);
list_store = gtk_list_store_new (1, G_TYPE_STRING);
- for ( i = 0 ; i < sizeof (date_format) / sizeof (date_format[0]) ; ++i )
+ for (i = 0 ; i < sizeof (date_format) / sizeof (date_format[0]) ; ++i)
{
const struct fmt_spec *f = &date_format[i];
gtk_list_store_append (list_store, &iter);
list_store = gtk_list_store_new (1, G_TYPE_STRING);
- for ( i = 0 ; i < sizeof (dollar_format)/sizeof (dollar_format[0]) ; ++i )
+ for (i = 0 ; i < sizeof (dollar_format)/sizeof (dollar_format[0]) ; ++i)
{
char *template = settings_dollar_template (&dollar_format[i]);
gtk_list_store_append (list_store, &iter);
list_store = gtk_list_store_new (1, G_TYPE_STRING);
- for ( i = 0 ; i < 5 ; ++i )
+ for (i = 0 ; i < 5 ; ++i)
{
enum fmt_type cc_fmts[5] = {FMT_CCA, FMT_CCB, FMT_CCC, FMT_CCD, FMT_CCE};
gtk_list_store_append (list_store, &iter);
va_list ap;
const char *s = fmt;
- if ( 0 != printf_parse (fmt, &d, &a) )
+ if (0 != printf_parse (fmt, &d, &a))
return NULL;
widgets = xcalloc (d.count, sizeof (*widgets));
va_start (ap, fmt);
- for (i = 0 ; i < d.count ; ++i )
+ for (i = 0 ; i < d.count ; ++i)
{
- if ( d.dir[i].conversion != '%')
+ if (d.dir[i].conversion != '%')
widgets[i] = va_arg (ap, GtkWidget *);
}
va_end (ap);
output = g_string_sized_new (strlen (fmt));
- for (i = 0 ; i < d.count ; ++i )
+ for (i = 0 ; i < d.count ; ++i)
{
char_directive dir = d.dir[i];
GtkWidget *w ;
const gchar *entry_text;
- if ( dir.conversion == '%')
+ if (dir.conversion == '%')
{
s++;
continue;
w = widgets [dir.arg_index];
entry_text = gtk_entry_get_text (GTK_ENTRY (w));
- if ( dir.dir_start > s )
+ if (dir.dir_start > s)
g_string_append_len (output, s, dir.dir_start - s);
s = dir.dir_end;
gtk_menu_attach (GTK_MENU (menu), minimize, 0, 1, 0, 1);
- if (PSPPIRE_DATA_WINDOW_TYPE == G_OBJECT_TYPE (toplevel) )
+ if (PSPPIRE_DATA_WINDOW_TYPE == G_OBJECT_TYPE (toplevel))
{
gtk_menu_attach (GTK_MENU (menu), split, 0, 1, 1, 2);
g_signal_connect_swapped (split, "toggled",
break;
case OPT_SYNTAX:
- if (!strcmp (optarg, "compatible") )
+ if (!strcmp (optarg, "compatible"))
settings_set_syntax (COMPATIBLE);
else if (!strcmp (optarg, "enhanced"))
settings_set_syntax (ENHANCED);
max_fd = (max_fd > fd) ? max_fd : fd;
FD_SET (fd, &what);
ret = select (max_fd + 1, &what, NULL, NULL, &timeout);
- if ( ret == -1 && errno != EINTR)
+ if (ret == -1 && errno != EINTR)
{
perror ("Select failed");
continue;
}
- if (ret > 0 )
+ if (ret > 0)
{
if (FD_ISSET (pfd[0], &what))
{
static void
readline_init (void)
{
- if ( 0 != pipe2 (pfd, O_NONBLOCK))
+ if (0 != pipe2 (pfd, O_NONBLOCK))
perror ("Cannot create pipe");
- if ( SIG_ERR == signal (SIGINT, handler))
+ if (SIG_ERR == signal (SIGINT, handler))
perror ("Cannot add signal handler");
rl_catch_signals = 0;
static void
readline_done (void)
{
- if (history_file != NULL && false == settings_get_testing_mode () )
+ if (history_file != NULL && false == settings_get_testing_mode ())
write_history (history_file);
clear_history ();
free (history_file);
for (i = MIN (15, strlen (type_name)); i < 16; i++)
putchar (' ');
- for (i = 0; i < n; )
+ for (i = 0; i < n;)
{
const uint8_t *u_input = CHAR_CAST (const uint8_t *, input);
ucs4_t uc;
find_by_position (struct abt *abt, int position)
{
struct abt_node *p;
- for (p = abt->root; p != NULL; )
+ for (p = abt->root; p != NULL;)
{
int p_pos = p->down[0] ? abt_node_to_element (p->down[0])->count : 0;
if (position == p_pos)
unsigned int value = 1;
/* Disallow N values that overflow on 32-bit machines. */
assert (n <= 12);
- for (; n > 1; )
+ for (; n > 1;)
value *= n--;
return value;
}
unsigned int i;
assert (offset <= UINT_BIT);
- for (i = offset; i-- > 0; )
+ for (i = offset; i-- > 0;)
if (pattern & (1u << i))
{
*start = i;
unsigned int i;
assert (offset <= UINT_BIT);
- for (i = offset; i-- > 0; )
+ for (i = offset; i-- > 0;)
if (pattern & (1u << i))
{
*start = i;
unsigned int value = 1;
/* Disallow N values that overflow on 32-bit machines. */
assert (n <= 12);
- for (; n > 1; )
+ for (; n > 1;)
value *= n--;
return value;
}
int
main (int argc, char **argv)
{
- if ( argc < 4)
+ if (argc < 4)
{
fprintf (stderr, "Usage zip-test: {r|w} archive file0 file1 ... filen\n");
check_die ();
}
- if ( 0 == strcmp ("w", argv[1]))
+ if (0 == strcmp ("w", argv[1]))
{
int i;
struct zip_writer *zw = zip_writer_create (argv[2]);
for (i = 3; i < argc; ++i)
{
FILE *fp = fopen (argv[i], "r");
- if (!fp ) check_die ();
+ if (!fp) check_die ();
zip_writer_add (zw, fp, argv[i]);
}
zip_writer_close (zw);
}
- else if ( 0 == strcmp ("r", argv[1]))
+ else if (0 == strcmp ("r", argv[1]))
{
const int BUFSIZE=256;
char buf[BUFSIZE];
int i;
struct string str;
struct zip_reader *zr = zip_reader_create (argv[2], &str);
- if ( NULL == zr)
+ if (NULL == zr)
{
fprintf (stderr, "Could not create zip reader: %s\n", ds_cstr (&str));
check_die ();
int x = 0;
struct zip_member *zm ;
FILE *fp = fopen (argv[i], "w");
- if ( NULL == fp)
+ if (NULL == fp)
{
int e = errno;
fprintf (stderr, "Could not create file %s: %s\n", argv[i], strerror(e));
check_die ();
}
zm = zip_member_open (zr, argv[i]);
- if ( NULL == zm)
+ if (NULL == zm)
{
fprintf (stderr, "Could not open zip member %s from archive: %s\n",
argv[i], ds_cstr (&str));
}
zip_member_finish (zm);
fclose (fp);
- if ( x < 0)
+ if (x < 0)
{
fprintf (stderr, "Unzip failed: %s\n", ds_cstr (&str));
check_die ();
{
char *q;
- for (q = p; *p != '\0'; )
+ for (q = p; *p != '\0';)
if (*p == '\\' && p[1] == 'n')
{
*q++ = '\n';
break;
case 'a':
- for (const char *p = optarg; *p; )
+ for (const char *p = optarg; *p;)
if (p[1] == '-' && p[2] > p[0])
{
for (int ch = p[0]; ch <= p[2]; ch++)
{
printf ("%08llx: case %d's uncompressible data begins\n",
(long long int) ftello (r->file), case_num);
- for (i = 0; i < r->n_var_widths; )
+ for (i = 0; i < r->n_var_widths;)
{
int width = r->var_widths[i];
char raw_value[8];