| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // char* needs to be disposed off with DeleteArray by the caller. | 60 // char* needs to be disposed off with DeleteArray by the caller. |
| 61 char* ReadLine(const char* prompt); | 61 char* ReadLine(const char* prompt); |
| 62 | 62 |
| 63 | 63 |
| 64 // Read and return the raw bytes in a file. the size of the buffer is returned | 64 // Read and return the raw bytes in a file. the size of the buffer is returned |
| 65 // in size. | 65 // in size. |
| 66 // The returned buffer must be freed by the caller. | 66 // The returned buffer must be freed by the caller. |
| 67 byte* ReadBytes(const char* filename, int* size, bool verbose = true); | 67 byte* ReadBytes(const char* filename, int* size, bool verbose = true); |
| 68 | 68 |
| 69 | 69 |
| 70 // Append size chars from str to the file given by filename. |
| 71 // The file is overwritten. Returns the number of chars written. |
| 72 int AppendChars(const char* filename, |
| 73 const char* str, |
| 74 int size, |
| 75 bool verbose = true); |
| 76 |
| 77 |
| 70 // Write size chars from str to the file given by filename. | 78 // Write size chars from str to the file given by filename. |
| 71 // The file is overwritten. Returns the number of chars written. | 79 // The file is overwritten. Returns the number of chars written. |
| 72 int WriteChars(const char* filename, | 80 int WriteChars(const char* filename, |
| 73 const char* str, | 81 const char* str, |
| 74 int size, | 82 int size, |
| 75 bool verbose = true); | 83 bool verbose = true); |
| 76 | 84 |
| 77 | 85 |
| 78 // Write size bytes to the file given by filename. | 86 // Write size bytes to the file given by filename. |
| 79 // The file is overwritten. Returns the number of bytes written. | 87 // The file is overwritten. Returns the number of bytes written. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // compute the length of the input string. | 218 // compute the length of the input string. |
| 211 void AddString(const char* s); | 219 void AddString(const char* s); |
| 212 | 220 |
| 213 // Add the first 'n' characters of the given string 's' to the | 221 // Add the first 'n' characters of the given string 's' to the |
| 214 // builder. The input string must have enough characters. | 222 // builder. The input string must have enough characters. |
| 215 void AddSubstring(const char* s, int n); | 223 void AddSubstring(const char* s, int n); |
| 216 | 224 |
| 217 // Add formatted contents to the builder just like printf(). | 225 // Add formatted contents to the builder just like printf(). |
| 218 void AddFormatted(const char* format, ...); | 226 void AddFormatted(const char* format, ...); |
| 219 | 227 |
| 228 // Add formatted contents like printf based on a va_list. |
| 229 void AddFormattedList(const char* format, va_list list); |
| 230 |
| 220 // Add character padding to the builder. If count is non-positive, | 231 // Add character padding to the builder. If count is non-positive, |
| 221 // nothing is added to the builder. | 232 // nothing is added to the builder. |
| 222 void AddPadding(char c, int count); | 233 void AddPadding(char c, int count); |
| 223 | 234 |
| 224 // Finalize the string by 0-terminating it and returning the buffer. | 235 // Finalize the string by 0-terminating it and returning the buffer. |
| 225 char* Finalize(); | 236 char* Finalize(); |
| 226 | 237 |
| 227 private: | 238 private: |
| 228 Vector<char> buffer_; | 239 Vector<char> buffer_; |
| 229 int position_; | 240 int position_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 303 } |
| 293 #endif | 304 #endif |
| 294 while (dest < limit) { | 305 while (dest < limit) { |
| 295 *dest++ = static_cast<sinkchar>(*src++); | 306 *dest++ = static_cast<sinkchar>(*src++); |
| 296 } | 307 } |
| 297 } | 308 } |
| 298 | 309 |
| 299 } } // namespace v8::internal | 310 } } // namespace v8::internal |
| 300 | 311 |
| 301 #endif // V8_V8UTILS_H_ | 312 #endif // V8_V8UTILS_H_ |
| OLD | NEW |