1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-09-30 13:26:01 +03:00

dump.c: add dumping of %iprint

This commit is contained in:
Werner Almesberger 2014-02-15 18:08:26 -03:00
parent 1bc94d0445
commit 1d7eccb06b
2 changed files with 22 additions and 2 deletions

9
dump.c
View File

@ -1,8 +1,8 @@
/*
* dump.c - Dump objects in the native FPD format
*
* Written 2009-2012 by Werner Almesberger
* Copyright 2009-2012 by Werner Almesberger
* Written 2009-2012, 2014 by Werner Almesberger
* Copyright 2009-2012, 2014 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -383,6 +383,11 @@ char *print_obj(const struct obj *obj, const struct vec *prev)
}
free(s2);
break;
case ot_iprint:
s2 = unparse(obj->u.iprint.expr);
s = stralloc_printf("%%iprint %s", s2);
free(s2);
break;
default:
abort();
}

View File

@ -98,4 +98,19 @@ expect <<EOF
undefined variable "foo"
EOF
#------------------------------------------------------------------------------
fped_dump "iprint: dump" <<EOF
%iprint 42
EOF
expect <<EOF
42
/* MACHINE-GENERATED ! */
package "_"
unit mm
%iprint 42
EOF
###############################################################################