2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
17 static char *skip_spaces(char *s
)
24 static int is_begin_scop(char *line
)
26 line
= skip_spaces(line
);
29 line
= skip_spaces(line
+ 1);
30 if (strncmp(line
, "pragma", sizeof("pragma") - 1))
32 line
= skip_spaces(line
+ sizeof("pragma") - 1);
33 if (strncmp(line
, "scop", sizeof("scop") - 1))
38 static int is_end_scop(char *line
)
40 line
= skip_spaces(line
);
43 line
= skip_spaces(line
+ 1);
44 if (strncmp(line
, "pragma", sizeof("pragma") - 1))
46 line
= skip_spaces(line
+ sizeof("pragma") - 1);
47 if (strncmp(line
, "endscop", sizeof("endscop") - 1))
52 void copy_before_scop(FILE *input
, FILE *output
)
55 while (fgets(line
, sizeof(line
), input
)) {
56 fprintf(output
, "%s", line
);
57 if (is_begin_scop(line
))
62 void copy_after_scop(FILE *input
, FILE *output
)
65 while (fgets(line
, sizeof(line
), input
)) {
66 if (is_end_scop(line
)) {
67 fprintf(output
, "%s", line
);
71 while (fgets(line
, sizeof(line
), input
)) {
72 fprintf(output
, "%s", line
);