Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/betree.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,17 +522,17 @@ bool betree_insert_with_constants(struct betree* tree,
{
struct ast_node* node;
if(parse(expr, &node) != 0) {
fprintf(stderr, "Can't parse %ld\n", id);
fprintf(stderr, "Can't parse %"PRIbst"\n", id);
return false;
}
assign_variable_id(tree->config, node);
if(!is_valid(tree->config, node)) {
fprintf(stderr, "Can't validate %ld\n", id);
fprintf(stderr, "Can't validate %"PRIbst"\n", id);
free_ast_node(node);
return false;
}
if(!assign_constants(constant_count, constants, node)) {
fprintf(stderr, "Can't assign constants %ld\n", id);
fprintf(stderr, "Can't assign constants %"PRIbst"\n", id);
return false;
}
assign_str_id(tree->config, node, false);
Expand All @@ -548,7 +548,7 @@ const struct betree_sub* betree_make_sub(struct betree* tree, betree_sub_t id, s
{
struct ast_node* node;
if(parse(expr, &node) != 0) {
fprintf(stderr, "Can't parse %ld\n", id);
fprintf(stderr, "Can't parse %"PRIbst"\n", id);
return false;
}
assign_variable_id(tree->config, node);
Expand All @@ -561,7 +561,7 @@ const struct betree_sub* betree_make_sub(struct betree* tree, betree_sub_t id, s
return false;
}
if(!assign_constants(constant_count, constants, node)) {
fprintf(stderr, "Can't assign constants %ld\n", id);
fprintf(stderr, "Can't assign constants %"PRIbst"\n", id);
return false;
}
assign_str_id(tree->config, node, true);
Expand Down
2 changes: 2 additions & 0 deletions src/betree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>

typedef uint64_t betree_sub_t;
#define PRIbst PRIu64

struct config;
struct cnode;
Expand Down
12 changes: 6 additions & 6 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static void write_dot_file_lnode_names(
fprintf(f, ", ");
}
}
fprintf(f, "S<sub>%lu</sub>", lnode->subs[i]->id);
fprintf(f, "S<sub>%"PRIbst"</sub>", lnode->subs[i]->id);
}
fprintf(f, "\\}>, color=lightblue1, fillcolor=lightblue1, style=filled, shape=record]\n");
}
Expand Down Expand Up @@ -241,23 +241,23 @@ static void write_dot_file_cdir_td(FILE* f,
if(current_depth == 0) {
print_spaces(f, level);
if(cdir == NULL) {
fprintf(f, "<td colspan=\"%lu\"></td>\n", colspan);
fprintf(f, "<td colspan=\"%"PRIu64"\"></td>\n", colspan);
}
else {
const char* name = get_name_cdir(config, cdir);
switch(cdir->bound.value_type) {
case(BETREE_INTEGER):
case(BETREE_INTEGER_LIST):
fprintf(f,
"<td colspan=\"%lu\" port=\"%s\">[%ld, %ld]</td>\n",
"<td colspan=\"%"PRIu64"\" port=\"%s\">[%"PRIi64", %"PRIi64"]</td>\n",
colspan,
name,
cdir->bound.imin,
cdir->bound.imax);
break;
case(BETREE_FLOAT): {
fprintf(f,
"<td colspan=\"%lu\" port=\"%s\">[%.0f, %.0f]</td>\n",
"<td colspan=\"%"PRIu64"\" port=\"%s\">[%.0f, %.0f]</td>\n",
colspan,
name,
cdir->bound.fmin,
Expand All @@ -268,7 +268,7 @@ static void write_dot_file_cdir_td(FILE* f,
const char* min = cdir->bound.bmin ? "true" : "false";
const char* max = cdir->bound.bmax ? "true" : "false";
fprintf(f,
"<td colspan=\"%lu\" port=\"%s\">[%s, %s]</td>\n",
"<td colspan=\"%"PRIu64"\" port=\"%s\">[%s, %s]</td>\n",
colspan,
name,
min,
Expand All @@ -280,7 +280,7 @@ static void write_dot_file_cdir_td(FILE* f,
case(BETREE_INTEGER_ENUM):
case(BETREE_INTEGER_LIST_ENUM):
fprintf(f,
"<td colspan=\"%lu\" port=\"%s\">[%zu, %zu]</td>\n",
"<td colspan=\"%"PRIu64"\" port=\"%s\">[%zu, %zu]</td>\n",
colspan,
name,
cdir->bound.smin,
Expand Down
20 changes: 10 additions & 10 deletions src/printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void print_variable(const struct betree_variable* v)
printf("%s", v->value.boolean_value ? "true" : "false");
break;
case BETREE_INTEGER:
printf("%ld", v->value.integer_value);
printf("%"PRIi64, v->value.integer_value);
break;
case BETREE_FLOAT:
printf("%.2f", v->value.float_value);
Expand All @@ -410,7 +410,7 @@ void print_variable(const struct betree_variable* v)
printf("%s", inner);
break;
case BETREE_INTEGER_ENUM:
printf("%ld", v->value.integer_enum_value.integer);
printf("%"PRIi64, v->value.integer_enum_value.integer);
break;
case BETREE_INTEGER_LIST_ENUM:
inner = integer_enum_list_value_to_string(v->value.integer_enum_list_value);
Expand Down Expand Up @@ -450,13 +450,13 @@ void print_attr_domain(const struct attr_domain* domain)
printf("INT64_MIN, ");
}
else {
printf("%ld, ", domain->bound.imin);
printf("%"PRIi64", ", domain->bound.imin);
}
if(domain->bound.imax == INT64_MAX) {
printf("INT64_MAX]\n");
}
else {
printf("%ld]\n", domain->bound.imax);
printf("%"PRIi64"]\n", domain->bound.imax);
}
break;
case BETREE_FLOAT:
Expand Down Expand Up @@ -492,13 +492,13 @@ void print_attr_domain(const struct attr_domain* domain)
printf("INT64_MIN, ");
}
else {
printf("%ld, ", domain->bound.imin);
printf("%"PRIi64", ", domain->bound.imin);
}
if(domain->bound.imax == INT64_MAX) {
printf("INT64_MAX]\n");
}
else {
printf("%ld]\n", domain->bound.imax);
printf("%"PRIi64"]\n", domain->bound.imax);
}
break;
case BETREE_STRING_LIST:
Expand Down Expand Up @@ -558,13 +558,13 @@ void print_cdir(const struct cdir* cdir)
printf("INT64_MIN, ");
}
else {
printf("%ld, ", cdir->bound.imin);
printf("%"PRIi64", ", cdir->bound.imin);
}
if(cdir->bound.imax == INT64_MAX) {
printf("INT64_MAX]\n");
}
else {
printf("%ld]\n", cdir->bound.imax);
printf("%"PRIi64"]\n", cdir->bound.imax);
}
break;
case BETREE_FLOAT:
Expand Down Expand Up @@ -597,13 +597,13 @@ void print_cdir(const struct cdir* cdir)
printf("INT64_MIN, ");
}
else {
printf("%ld, ", cdir->bound.imin);
printf("%"PRIi64", ", cdir->bound.imin);
}
if(cdir->bound.imax == INT64_MAX) {
printf("INT64_MAX]\n");
}
else {
printf("%ld]\n", cdir->bound.imax);
printf("%"PRIi64"]\n", cdir->bound.imax);
}
break;
case BETREE_STRING_LIST:
Expand Down
2 changes: 1 addition & 1 deletion src/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ void event_to_string(const struct betree_event* event, char* buffer)
break;
}
case(BETREE_INTEGER_ENUM): {
length += sprintf(buffer + length, "%s = %ld", attr, pred->value.integer_enum_value.integer);
length += sprintf(buffer + length, "%s = %"PRIi64, attr, pred->value.integer_enum_value.integer);
break;
}
case(BETREE_INTEGER_LIST_ENUM): {
Expand Down