Polly 19.0.0git
isl_printer.c
Go to the documentation of this file.
1#include <string.h>
2#include <isl_int.h>
3#include <isl/id.h>
4#include <isl/id_to_id.h>
6
8{
9 fprintf(p->file, "%s%*s%s", p->indent_prefix ? p->indent_prefix : "",
10 p->indent, "", p->prefix ? p->prefix : "");
11 return p;
12}
13
15{
16 fprintf(p->file, "%s\n", p->suffix ? p->suffix : "");
17 return p;
18}
19
21{
22 fflush(p->file);
23 return p;
24}
25
27 const char *s)
28{
29 fprintf(p->file, "%s", s);
30 return p;
31}
32
34 double d)
35{
36 fprintf(p->file, "%g", d);
37 return p;
38}
39
41{
42 fprintf(p->file, "%d", i);
43 return p;
44}
45
47{
48 isl_int_print(p->file, i, p->width);
49 return p;
50}
51
52static int grow_buf(__isl_keep isl_printer *p, int extra)
53{
54 int new_size;
55 char *new_buf;
56
57 if (p->buf_size == 0)
58 return -1;
59
60 new_size = ((p->buf_n + extra + 1) * 3) / 2;
61 new_buf = isl_realloc_array(p->ctx, p->buf, char, new_size);
62 if (!new_buf) {
63 p->buf_size = 0;
64 return -1;
65 }
66 p->buf = new_buf;
67 p->buf_size = new_size;
68
69 return 0;
70}
71
73 const char *s, int len)
74{
75 if (p->buf_n + len + 1 >= p->buf_size && grow_buf(p, len))
76 goto error;
77 memcpy(p->buf + p->buf_n, s, len);
78 p->buf_n += len;
79
80 p->buf[p->buf_n] = '\0';
81 return p;
82error:
84 return NULL;
85}
86
88 int indent)
89{
90 int i;
91
92 if (p->buf_n + indent + 1 >= p->buf_size && grow_buf(p, indent))
93 goto error;
94 for (i = 0; i < indent; ++i)
95 p->buf[p->buf_n++] = ' ';
96 p->buf[p->buf_n] = '\0';
97 return p;
98error:
100 return NULL;
101}
102
104{
105 if (p->indent_prefix)
106 p = str_print(p, p->indent_prefix, strlen(p->indent_prefix));
107 p = str_print_indent(p, p->indent);
108 if (p->prefix)
109 p = str_print(p, p->prefix, strlen(p->prefix));
110 return p;
111}
112
114{
115 if (p->suffix)
116 p = str_print(p, p->suffix, strlen(p->suffix));
117 p = str_print(p, "\n", strlen("\n"));
118 return p;
119}
120
122{
123 p->buf_n = 0;
124 p->buf[p->buf_n] = '\0';
125 return p;
126}
127
129 const char *s)
130{
131 return str_print(p, s, strlen(s));
132}
133
135 double d)
136{
137 int left = p->buf_size - p->buf_n;
138 int need = snprintf(p->buf + p->buf_n, left, "%g", d);
139 if (need >= left) {
140 if (grow_buf(p, need))
141 goto error;
142 left = p->buf_size - p->buf_n;
143 need = snprintf(p->buf + p->buf_n, left, "%g", d);
144 }
145 p->buf_n += need;
146 return p;
147error:
149 return NULL;
150}
151
153{
154 int left = p->buf_size - p->buf_n;
155 int need = snprintf(p->buf + p->buf_n, left, "%d", i);
156 if (need >= left) {
157 if (grow_buf(p, need))
158 goto error;
159 left = p->buf_size - p->buf_n;
160 need = snprintf(p->buf + p->buf_n, left, "%d", i);
161 }
162 p->buf_n += need;
163 return p;
164error:
166 return NULL;
167}
168
170 isl_int i)
171{
172 char *s;
173 int len;
174
175 s = isl_int_get_str(i);
176 len = strlen(s);
177 if (len < p->width)
178 p = str_print_indent(p, p->width - len);
179 p = str_print(p, s, len);
181 return p;
182}
183
188 double d);
191 isl_int i);
193 const char *s);
195};
196
197static struct isl_printer_ops file_ops = {
205};
206
207static struct isl_printer_ops str_ops = {
215};
216
218{
219 struct isl_printer *p = isl_calloc_type(ctx, struct isl_printer);
220 if (!p)
221 return NULL;
222 p->ctx = ctx;
223 isl_ctx_ref(p->ctx);
224 p->ops = &file_ops;
225 p->file = file;
226 p->buf = NULL;
227 p->buf_n = 0;
228 p->buf_size = 0;
229 p->indent = 0;
230 p->output_format = ISL_FORMAT_ISL;
231 p->indent_prefix = NULL;
232 p->prefix = NULL;
233 p->suffix = NULL;
234 p->width = 0;
235 p->yaml_style = ISL_YAML_STYLE_FLOW;
236
237 return p;
238}
239
241{
242 struct isl_printer *p = isl_calloc_type(ctx, struct isl_printer);
243 if (!p)
244 return NULL;
245 p->ctx = ctx;
246 isl_ctx_ref(p->ctx);
247 p->ops = &str_ops;
248 p->file = NULL;
249 p->buf = isl_alloc_array(ctx, char, 256);
250 if (!p->buf)
251 goto error;
252 p->buf_n = 0;
253 p->buf[0] = '\0';
254 p->buf_size = 256;
255 p->indent = 0;
256 p->output_format = ISL_FORMAT_ISL;
257 p->indent_prefix = NULL;
258 p->prefix = NULL;
259 p->suffix = NULL;
260 p->width = 0;
261 p->yaml_style = ISL_YAML_STYLE_FLOW;
262
263 return p;
264error:
266 return NULL;
267}
268
270{
271 if (!p)
272 return NULL;
273 free(p->buf);
274 free(p->indent_prefix);
275 free(p->prefix);
276 free(p->suffix);
277 free(p->yaml_state);
278 isl_id_to_id_free(p->notes);
279 isl_ctx_deref(p->ctx);
280 free(p);
281
282 return NULL;
283}
284
286{
287 return printer ? printer->ctx : NULL;
288}
289
291{
292 if (!printer)
293 return NULL;
294 if (!printer->file)
296 "not a file printer", return NULL);
297 return printer->file;
298}
299
301 int width)
302{
303 if (!p)
304 return NULL;
305
306 p->width = width;
307
308 return p;
309}
310
312 int indent)
313{
314 if (!p)
315 return NULL;
316
317 p->indent = indent;
318
319 return p;
320}
321
323 int indent)
324{
325 if (!p)
326 return NULL;
327
328 p->indent += indent;
329 if (p->indent < 0)
330 p->indent = 0;
331
332 return p;
333}
334
335/* Replace the indent prefix of "p" by "prefix".
336 */
338 const char *prefix)
339{
340 if (!p)
341 return NULL;
342
343 free(p->indent_prefix);
344 p->indent_prefix = prefix ? strdup(prefix) : NULL;
345
346 return p;
347}
348
350 const char *prefix)
351{
352 if (!p)
353 return NULL;
354
355 free(p->prefix);
356 p->prefix = prefix ? strdup(prefix) : NULL;
357
358 return p;
359}
360
362 const char *suffix)
363{
364 if (!p)
365 return NULL;
366
367 free(p->suffix);
368 p->suffix = suffix ? strdup(suffix) : NULL;
369
370 return p;
371}
372
374 int output_format)
375{
376 if (!p)
377 return NULL;
378
379 p->output_format = output_format;
380
381 return p;
382}
383
385{
386 if (!p)
387 return -1;
388 return p->output_format;
389}
390
391/* Does "p" have a note with identifier "id"?
392 */
394 __isl_keep isl_id *id)
395{
396 if (!p || !id)
397 return isl_bool_error;
398 if (!p->notes)
399 return isl_bool_false;
400 return isl_id_to_id_has(p->notes, id);
401}
402
403/* Retrieve the note identified by "id" from "p".
404 * The note is assumed to exist.
405 */
407 __isl_take isl_id *id)
408{
409 isl_bool has_note;
410
411 has_note = isl_printer_has_note(p, id);
412 if (has_note < 0)
413 goto error;
414 if (!has_note)
416 "no such note", goto error);
417
418 return isl_id_to_id_get(p->notes, id);
419error:
420 isl_id_free(id);
421 return NULL;
422}
423
424/* Associate "note" to the identifier "id" in "p",
425 * replacing the previous note associated to the identifier, if any.
426 */
429{
430 if (!p || !id || !note)
431 goto error;
432 if (!p->notes) {
433 p->notes = isl_id_to_id_alloc(isl_printer_get_ctx(p), 1);
434 if (!p->notes)
435 goto error;
436 }
437 p->notes = isl_id_to_id_set(p->notes, id, note);
438 if (!p->notes)
439 return isl_printer_free(p);
440 return p;
441error:
443 isl_id_free(id);
444 isl_id_free(note);
445 return NULL;
446}
447
448/* Keep track of whether the printing to "p" is being performed from
449 * an isl_*_dump function as specified by "dump".
450 */
452 int dump)
453{
454 if (!p)
455 return NULL;
456
457 p->dump = dump;
458
459 return p;
460}
461
462/* Set the YAML style of "p" to "yaml_style" and return the updated printer.
463 */
465 int yaml_style)
466{
467 if (!p)
468 return NULL;
469
470 p->yaml_style = yaml_style;
471
472 return p;
473}
474
475/* Return the YAML style of "p" or -1 on error.
476 */
478{
479 if (!p)
480 return -1;
481 return p->yaml_style;
482}
483
484/* Push "state" onto the stack of currently active YAML elements and
485 * return the updated printer.
486 */
488 enum isl_yaml_state state)
489{
490 if (!p)
491 return NULL;
492
493 if (p->yaml_size < p->yaml_depth + 1) {
494 enum isl_yaml_state *state;
495 state = isl_realloc_array(p->ctx, p->yaml_state,
496 enum isl_yaml_state, p->yaml_depth + 1);
497 if (!state)
498 return isl_printer_free(p);
499 p->yaml_state = state;
500 p->yaml_size = p->yaml_depth + 1;
501 }
502
503 p->yaml_state[p->yaml_depth] = state;
504 p->yaml_depth++;
505
506 return p;
507}
508
509/* Remove the innermost active YAML element from the stack and
510 * return the updated printer.
511 */
513{
514 if (!p)
515 return NULL;
516 p->yaml_depth--;
517 return p;
518}
519
520/* Set the state of the innermost active YAML element to "state" and
521 * return the updated printer.
522 */
524 enum isl_yaml_state state)
525{
526 if (!p)
527 return NULL;
528 if (p->yaml_depth < 1)
530 "not in YAML construct", return isl_printer_free(p));
531
532 p->yaml_state[p->yaml_depth - 1] = state;
533
534 return p;
535}
536
537/* Return the state of the innermost active YAML element.
538 * Return isl_yaml_none if we are not inside any YAML element.
539 */
541{
542 if (!p)
543 return isl_yaml_none;
544 if (p->yaml_depth < 1)
545 return isl_yaml_none;
546 return p->yaml_state[p->yaml_depth - 1];
547}
548
549/* If we are printing a YAML document and we are at the start of an element,
550 * print whatever is needed before we can print the actual element and
551 * keep track of the fact that we are now printing the element.
552 * If "eol" is set, then whatever we print is going to be the last
553 * thing that gets printed on this line.
554 *
555 * If we are about the print the first key of a mapping, then nothing
556 * extra needs to be printed. For any other key, however, we need
557 * to either move to the next line (in block format) or print a comma
558 * (in flow format).
559 * Before printing a value in a mapping, we need to print a colon.
560 *
561 * For sequences, in flow format, we only need to print a comma
562 * for each element except the first.
563 * In block format, before the first element in the sequence,
564 * we move to a new line, print a dash and increase the indentation.
565 * Before any other element, we print a dash on a new line,
566 * temporarily moving the indentation back.
567 */
569 int eol)
570{
571 enum isl_yaml_state state;
572
573 if (!p)
574 return NULL;
575
576 state = current_state(p);
577 if (state == isl_yaml_mapping_val_start) {
578 if (eol)
579 p = p->ops->print_str(p, ":");
580 else
581 p = p->ops->print_str(p, ": ");
583 } else if (state == isl_yaml_mapping_first_key_start) {
585 } else if (state == isl_yaml_mapping_key_start) {
586 if (p->yaml_style == ISL_YAML_STYLE_FLOW)
587 p = p->ops->print_str(p, ", ");
588 else {
589 p = p->ops->end_line(p);
590 p = p->ops->start_line(p);
591 }
593 } else if (state == isl_yaml_sequence_first_start) {
594 if (p->yaml_style != ISL_YAML_STYLE_FLOW) {
595 p = p->ops->end_line(p);
596 p = p->ops->start_line(p);
597 p = p->ops->print_str(p, "- ");
598 p = isl_printer_indent(p, 2);
599 }
601 } else if (state == isl_yaml_sequence_start) {
602 if (p->yaml_style == ISL_YAML_STYLE_FLOW)
603 p = p->ops->print_str(p, ", ");
604 else {
605 p = p->ops->end_line(p);
606 p = isl_printer_indent(p, -2);
607 p = p->ops->start_line(p);
608 p = p->ops->print_str(p, "- ");
609 p = isl_printer_indent(p, 2);
610 }
612 }
613
614 return p;
615}
616
618 const char *s)
619{
620 if (!p)
621 return NULL;
622 if (!s)
623 return isl_printer_free(p);
624 p = enter_state(p, 0);
625 if (!p)
626 return NULL;
627 return p->ops->print_str(p, s);
628}
629
631 double d)
632{
633 p = enter_state(p, 0);
634 if (!p)
635 return NULL;
636
637 return p->ops->print_double(p, d);
638}
639
641{
642 p = enter_state(p, 0);
643 if (!p)
644 return NULL;
645
646 return p->ops->print_int(p, i);
647}
648
650 isl_int i)
651{
652 p = enter_state(p, 0);
653 if (!p)
654 return NULL;
655
656 return p->ops->print_isl_int(p, i);
657}
658
660{
661 if (!p)
662 return NULL;
663
664 return p->ops->start_line(p);
665}
666
668{
669 if (!p)
670 return NULL;
671
672 return p->ops->end_line(p);
673}
674
675/* Return a copy of the string constructed by the string printer "printer".
676 */
678{
679 if (!printer)
680 return NULL;
681 if (printer->ops != &str_ops)
683 "isl_printer_get_str can only be called on a string "
684 "printer", return NULL);
685 if (!printer->buf)
686 return NULL;
687 return strdup(printer->buf);
688}
689
691{
692 if (!p)
693 return NULL;
694
695 return p->ops->flush(p);
696}
697
698/* Start a YAML mapping and push a new state to reflect that we
699 * are about to print the first key in a mapping.
700 *
701 * In flow style, print the opening brace.
702 * In block style, move to the next line with an increased indentation,
703 * except if this is the outer mapping or if we are inside a sequence
704 * (in which case we have already increased the indentation and we want
705 * to print the first key on the same line as the dash).
706 */
709{
710 enum isl_yaml_state state;
711
712 if (!p)
713 return NULL;
714 p = enter_state(p, p->yaml_style == ISL_YAML_STYLE_BLOCK);
715 if (!p)
716 return NULL;
717 state = current_state(p);
718 if (p->yaml_style == ISL_YAML_STYLE_FLOW)
719 p = p->ops->print_str(p, "{ ");
720 else if (state != isl_yaml_none && state != isl_yaml_sequence) {
721 p = p->ops->end_line(p);
722 p = isl_printer_indent(p, 2);
723 p = p->ops->start_line(p);
724 }
726 return p;
727}
728
729/* Finish a YAML mapping and pop it from the state stack.
730 *
731 * In flow style, print the closing brace.
732 *
733 * In block style, first check if we are still in the
734 * isl_yaml_mapping_first_key_start state. If so, we have not printed
735 * anything yet, so print "{}" to indicate an empty mapping.
736 * If we increased the indentation in isl_printer_yaml_start_mapping,
737 * then decrease it again.
738 * If this is the outer mapping then print a newline.
739 */
742{
743 enum isl_yaml_state state;
744
745 state = current_state(p);
746 p = pop_state(p);
747 if (!p)
748 return NULL;
749 if (p->yaml_style == ISL_YAML_STYLE_FLOW)
750 return p->ops->print_str(p, " }");
752 p = p->ops->print_str(p, "{}");
753 if (!p)
754 return NULL;
755 state = current_state(p);
756 if (state != isl_yaml_none && state != isl_yaml_sequence)
757 p = isl_printer_indent(p, -2);
758 if (state == isl_yaml_none)
759 p = p->ops->end_line(p);
760 return p;
761}
762
763/* Start a YAML sequence and push a new state to reflect that we
764 * are about to print the first element in a sequence.
765 *
766 * In flow style, print the opening bracket.
767 */
770{
771 if (!p)
772 return NULL;
773 p = enter_state(p, p->yaml_style == ISL_YAML_STYLE_BLOCK);
775 if (!p)
776 return NULL;
777 if (p->yaml_style == ISL_YAML_STYLE_FLOW)
778 p = p->ops->print_str(p, "[ ");
779 return p;
780}
781
782/* Finish a YAML sequence and pop it from the state stack.
783 *
784 * In flow style, print the closing bracket.
785 *
786 * In block style, check if we are still in the
787 * isl_yaml_sequence_first_start state. If so, we have not printed
788 * anything yet, so print "[]" or " []" to indicate an empty sequence.
789 * We print the extra space when we instructed enter_state not
790 * to print a space at the end of the line.
791 * Otherwise, undo the increase in indentation performed by
792 * enter_state when moving away from the isl_yaml_sequence_first_start
793 * state.
794 * If this is the outer sequence then print a newline.
795 */
798{
799 enum isl_yaml_state state, up;
800
801 state = current_state(p);
802 p = pop_state(p);
803 if (!p)
804 return NULL;
805 if (p->yaml_style == ISL_YAML_STYLE_FLOW)
806 return p->ops->print_str(p, " ]");
807 up = current_state(p);
808 if (state == isl_yaml_sequence_first_start) {
809 if (up == isl_yaml_mapping_val)
810 p = p->ops->print_str(p, " []");
811 else
812 p = p->ops->print_str(p, "[]");
813 } else {
814 p = isl_printer_indent(p, -2);
815 }
816 if (!p)
817 return NULL;
818 state = current_state(p);
819 if (state == isl_yaml_none)
820 p = p->ops->end_line(p);
821 return p;
822}
823
824/* Mark the fact that the current element is finished and that
825 * the next output belongs to the next element.
826 * In particular, if we are printing a key, then prepare for
827 * printing the subsequent value. If we are printing a value,
828 * prepare for printing the next key. If we are printing an
829 * element in a sequence, prepare for printing the next element.
830 */
832{
833 enum isl_yaml_state state;
834
835 if (!p)
836 return NULL;
837 if (p->yaml_depth < 1)
839 "not in YAML construct", return isl_printer_free(p));
840
841 state = current_state(p);
842 if (state == isl_yaml_mapping_key)
844 else if (state == isl_yaml_mapping_val)
846 else if (state == isl_yaml_sequence)
848 p = update_state(p, state);
849
850 return p;
851}
#define __isl_take
Definition: ctx.h:22
#define isl_calloc_type(ctx, type)
Definition: ctx.h:129
#define __isl_give
Definition: ctx.h:19
#define __isl_null
Definition: ctx.h:28
#define isl_die(ctx, errno, msg, code)
Definition: ctx.h:137
void isl_ctx_deref(struct isl_ctx *ctx)
Definition: isl_ctx.c:275
@ isl_error_invalid
Definition: ctx.h:80
#define isl_alloc_array(ctx, type, n)
Definition: ctx.h:131
#define __isl_keep
Definition: ctx.h:25
#define isl_realloc_array(ctx, ptr, type, n)
Definition: ctx.h:134
void isl_ctx_ref(struct isl_ctx *ctx)
Definition: isl_ctx.c:270
isl_bool
Definition: ctx.h:89
@ isl_bool_false
Definition: ctx.h:91
@ isl_bool_error
Definition: ctx.h:90
__isl_null isl_id * isl_id_free(__isl_take isl_id *id)
Definition: isl_id.c:207
#define isl_int_print(out, i, width)
Definition: isl_int.h:40
#define isl_int_get_str(r)
Definition: isl_int_gmp.h:22
#define isl_int_free_str(s)
Definition: isl_int_gmp.h:82
static __isl_give isl_printer * str_print_isl_int(__isl_take isl_printer *p, isl_int i)
Definition: isl_printer.c:169
int isl_printer_get_yaml_style(__isl_keep isl_printer *p)
Definition: isl_printer.c:477
__isl_give isl_printer * isl_printer_yaml_start_mapping(__isl_take isl_printer *p)
Definition: isl_printer.c:707
__isl_give isl_printer * isl_printer_set_suffix(__isl_take isl_printer *p, const char *suffix)
Definition: isl_printer.c:361
static struct isl_printer_ops file_ops
Definition: isl_printer.c:197
static __isl_give isl_printer * file_print_isl_int(__isl_take isl_printer *p, isl_int i)
Definition: isl_printer.c:46
__isl_give isl_printer * isl_printer_yaml_next(__isl_take isl_printer *p)
Definition: isl_printer.c:831
__isl_give isl_printer * isl_printer_set_prefix(__isl_take isl_printer *p, const char *prefix)
Definition: isl_printer.c:349
__isl_give isl_printer * isl_printer_print_int(__isl_take isl_printer *p, int i)
Definition: isl_printer.c:640
static __isl_give isl_printer * push_state(__isl_take isl_printer *p, enum isl_yaml_state state)
Definition: isl_printer.c:487
static __isl_give isl_printer * file_print_str(__isl_take isl_printer *p, const char *s)
Definition: isl_printer.c:26
__isl_give isl_printer * isl_printer_set_indent(__isl_take isl_printer *p, int indent)
Definition: isl_printer.c:311
static __isl_give isl_printer * update_state(__isl_take isl_printer *p, enum isl_yaml_state state)
Definition: isl_printer.c:523
isl_bool isl_printer_has_note(__isl_keep isl_printer *p, __isl_keep isl_id *id)
Definition: isl_printer.c:393
__isl_give isl_printer * isl_printer_flush(__isl_take isl_printer *p)
Definition: isl_printer.c:690
__isl_give char * isl_printer_get_str(__isl_keep isl_printer *printer)
Definition: isl_printer.c:677
static __isl_give isl_printer * str_print(__isl_take isl_printer *p, const char *s, int len)
Definition: isl_printer.c:72
static __isl_give isl_printer * str_print_int(__isl_take isl_printer *p, int i)
Definition: isl_printer.c:152
static __isl_give isl_printer * file_start_line(__isl_take isl_printer *p)
Definition: isl_printer.c:7
FILE * isl_printer_get_file(__isl_keep isl_printer *printer)
Definition: isl_printer.c:290
static __isl_give isl_printer * str_end_line(__isl_take isl_printer *p)
Definition: isl_printer.c:113
int isl_printer_get_output_format(__isl_keep isl_printer *p)
Definition: isl_printer.c:384
__isl_give isl_printer * isl_printer_set_note(__isl_take isl_printer *p, __isl_take isl_id *id, __isl_take isl_id *note)
Definition: isl_printer.c:427
__isl_give isl_printer * isl_printer_set_indent_prefix(__isl_take isl_printer *p, const char *prefix)
Definition: isl_printer.c:337
__isl_give isl_printer * isl_printer_set_dump(__isl_take isl_printer *p, int dump)
Definition: isl_printer.c:451
__isl_give isl_printer * isl_printer_yaml_end_mapping(__isl_take isl_printer *p)
Definition: isl_printer.c:740
__isl_give isl_printer * isl_printer_yaml_end_sequence(__isl_take isl_printer *p)
Definition: isl_printer.c:796
__isl_give isl_printer * isl_printer_yaml_start_sequence(__isl_take isl_printer *p)
Definition: isl_printer.c:768
static __isl_give isl_printer * str_print_double(__isl_take isl_printer *p, double d)
Definition: isl_printer.c:134
__isl_give isl_printer * isl_printer_set_isl_int_width(__isl_take isl_printer *p, int width)
Definition: isl_printer.c:300
static __isl_give isl_printer * file_print_int(__isl_take isl_printer *p, int i)
Definition: isl_printer.c:40
__isl_give isl_printer * isl_printer_to_file(isl_ctx *ctx, FILE *file)
Definition: isl_printer.c:217
static __isl_give isl_printer * file_print_double(__isl_take isl_printer *p, double d)
Definition: isl_printer.c:33
static __isl_give isl_printer * file_flush(__isl_take isl_printer *p)
Definition: isl_printer.c:20
static __isl_give isl_printer * str_flush(__isl_take isl_printer *p)
Definition: isl_printer.c:121
static __isl_give isl_printer * str_print_indent(__isl_take isl_printer *p, int indent)
Definition: isl_printer.c:87
__isl_give isl_printer * isl_printer_print_str(__isl_take isl_printer *p, const char *s)
Definition: isl_printer.c:617
__isl_give isl_printer * isl_printer_start_line(__isl_take isl_printer *p)
Definition: isl_printer.c:659
__isl_give isl_printer * isl_printer_indent(__isl_take isl_printer *p, int indent)
Definition: isl_printer.c:322
static enum isl_yaml_state current_state(__isl_keep isl_printer *p)
Definition: isl_printer.c:540
__isl_give isl_printer * isl_printer_set_yaml_style(__isl_take isl_printer *p, int yaml_style)
Definition: isl_printer.c:464
__isl_give isl_printer * isl_printer_to_str(isl_ctx *ctx)
Definition: isl_printer.c:240
static __isl_give isl_printer * pop_state(__isl_take isl_printer *p)
Definition: isl_printer.c:512
isl_ctx * isl_printer_get_ctx(__isl_keep isl_printer *printer)
Definition: isl_printer.c:285
static __isl_give isl_printer * str_start_line(__isl_take isl_printer *p)
Definition: isl_printer.c:103
static struct isl_printer_ops str_ops
Definition: isl_printer.c:207
__isl_give isl_printer * isl_printer_end_line(__isl_take isl_printer *p)
Definition: isl_printer.c:667
static __isl_give isl_printer * str_print_str(__isl_take isl_printer *p, const char *s)
Definition: isl_printer.c:128
static __isl_give isl_printer * file_end_line(__isl_take isl_printer *p)
Definition: isl_printer.c:14
__isl_give isl_id * isl_printer_get_note(__isl_keep isl_printer *p, __isl_take isl_id *id)
Definition: isl_printer.c:406
__isl_give isl_printer * isl_printer_set_output_format(__isl_take isl_printer *p, int output_format)
Definition: isl_printer.c:373
static __isl_give isl_printer * enter_state(__isl_take isl_printer *p, int eol)
Definition: isl_printer.c:568
__isl_give isl_printer * isl_printer_print_double(__isl_take isl_printer *p, double d)
Definition: isl_printer.c:630
__isl_null isl_printer * isl_printer_free(__isl_take isl_printer *p)
Definition: isl_printer.c:269
__isl_give isl_printer * isl_printer_print_isl_int(__isl_take isl_printer *p, isl_int i)
Definition: isl_printer.c:649
static int grow_buf(__isl_keep isl_printer *p, int extra)
Definition: isl_printer.c:52
const char * p
Definition: isl_test.c:8643
isl_yaml_state
Definition: isl_yaml.h:6
@ isl_yaml_sequence
Definition: isl_yaml.h:15
@ isl_yaml_mapping_val_start
Definition: isl_yaml.h:11
@ isl_yaml_mapping_first_key_start
Definition: isl_yaml.h:8
@ isl_yaml_mapping_val
Definition: isl_yaml.h:12
@ isl_yaml_sequence_start
Definition: isl_yaml.h:14
@ isl_yaml_mapping_key_start
Definition: isl_yaml.h:9
@ isl_yaml_none
Definition: isl_yaml.h:7
@ isl_yaml_sequence_first_start
Definition: isl_yaml.h:13
@ isl_yaml_mapping_key
Definition: isl_yaml.h:10
#define ISL_YAML_STYLE_FLOW
Definition: printer.h:39
#define ISL_YAML_STYLE_BLOCK
Definition: printer.h:38
#define ISL_FORMAT_ISL
Definition: printer.h:27
struct isl_ctx * ctx