File tree Expand file tree Collapse file tree 4 files changed +33
-22
lines changed
Expand file tree Collapse file tree 4 files changed +33
-22
lines changed Original file line number Diff line number Diff line change 2020#include "prism/internal/bit.h"
2121
2222#include "prism/allocator.h"
23+ #include "prism/excludes.h"
2324#include "prism/files.h"
2425
2526#include <ctype.h>
7980 #define PRISM_ISINF (x ) isinf(x)
8081#endif
8182
82- /**
83- * If PRISM_BUILD_MINIMAL is defined, then we're going to define every possible
84- * switch that will turn off certain features of prism.
85- */
86- #ifdef PRISM_BUILD_MINIMAL
87- /** Exclude the serialization API. */
88- #define PRISM_EXCLUDE_SERIALIZATION
89-
90- /** Exclude the JSON serialization API. */
91- #define PRISM_EXCLUDE_JSON
92-
93- /** Exclude the prettyprint API. */
94- #define PRISM_EXCLUDE_PRETTYPRINT
95-
96- /** Exclude the full set of encodings, using the minimal only. */
97- #define PRISM_ENCODING_EXCLUDE_FULL
98- #endif
99-
10083/**
10184 * Support PRISM_LIKELY and PRISM_UNLIKELY to help the compiler optimize its
10285 * branch predication.
Original file line number Diff line number Diff line change 1+ /**
2+ * @file excludes.h
3+ *
4+ * A header file that defines macros to exclude certain features of the prism
5+ * library. This is useful for reducing the size of the library when certain
6+ * features are not needed.
7+ */
8+ #ifndef PRISM_EXCLUDES_H
9+ #define PRISM_EXCLUDES_H
10+
11+ /**
12+ * If PRISM_BUILD_MINIMAL is defined, then we're going to define every possible
13+ * switch that will turn off certain features of prism.
14+ */
15+ #ifdef PRISM_BUILD_MINIMAL
16+ /** Exclude the serialization API. */
17+ #define PRISM_EXCLUDE_SERIALIZATION
18+
19+ /** Exclude the JSON serialization API. */
20+ #define PRISM_EXCLUDE_JSON
21+
22+ /** Exclude the prettyprint API. */
23+ #define PRISM_EXCLUDE_PRETTYPRINT
24+
25+ /** Exclude the full set of encodings, using the minimal only. */
26+ #define PRISM_ENCODING_EXCLUDE_FULL
27+ #endif
28+
29+ #endif
Original file line number Diff line number Diff line change 66#ifndef PRISM_PRETTYPRINT_H
77#define PRISM_PRETTYPRINT_H
88
9- #include "prism/defines .h"
9+ #include "prism/excludes .h"
1010
1111#ifdef PRISM_EXCLUDE_PRETTYPRINT
1212
13- void pm_prettyprint (void );
13+ #define pm_prettyprint (output_buffer_ , parser_ , node_ )
1414
1515#else
1616
17- #include <stdio.h>
18-
1917#include "prism/ast.h"
2018#include "prism/buffer.h"
2119#include "prism/parser.h"
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ Gem::Specification.new do |spec|
6262 "include/prism/defines.h" ,
6363 "include/prism/diagnostic.h" ,
6464 "include/prism/encoding.h" ,
65+ "include/prism/excludes.h" ,
6566 "include/prism/files.h" ,
6667 "include/prism/integer.h" ,
6768 "include/prism/line_offset_list.h" ,
You can’t perform that action at this time.
0 commit comments