Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: src/vm/ffi_posix.cc

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/vm/ffi_macos.cc ('k') | src/vm/ffi_static.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if defined(FLETCH_TARGET_OS_POSIX) 5 #if defined(DARTINO_TARGET_OS_POSIX)
6 6
7 #ifdef FLETCH_ENABLE_FFI 7 #ifdef DARTINO_ENABLE_FFI
8 8
9 #include "src/vm/ffi.h" 9 #include "src/vm/ffi.h"
10 10
11 #include <dlfcn.h> 11 #include <dlfcn.h>
12 #include <errno.h> 12 #include <errno.h>
13 #include <libgen.h> 13 #include <libgen.h>
14 #include <sys/param.h> 14 #include <sys/param.h>
15 15
16 #include "src/shared/platform.h" 16 #include "src/shared/platform.h"
17 #include "src/shared/utils.h" 17 #include "src/shared/utils.h"
18 18
19 #include "src/vm/natives.h" 19 #include "src/vm/natives.h"
20 #include "src/vm/object.h" 20 #include "src/vm/object.h"
21 #include "src/vm/process.h" 21 #include "src/vm/process.h"
22 22
23 namespace fletch { 23 namespace dartino {
24 24
25 char* ForeignUtils::DirectoryName(char* path, char* buffer, size_t len) { 25 char* ForeignUtils::DirectoryName(char* path, char* buffer, size_t len) {
26 strncpy(buffer, path, len); 26 strncpy(buffer, path, len);
27 buffer[len - 1] = '\0'; 27 buffer[len - 1] = '\0';
28 return dirname(buffer); 28 return dirname(buffer);
29 } 29 }
30 30
31 class DefaultLibraryEntry { 31 class DefaultLibraryEntry {
32 public: 32 public:
33 DefaultLibraryEntry(void* handle, DefaultLibraryEntry* next) 33 DefaultLibraryEntry(void* handle, DefaultLibraryEntry* next)
(...skipping 29 matching lines...) Expand all
63 delete current; 63 delete current;
64 current = next; 64 current = next;
65 } 65 }
66 delete mutex_; 66 delete mutex_;
67 } 67 }
68 68
69 bool ForeignFunctionInterface::AddDefaultSharedLibrary(const char* library) { 69 bool ForeignFunctionInterface::AddDefaultSharedLibrary(const char* library) {
70 ScopedLock lock(mutex_); 70 ScopedLock lock(mutex_);
71 void* handle = dlopen(library, RTLD_LOCAL | RTLD_LAZY); 71 void* handle = dlopen(library, RTLD_LOCAL | RTLD_LAZY);
72 if (handle != NULL) { 72 if (handle != NULL) {
73 // We have to maintain the insertion order (see fletch_api.h). 73 // We have to maintain the insertion order (see dartino_api.h).
74 if (libraries_ == NULL) { 74 if (libraries_ == NULL) {
75 libraries_ = new DefaultLibraryEntry(handle, libraries_); 75 libraries_ = new DefaultLibraryEntry(handle, libraries_);
76 } else { 76 } else {
77 libraries_->append(new DefaultLibraryEntry(handle, libraries_)); 77 libraries_->append(new DefaultLibraryEntry(handle, libraries_));
78 } 78 }
79 return true; 79 return true;
80 } 80 }
81 return false; 81 return false;
82 } 82 }
83 83
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (wrote > MAXPATHLEN) { 152 if (wrote > MAXPATHLEN) {
153 return Failure::index_out_of_bounds(); 153 return Failure::index_out_of_bounds();
154 } 154 }
155 return process->NewStringFromAscii(List<const char>(result, strlen(result))); 155 return process->NewStringFromAscii(List<const char>(result, strlen(result)));
156 } 156 }
157 END_NATIVE() 157 END_NATIVE()
158 158
159 BEGIN_NATIVE(ForeignErrno) { return Smi::FromWord(errno); } 159 BEGIN_NATIVE(ForeignErrno) { return Smi::FromWord(errno); }
160 END_NATIVE() 160 END_NATIVE()
161 161
162 } // namespace fletch 162 } // namespace dartino
163 163
164 #endif // FLETCH_ENABLE_FFI 164 #endif // DARTINO_ENABLE_FFI
165 165
166 #endif // defined(FLETCH_TARGET_OS_POSIX) 166 #endif // defined(DARTINO_TARGET_OS_POSIX)
OLDNEW
« no previous file with comments | « src/vm/ffi_macos.cc ('k') | src/vm/ffi_static.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698