isl_printer_print_aff: support printing in C format
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 24 Jun 2011 20:38:49 +0000 (22:38 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 1 Jul 2011 16:52:22 +0000 (18:52 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_output.c

index 89564c5..ec2d664 100644 (file)
@@ -2237,7 +2237,7 @@ static __isl_give isl_printer *print_aff(__isl_take isl_printer *p,
        return p;
 }
 
-__isl_give isl_printer *isl_printer_print_aff(__isl_take isl_printer *p,
+static __isl_give isl_printer *print_aff_isl(__isl_take isl_printer *p,
        __isl_keep isl_aff *aff)
 {
        if (!aff)
@@ -2416,6 +2416,23 @@ error:
        return NULL;
 }
 
+__isl_give isl_printer *isl_printer_print_aff(__isl_take isl_printer *p,
+       __isl_keep isl_aff *aff)
+{
+       if (!p || !aff)
+               goto error;
+
+       if (p->output_format == ISL_FORMAT_ISL)
+               return print_aff_isl(p, aff);
+       else if (p->output_format == ISL_FORMAT_C)
+               return print_aff_c(p, aff);
+       isl_die(p->ctx, isl_error_unsupported, "unsupported output format",
+               goto error);
+error:
+       isl_printer_free(p);
+       return NULL;
+}
+
 __isl_give isl_printer *isl_printer_print_pw_aff(__isl_take isl_printer *p,
        __isl_keep isl_pw_aff *pwaff)
 {