+2003-05-24 Paul Eggert <eggert@twinsun.com>
+
+ Switch from 'int' to 'bool' where that makes sense.
+
+ * lib/abitset.c (abitset_test, abitset_empty_p, abitset_equal_p,
+ abitset_subset_p, abitset_disjoint_p, abitset_and_cmp,
+ abitset_andn_cmp, abitset_or_cmp, abitset_xor_cmp, abitset_and_or,
+ abitset_and_or_cmp, abitset_andn_or_cmp, abitset_or_and_cmp):
+ Return or accept bool, not int. All callers changed.
+ * lib/bbitset.h: (bitset_toggle_, bitset_copy_, bitset_and_or_cmp_,
+ bitset_andn_or_cmp_, bitset_or_and_cmp_): Likewise.
+ * lib/bitset.c (bitset_only_set_p, bitset_print, bitset_toggle_,
+ bitset_copy_, bitset_op4_cmp, bitset_and_or_cmp_, bitset_andn_or_cmp_,
+ bitset_or_and_cmp_): Likewise.
+ * lib/bitset.h (bitset_test, bitset_only_set_p): Likewise.
+ * lib/bitset_stats.c (bitset_stats_print, bitset_stats_toggle,
+ bitset_stats_test, bitset_stats_empty_p, bitset_stats_disjoint_p,
+ bitset_stats_equal_p, bitset_stats_subset_p, bitset_stats_and_cmp,
+ bitset_stats_andn_cmp, bitset_stats_or_cmp, bitset_stats_xor_cmp,
+ bitset_stats_and_or_cmp, bitset_stats_andn_or_cmp,
+ bitset_stats_or_and_cmp): Likewise.
+ * lib/ebitset.c (ebitset_elt_zero_p, ebitset_equal_p, ebitset_copy_cmp,
+ ebitset_test, ebitset_empty_p, ebitset_subset_p, ebitset_disjoint_p,
+ ebitset_op3_cmp, ebitset_and_cmp, ebitset_andn_cmp, ebitset_or_cmp,
+ ebitset_xor_cmp): Likewise.
+ * lib/lbitset.c (lbitset_elt_zero_p, lbitset_equal_p, lbitset_copy_cmp,
+ lbitset_test, lbitset_empty_p, lbitset_subset_p, lbitset_disjoint_p,
+ lbitset_op3_cmp, lbitset_and_cmp, lbitset_andn_cmp, lbitset_or_cmp,
+ lbitset_xor_cmp): Likewise.
+ * lib/bbitset.h: Include <stdbool.h>.
+ (struct bitset_vtable): The following members now return bool, not
+ int: toggle, test, empty_p, disjoint_p, equal_p, subset_p,
+ and_cmp, andn_cmp, or_cmp, xor_cmp, and_or_cmp, andn_or_cmp,
+ or_and_cmp).
+ * src/conflicts.c (count_rr_conflicts): Likewise.
+ * lib/bitset_stats.h (bitset_stats_enabled): Now bool, not int.
+ All uses changed.
+ * lib/ebitset.c (ebitset_obstack_init): Likewise.
+ * lib/lbitset.c (lbitset_obstack_init): Likewise.
+ * src/getargs.c (debug_flag, defines_flag, locations_flag,
+ no_lines_flag, no_parser_flag, token_table_flag, yacc_flag,
+ graph_flag): Likewise.
+ * src/getargs.h (debug_flag, defines_flag, locations_flag,
+ no_lines_flag, no_parser_flag, token_table_flag, yacc_flag,
+ graph_flag): Likewise.
+ * src/output.c (error_verbose): Likewise.
+ * src/output.h (error_verbose): Likewise.
+ * src/reader.c (start_flag, typed): Likewise.
+ * src/reader.h (typed): Likewise.
+ * src/getargs.c (LOCATIONS_OPTION): New constant.
+ (long_options, getargs): Use it.
+ * src/lalr.c (build_relations): Use bool, not int.
+ * src/nullable.c (nullable_compute): Likewise.
+ * src/print.c (print_reductions): Likewise.
+ * src/tables.c (action_row, pack_vector): Likewise.
+ * src/muscle_tab.h (MUSCLE_INSERT_BOOL): New macro.
+ * src/output.c (prepare): Use it.
+ * src/output.c (token_definitions_output,
+ symbol_destructors_output, symbol_destructors_output): Use string,
+ not boolean integer, to keep track of whether to output separator.
+ * src/print_graph.c (print_core): Likewise.
+ * src/state.c (state_rule_lookaheads_print): Likewise.
+
+ * config/install-sh: Sync from automake 1.7.5.
+
2003-05-14 Paul Eggert <eggert@twinsun.com>
* src/parse-gram.y (rules_or_grammar_declaration): Require a
/* Array bitsets.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
/* Test bit BITNO in bitset SRC. */
-static int
+static bool
abitset_test (bitset src ATTRIBUTE_UNUSED,
bitset_bindex bitno ATTRIBUTE_UNUSED)
{
/* This should never occur for abitsets since we should always
hit the cache. */
abort ();
- return 0;
+ return false;
}
}
-static int
+static bool
abitset_empty_p (bitset dst)
{
bitset_windex i;
for (i = 0; i < dst->b.csize; i++)
if (dstp[i])
- return 0;
+ return false;
- return 1;
+ return true;
}
}
-static int
+static bool
abitset_equal_p (bitset dst, bitset src)
{
bitset_windex i;
for (i = 0; i < size; i++)
if (*srcp++ != *dstp++)
- return 0;
- return 1;
+ return false;
+ return true;
}
-static int
+static bool
abitset_subset_p (bitset dst, bitset src)
{
bitset_windex i;
for (i = 0; i < size; i++, dstp++, srcp++)
if (*dstp != (*srcp | *dstp))
- return 0;
- return 1;
+ return false;
+ return true;
}
-static int
+static bool
abitset_disjoint_p (bitset dst, bitset src)
{
bitset_windex i;
for (i = 0; i < size; i++)
if (*srcp++ & *dstp++)
- return 0;
+ return false;
- return 1;
+ return true;
}
}
-static int
+static bool
abitset_and_cmp (bitset dst, bitset src1, bitset src2)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *dstp = ABITSET_WORDS (dst);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
}
-static int
+static bool
abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *dstp = ABITSET_WORDS (dst);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
}
-static int
+static bool
abitset_or_cmp (bitset dst, bitset src1, bitset src2)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *dstp = ABITSET_WORDS (dst);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
}
-static int
+static bool
abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *dstp = ABITSET_WORDS (dst);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
}
-static int
+static bool
abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *src3p = ABITSET_WORDS (src3);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
}
-static int
+static bool
abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *src3p = ABITSET_WORDS (src3);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
}
-static int
+static bool
abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
bitset_windex i;
- int changed = 0;
+ bool changed = false;
bitset_word *src1p = ABITSET_WORDS (src1);
bitset_word *src2p = ABITSET_WORDS (src2);
bitset_word *src3p = ABITSET_WORDS (src3);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
#include "libiberty.h"
+#include <stdbool.h>
#include <limits.h>
/* Currently we support three flavours of bitsets:
{
void (*set) PARAMS ((bitset, bitset_bindex));
void (*reset) PARAMS ((bitset, bitset_bindex));
- int (*toggle) PARAMS ((bitset, bitset_bindex));
- int (*test) PARAMS ((bitset, bitset_bindex));
+ bool (*toggle) PARAMS ((bitset, bitset_bindex));
+ bool (*test) PARAMS ((bitset, bitset_bindex));
bitset_bindex (*size) PARAMS ((bitset));
bitset_bindex (*count) PARAMS ((bitset));
- int (*empty_p) PARAMS ((bitset));
+ bool (*empty_p) PARAMS ((bitset));
void (*ones) PARAMS ((bitset));
void (*zero) PARAMS ((bitset));
void (*copy) PARAMS ((bitset, bitset));
- int (*disjoint_p) PARAMS ((bitset, bitset));
- int (*equal_p) PARAMS ((bitset, bitset));
+ bool (*disjoint_p) PARAMS ((bitset, bitset));
+ bool (*equal_p) PARAMS ((bitset, bitset));
void (*not) PARAMS ((bitset, bitset));
- int (*subset_p) PARAMS ((bitset, bitset));
+ bool (*subset_p) PARAMS ((bitset, bitset));
void (*and) PARAMS ((bitset, bitset, bitset));
- int (*and_cmp) PARAMS ((bitset, bitset, bitset));
+ bool (*and_cmp) PARAMS ((bitset, bitset, bitset));
void (*andn) PARAMS ((bitset, bitset, bitset));
- int (*andn_cmp) PARAMS ((bitset, bitset, bitset));
+ bool (*andn_cmp) PARAMS ((bitset, bitset, bitset));
void (*or) PARAMS ((bitset, bitset, bitset));
- int (*or_cmp) PARAMS ((bitset, bitset, bitset));
+ bool (*or_cmp) PARAMS ((bitset, bitset, bitset));
void (*xor) PARAMS ((bitset, bitset, bitset));
- int (*xor_cmp) PARAMS ((bitset, bitset, bitset));
+ bool (*xor_cmp) PARAMS ((bitset, bitset, bitset));
void (*and_or) PARAMS ((bitset, bitset, bitset, bitset));
- int (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
+ bool (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*andn_or) PARAMS ((bitset, bitset, bitset, bitset));
- int (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
+ bool (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
void (*or_and) PARAMS ((bitset, bitset, bitset, bitset));
- int (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
+ bool (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
bitset_bindex (*list) PARAMS ((bitset, bitset_bindex *,
bitset_bindex, bitset_bindex *));
/* Private functions for bitset implementations. */
-extern int bitset_toggle_ PARAMS ((bitset, bitset_bindex));
+extern bool bitset_toggle_ PARAMS ((bitset, bitset_bindex));
extern bitset_bindex bitset_count_ PARAMS ((bitset));
-extern int bitset_copy_ PARAMS ((bitset, bitset));
+extern bool bitset_copy_ PARAMS ((bitset, bitset));
extern void bitset_and_or_ PARAMS ((bitset, bitset, bitset, bitset));
-extern int bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
+extern bool bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_andn_or_ PARAMS ((bitset, bitset, bitset, bitset));
-extern int bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
+extern bool bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
extern void bitset_or_and_ PARAMS ((bitset, bitset, bitset, bitset));
-extern int bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
+extern bool bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
#endif /* _BBITSET_H */
/* General bitsets.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
}
-/* Return non-zero if BITNO in SRC is the only set bit. */
-int
+/* Is BITNO in SRC the only set bit? */
+bool
bitset_only_set_p (bitset src, bitset_bindex bitno)
{
bitset_bindex val[2];
bitset_bindex next = 0;
if (bitset_list (src, val, 2, &next) != 1)
- return 0;
+ return false;
return val[0] == bitno;
}
/* Print contents of bitset BSET to FILE. */
static void
-bitset_print (FILE *file, bitset bset, int verbose)
+bitset_print (FILE *file, bitset bset, bool verbose)
{
unsigned int pos;
bitset_bindex i;
void
bitset_dump (FILE *file, bitset bset)
{
- bitset_print (file, bset, 0);
+ bitset_print (file, bset, false);
}
-/* Toggle bit BITNO in bitset BSET and return non-zero if not set. */
-int
+/* Toggle bit BITNO in bitset BSET and the new value of the bit. */
+bool
bitset_toggle_ (bitset bset, bitset_bindex bitno)
{
/* This routine is for completeness. It could be optimized if
if (bitset_test (bset, bitno))
{
bitset_reset (bset, bitno);
- return 0;
+ return false;
}
else
{
bitset_set (bset, bitno);
- return 1;
+ return true;
}
}
}
-/* DST = SRC. Return non-zero if DST != SRC.
+/* DST = SRC. Return true if DST != SRC.
This is a fallback for the case where SRC and DST are different
bitset types. */
-int
+bool
bitset_copy_ (bitset dst, bitset src)
{
bitset_bindex i;
bitset_set (dst, i);
};
- return 1;
+ return true;
}
/* This is a fallback for implementations that do not support
four operand operations. */
-static inline int
+static inline bool
bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
enum bitset_ops op)
{
- int changed = 0;
- int stats_enabled_save;
+ bool changed = false;
+ bool stats_enabled_save;
bitset tmp;
/* Create temporary bitset. */
stats_enabled_save = bitset_stats_enabled;
- bitset_stats_enabled = 0;
+ bitset_stats_enabled = false;
tmp = bitset_alloc (0, bitset_type_get (dst));
bitset_stats_enabled = stats_enabled_save;
/* DST = (SRC1 & SRC2) | SRC3. Return non-zero if
DST != (SRC1 & SRC2) | SRC3. */
-int
+bool
bitset_and_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
{
return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_AND_OR);
/* DST = (SRC1 & ~SRC2) | SRC3. Return non-zero if
DST != (SRC1 & ~SRC2) | SRC3. */
-int
+bool
bitset_andn_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
{
return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_ANDN_OR);
/* DST = (SRC1 | SRC2) & SRC3. Return non-zero if
DST != (SRC1 | SRC2) & SRC3. */
-int
+bool
bitset_or_and_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
{
return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_OR_AND);
debug_bitset (bitset bset)
{
if (bset)
- bitset_print (stderr, bset, 1);
+ bitset_print (stderr, bset, true);
}
/* Test bit BITNO in bitset BSET. */
-static inline int
+static inline bool
bitset_test (bitset bset, bitset_bindex bitno)
{
bitset_windex windex = bitno / BITSET_WORD_BITS;
extern bitset_bindex bitset_last PARAMS ((bitset));
/* Return nonzero if this is the only set bit. */
-extern int bitset_only_set_p PARAMS ((bitset, bitset_bindex));
+extern bool bitset_only_set_p PARAMS ((bitset, bitset_bindex));
/* Dump bitset. */
extern void bitset_dump PARAMS ((FILE *, bitset));
struct bitset_stats_info_struct bitset_stats_info_data;
struct bitset_stats_info_struct *bitset_stats_info;
-int bitset_stats_enabled = 0;
+bool bitset_stats_enabled = false;
/* Print a percentage histogram with message MSG to FILE. */
/* Print all bitset statistics to FILE. */
static void
-bitset_stats_print (FILE *file, int verbose ATTRIBUTE_UNUSED)
+bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
{
int i;
{
if (!bitset_stats_info)
bitset_stats_info = &bitset_stats_info_data;
- bitset_stats_enabled = 1;
+ bitset_stats_enabled = true;
}
void
bitset_stats_disable (void)
{
- bitset_stats_enabled = 0;
+ bitset_stats_enabled = false;
}
void
bitset_stats_dump (FILE *file)
{
- bitset_stats_print (file, 0);
+ bitset_stats_print (file, false);
}
void
debug_bitset_stats (void)
{
- bitset_stats_print (stderr, 1);
+ bitset_stats_print (stderr, true);
}
}
-static int
+static bool
bitset_stats_toggle (bitset src, bitset_bindex bitno)
{
return BITSET_TOGGLE_ (src->s.bset, bitno);
}
-static int
+static bool
bitset_stats_test (bitset src, bitset_bindex bitno)
{
bitset bset = src->s.bset;
}
-static int
+static bool
bitset_stats_empty_p (bitset dst)
{
return BITSET_EMPTY_P_ (dst->s.bset);
}
-static int
+static bool
bitset_stats_disjoint_p (bitset dst, bitset src)
{
BITSET_CHECK2_ (dst, src);
}
-static int
+static bool
bitset_stats_equal_p (bitset dst, bitset src)
{
BITSET_CHECK2_ (dst, src);
}
-static int
+static bool
bitset_stats_subset_p (bitset dst, bitset src)
{
BITSET_CHECK2_ (dst, src);
}
-static int
+static bool
bitset_stats_and_cmp (bitset dst, bitset src1, bitset src2)
{
BITSET_CHECK3_ (dst, src1, src2);
}
-static int
+static bool
bitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2)
{
BITSET_CHECK3_ (dst, src1, src2);
}
-static int
+static bool
bitset_stats_or_cmp (bitset dst, bitset src1, bitset src2)
{
BITSET_CHECK3_ (dst, src1, src2);
}
-static int
+static bool
bitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2)
{
BITSET_CHECK3_ (dst, src1, src2);
}
-static int
+static bool
bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
BITSET_CHECK4_ (dst, src1, src2, src3);
}
-static int
+static bool
bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
BITSET_CHECK4_ (dst, src1, src2, src3);
}
-static int
+static bool
bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
{
BITSET_CHECK4_ (dst, src1, src2, src3);
/* Functions to support bitset statistics.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
#include "bbitset.h"
-extern int bitset_stats_enabled;
+extern bool bitset_stats_enabled;
extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
/* Functions to support expandable bitsets.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
/* Obstack to allocate bitset elements from. */
static struct obstack ebitset_obstack;
-static int ebitset_obstack_init = 0;
+static bool ebitset_obstack_init = false;
static ebitset_elt *ebitset_free_list; /* Free list of bitset elements. */
#define EBITSET_ELTS(BSET) ((BSET)->e.elts)
{
if (!ebitset_obstack_init)
{
- ebitset_obstack_init = 1;
+ ebitset_obstack_init = true;
/* Let particular systems override the size of a chunk. */
}
-/* Return nonzero if all bits in an element are zero. */
-static inline int
+/* Are all bits in an element zero? */
+static inline bool
ebitset_elt_zero_p (ebitset_elt *elt)
{
int i;
for (i = 0; i < EBITSET_ELT_WORDS; i++)
if (EBITSET_WORDS (elt)[i])
- return 0;
+ return false;
- return 1;
+ return true;
}
}
-static inline int
+static inline bool
ebitset_equal_p (bitset dst, bitset src)
{
ebitset_elts *selts;
bitset_windex j;
if (src == dst)
- return 1;
+ return true;
ebitset_weed (dst);
ebitset_weed (src);
if (EBITSET_SIZE (src) != EBITSET_SIZE (dst))
- return 0;
+ return false;
selts = EBITSET_ELTS (src);
delts = EBITSET_ELTS (dst);
if (!selt && !delt)
continue;
if ((selt && !delt) || (!selt && delt))
- return 0;
+ return false;
for (i = 0; i < EBITSET_ELT_WORDS; i++)
if (EBITSET_WORDS (selt)[i] != EBITSET_WORDS (delt)[i])
- return 0;
+ return false;
}
- return 1;
+ return true;
}
}
-/* Copy bits from bitset SRC to bitset DST. Return non-zero if
+/* Copy bits from bitset SRC to bitset DST. Return true if
bitsets different. */
-static inline int
+static inline bool
ebitset_copy_cmp (bitset dst, bitset src)
{
if (src == dst)
- return 0;
+ return false;
if (EBITSET_ZERO_P (dst))
{
}
if (ebitset_equal_p (dst, src))
- return 0;
+ return false;
ebitset_copy_ (dst, src);
- return 1;
+ return true;
}
/* Test bit BITNO in bitset SRC. */
-static int
+static bool
ebitset_test (bitset src, bitset_bindex bitno)
{
bitset_windex windex = bitno / BITSET_WORD_BITS;
- if (!ebitset_elt_find (src, windex, EBITSET_FIND))
- return 0;
-
- return (src->b.
- cdata[windex - src->b.cindex] >> (bitno % BITSET_WORD_BITS)) & 1;
+ return (ebitset_elt_find (src, windex, EBITSET_FIND)
+ && ((src->b.cdata[windex - src->b.cindex]
+ >> (bitno % BITSET_WORD_BITS))
+ & 1));
}
}
-static int
+static bool
ebitset_empty_p (bitset dst)
{
return !ebitset_weed (dst);
}
-/* Return 1 if DST == DST | SRC. */
-static int
+/* Is DST == DST | SRC? */
+static bool
ebitset_subset_p (bitset dst, bitset src)
{
bitset_windex j;
for (i = 0; i < EBITSET_ELT_WORDS; i++)
if (EBITSET_WORDS (delt)[i]
!= (EBITSET_WORDS (selt)[i] | EBITSET_WORDS (delt)[i]))
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-/* Return 1 if DST & SRC == 0. */
-static int
+/* Is DST & SRC == 0? */
+static bool
ebitset_disjoint_p (bitset dst, bitset src)
{
bitset_windex j;
for (i = 0; i < EBITSET_ELT_WORDS; i++)
if ((EBITSET_WORDS (selt)[i] & EBITSET_WORDS (delt)[i]))
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-static int
+static bool
ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
{
bitset_windex ssize1;
bitset_word *srcp1;
bitset_word *srcp2;
bitset_word *dstp;
- int changed = 0;
+ bool changed = false;
unsigned int i;
bitset_windex j;
{
if (delt)
{
- changed = 1;
+ changed = true;
ebitset_elt_remove (dst, j);
}
continue;
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
{
ebitset_elt *delt;
- changed = 1;
+ changed = true;
delt = delts[j];
}
-static int
+static bool
ebitset_and_cmp (bitset dst, bitset src1, bitset src2)
{
- int changed;
+ bool changed;
if (EBITSET_ZERO_P (src2))
{
}
-static int
+static bool
ebitset_andn_cmp (bitset dst, bitset src1, bitset src2)
{
- int changed;
+ bool changed;
if (EBITSET_ZERO_P (src2))
{
}
-static int
+static bool
ebitset_or_cmp (bitset dst, bitset src1, bitset src2)
{
if (EBITSET_ZERO_P (src2))
}
-static int
+static bool
ebitset_xor_cmp (bitset dst, bitset src1, bitset src2)
{
if (EBITSET_ZERO_P (src2))
ebitset_free_list = 0;
if (ebitset_obstack_init)
{
- ebitset_obstack_init = 0;
+ ebitset_obstack_init = false;
obstack_free (&ebitset_obstack, NULL);
}
}
/* Functions to support link list bitsets.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
This program is free software; you can redistribute it and/or modify
/* Obstack to allocate bitset elements from. */
static struct obstack lbitset_obstack;
-static int lbitset_obstack_init = 0;
+static bool lbitset_obstack_init = false;
static lbitset_elt *lbitset_free_list; /* Free list of bitset elements. */
extern void debug_lbitset PARAMS ((bitset));
{
if (!lbitset_obstack_init)
{
- lbitset_obstack_init = 1;
+ lbitset_obstack_init = true;
/* Let particular systems override the size of a chunk. */
}
-/* Return nonzero if all bits in an element are zero. */
-static inline int
+/* Are all bits in an element zero? */
+static inline bool
lbitset_elt_zero_p (lbitset_elt *elt)
{
int i;
for (i = 0; i < LBITSET_ELT_WORDS; i++)
if (elt->words[i])
- return 0;
+ return false;
- return 1;
+ return true;
}
}
-/* Return 1 if DST == SRC. */
-static inline int
+/* Is DST == SRC? */
+static inline bool
lbitset_equal_p (bitset dst, bitset src)
{
lbitset_elt *selt;
int j;
if (src == dst)
- return 1;
+ return true;
lbitset_weed (src);
lbitset_weed (dst);
selt && delt; selt = selt->next, delt = delt->next)
{
if (selt->index != delt->index)
- return 0;
+ return false;
for (j = 0; j < LBITSET_ELT_WORDS; j++)
if (delt->words[j] != selt->words[j])
- return 0;
+ return false;
}
return !selt && !delt;
}
}
-/* Copy bits from bitset SRC to bitset DST. Return non-zero if
+/* Copy bits from bitset SRC to bitset DST. Return true if
bitsets different. */
-static inline int
+static inline bool
lbitset_copy_cmp (bitset dst, bitset src)
{
if (src == dst)
- return 0;
+ return false;
if (!LBITSET_HEAD (dst))
{
}
if (lbitset_equal_p (dst, src))
- return 0;
+ return false;
lbitset_copy (dst, src);
- return 1;
+ return true;
}
/* Test bit BITNO in bitset SRC. */
-static int
+static bool
lbitset_test (bitset src, bitset_bindex bitno)
{
bitset_windex windex = bitno / BITSET_WORD_BITS;
- if (!lbitset_elt_find (src, windex, LBITSET_FIND))
- return 0;
-
- return (src->b.cdata[windex - src->b.cindex]
- >> (bitno % BITSET_WORD_BITS)) & 1;
+ return (lbitset_elt_find (src, windex, LBITSET_FIND)
+ && ((src->b.cdata[windex - src->b.cindex]
+ >> (bitno % BITSET_WORD_BITS))
+ & 1));
}
}
-static int
+static bool
lbitset_empty_p (bitset dst)
{
lbitset_weed (dst);
- if (LBITSET_HEAD (dst))
- return 0;
- return 1;
+ return !LBITSET_HEAD (dst);
}
}
-/* Return 1 if DST == DST | SRC. */
-static int
+/* Is DST == DST | SRC? */
+static bool
lbitset_subset_p (bitset dst, bitset src)
{
lbitset_elt *selt;
for (j = 0; j < LBITSET_ELT_WORDS; j++)
if (delt->words[j] != (selt->words[j] | delt->words[j]))
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-/* Return 1 if DST & SRC == 0. */
-static int
+/* Is DST & SRC == 0? */
+static bool
lbitset_disjoint_p (bitset dst, bitset src)
{
lbitset_elt *selt;
for (j = 0; j < LBITSET_ELT_WORDS; j++)
if (selt->words[j] & delt->words[j])
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-static int
+static bool
lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
{
lbitset_elt *selt1 = LBITSET_HEAD (src1);
bitset_word *srcp1;
bitset_word *srcp2;
bitset_word *dstp;
- int changed = 0;
+ bool changed = false;
unsigned int i;
LBITSET_HEAD (dst) = 0;
elements that we've skipped. */
while (delt && delt->index < windex)
{
- changed = 1;
+ changed = true;
dtmp = delt;
delt = delt->next;
lbitset_elt_free (dtmp);
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
if (*dstp != tmp)
{
- changed = 1;
+ changed = true;
*dstp = tmp;
}
}
/* If we have elements of DST left over, free them all. */
if (delt)
{
- changed = 1;
+ changed = true;
lbitset_prune (dst, delt);
}
}
-static int
+static bool
lbitset_and_cmp (bitset dst, bitset src1, bitset src2)
{
lbitset_elt *selt1 = LBITSET_HEAD (src1);
lbitset_elt *selt2 = LBITSET_HEAD (src2);
- int changed;
+ bool changed;
if (!selt2)
{
}
-static int
+static bool
lbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
{
lbitset_elt *selt1 = LBITSET_HEAD (src1);
lbitset_elt *selt2 = LBITSET_HEAD (src2);
- int changed;
+ bool changed;
if (!selt2)
{
}
-static int
+static bool
lbitset_or_cmp (bitset dst, bitset src1, bitset src2)
{
lbitset_elt *selt1 = LBITSET_HEAD (src1);
}
-static int
+static bool
lbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
{
lbitset_elt *selt1 = LBITSET_HEAD (src1);
lbitset_free_list = 0;
if (lbitset_obstack_init)
{
- lbitset_obstack_init = 0;
+ lbitset_obstack_init = false;
obstack_free (&lbitset_obstack, NULL);
}
}
+`----------------------------------------------------------------*/
static int
-count_rr_conflicts (state *s, int one_per_token)
+count_rr_conflicts (state *s, bool one_per_token)
{
int i;
reductions *reds = s->reductions;
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
not set, and then we want 0 SR, or else it is specified, in which
case we want equality. */
- int src_ok = 0;
+ bool src_ok = false;
int src_total = 0;
int rrc_total = 0;
#include "getargs.h"
#include "uniqstr.h"
-int debug_flag = 0;
-int defines_flag = 0;
-int locations_flag = 0;
-int no_lines_flag = 0;
-int no_parser_flag = 0;
+bool debug_flag;
+bool defines_flag;
+bool locations_flag;
+bool no_lines_flag;
+bool no_parser_flag;
int report_flag = report_none;
-int token_table_flag = 0;
-int yacc_flag = 0; /* for -y */
-int graph_flag = 0;
+bool token_table_flag;
+bool yacc_flag; /* for -y */
+bool graph_flag;
int trace_flag = trace_none;
bool nondeterministic_parser = false;
/* Shorts options. */
const char *short_options = "yvegdhr:ltknVo:b:p:S:T::";
+/* Values for long options that do not have single-letter equivalents. */
+enum
+{
+ LOCATIONS_OPTION = CHAR_MAX + 1
+};
+
static struct option const long_options[] =
{
/* Operation modes. */
/* Parser. */
{ "debug", no_argument, 0, 't' },
- { "locations", no_argument, &locations_flag, 1 },
+ { "locations", no_argument, 0, LOCATIONS_OPTION },
{ "no-lines", no_argument, 0, 'l' },
{ "no-parser", no_argument, 0, 'n' },
{ "raw", no_argument, 0, 0 },
break;
case 'y':
- yacc_flag = 1;
+ yacc_flag = true;
break;
case 'h':
case 'g':
/* Here, the -g and --graph=FILE options are differentiated. */
- graph_flag = 1;
+ graph_flag = true;
if (optarg)
spec_graph_file = AS_FILE_NAME (optarg);
break;
case 'd':
/* Here, the -d and --defines options are differentiated. */
- defines_flag = 1;
+ defines_flag = true;
if (optarg)
spec_defines_file = AS_FILE_NAME (optarg);
break;
case 'l':
- no_lines_flag = 1;
+ no_lines_flag = true;
+ break;
+
+ case LOCATIONS_OPTION:
+ locations_flag = true;
break;
case 'k':
- token_table_flag = 1;
+ token_table_flag = true;
break;
case 'n':
- no_parser_flag = 1;
+ no_parser_flag = true;
break;
case 't':
- debug_flag = 1;
+ debug_flag = true;
break;
case 'o':
extern const char *skeleton; /* for -S */
extern const char *include; /* for -I */
-extern int debug_flag; /* for -t */
-extern int defines_flag; /* for -d */
-extern int locations_flag;
-extern int no_lines_flag; /* for -l */
-extern int no_parser_flag; /* for -n */
-extern int token_table_flag; /* for -k */
-extern int graph_flag; /* for -g */
-extern int yacc_flag; /* for -y */
+extern bool debug_flag; /* for -t */
+extern bool defines_flag; /* for -d */
+extern bool locations_flag;
+extern bool no_lines_flag; /* for -l */
+extern bool no_parser_flag; /* for -n */
+extern bool token_table_flag; /* for -k */
+extern bool graph_flag; /* for -g */
+extern bool yacc_flag; /* for -y */
/* GLR_PARSER is true if the input file says to use the GLR
(Generalized LR) parser, and to output some additional information
/* Compute look-ahead criteria for Bison.
- Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002
+ Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
for (rulep = derives[symbol1 - ntokens]; *rulep; rulep++)
{
- int done;
+ bool done;
int length = 1;
item_number *rp;
state *s = states[from_state[i]];
add_lookback_edge (s, *rulep, i);
length--;
- done = 0;
+ done = false;
while (!done)
{
- done = 1;
+ done = true;
rp--;
/* JF added rp>=ritem && I hope to god its right! */
if (rp >= ritem && ISVAR (*rp))
edge[nedges++] = map_goto (states1[--length],
item_number_as_symbol_number (*rp));
if (nullable[*rp - ntokens])
- done = 0;
+ done = false;
}
}
}
/* An obstack dedicated to receive muscle keys and values. */
extern struct obstack muscle_obstack;
+#define MUSCLE_INSERT_BOOL(Key, Value) \
+{ \
+ int v = Value; \
+ MUSCLE_INSERT_INT (Key, v); \
+}
+
#define MUSCLE_INSERT_INT(Key, Value) \
{ \
obstack_fgrow1 (&muscle_obstack, "%d", Value); \
{
/* This rule has a non empty RHS. */
item_number *rp = NULL;
- int any_tokens = 0;
+ bool any_tokens = false;
for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
if (ISTOKEN (*rp))
- any_tokens = 1;
+ any_tokens = true;
/* This rule has only nonterminals: schedule it for the second
pass. */
if (rules_ruleno->useful
&& ! nullable[rules_ruleno->lhs->number - ntokens])
{
- nullable[rules_ruleno->lhs->number - ntokens] = 1;
+ nullable[rules_ruleno->lhs->number - ntokens] = true;
*s2++ = rules_ruleno->lhs->number;
}
}
if (--rcount[r->number] == 0)
if (r->useful && ! nullable[r->lhs->number - ntokens])
{
- nullable[r->lhs->number - ntokens] = 1;
+ nullable[r->lhs->number - ntokens] = true;
*s2++ = r->lhs->number;
}
}
static struct obstack format_obstack;
-int error_verbose = 0;
+bool error_verbose = false;
token_definitions_output (FILE *out)
{
int i;
- int first = 1;
+ char const *sep = "";
fputs ("m4_define([b4_tokens], \n[", out);
for (i = 0; i < ntokens; ++i)
continue;
fprintf (out, "%s[[[%s]], [%d]]",
- first ? "" : ",\n", sym->tag, number);
-
- first = 0;
+ sep, sym->tag, number);
+ sep = ",\n";
}
fputs ("])\n\n", out);
}
symbol_destructors_output (FILE *out)
{
int i;
- int first = 1;
+ char const *sep = "";
fputs ("m4_define([b4_symbol_destructors], \n[", out);
for (i = 0; i < nsyms; ++i)
/* Filename, lineno,
Symbol-name, Symbol-number,
destructor, typename. */
- fprintf (out, "%s[",
- first ? "" : ",\n");
+ fprintf (out, "%s[", sep);
+ sep = ",\n";
escaped_file_name_output (out, sym->destructor_location.start.file);
fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
sym->destructor_location.start.line,
sym->number,
sym->destructor,
sym->type_name);
-
- first = 0;
}
fputs ("])\n\n", out);
}
symbol_printers_output (FILE *out)
{
int i;
- int first = 1;
+ char const *sep = "";
fputs ("m4_define([b4_symbol_printers], \n[", out);
for (i = 0; i < nsyms; ++i)
/* Filename, lineno,
Symbol-name, Symbol-number,
printer, typename. */
- fprintf (out, "%s[",
- first ? "" : ",\n");
+ fprintf (out, "%s[", sep);
+ sep = ",\n";
escaped_file_name_output (out, sym->printer_location.start.file);
fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
sym->printer_location.start.line,
sym->number,
sym->printer,
sym->type_name);
-
- first = 0;
}
fputs ("])\n\n", out);
}
prepare (void)
{
/* Flags. */
- MUSCLE_INSERT_INT ("debug", debug_flag);
- MUSCLE_INSERT_INT ("defines_flag", defines_flag);
- MUSCLE_INSERT_INT ("error_verbose", error_verbose);
- MUSCLE_INSERT_INT ("locations_flag", locations_flag);
- MUSCLE_INSERT_INT ("pure", pure_parser);
- MUSCLE_INSERT_INT ("synclines_flag", !no_lines_flag);
+ MUSCLE_INSERT_BOOL ("debug", debug_flag);
+ MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
+ MUSCLE_INSERT_BOOL ("error_verbose", error_verbose);
+ MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
+ MUSCLE_INSERT_BOOL ("pure", pure_parser);
+ MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
/* File names. */
MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy");
/* Output the generated parsing program for bison,
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
#ifndef OUTPUT_H_
# define OUTPUT_H_
-extern int error_verbose;
+extern bool error_verbose;
/* Output the parsing tables and the parser code to FTABLE. */
void output (void);
declaration:
grammar_declaration
| PROLOGUE { prologue_augment ($1, @1); }
-| "%debug" { debug_flag = 1; }
+| "%debug" { debug_flag = true; }
| "%define" string_content string_content { muscle_insert ($2, $3); }
-| "%defines" { defines_flag = 1; }
-| "%error-verbose" { error_verbose = 1; }
+| "%defines" { defines_flag = true; }
+| "%error-verbose" { error_verbose = true; }
| "%expect" INT { expected_conflicts = $2; }
| "%file-prefix" "=" string_content { spec_file_prefix = $3; }
| "%glr-parser" { nondeterministic_parser = true;
glr_parser = true; }
| "%lex-param {...}" { add_param ("lex_param", $1, @1); }
-| "%locations" { locations_flag = 1; }
+| "%locations" { locations_flag = true; }
| "%name-prefix" "=" string_content { spec_name_prefix = $3; }
-| "%no-lines" { no_lines_flag = 1; }
+| "%no-lines" { no_lines_flag = true; }
| "%nondeterministic-parser" { nondeterministic_parser = true; }
| "%output" "=" string_content { spec_outfile = $3; }
| "%parse-param {...}" { add_param ("parse_param", $1, @1); }
| "%pure-parser" { pure_parser = true; }
| "%skeleton" string_content { skeleton = $2; }
-| "%token-table" { token_table_flag = 1; }
+| "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag = report_states; }
-| "%yacc" { yacc_flag = 1; }
+| "%yacc" { yacc_flag = true; }
| ";"
;
}
| "%union {...}"
{
- typed = 1;
+ typed = true;
MUSCLE_INSERT_INT ("stype_line", @1.start.line);
muscle_insert ("stype", $1);
}
if (reds->lookaheads)
for (i = 0; i < ntokens; i++)
{
- int count = bitset_test (shiftset, i);
+ bool count = bitset_test (shiftset, i);
for (j = 0; j < reds->num; ++j)
if (bitset_test (reds->lookaheads[j], i))
{
- if (count == 0)
+ if (! count)
{
if (reds->rules[j] != default_rule)
max_length (&width, symbols[i]->tag);
- count++;
+ count = true;
}
else
{
if (reds->lookaheads)
for (i = 0; i < ntokens; i++)
{
- int defaulted = 0;
- int count = bitset_test (shiftset, i);
+ bool defaulted = false;
+ bool count = bitset_test (shiftset, i);
for (j = 0; j < reds->num; ++j)
if (bitset_test (reds->lookaheads[j], i))
{
- if (count == 0)
+ if (! count)
{
if (reds->rules[j] != default_rule)
print_reduction (out, width,
symbols[i]->tag,
reds->rules[j], true);
else
- defaulted = 1;
- count++;
+ defaulted = true;
+ count = true;
}
else
{
print_reduction (out, width,
symbols[i]->tag,
default_rule, true);
- defaulted = 0;
+ defaulted = false;
print_reduction (out, width,
symbols[i]->tag,
reds->rules[j], false);
/* Output a VCG description on generated parser, for Bison,
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
{
bitset_iterator biter;
int k;
- int not_first = 0;
+ char const *sep = "";
obstack_sgrow (oout, "[");
BITSET_FOR_EACH (biter, reds->lookaheads[redno], k, 0)
- obstack_fgrow2 (oout, "%s%s",
- not_first++ ? ", " : "",
- symbols[k]->tag);
+ {
+ obstack_fgrow2 (oout, "%s%s", sep, symbols[k]->tag);
+ sep = ", ";
+ }
obstack_sgrow (oout, "]");
}
}
#include "symtab.h"
static symbol_list *grammar = NULL;
-static int start_flag = 0;
+static bool start_flag = false;
merger_list *merge_functions;
-/* Nonzero if %union has been seen. */
-int typed = 0;
+/* Has %union been seen? */
+bool typed = false;
\f
/*-----------------------.
| Set the start symbol. |
complain_at (loc, _("multiple %s declarations"), "%start");
else
{
- start_flag = 1;
+ start_flag = true;
startsymbol = sym;
startsymbol_location = loc;
}
{
startsymbol = lhs;
startsymbol_location = loc;
- start_flag = 1;
+ start_flag = true;
}
/* Start a new rule and record its lhs. */
extern merger_list *merge_functions;
-extern int typed;
+extern bool typed;
#endif /* !READER_H_ */
handle_action_at (char *text, location loc)
{
char *cp = text + 1;
- locations_flag = 1;
+ locations_flag = true;
if (! current_rule)
return false;
{
bitset_iterator biter;
int k;
- int not_first = 0;
+ char const *sep = "";
fprintf (out, " [");
BITSET_FOR_EACH (biter, reds->lookaheads[red], k, 0)
- fprintf (out, "%s%s",
- not_first++ ? ", " : "",
- symbols[k]->tag);
+ {
+ fprintf (out, "%s%s", sep, symbols[k]->tag);
+ sep = ", ";
+ }
fprintf (out, "]");
}
}
transitions *trans = s->transitions;
errs *errp = s->errs;
/* Set to nonzero to inhibit having any default reduction. */
- int nodefault = 0;
- int conflicted = 0;
+ bool nodefault = false;
+ bool conflicted = false;
for (i = 0; i < ntokens; i++)
actrow[i] = conflrow[i] = 0;
/* and record this rule as the rule to use if that
token follows. */
if (actrow[j] != 0)
- conflicted = conflrow[j] = 1;
+ {
+ conflicted = true;
+ conflrow[j] = 1;
+ }
actrow[j] = rule_number_as_item_number (reds->rules[i]->number);
}
}
state *shift_state = trans->states[i];
if (actrow[sym] != 0)
- conflicted = conflrow[sym] = 1;
+ {
+ conflicted = true;
+ conflrow[sym] = 1;
+ }
actrow[sym] = state_number_as_int (shift_state->number);
/* Do not use any default reduction if there is a shift for
error */
if (sym == errtoken->number)
- nodefault = 1;
+ nodefault = true;
}
/* See which tokens are an explicit error in this state (due to
for (j = lowzero - from[0]; ; j++)
{
int k;
- int ok = 1;
+ bool ok = true;
if (table_size <= j)
abort ();
table_grow (loc);
if (table[loc] != 0)
- ok = 0;
+ ok = false;
}
for (k = 0; ok && k < vector; k++)
if (pos[k] == j)
- ok = 0;
+ ok = false;
if (ok)
{