| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 /// Provides common infrastructure for reading commads from a [Stream]. | 5 /// Provides common infrastructure for reading commads from a [Stream]. |
| 6 /// | 6 /// |
| 7 /// We have two independent command kinds that follow the same scheme: | 7 /// We have two independent command kinds that follow the same scheme: |
| 8 /// | 8 /// |
| 9 /// 1. ../vm_commands.dart | 9 /// 1. ../vm_commands.dart |
| 10 /// 2. hub/client_commands.dart | 10 /// 2. hub/client_commands.dart |
| 11 /// | 11 /// |
| 12 /// Both commands are serialized in this format (using little endian): | 12 /// Both commands are serialized in this format (using little endian): |
| 13 /// | 13 /// |
| 14 /// * Byte offset 0: one byte (code) which corresponds to an enum value. | 14 /// * Byte offset 0: one byte (code) which corresponds to an enum value. |
| 15 /// * Byte offset 1: four bytes payload length (unsigned int). | 15 /// * Byte offset 1: four bytes payload length (unsigned int). |
| 16 /// * Byte offset 5: payload length bytes of payload. | 16 /// * Byte offset 5: payload length bytes of payload. |
| 17 library fletchc.src.command_transformer_builder; | 17 library dartino_compiler.src.command_transformer_builder; |
| 18 | 18 |
| 19 import 'dart:async' show | 19 import 'dart:async' show |
| 20 EventSink, | 20 EventSink, |
| 21 StreamTransformer; | 21 StreamTransformer; |
| 22 | 22 |
| 23 import 'dart:convert' show | 23 import 'dart:convert' show |
| 24 ASCII; | 24 ASCII; |
| 25 | 25 |
| 26 import 'dart:io' show | 26 import 'dart:io' show |
| 27 BytesBuilder; | 27 BytesBuilder; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // https://github.com/dart-lang/sdk/issues/23953 | 214 // https://github.com/dart-lang/sdk/issues/23953 |
| 215 buffer = new Uint8List.fromList( | 215 buffer = new Uint8List.fromList( |
| 216 buffer.buffer.asUint8List(buffer.offsetInBytes + offset)); | 216 buffer.buffer.asUint8List(buffer.offsetInBytes + offset)); |
| 217 assert(buffer.offsetInBytes == 0); | 217 assert(buffer.offsetInBytes == 0); |
| 218 offset = 0; | 218 offset = 0; |
| 219 } | 219 } |
| 220 return buffer.buffer.asByteData(buffer.offsetInBytes) | 220 return buffer.buffer.asByteData(buffer.offsetInBytes) |
| 221 .getFloat64(offset, commandEndianness); | 221 .getFloat64(offset, commandEndianness); |
| 222 } | 222 } |
| 223 } | 223 } |
| OLD | NEW |