blob: 2a2458d61a394a593e8b3967894b28ed0b771b1a [file] [log] [blame]
Chris Lattner60d39622008-08-17 01:35:29 +00001//===--- raw_ostream.cpp - Implement the raw_ostream classes --------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This implements support for bulk buffered stream output.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/Support/raw_ostream.h"
Chris Lattner42f77ab2008-08-23 20:34:06 +000015#include "llvm/Support/Format.h"
Daniel Dunbar0d9eb9b2008-11-13 05:01:07 +000016#include "llvm/System/Program.h"
Torok Edwine8ebb0f2009-06-04 07:09:50 +000017#include "llvm/System/Process.h"
Chris Lattner097af7f2008-08-23 19:23:10 +000018#include "llvm/ADT/SmallVector.h"
Chris Lattner969a46a2008-08-22 15:45:00 +000019#include "llvm/Config/config.h"
Daniel Dunbarb372c112009-03-17 21:15:18 +000020#include "llvm/Support/Compiler.h"
Daniel Dunbar579fb872009-07-15 08:11:46 +000021#include "llvm/Support/ErrorHandling.h"
Chris Lattner07f51f72008-08-17 04:13:37 +000022#include <ostream>
Chris Lattner60d39622008-08-17 01:35:29 +000023
Chris Lattner969a46a2008-08-22 15:45:00 +000024#if defined(HAVE_UNISTD_H)
25# include <unistd.h>
26#endif
27#if defined(HAVE_FCNTL_H)
28# include <fcntl.h>
29#endif
Argyrios Kyrtzidisb68dc362008-08-17 09:25:21 +000030
31#if defined(_MSC_VER)
Chris Lattner60d39622008-08-17 01:35:29 +000032#include <io.h>
Cedric Veneta3f343f2008-08-24 11:56:40 +000033#include <fcntl.h>
Owen Andersoncb371882008-08-21 00:14:44 +000034#ifndef STDIN_FILENO
35# define STDIN_FILENO 0
36#endif
37#ifndef STDOUT_FILENO
38# define STDOUT_FILENO 1
39#endif
40#ifndef STDERR_FILENO
41# define STDERR_FILENO 2
42#endif
Chris Lattner60d39622008-08-17 01:35:29 +000043#endif
44
Chris Lattner969a46a2008-08-22 15:45:00 +000045using namespace llvm;
46
Dan Gohmane87b2ab2009-07-15 23:25:33 +000047raw_ostream::~raw_ostream() {
Dan Gohman9a312542009-07-27 20:49:44 +000048 // raw_ostream's subclasses should take care to flush the buffer
49 // in their destructors.
50 assert(OutBufCur == OutBufStart &&
51 "raw_ostream destructor called with non-empty buffer!");
52
Dan Gohmane87b2ab2009-07-15 23:25:33 +000053 delete [] OutBufStart;
54
55 // If there are any pending errors, report them now. Clients wishing
56 // to avoid llvm_report_error calls should check for errors with
57 // has_error() and clear the error flag with clear_error() before
58 // destructing raw_ostream objects which may have errors.
59 if (Error)
60 llvm_report_error("IO failure on output stream.");
61}
Chris Lattner969a46a2008-08-22 15:45:00 +000062
Chris Lattner60d39622008-08-17 01:35:29 +000063// An out of line virtual method to provide a home for the class vtable.
64void raw_ostream::handle() {}
65
Dan Gohman524dea42009-08-13 15:58:55 +000066void raw_ostream::SetBufferSize(size_t Size) {
67 assert(Size >= 64 &&
68 "Buffer size must be somewhat large for invariants to hold");
69 flush();
70
71 delete [] OutBufStart;
72 OutBufStart = new char[Size];
73 OutBufEnd = OutBufStart+Size;
74 OutBufCur = OutBufStart;
75 Unbuffered = false;
76}
77
78void raw_ostream::SetUnbuffered() {
79 flush();
80
81 delete [] OutBufStart;
82 OutBufStart = OutBufEnd = OutBufCur = 0;
83 Unbuffered = true;
84}
85
Owen Anderson66b17ba2008-08-21 20:58:52 +000086raw_ostream &raw_ostream::operator<<(unsigned long N) {
87 // Zero is a special case.
88 if (N == 0)
89 return *this << '0';
90
91 char NumberBuffer[20];
92 char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
93 char *CurPtr = EndPtr;
94
95 while (N) {
96 *--CurPtr = '0' + char(N % 10);
97 N /= 10;
98 }
99 return write(CurPtr, EndPtr-CurPtr);
100}
101
102raw_ostream &raw_ostream::operator<<(long N) {
103 if (N < 0) {
Daniel Dunbarde75d7f2009-03-16 22:00:17 +0000104 *this << '-';
Owen Anderson66b17ba2008-08-21 20:58:52 +0000105 N = -N;
106 }
107
108 return this->operator<<(static_cast<unsigned long>(N));
109}
110
111raw_ostream &raw_ostream::operator<<(unsigned long long N) {
Daniel Dunbar78a3dd82009-07-29 06:45:14 +0000112 // Output using 32-bit div/mod when possible.
113 if (N == static_cast<unsigned long>(N))
114 return this->operator<<(static_cast<unsigned long>(N));
115
Owen Anderson66b17ba2008-08-21 20:58:52 +0000116 char NumberBuffer[20];
117 char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
118 char *CurPtr = EndPtr;
119
120 while (N) {
121 *--CurPtr = '0' + char(N % 10);
122 N /= 10;
123 }
124 return write(CurPtr, EndPtr-CurPtr);
125}
126
127raw_ostream &raw_ostream::operator<<(long long N) {
128 if (N < 0) {
Daniel Dunbarde75d7f2009-03-16 22:00:17 +0000129 *this << '-';
Owen Anderson66b17ba2008-08-21 20:58:52 +0000130 N = -N;
131 }
132
133 return this->operator<<(static_cast<unsigned long long>(N));
134}
135
Daniel Dunbar48018e02009-07-30 18:21:23 +0000136raw_ostream &raw_ostream::write_hex(unsigned long long N) {
Daniel Dunbarb451a0c2009-03-16 22:08:44 +0000137 // Zero is a special case.
138 if (N == 0)
139 return *this << '0';
140
141 char NumberBuffer[20];
142 char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
143 char *CurPtr = EndPtr;
144
145 while (N) {
Dan Gohmanad60f662009-07-16 15:24:40 +0000146 uintptr_t x = N % 16;
Daniel Dunbarb451a0c2009-03-16 22:08:44 +0000147 *--CurPtr = (x < 10 ? '0' + x : 'a' + x - 10);
148 N /= 16;
149 }
150
151 return write(CurPtr, EndPtr-CurPtr);
Chris Lattner944fac72008-08-23 22:23:09 +0000152}
153
Daniel Dunbar48018e02009-07-30 18:21:23 +0000154raw_ostream &raw_ostream::operator<<(const void *P) {
155 *this << '0' << 'x';
156
157 return write_hex((uintptr_t) P);
158}
159
Daniel Dunbarcf2a2c62009-03-16 22:55:06 +0000160void raw_ostream::flush_nonempty() {
161 assert(OutBufCur > OutBufStart && "Invalid call to flush_nonempty.");
Daniel Dunbar89a66a92009-03-16 23:29:31 +0000162 write_impl(OutBufStart, OutBufCur - OutBufStart);
Daniel Dunbarcf2a2c62009-03-16 22:55:06 +0000163 OutBufCur = OutBufStart;
164}
165
Daniel Dunbarde75d7f2009-03-16 22:00:17 +0000166raw_ostream &raw_ostream::write(unsigned char C) {
Daniel Dunbar262541b2009-03-17 01:36:56 +0000167 // Group exceptional cases into a single branch.
168 if (OutBufCur >= OutBufEnd) {
169 if (Unbuffered) {
170 write_impl(reinterpret_cast<char*>(&C), 1);
171 return *this;
172 }
173
174 if (!OutBufStart)
175 SetBufferSize();
176 else
177 flush_nonempty();
Daniel Dunbard17d74b2009-03-17 01:13:35 +0000178 }
179
Daniel Dunbarde75d7f2009-03-16 22:00:17 +0000180 *OutBufCur++ = C;
Daniel Dunbarb451a0c2009-03-16 22:08:44 +0000181 return *this;
Daniel Dunbarde75d7f2009-03-16 22:00:17 +0000182}
Chris Lattner944fac72008-08-23 22:23:09 +0000183
Dan Gohmanad60f662009-07-16 15:24:40 +0000184raw_ostream &raw_ostream::write(const char *Ptr, size_t Size) {
Daniel Dunbar262541b2009-03-17 01:36:56 +0000185 // Group exceptional cases into a single branch.
Daniel Dunbarb372c112009-03-17 21:15:18 +0000186 if (BUILTIN_EXPECT(OutBufCur+Size > OutBufEnd, false)) {
Dan Gohman33e49ef2009-08-13 15:44:52 +0000187 if (BUILTIN_EXPECT(!OutBufStart, false)) {
188 if (Unbuffered) {
189 write_impl(Ptr, Size);
190 return *this;
191 }
192 // Set up a buffer and start over.
Daniel Dunbar262541b2009-03-17 01:36:56 +0000193 SetBufferSize();
Dan Gohman33e49ef2009-08-13 15:44:52 +0000194 return write(Ptr, Size);
195 }
196 // Write out the data in buffer-sized blocks until the remainder
197 // fits within the buffer.
198 do {
199 size_t NumBytes = OutBufEnd - OutBufCur;
200 copy_to_buffer(Ptr, NumBytes);
Daniel Dunbar262541b2009-03-17 01:36:56 +0000201 flush_nonempty();
Dan Gohman33e49ef2009-08-13 15:44:52 +0000202 Ptr += NumBytes;
203 Size -= NumBytes;
204 } while (OutBufCur+Size > OutBufEnd);
Daniel Dunbar262541b2009-03-17 01:36:56 +0000205 }
Dan Gohman33e49ef2009-08-13 15:44:52 +0000206
207 copy_to_buffer(Ptr, Size);
208
209 return *this;
210}
211
212void raw_ostream::copy_to_buffer(const char *Ptr, size_t Size) {
Owen Anderson66b17ba2008-08-21 20:58:52 +0000213 // Handle short strings specially, memcpy isn't very good at very short
214 // strings.
215 switch (Size) {
216 case 4: OutBufCur[3] = Ptr[3]; // FALL THROUGH
217 case 3: OutBufCur[2] = Ptr[2]; // FALL THROUGH
218 case 2: OutBufCur[1] = Ptr[1]; // FALL THROUGH
219 case 1: OutBufCur[0] = Ptr[0]; // FALL THROUGH
220 case 0: break;
221 default:
Dan Gohman33e49ef2009-08-13 15:44:52 +0000222 memcpy(OutBufCur, Ptr, Size);
Owen Anderson66b17ba2008-08-21 20:58:52 +0000223 break;
224 }
Daniel Dunbare77e4342009-03-10 16:21:55 +0000225
Dan Gohman33e49ef2009-08-13 15:44:52 +0000226 OutBufCur += Size;
Owen Anderson66b17ba2008-08-21 20:58:52 +0000227}
228
Chris Lattner097af7f2008-08-23 19:23:10 +0000229// Formatted output.
230raw_ostream &raw_ostream::operator<<(const format_object_base &Fmt) {
Daniel Dunbar262541b2009-03-17 01:36:56 +0000231 // If we have more than a few bytes left in our output buffer, try
232 // formatting directly onto its end.
233 //
234 // FIXME: This test is a bit silly, since if we don't have enough
235 // space in the buffer we will have to flush the formatted output
236 // anyway. We should just flush upfront in such cases, and use the
237 // whole buffer as our scratch pad. Note, however, that this case is
238 // also necessary for correctness on unbuffered streams.
Dan Gohmanad60f662009-07-16 15:24:40 +0000239 size_t NextBufferSize = 127;
Chris Lattner097af7f2008-08-23 19:23:10 +0000240 if (OutBufEnd-OutBufCur > 3) {
Dan Gohmanad60f662009-07-16 15:24:40 +0000241 size_t BufferBytesLeft = OutBufEnd-OutBufCur;
242 size_t BytesUsed = Fmt.print(OutBufCur, BufferBytesLeft);
Chris Lattner097af7f2008-08-23 19:23:10 +0000243
244 // Common case is that we have plenty of space.
245 if (BytesUsed < BufferBytesLeft) {
246 OutBufCur += BytesUsed;
247 return *this;
248 }
249
250 // Otherwise, we overflowed and the return value tells us the size to try
251 // again with.
252 NextBufferSize = BytesUsed;
253 }
254
255 // If we got here, we didn't have enough space in the output buffer for the
256 // string. Try printing into a SmallVector that is resized to have enough
257 // space. Iterate until we win.
258 SmallVector<char, 128> V;
259
260 while (1) {
261 V.resize(NextBufferSize);
262
263 // Try formatting into the SmallVector.
Dan Gohmanad60f662009-07-16 15:24:40 +0000264 size_t BytesUsed = Fmt.print(&V[0], NextBufferSize);
Chris Lattner097af7f2008-08-23 19:23:10 +0000265
266 // If BytesUsed fit into the vector, we win.
Chris Lattnerf61ca1e2008-10-26 19:20:47 +0000267 if (BytesUsed <= NextBufferSize)
Chris Lattner097af7f2008-08-23 19:23:10 +0000268 return write(&V[0], BytesUsed);
269
270 // Otherwise, try again with a new size.
271 assert(BytesUsed > NextBufferSize && "Didn't grow buffer!?");
272 NextBufferSize = BytesUsed;
273 }
274}
275
276//===----------------------------------------------------------------------===//
277// Formatted Output
278//===----------------------------------------------------------------------===//
279
280// Out of line virtual method.
281void format_object_base::home() {
282}
283
Chris Lattner60d39622008-08-17 01:35:29 +0000284//===----------------------------------------------------------------------===//
285// raw_fd_ostream
286//===----------------------------------------------------------------------===//
287
Daniel Dunbar48534b32008-10-21 19:53:10 +0000288/// raw_fd_ostream - Open the specified file for writing. If an error
289/// occurs, information about the error is put into ErrorInfo, and the
290/// stream should be immediately destroyed; the string will be empty
291/// if no error occurred.
Dan Gohmana1bdced2009-07-15 17:29:42 +0000292raw_fd_ostream::raw_fd_ostream(const char *Filename, bool Binary, bool Force,
Ted Kremenekd75ba1c2008-12-04 22:51:11 +0000293 std::string &ErrorInfo) : pos(0) {
Daniel Dunbar48534b32008-10-21 19:53:10 +0000294 ErrorInfo.clear();
295
Chris Lattnerc52b1282008-08-17 03:53:23 +0000296 // Handle "-" as stdout.
297 if (Filename[0] == '-' && Filename[1] == 0) {
298 FD = STDOUT_FILENO;
Daniel Dunbar0d9eb9b2008-11-13 05:01:07 +0000299 // If user requested binary then put stdout into binary mode if
300 // possible.
301 if (Binary)
302 sys::Program::ChangeStdoutToBinary();
Chris Lattnerc52b1282008-08-17 03:53:23 +0000303 ShouldClose = false;
304 return;
305 }
306
Daniel Dunbar0d9eb9b2008-11-13 05:01:07 +0000307 int Flags = O_WRONLY|O_CREAT|O_TRUNC;
308#ifdef O_BINARY
309 if (Binary)
310 Flags |= O_BINARY;
311#endif
Dan Gohmana1bdced2009-07-15 17:29:42 +0000312 if (!Force)
313 Flags |= O_EXCL;
Dan Gohman9f79d3e2009-07-15 16:39:40 +0000314 FD = open(Filename, Flags, 0664);
Chris Lattner60d39622008-08-17 01:35:29 +0000315 if (FD < 0) {
316 ErrorInfo = "Error opening output file '" + std::string(Filename) + "'";
317 ShouldClose = false;
318 } else {
319 ShouldClose = true;
320 }
321}
322
323raw_fd_ostream::~raw_fd_ostream() {
Ted Kremenek43d1f022008-10-23 23:49:09 +0000324 if (FD >= 0) {
325 flush();
326 if (ShouldClose)
Dan Gohmand3a974f2009-07-15 16:43:01 +0000327 if (::close(FD) != 0)
Dan Gohmane87b2ab2009-07-15 23:25:33 +0000328 error_detected();
Ted Kremenek43d1f022008-10-23 23:49:09 +0000329 }
Chris Lattner60d39622008-08-17 01:35:29 +0000330}
331
Dan Gohmanad60f662009-07-16 15:24:40 +0000332void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
Ted Kremenek43d1f022008-10-23 23:49:09 +0000333 assert (FD >= 0 && "File already closed.");
Daniel Dunbar89a66a92009-03-16 23:29:31 +0000334 pos += Size;
Daniel Dunbar579fb872009-07-15 08:11:46 +0000335 if (::write(FD, Ptr, Size) != (ssize_t) Size)
Dan Gohmane87b2ab2009-07-15 23:25:33 +0000336 error_detected();
Chris Lattner60d39622008-08-17 01:35:29 +0000337}
338
Ted Kremenek43d1f022008-10-23 23:49:09 +0000339void raw_fd_ostream::close() {
340 assert (ShouldClose);
341 ShouldClose = false;
342 flush();
Dan Gohmand3a974f2009-07-15 16:43:01 +0000343 if (::close(FD) != 0)
Dan Gohmane87b2ab2009-07-15 23:25:33 +0000344 error_detected();
Ted Kremenek43d1f022008-10-23 23:49:09 +0000345 FD = -1;
346}
347
Ted Kremenek9c278862009-01-26 21:42:04 +0000348uint64_t raw_fd_ostream::seek(uint64_t off) {
349 flush();
Daniel Dunbar579fb872009-07-15 08:11:46 +0000350 pos = ::lseek(FD, off, SEEK_SET);
Dan Gohmand3a974f2009-07-15 16:43:01 +0000351 if (pos != off)
Dan Gohmane87b2ab2009-07-15 23:25:33 +0000352 error_detected();
Ted Kremenek9c278862009-01-26 21:42:04 +0000353 return pos;
354}
355
Torok Edwine8ebb0f2009-06-04 07:09:50 +0000356raw_ostream &raw_fd_ostream::changeColor(enum Colors colors, bool bold,
357 bool bg) {
358 if (sys::Process::ColorNeedsFlush())
359 flush();
360 const char *colorcode =
361 (colors == SAVEDCOLOR) ? sys::Process::OutputBold(bg)
362 : sys::Process::OutputColor(colors, bold, bg);
363 if (colorcode) {
Dan Gohmanad60f662009-07-16 15:24:40 +0000364 size_t len = strlen(colorcode);
Torok Edwine8ebb0f2009-06-04 07:09:50 +0000365 write(colorcode, len);
366 // don't account colors towards output characters
367 pos -= len;
368 }
369 return *this;
370}
371
372raw_ostream &raw_fd_ostream::resetColor() {
373 if (sys::Process::ColorNeedsFlush())
374 flush();
375 const char *colorcode = sys::Process::ResetColor();
376 if (colorcode) {
Dan Gohmanad60f662009-07-16 15:24:40 +0000377 size_t len = strlen(colorcode);
Torok Edwine8ebb0f2009-06-04 07:09:50 +0000378 write(colorcode, len);
379 // don't account colors towards output characters
380 pos -= len;
381 }
382 return *this;
383}
384
Chris Lattner07f51f72008-08-17 04:13:37 +0000385//===----------------------------------------------------------------------===//
386// raw_stdout/err_ostream
387//===----------------------------------------------------------------------===//
Chris Lattner60d39622008-08-17 01:35:29 +0000388
389raw_stdout_ostream::raw_stdout_ostream():raw_fd_ostream(STDOUT_FILENO, false) {}
Daniel Dunbare77e4342009-03-10 16:21:55 +0000390raw_stderr_ostream::raw_stderr_ostream():raw_fd_ostream(STDERR_FILENO, false,
391 true) {}
Chris Lattner60d39622008-08-17 01:35:29 +0000392
393// An out of line virtual method to provide a home for the class vtable.
394void raw_stdout_ostream::handle() {}
395void raw_stderr_ostream::handle() {}
Chris Lattner07f51f72008-08-17 04:13:37 +0000396
397/// outs() - This returns a reference to a raw_ostream for standard output.
398/// Use it like: outs() << "foo" << "bar";
Owen Andersoncb371882008-08-21 00:14:44 +0000399raw_ostream &llvm::outs() {
Chris Lattner07f51f72008-08-17 04:13:37 +0000400 static raw_stdout_ostream S;
401 return S;
402}
403
404/// errs() - This returns a reference to a raw_ostream for standard error.
405/// Use it like: errs() << "foo" << "bar";
Owen Andersoncb371882008-08-21 00:14:44 +0000406raw_ostream &llvm::errs() {
Chris Lattner07f51f72008-08-17 04:13:37 +0000407 static raw_stderr_ostream S;
408 return S;
409}
410
Daniel Dunbar34ccf032009-07-16 21:17:53 +0000411/// nulls() - This returns a reference to a raw_ostream which discards output.
412raw_ostream &llvm::nulls() {
413 static raw_null_ostream S;
414 return S;
415}
416
Chris Lattner07f51f72008-08-17 04:13:37 +0000417//===----------------------------------------------------------------------===//
418// raw_os_ostream
419//===----------------------------------------------------------------------===//
420
Chris Lattner944fac72008-08-23 22:23:09 +0000421raw_os_ostream::~raw_os_ostream() {
422 flush();
423}
424
Dan Gohmanad60f662009-07-16 15:24:40 +0000425void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
Daniel Dunbar89a66a92009-03-16 23:29:31 +0000426 OS.write(Ptr, Size);
Chris Lattner07f51f72008-08-17 04:13:37 +0000427}
Chris Lattner78a28122008-08-23 22:43:04 +0000428
Douglas Gregor8f7be472009-04-20 07:34:17 +0000429uint64_t raw_os_ostream::current_pos() { return OS.tellp(); }
430
431uint64_t raw_os_ostream::tell() {
432 return (uint64_t)OS.tellp() + GetNumBytesInBuffer();
433}
434
Chris Lattner78a28122008-08-23 22:43:04 +0000435//===----------------------------------------------------------------------===//
436// raw_string_ostream
437//===----------------------------------------------------------------------===//
438
439raw_string_ostream::~raw_string_ostream() {
440 flush();
441}
442
Dan Gohmanad60f662009-07-16 15:24:40 +0000443void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
Daniel Dunbar89a66a92009-03-16 23:29:31 +0000444 OS.append(Ptr, Size);
Chris Lattner78a28122008-08-23 22:43:04 +0000445}
446
447//===----------------------------------------------------------------------===//
448// raw_svector_ostream
449//===----------------------------------------------------------------------===//
450
451raw_svector_ostream::~raw_svector_ostream() {
452 flush();
453}
454
Dan Gohmanad60f662009-07-16 15:24:40 +0000455void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
Daniel Dunbar89a66a92009-03-16 23:29:31 +0000456 OS.append(Ptr, Ptr + Size);
Chris Lattner78a28122008-08-23 22:43:04 +0000457}
458
Douglas Gregor8f7be472009-04-20 07:34:17 +0000459uint64_t raw_svector_ostream::current_pos() { return OS.size(); }
460
461uint64_t raw_svector_ostream::tell() {
462 return OS.size() + GetNumBytesInBuffer();
463}
Daniel Dunbar34ccf032009-07-16 21:17:53 +0000464
465//===----------------------------------------------------------------------===//
466// raw_null_ostream
467//===----------------------------------------------------------------------===//
468
Dan Gohmanf78c8352009-07-27 21:46:02 +0000469raw_null_ostream::~raw_null_ostream() {
470#ifndef NDEBUG
471 // ~raw_ostream asserts that the buffer is empty. This isn't necessary
472 // with raw_null_ostream, but it's better to have raw_null_ostream follow
473 // the rules than to change the rules just for raw_null_ostream.
474 flush();
475#endif
476}
477
Daniel Dunbar34ccf032009-07-16 21:17:53 +0000478void raw_null_ostream::write_impl(const char *Ptr, size_t Size) {
479}
480
481uint64_t raw_null_ostream::current_pos() {
482 return 0;
483}