| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/file.h" | 5 #include "bin/file.h" |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/dartutils.h" | 8 #include "bin/dartutils.h" |
| 9 #include "bin/io_buffer.h" | 9 #include "bin/io_buffer.h" |
| 10 #include "bin/thread.h" | 10 #include "bin/thread.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { | 490 void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { |
| 491 Dart_EnterScope(); | 491 Dart_EnterScope(); |
| 492 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | 492 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); |
| 493 ASSERT(fd == 0 || fd == 1 || fd == 2); | 493 ASSERT(fd == 0 || fd == 1 || fd == 2); |
| 494 File::StdioHandleType type = File::GetStdioHandleType(static_cast<int>(fd)); | 494 File::StdioHandleType type = File::GetStdioHandleType(static_cast<int>(fd)); |
| 495 Dart_SetReturnValue(args, Dart_NewInteger(type)); | 495 Dart_SetReturnValue(args, Dart_NewInteger(type)); |
| 496 Dart_ExitScope(); | 496 Dart_ExitScope(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 | 499 |
| 500 void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) { |
| 501 Dart_EnterScope(); |
| 502 if (Dart_IsString(Dart_GetNativeArgument(args, 0)) && |
| 503 Dart_IsBoolean(Dart_GetNativeArgument(args, 1))) { |
| 504 const char* str = |
| 505 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 506 bool follow_links = |
| 507 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1)); |
| 508 File::Type type = File::GetType(str, follow_links); |
| 509 Dart_SetReturnValue(args, Dart_NewInteger(static_cast<int>(type))); |
| 510 } else { |
| 511 OSError os_error(-1, "Invalid argument", OSError::kUnknown); |
| 512 Dart_Handle err = DartUtils::NewDartOSError(&os_error); |
| 513 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 514 Dart_SetReturnValue(args, err); |
| 515 } |
| 516 Dart_ExitScope(); |
| 517 } |
| 518 |
| 519 |
| 500 static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) { | 520 static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) { |
| 501 ASSERT(cobject->IsInt32OrInt64()); | 521 ASSERT(cobject->IsInt32OrInt64()); |
| 502 int64_t result; | 522 int64_t result; |
| 503 if (cobject->IsInt32()) { | 523 if (cobject->IsInt32()) { |
| 504 CObjectInt32 value(cobject); | 524 CObjectInt32 value(cobject); |
| 505 result = value.Value(); | 525 result = value.Value(); |
| 506 } else { | 526 } else { |
| 507 CObjectInt64 value(cobject); | 527 CObjectInt64 value(cobject); |
| 508 result = value.Value(); | 528 result = value.Value(); |
| 509 } | 529 } |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 Dart_EnterScope(); | 1009 Dart_EnterScope(); |
| 990 Dart_SetReturnValue(args, Dart_Null()); | 1010 Dart_SetReturnValue(args, Dart_Null()); |
| 991 Dart_Port service_port = File::GetServicePort(); | 1011 Dart_Port service_port = File::GetServicePort(); |
| 992 if (service_port != ILLEGAL_PORT) { | 1012 if (service_port != ILLEGAL_PORT) { |
| 993 // Return a send port for the service port. | 1013 // Return a send port for the service port. |
| 994 Dart_Handle send_port = Dart_NewSendPort(service_port); | 1014 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 995 Dart_SetReturnValue(args, send_port); | 1015 Dart_SetReturnValue(args, send_port); |
| 996 } | 1016 } |
| 997 Dart_ExitScope(); | 1017 Dart_ExitScope(); |
| 998 } | 1018 } |
| OLD | NEW |