9 fprintf(
p->file,
"%s%*s%s",
p->indent_prefix ?
p->indent_prefix :
"",
10 p->indent,
"",
p->prefix ?
p->prefix :
"");
16 fprintf(
p->file,
"%s\n",
p->suffix ?
p->suffix :
"");
29 fprintf(
p->file,
"%s", s);
36 fprintf(
p->file,
"%g", d);
42 fprintf(
p->file,
"%d", i);
60 new_size = ((
p->buf_n + extra + 1) * 3) / 2;
67 p->buf_size = new_size;
73 const char *s,
int len)
75 if (
p->buf_n + len + 1 >=
p->buf_size &&
grow_buf(
p, len))
77 memcpy(
p->buf +
p->buf_n, s, len);
80 p->buf[
p->buf_n] =
'\0';
92 if (
p->buf_n + indent + 1 >=
p->buf_size &&
grow_buf(
p, indent))
94 for (i = 0; i < indent; ++i)
95 p->buf[
p->buf_n++] =
' ';
96 p->buf[
p->buf_n] =
'\0';
105 if (
p->indent_prefix)
106 p =
str_print(
p,
p->indent_prefix, strlen(
p->indent_prefix));
124 p->buf[
p->buf_n] =
'\0';
137 int left =
p->buf_size -
p->buf_n;
138 int need = snprintf(
p->buf +
p->buf_n, left,
"%g", d);
142 left =
p->buf_size -
p->buf_n;
143 need = snprintf(
p->buf +
p->buf_n, left,
"%g", d);
154 int left =
p->buf_size -
p->buf_n;
155 int need = snprintf(
p->buf +
p->buf_n, left,
"%d", i);
159 left =
p->buf_size -
p->buf_n;
160 need = snprintf(
p->buf +
p->buf_n, left,
"%d", i);
231 p->indent_prefix = NULL;
257 p->indent_prefix = NULL;
274 free(
p->indent_prefix);
278 isl_id_to_id_free(
p->notes);
287 return printer ? printer->ctx : NULL;
296 "not a file printer",
return NULL);
297 return printer->file;
343 free(
p->indent_prefix);
388 return p->output_format;
400 return isl_id_to_id_has(
p->notes,
id);
416 "no such note",
goto error);
418 return isl_id_to_id_get(
p->notes,
id);
430 if (!
p || !
id || !note)
437 p->notes = isl_id_to_id_set(
p->notes,
id, note);
481 return p->yaml_style;
493 if (
p->yaml_size <
p->yaml_depth + 1) {
499 p->yaml_state = state;
500 p->yaml_size =
p->yaml_depth + 1;
503 p->yaml_state[
p->yaml_depth] = state;
528 if (
p->yaml_depth < 1)
532 p->yaml_state[
p->yaml_depth - 1] = state;
544 if (
p->yaml_depth < 1)
546 return p->yaml_state[
p->yaml_depth - 1];
579 p =
p->ops->print_str(
p,
":");
581 p =
p->ops->print_str(
p,
": ");
587 p =
p->ops->print_str(
p,
", ");
589 p =
p->ops->end_line(
p);
590 p =
p->ops->start_line(
p);
595 p =
p->ops->end_line(
p);
596 p =
p->ops->start_line(
p);
597 p =
p->ops->print_str(
p,
"- ");
603 p =
p->ops->print_str(
p,
", ");
605 p =
p->ops->end_line(
p);
607 p =
p->ops->start_line(
p);
608 p =
p->ops->print_str(
p,
"- ");
627 return p->ops->print_str(
p, s);
637 return p->ops->print_double(
p, d);
646 return p->ops->print_int(
p, i);
656 return p->ops->print_isl_int(
p, i);
664 return p->ops->start_line(
p);
672 return p->ops->end_line(
p);
683 "isl_printer_get_str can only be called on a string "
684 "printer",
return NULL);
687 return strdup(printer->buf);
695 return p->ops->flush(
p);
719 p =
p->ops->print_str(
p,
"{ ");
721 p =
p->ops->end_line(
p);
723 p =
p->ops->start_line(
p);
750 return p->ops->print_str(
p,
" }");
752 p =
p->ops->print_str(
p,
"{}");
759 p =
p->ops->end_line(
p);
778 p =
p->ops->print_str(
p,
"[ ");
806 return p->ops->print_str(
p,
" ]");
810 p =
p->ops->print_str(
p,
" []");
812 p =
p->ops->print_str(
p,
"[]");
820 p =
p->ops->end_line(
p);
837 if (
p->yaml_depth < 1)
#define isl_calloc_type(ctx, type)
#define isl_die(ctx, errno, msg, code)
void isl_ctx_deref(struct isl_ctx *ctx)
#define isl_alloc_array(ctx, type, n)
#define isl_realloc_array(ctx, ptr, type, n)
void isl_ctx_ref(struct isl_ctx *ctx)
__isl_null isl_id * isl_id_free(__isl_take isl_id *id)
#define isl_int_print(out, i, width)
#define isl_int_get_str(r)
#define isl_int_free_str(s)
static __isl_give isl_printer * str_print_isl_int(__isl_take isl_printer *p, isl_int i)
int isl_printer_get_yaml_style(__isl_keep isl_printer *p)
__isl_give isl_printer * isl_printer_yaml_start_mapping(__isl_take isl_printer *p)
__isl_give isl_printer * isl_printer_set_suffix(__isl_take isl_printer *p, const char *suffix)
static struct isl_printer_ops file_ops
static __isl_give isl_printer * file_print_isl_int(__isl_take isl_printer *p, isl_int i)
__isl_give isl_printer * isl_printer_yaml_next(__isl_take isl_printer *p)
__isl_give isl_printer * isl_printer_set_prefix(__isl_take isl_printer *p, const char *prefix)
__isl_give isl_printer * isl_printer_print_int(__isl_take isl_printer *p, int i)
static __isl_give isl_printer * push_state(__isl_take isl_printer *p, enum isl_yaml_state state)
static __isl_give isl_printer * file_print_str(__isl_take isl_printer *p, const char *s)
__isl_give isl_printer * isl_printer_set_indent(__isl_take isl_printer *p, int indent)
static __isl_give isl_printer * update_state(__isl_take isl_printer *p, enum isl_yaml_state state)
isl_bool isl_printer_has_note(__isl_keep isl_printer *p, __isl_keep isl_id *id)
__isl_give isl_printer * isl_printer_flush(__isl_take isl_printer *p)
__isl_give char * isl_printer_get_str(__isl_keep isl_printer *printer)
static __isl_give isl_printer * str_print(__isl_take isl_printer *p, const char *s, int len)
static __isl_give isl_printer * str_print_int(__isl_take isl_printer *p, int i)
static __isl_give isl_printer * file_start_line(__isl_take isl_printer *p)
FILE * isl_printer_get_file(__isl_keep isl_printer *printer)
static __isl_give isl_printer * str_end_line(__isl_take isl_printer *p)
int isl_printer_get_output_format(__isl_keep isl_printer *p)
__isl_give isl_printer * isl_printer_set_note(__isl_take isl_printer *p, __isl_take isl_id *id, __isl_take isl_id *note)
__isl_give isl_printer * isl_printer_set_indent_prefix(__isl_take isl_printer *p, const char *prefix)
__isl_give isl_printer * isl_printer_set_dump(__isl_take isl_printer *p, int dump)
__isl_give isl_printer * isl_printer_yaml_end_mapping(__isl_take isl_printer *p)
__isl_give isl_printer * isl_printer_yaml_end_sequence(__isl_take isl_printer *p)
__isl_give isl_printer * isl_printer_yaml_start_sequence(__isl_take isl_printer *p)
static __isl_give isl_printer * str_print_double(__isl_take isl_printer *p, double d)
__isl_give isl_printer * isl_printer_set_isl_int_width(__isl_take isl_printer *p, int width)
static __isl_give isl_printer * file_print_int(__isl_take isl_printer *p, int i)
__isl_give isl_printer * isl_printer_to_file(isl_ctx *ctx, FILE *file)
static __isl_give isl_printer * file_print_double(__isl_take isl_printer *p, double d)
static __isl_give isl_printer * file_flush(__isl_take isl_printer *p)
static __isl_give isl_printer * str_flush(__isl_take isl_printer *p)
static __isl_give isl_printer * str_print_indent(__isl_take isl_printer *p, int indent)
__isl_give isl_printer * isl_printer_print_str(__isl_take isl_printer *p, const char *s)
__isl_give isl_printer * isl_printer_start_line(__isl_take isl_printer *p)
__isl_give isl_printer * isl_printer_indent(__isl_take isl_printer *p, int indent)
static enum isl_yaml_state current_state(__isl_keep isl_printer *p)
__isl_give isl_printer * isl_printer_set_yaml_style(__isl_take isl_printer *p, int yaml_style)
__isl_give isl_printer * isl_printer_to_str(isl_ctx *ctx)
static __isl_give isl_printer * pop_state(__isl_take isl_printer *p)
isl_ctx * isl_printer_get_ctx(__isl_keep isl_printer *printer)
static __isl_give isl_printer * str_start_line(__isl_take isl_printer *p)
static struct isl_printer_ops str_ops
__isl_give isl_printer * isl_printer_end_line(__isl_take isl_printer *p)
static __isl_give isl_printer * str_print_str(__isl_take isl_printer *p, const char *s)
static __isl_give isl_printer * file_end_line(__isl_take isl_printer *p)
__isl_give isl_id * isl_printer_get_note(__isl_keep isl_printer *p, __isl_take isl_id *id)
__isl_give isl_printer * isl_printer_set_output_format(__isl_take isl_printer *p, int output_format)
static __isl_give isl_printer * enter_state(__isl_take isl_printer *p, int eol)
__isl_give isl_printer * isl_printer_print_double(__isl_take isl_printer *p, double d)
__isl_null isl_printer * isl_printer_free(__isl_take isl_printer *p)
__isl_give isl_printer * isl_printer_print_isl_int(__isl_take isl_printer *p, isl_int i)
static int grow_buf(__isl_keep isl_printer *p, int extra)
@ isl_yaml_mapping_val_start
@ isl_yaml_mapping_first_key_start
@ isl_yaml_sequence_start
@ isl_yaml_mapping_key_start
@ isl_yaml_sequence_first_start
#define ISL_YAML_STYLE_FLOW
#define ISL_YAML_STYLE_BLOCK