From 426c0e7acdf6b39c5ee6a5c94c8ee10b140b9f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20Brau=C3=9Fe?= Date: Fri, 19 Apr 2024 09:23:29 +0200 Subject: [PATCH] move c_print_set() to set.c --- inc/ltl2ba.h | 4 +++- src/buchi.c | 25 ------------------------- src/set.c | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/inc/ltl2ba.h b/inc/ltl2ba.h index 3b403b0..7d850e1 100644 --- a/inc/ltl2ba.h +++ b/inc/ltl2ba.h @@ -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); diff --git a/src/buchi.c b/src/buchi.c index 97e22ff..d1132c4 100644 --- a/src/buchi.c +++ b/src/buchi.c @@ -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) { diff --git a/src/set.c b/src/set.c index 3b90233..1e09283 100644 --- a/src/set.c +++ b/src/set.c @@ -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;;