89ef11e004
- Modify bin.gypi to ensure that the io library and patch files are read directly from the sources. Remove the source buffer generation step in the gypi files for all the io library and patch files. - Restructure the code a bit to eliminate some code duplication. - Delete runtime/tools/concat_library.py R=ager@google.com, sgjesse@google.com Review URL: https://codereview.chromium.org//14752008 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22514 260f80e4-7a28-3924-810f-c04153c831b5
80 lines
2.3 KiB
C++
80 lines
2.3 KiB
C++
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef BIN_BUILTIN_H_
|
|
#define BIN_BUILTIN_H_
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "include/dart_api.h"
|
|
|
|
#include "platform/assert.h"
|
|
#include "platform/globals.h"
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
#define FUNCTION_NAME(name) Builtin_##name
|
|
#define REGISTER_FUNCTION(name, count) \
|
|
{ ""#name, FUNCTION_NAME(name), count },
|
|
#define DECLARE_FUNCTION(name, count) \
|
|
extern void FUNCTION_NAME(name)(Dart_NativeArguments args);
|
|
|
|
|
|
class Builtin {
|
|
public:
|
|
// Note: Changes to this enum should be accompanied with changes to
|
|
// the builtin_libraries_ array in builtin.cc and builtin_nolib.cc.
|
|
enum BuiltinLibraryId {
|
|
kBuiltinLibrary = 0,
|
|
kIOLibrary,
|
|
|
|
kInvalidLibrary,
|
|
};
|
|
|
|
// Get source corresponding to built in library specified in 'id'.
|
|
static Dart_Handle Source(BuiltinLibraryId id);
|
|
|
|
// Get source of part file specified in 'uri'.
|
|
static Dart_Handle PartSource(BuiltinLibraryId id, const char* part_uri);
|
|
|
|
// Setup native resolver method built in library specified in 'id'.
|
|
static void SetNativeResolver(BuiltinLibraryId id);
|
|
|
|
// Check if built in library specified in 'id' is already loaded, if not
|
|
// load it.
|
|
static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id);
|
|
|
|
private:
|
|
// Map specified URI to an actual file name from 'source_paths' and read
|
|
// the file.
|
|
static Dart_Handle GetSource(const char** source_paths, const char* uri);
|
|
|
|
// Native method support.
|
|
static Dart_NativeFunction NativeLookup(Dart_Handle name,
|
|
int argument_count);
|
|
|
|
static const char* builtin_source_paths_[];
|
|
static const char* io_source_paths_[];
|
|
static const char* io_patch_paths_[];
|
|
|
|
typedef struct {
|
|
const char* url_;
|
|
const char** source_paths_;
|
|
const char* patch_url_;
|
|
const char** patch_paths_;
|
|
bool has_natives_;
|
|
} builtin_lib_props;
|
|
static builtin_lib_props builtin_libraries_[];
|
|
|
|
DISALLOW_ALLOCATION();
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin);
|
|
};
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|
|
|
|
#endif // BIN_BUILTIN_H_
|