187 if (count < 0) return;
188 if (SP_USE_TABS && count >= 8) {
189 int target = position() + count;
190 while (count >= 8) {
191 this->write("\t", 1);
192 count -= 8;
193 }
194 count = target - position();
195 }
196 while (count > 0) {
197 int nw = (count > 8) ? 8 : count;
198 this->write(" ", nw);
199 count -= nw;
200 }
201 }
202
203 void outputStream::cr() {
204 this->write("\n", 1);
205 }
206
207 void outputStream::stamp() {
208 if (! _stamp.is_updated()) {
209 _stamp.update(); // start at 0 on first call to stamp()
210 }
211
212 // outputStream::stamp() may get called by ostream_abort(), use snprintf
213 // to avoid allocating large stack buffer in print().
214 char buf[40];
215 jio_snprintf(buf, sizeof(buf), "%.3f", _stamp.seconds());
216 print_raw(buf);
217 }
218
219 void outputStream::stamp(bool guard,
220 const char* prefix,
221 const char* suffix) {
222 if (!guard) {
223 return;
224 }
225 print_raw(prefix);
226 stamp();
|
187 if (count < 0) return;
188 if (SP_USE_TABS && count >= 8) {
189 int target = position() + count;
190 while (count >= 8) {
191 this->write("\t", 1);
192 count -= 8;
193 }
194 count = target - position();
195 }
196 while (count > 0) {
197 int nw = (count > 8) ? 8 : count;
198 this->write(" ", nw);
199 count -= nw;
200 }
201 }
202
203 void outputStream::cr() {
204 this->write("\n", 1);
205 }
206
207 void outputStream::cr_indent() {
208 cr(); indent();
209 }
210
211 void outputStream::stamp() {
212 if (! _stamp.is_updated()) {
213 _stamp.update(); // start at 0 on first call to stamp()
214 }
215
216 // outputStream::stamp() may get called by ostream_abort(), use snprintf
217 // to avoid allocating large stack buffer in print().
218 char buf[40];
219 jio_snprintf(buf, sizeof(buf), "%.3f", _stamp.seconds());
220 print_raw(buf);
221 }
222
223 void outputStream::stamp(bool guard,
224 const char* prefix,
225 const char* suffix) {
226 if (!guard) {
227 return;
228 }
229 print_raw(prefix);
230 stamp();
|