equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
57 // creation |
57 // creation |
58 outputStream(int width = 80); |
58 outputStream(int width = 80); |
59 outputStream(int width, bool has_time_stamps); |
59 outputStream(int width, bool has_time_stamps); |
60 |
60 |
61 // indentation |
61 // indentation |
62 void indent(); |
62 outputStream& indent(); |
63 void inc() { _indentation++; }; |
63 void inc() { _indentation++; }; |
64 void dec() { _indentation--; }; |
64 void dec() { _indentation--; }; |
|
65 void inc(int n) { _indentation += n; }; |
|
66 void dec(int n) { _indentation -= n; }; |
65 int indentation() const { return _indentation; } |
67 int indentation() const { return _indentation; } |
66 void set_indentation(int i) { _indentation = i; } |
68 void set_indentation(int i) { _indentation = i; } |
67 void fill_to(int col); |
69 void fill_to(int col); |
68 void move_to(int col, int slop = 6, int min_space = 2); |
70 void move_to(int col, int slop = 6, int min_space = 2); |
69 |
71 |
82 void vprint_cr(const char* format, va_list argptr); |
84 void vprint_cr(const char* format, va_list argptr); |
83 void print_raw(const char* str) { write(str, strlen(str)); } |
85 void print_raw(const char* str) { write(str, strlen(str)); } |
84 void print_raw(const char* str, int len) { write(str, len); } |
86 void print_raw(const char* str, int len) { write(str, len); } |
85 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); } |
87 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); } |
86 void print_raw_cr(const char* str, int len){ write(str, len); cr(); } |
88 void print_raw_cr(const char* str, int len){ write(str, len); cr(); } |
|
89 void print_data(void* data, size_t len, bool with_ascii); |
87 void put(char ch); |
90 void put(char ch); |
88 void sp(int count = 1); |
91 void sp(int count = 1); |
89 void cr(); |
92 void cr(); |
90 void bol() { if (_position > 0) cr(); } |
93 void bol() { if (_position > 0) cr(); } |
91 |
94 |
120 // standard output |
123 // standard output |
121 // ANSI C++ name collision |
124 // ANSI C++ name collision |
122 extern outputStream* tty; // tty output |
125 extern outputStream* tty; // tty output |
123 extern outputStream* gclog_or_tty; // stream for gc log if -Xloggc:<f>, or tty |
126 extern outputStream* gclog_or_tty; // stream for gc log if -Xloggc:<f>, or tty |
124 |
127 |
|
128 class streamIndentor : public StackObj { |
|
129 private: |
|
130 outputStream* _str; |
|
131 int _amount; |
|
132 |
|
133 public: |
|
134 streamIndentor(outputStream* str, int amt = 2) : _str(str), _amount(amt) { |
|
135 _str->inc(_amount); |
|
136 } |
|
137 ~streamIndentor() { _str->dec(_amount); } |
|
138 }; |
|
139 |
|
140 |
125 // advisory locking for the shared tty stream: |
141 // advisory locking for the shared tty stream: |
126 class ttyLocker: StackObj { |
142 class ttyLocker: StackObj { |
127 friend class ttyUnlocker; |
143 friend class ttyUnlocker; |
128 private: |
144 private: |
129 intx _holder; |
145 intx _holder; |