]>
git.proxmox.com Git - rustc.git/blob - src/binaryen/src/pretty_printing.h
2 * Copyright 2015 WebAssembly Community Group participants
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // Pretty printing helpers
21 #ifndef wasm_pretty_printing_h
22 #define wasm_pretty_printing_h
26 #include "support/colors.h"
28 inline std::ostream
&doIndent(std::ostream
&o
, unsigned indent
) {
29 for (unsigned i
= 0; i
< indent
; i
++) {
35 inline std::ostream
&prepareMajorColor(std::ostream
&o
) {
41 inline std::ostream
&prepareColor(std::ostream
&o
) {
47 inline std::ostream
&prepareMinorColor(std::ostream
&o
) {
52 inline std::ostream
&restoreNormalColor(std::ostream
&o
) {
57 inline std::ostream
& printText(std::ostream
&o
, const char *str
) {
65 inline std::ostream
& printOpening(std::ostream
&o
, const char *str
, bool major
=false) {
67 major
? prepareMajorColor(o
) : prepareColor(o
);
69 restoreNormalColor(o
);
73 inline std::ostream
& printMinorOpening(std::ostream
&o
, const char *str
) {
77 restoreNormalColor(o
);
81 #endif // wasm_pretty_printing_h