source: trunk/Jgraph/complex-examples/convert.awk@ 654

Last change on this file since 654 was 419, checked in by Nicholas Riley, 17 years ago

Jgraph: Debian changes by pzn@…

File size: 1.2 KB
Line 
1BEGIN { printf("{ x = $1; y = $2; \\\n"); }
2 { inpts = 0; instr = 0; npts = 0; inx = 0; \
3 iny = 0;\
4 printf(" printf(\"");\
5 for (i = 1; i <= NF; i++) {\
6 if (instr) { \
7 printf(" %s", $i); \
8 } else if (inpts > 0) {\
9 printf(" %%f");\
10 pts[npts] = $i;\
11 if (inpts % 2) x[npts] = "x"; else x[npts] = "y";\
12 inpts++;\
13 npts++;\
14 } else if (inx) {\
15 printf(" %%f");\
16 pts[npts] = $i;\
17 x[npts] = "x";\
18 npts++;\
19 inx = 0;\
20 } else if (iny) {\
21 printf(" %%f");\
22 pts[npts] = $i;\
23 x[npts] = "y";\
24 npts++;\
25 iny = 0;\
26 } else {\
27 printf(" %s", $i);\
28 if ($i == ":") instr = 1;\
29 if ($i == "x") inx = 1;\
30 if ($i == "y") iny = 1;\
31 if ($i == "pts") inpts = 1; \
32 }\
33 }\
34 printf("\\n\"");\
35 if (npts > 0) {\
36 for (i = 0; i < npts; i++) {\
37 printf(", %s + %f", x[i], pts[i]);\
38 }\
39 }\
40 printf(");\\\n");\
41 }
42END { printf("}\n"); }
Note: See TracBrowser for help on using the repository browser.