summaryrefslogtreecommitdiff
path: root/tools/d2c/manual.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/manual.h')
-rw-r--r--tools/d2c/manual.h71
1 files changed, 37 insertions, 34 deletions
diff --git a/tools/d2c/manual.h b/tools/d2c/manual.h
index e3375b8..4106702 100644
--- a/tools/d2c/manual.h
+++ b/tools/d2c/manual.h
@@ -25,40 +25,43 @@
#define _TOOLS_D2C_MANUAL_H
-#define read_block(tmp) \
- ({ \
- unsigned int __depth; \
- bool __is_string; \
- char *__iter; \
- \
- __depth = 1; \
- __is_string = false; \
- \
- for (__iter = temp; __depth > 0; __iter += (__depth > 0 ? 1 : 0)) \
- { \
- *__iter = input(); \
- \
- switch (*__iter) \
- { \
- case '"': \
- __is_string = !__is_string; \
- break; \
- \
- case '{': \
- if (!__is_string) __depth++; \
- break; \
- \
- case '}': \
- if (!__is_string) __depth--; \
- break; \
- \
- } \
- \
- } \
- \
- *__iter = '\0'; \
- \
- printf("\n\nBLOCK\n''''\n%s\n''''\n\n", temp); \
+#define read_block(tmp) \
+ ({ \
+ unsigned int __depth; \
+ bool __is_string; \
+ char *__iter; \
+ \
+ __depth = 1; \
+ __is_string = false; \
+ \
+ for (__iter = temp; __depth > 0; __iter += (__depth > 0 ? 1 : 0)) \
+ { \
+ *__iter = input(); \
+ \
+ switch (*__iter) \
+ { \
+ case '"': \
+ __is_string = !__is_string; \
+ break; \
+ \
+ case '{': \
+ if (!__is_string) __depth++; \
+ break; \
+ \
+ case '}': \
+ if (!__is_string) \
+ { \
+ __depth--; \
+ if (__depth == 0) unput('}'); \
+ } \
+ break; \
+ \
+ } \
+ \
+ } \
+ \
+ *__iter = '\0'; \
+ \
})