OSDN Git Service

log/syslog: Fix name of C function syslog_c.
[pf3gnuchains/gcc-fork.git] / libgo / runtime / interface.h
1 /* interface.h -- the interface type for Go.
2
3    Copyright 2009 The Go Authors. All rights reserved.
4    Use of this source code is governed by a BSD-style
5    license that can be found in the LICENSE file.  */
6
7 #ifndef LIBGO_INTERFACE_H
8 #define LIBGO_INTERFACE_H
9
10 #include "go-type.h"
11
12 /* A variable of interface type is an instance of this struct, if the
13    interface has any methods.  */
14
15 struct __go_interface
16 {
17   /* A pointer to the interface method table.  The first pointer is
18      the type descriptor of the object.  Subsequent pointers are
19      pointers to functions.  This is effectively the vtable for this
20      interface.  The function pointers are in the same order as the
21      list in the internal representation of the interface, which sorts
22      them by name.  */
23   const void **__methods;
24
25   /* The object.  If the object is a pointer--if the type descriptor
26      code is GO_PTR or GO_UNSAFE_POINTER--then this field is the value
27      of the object itself.  Otherwise this is a pointer to memory
28      which holds the value.  */
29   void *__object;
30 };
31
32 /* A variable of an empty interface type is an instance of this
33    struct.  */
34
35 struct __go_empty_interface
36 {
37   /* The type descriptor of the object.  */
38   const struct __go_type_descriptor *__type_descriptor;
39
40   /* The object.  This is the same as __go_interface above.  */
41   void *__object;
42 };
43
44 extern void *
45 __go_convert_interface (const struct __go_type_descriptor *,
46                         const struct __go_type_descriptor *);
47
48 extern void *
49 __go_convert_interface_2 (const struct __go_type_descriptor *,
50                           const struct __go_type_descriptor *,
51                           _Bool may_fail);
52
53 extern _Bool
54 __go_can_convert_to_interface(const struct __go_type_descriptor *,
55                               const struct __go_type_descriptor *);
56
57 #endif /* !defined(LIBGO_INTERFACE_H) */