Skip to content

Commit

Permalink
move c_print_set() to set.c
Browse files Browse the repository at this point in the history
  • Loading branch information
fbrausse committed Apr 19, 2024
1 parent 75e9a13 commit 426c0e7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
4 changes: 3 additions & 1 deletion inc/ltl2ba.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ void spin_print_set(FILE *, const char *const *sym_table, int *, int *,
int sym_size);
void dot_print_set(FILE *, const char *const *sym_table,
const ltl2ba_Cexprtab *cexpr, int *, int *, int sym_size,
int);
int need_parens);
void c_print_set(FILE *f, const char *const *sym_table, int *pos, int *neg,
int sym_size);
void print_set(FILE *, int *, int);
int empty_set(int *, int);
int empty_intersect_sets(int *, int *, int);
Expand Down
25 changes: 0 additions & 25 deletions src/buchi.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,31 +887,6 @@ static void print_fsm_func_opener(FILE *f)
return;
}

/* prints the content of a set for C */
static void c_print_set(FILE *f, const char *const *sym_table, int *pos, int *neg, int sym_size)
{
static const int mod = 8 * sizeof(int); /* keep in sync with set.c */

int i, j, start = 1;
for(i = 0; i < sym_size; i++)
for(j = 0; j < mod; j++) {
if(pos && pos[i] & (1 << j)) {
if(!start)
fprintf(f, " && ");
fprintf(f, "%s()", sym_table[mod * i + j]);
start = 0;
}
if(neg && neg[i] & (1 << j)) {
if(!start)
fprintf(f, " && ");
fprintf(f, "!%s()", sym_table[mod * i + j]);
start = 0;
}
}
if(start)
fprintf(f, "1");
}

static void print_transition_guard(FILE *f, const Buchi *b, BTrans *t,
BState *state, const char *const *sym_table)
{
Expand Down
23 changes: 23 additions & 0 deletions src/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,29 @@ void dot_print_set(FILE *f, const char *const *sym_table,
if (count>1 && need_parens) fprintf(f,")");
}

/* prints the content of a set for C */
void c_print_set(FILE *f, const char *const *sym_table, int *pos, int *neg, int sym_size)
{
int i, j, start = 1;
for(i = 0; i < sym_size; i++)
for(j = 0; j < mod; j++) {
if(pos && pos[i] & (1 << j)) {
if(!start)
fprintf(f, " && ");
fprintf(f, "%s()", sym_table[mod * i + j]);
start = 0;
}
if(neg && neg[i] & (1 << j)) {
if(!start)
fprintf(f, " && ");
fprintf(f, "!%s()", sym_table[mod * i + j]);
start = 0;
}
}
if(start)
fprintf(f, "1");
}

void print_set(FILE *f, int *l, int size) /* prints the content of a set */
{
int i, j, start = 1;;
Expand Down

0 comments on commit 426c0e7

Please sign in to comment.