OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 <assert.h> | 5 #include <assert.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> |
8 | 9 |
9 #include "dart_archive.h" | 10 #include "dart_archive.h" |
10 #include "entry.h" | 11 #include "entry.h" |
11 #include "messaging.h" | 12 #include "messaging.h" |
12 #include "reader.h" | 13 #include "reader.h" |
13 | 14 |
14 /** The enumeration of request types for communicating with Dart. */ | 15 /** The enumeration of request types for communicating with Dart. */ |
15 enum RequestType { | 16 enum RequestType { |
16 kArchiveReadNew = 0, | 17 kArchiveReadNew = 0, |
17 kArchiveReadSupportFilterAll, | 18 kArchiveReadSupportFilterAll, |
18 kArchiveReadSupportFilterBzip2, | 19 kArchiveReadSupportFilterBzip2, |
19 kArchiveReadSupportFilterCompress, | 20 kArchiveReadSupportFilterCompress, |
20 kArchiveReadSupportFilterGzip, | 21 kArchiveReadSupportFilterGzip, |
21 kArchiveReadSupportFilterLzma, | 22 kArchiveReadSupportFilterLzma, |
22 kArchiveReadSupportFilterXz, | 23 kArchiveReadSupportFilterXz, |
23 kArchiveReadSupportFilterProgram, | 24 kArchiveReadSupportFilterProgram, |
24 kArchiveReadSupportFilterProgramSignature, | 25 kArchiveReadSupportFilterProgramSignature, |
25 kArchiveReadSupportFormatAll, | 26 kArchiveReadSupportFormatAll, |
26 kArchiveReadSupportFormatAr, | 27 kArchiveReadSupportFormatAr, |
27 kArchiveReadSupportFormatCpio, | 28 kArchiveReadSupportFormatCpio, |
28 kArchiveReadSupportFormatEmpty, | 29 kArchiveReadSupportFormatEmpty, |
29 kArchiveReadSupportFormatIso9660, | 30 kArchiveReadSupportFormatIso9660, |
30 kArchiveReadSupportFormatMtree, | 31 kArchiveReadSupportFormatMtree, |
31 kArchiveReadSupportFormatRaw, | 32 kArchiveReadSupportFormatRaw, |
32 kArchiveReadSupportFormatTar, | 33 kArchiveReadSupportFormatTar, |
33 kArchiveReadSupportFormatZip, | 34 kArchiveReadSupportFormatZip, |
34 kArchiveReadSetFilterOptions, | 35 kArchiveReadSetFilterOption, |
35 kArchiveReadSetFormatOptions, | 36 kArchiveReadSetFormatOption, |
36 kArchiveReadSetOptions, | 37 kArchiveReadSetOption, |
37 kArchiveReadOpenFilename, | 38 kArchiveReadOpenFilename, |
38 kArchiveReadOpenMemory, | 39 kArchiveReadOpenMemory, |
39 kArchiveReadNextHeader, | 40 kArchiveReadNextHeader, |
40 kArchiveReadDataBlock, | 41 kArchiveReadDataBlock, |
41 kArchiveReadDataSkip, | 42 kArchiveReadDataSkip, |
42 kArchiveReadClose, | 43 kArchiveReadClose, |
43 kArchiveReadFree, | 44 kArchiveReadFree, |
44 kArchiveEntryClone, | 45 kArchiveEntryClone, |
45 kArchiveEntryFree, | 46 kArchiveEntryFree, |
46 kArchiveEntryNew, | 47 kArchiveEntryNew, |
47 kArchiveEntrySetHardlink, | 48 kArchiveEntrySetHardlink, |
48 kArchiveEntrySetPathname, | 49 kArchiveEntrySetPathname, |
49 kArchiveEntrySetSourcepath, | |
50 kArchiveEntrySetSymlink, | 50 kArchiveEntrySetSymlink, |
51 kArchiveEntrySetGid, | 51 kArchiveEntrySetGid, |
52 kArchiveEntrySetUid, | 52 kArchiveEntrySetUid, |
53 kArchiveEntrySetPerm, | 53 kArchiveEntrySetPerm, |
54 kArchiveEntrySetGname, | 54 kArchiveEntrySetGname, |
55 kArchiveEntrySetUname, | 55 kArchiveEntrySetUname, |
56 kArchiveEntrySetFflagsSet, | 56 kArchiveEntrySetFflagsSet, |
57 kArchiveEntrySetFflagsClear, | 57 kArchiveEntrySetFflagsClear, |
58 kArchiveEntrySetFflagsText, | 58 kArchiveEntrySetFflagsText, |
59 kArchiveEntrySetFiletype, | 59 kArchiveEntrySetFiletype, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 break; | 162 break; |
163 case kArchiveReadSupportFormatRaw: | 163 case kArchiveReadSupportFormatRaw: |
164 archiveReadSupportFormatRaw(reply_port_id, (struct archive*) ptr); | 164 archiveReadSupportFormatRaw(reply_port_id, (struct archive*) ptr); |
165 break; | 165 break; |
166 case kArchiveReadSupportFormatTar: | 166 case kArchiveReadSupportFormatTar: |
167 archiveReadSupportFormatTar(reply_port_id, (struct archive*) ptr); | 167 archiveReadSupportFormatTar(reply_port_id, (struct archive*) ptr); |
168 break; | 168 break; |
169 case kArchiveReadSupportFormatZip: | 169 case kArchiveReadSupportFormatZip: |
170 archiveReadSupportFormatZip(reply_port_id, (struct archive*) ptr); | 170 archiveReadSupportFormatZip(reply_port_id, (struct archive*) ptr); |
171 break; | 171 break; |
172 case kArchiveReadSetFilterOptions: | 172 case kArchiveReadSetFilterOption: |
173 archiveReadSetFilterOptions(reply_port_id, (struct archive*) ptr, message); | 173 archiveReadSetFilterOption(reply_port_id, (struct archive*) ptr, message); |
174 break; | 174 break; |
175 case kArchiveReadSetFormatOptions: | 175 case kArchiveReadSetFormatOption: |
176 archiveReadSetFormatOptions(reply_port_id, (struct archive*) ptr, message); | 176 archiveReadSetFormatOption(reply_port_id, (struct archive*) ptr, message); |
177 break; | 177 break; |
178 case kArchiveReadSetOptions: | 178 case kArchiveReadSetOption: |
179 archiveReadSetOptions(reply_port_id, (struct archive*) ptr, message); | 179 archiveReadSetOption(reply_port_id, (struct archive*) ptr, message); |
180 break; | 180 break; |
181 case kArchiveReadOpenFilename: | 181 case kArchiveReadOpenFilename: |
182 archiveReadOpenFilename(reply_port_id, (struct archive*) ptr, message); | 182 archiveReadOpenFilename(reply_port_id, (struct archive*) ptr, message); |
183 break; | 183 break; |
184 case kArchiveReadOpenMemory: | 184 case kArchiveReadOpenMemory: |
185 archiveReadOpenMemory(reply_port_id, (struct archive*) ptr, message); | 185 archiveReadOpenMemory(reply_port_id, (struct archive*) ptr, message); |
186 break; | 186 break; |
187 case kArchiveReadNextHeader: | 187 case kArchiveReadNextHeader: |
188 archiveReadNextHeader(reply_port_id, (struct archive*) ptr); | 188 archiveReadNextHeader(reply_port_id, (struct archive*) ptr); |
189 break; | 189 break; |
(...skipping 19 matching lines...) Expand all Loading... |
209 archiveEntryNew(reply_port_id); | 209 archiveEntryNew(reply_port_id); |
210 break; | 210 break; |
211 case kArchiveEntrySetHardlink: | 211 case kArchiveEntrySetHardlink: |
212 archiveEntrySetHardlink( | 212 archiveEntrySetHardlink( |
213 reply_port_id, (struct archive_entry*) ptr, message); | 213 reply_port_id, (struct archive_entry*) ptr, message); |
214 break; | 214 break; |
215 case kArchiveEntrySetPathname: | 215 case kArchiveEntrySetPathname: |
216 archiveEntrySetPathname( | 216 archiveEntrySetPathname( |
217 reply_port_id, (struct archive_entry*) ptr, message); | 217 reply_port_id, (struct archive_entry*) ptr, message); |
218 break; | 218 break; |
219 case kArchiveEntrySetSourcepath: | |
220 archiveEntrySetSourcepath( | |
221 reply_port_id, (struct archive_entry*) ptr, message); | |
222 break; | |
223 case kArchiveEntrySetSymlink: | 219 case kArchiveEntrySetSymlink: |
224 archiveEntrySetSymlink(reply_port_id, (struct archive_entry*) ptr, message); | 220 archiveEntrySetSymlink(reply_port_id, (struct archive_entry*) ptr, message); |
225 break; | 221 break; |
226 case kArchiveEntrySetGid: | 222 case kArchiveEntrySetGid: |
227 archiveEntrySetGid(reply_port_id, (struct archive_entry*) ptr, message); | 223 archiveEntrySetGid(reply_port_id, (struct archive_entry*) ptr, message); |
228 break; | 224 break; |
229 case kArchiveEntrySetUid: | 225 case kArchiveEntrySetUid: |
230 archiveEntrySetUid(reply_port_id, (struct archive_entry*) ptr, message); | 226 archiveEntrySetUid(reply_port_id, (struct archive_entry*) ptr, message); |
231 break; | 227 break; |
232 case kArchiveEntrySetPerm: | 228 case kArchiveEntrySetPerm: |
233 archiveEntrySetPerm(reply_port_id, (struct archive_entry*) ptr, message); | 229 archiveEntrySetPerm(reply_port_id, (struct archive_entry*) ptr, message); |
234 break; | 230 break; |
235 case kArchiveEntrySetGname: | 231 case kArchiveEntrySetGname: |
236 archiveEntrySetGname(reply_port_id, (struct archive_entry*) ptr, message); | 232 archiveEntrySetGname(reply_port_id, (struct archive_entry*) ptr, message); |
237 break; | 233 break; |
238 case kArchiveEntrySetUname: | 234 case kArchiveEntrySetUname: |
239 archiveEntrySetUname(reply_port_id, (struct archive_entry*) ptr, message); | 235 archiveEntrySetUname(reply_port_id, (struct archive_entry*) ptr, message); |
240 break; | 236 break; |
241 case kArchiveEntrySetFflagsSet: | 237 case kArchiveEntrySetFflagsSet: |
242 archiveEntrySetFflagsSet( | 238 archiveEntrySetFflagsSet( |
243 reply_port_id, (struct archive_entry*) ptr, message); | 239 reply_port_id, (struct archive_entry*) ptr, message); |
244 break; | 240 break; |
245 case kArchiveEntrySetFflagsClear: | 241 case kArchiveEntrySetFflagsClear: |
246 archiveEntrySetFflagsClear( | 242 archiveEntrySetFflagsClear( |
247 reply_port_id, (struct archive_entry*) ptr, message); | 243 reply_port_id, (struct archive_entry*) ptr, message); |
248 break; | 244 break; |
249 case kArchiveEntrySetFflagsText: | |
250 archiveEntrySetFflagsText( | |
251 reply_port_id, (struct archive_entry*) ptr, message); | |
252 break; | |
253 case kArchiveEntrySetFiletype: | 245 case kArchiveEntrySetFiletype: |
254 archiveEntrySetFiletype( | 246 archiveEntrySetFiletype( |
255 reply_port_id, (struct archive_entry*) ptr, message); | 247 reply_port_id, (struct archive_entry*) ptr, message); |
256 break; | 248 break; |
257 case kArchiveEntrySetMode: | 249 case kArchiveEntrySetMode: |
258 archiveEntrySetMode(reply_port_id, (struct archive_entry*) ptr, message); | 250 archiveEntrySetMode(reply_port_id, (struct archive_entry*) ptr, message); |
259 break; | 251 break; |
260 case kArchiveEntrySetSize: | 252 case kArchiveEntrySetSize: |
261 archiveEntrySetSize(reply_port_id, (struct archive_entry*) ptr, message); | 253 archiveEntrySetSize(reply_port_id, (struct archive_entry*) ptr, message); |
262 break; | 254 break; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 406 |
415 /** Initializes the C extension. */ | 407 /** Initializes the C extension. */ |
416 DART_EXPORT Dart_Handle dart_archive_Init(Dart_Handle parent_library) { | 408 DART_EXPORT Dart_Handle dart_archive_Init(Dart_Handle parent_library) { |
417 if (Dart_IsError(parent_library)) return parent_library; | 409 if (Dart_IsError(parent_library)) return parent_library; |
418 | 410 |
419 Dart_Handle result_code = Dart_SetNativeResolver(parent_library, resolveName); | 411 Dart_Handle result_code = Dart_SetNativeResolver(parent_library, resolveName); |
420 if (Dart_IsError(result_code)) return result_code; | 412 if (Dart_IsError(result_code)) return result_code; |
421 | 413 |
422 return Dart_Null(); | 414 return Dart_Null(); |
423 } | 415 } |
OLD | NEW |