}
type ReadWrite interface {
- Read(p []byte) (n int, err *os.Error);
- Write(p []byte) (n int, err *os.Error);
+ Read;
+ Write;
}
type ReadClose interface {
- Read(p []byte) (n int, err *os.Error);
- Close() *os.Error;
+ Read;
+ Close;
}
type WriteClose interface {
- Write(p []byte) (n int, err *os.Error);
- Close() *os.Error;
+ Write;
+ Close;
}
type ReadWriteClose interface {
- Read(p []byte) (n int, err *os.Error);
- Write(p []byte) (n int, err *os.Error);
- Close() *os.Error;
+ Read;
+ Write;
+ Close;
}
// Convert a string to an array of bytes for easy marshaling.
var (
Missing = newBasicType(missingString, MissingKind, 1);
DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, 16); // TODO(r): size of interface?
- Bool = newBasicType("bool", BoolKind, 1); // TODO: need to know how big a bool is
- Int = newBasicType("int", IntKind, 4); // TODO: need to know how big an int is
+ Bool = newBasicType("bool", BoolKind, unsafe.Sizeof(true));
+ Int = newBasicType("int", IntKind, unsafe.Sizeof(int(0)));
Int8 = newBasicType("int8", Int8Kind, 1);
Int16 = newBasicType("int16", Int16Kind, 2);
Int32 = newBasicType("int32", Int32Kind, 4);
Int64 = newBasicType("int64", Int64Kind, 8);
- Uint = newBasicType("uint", UintKind, 4); // TODO: need to know how big a uint is
+ Uint = newBasicType("uint", UintKind, unsafe.Sizeof(uint(0)));
Uint8 = newBasicType("uint8", Uint8Kind, 1);
Uint16 = newBasicType("uint16", Uint16Kind, 2);
Uint32 = newBasicType("uint32", Uint32Kind, 4);
Uint64 = newBasicType("uint64", Uint64Kind, 8);
- Uintptr = newBasicType("uintptr", UintptrKind, 8); // TODO: need to know how big a uintptr is
- Float = newBasicType("float", FloatKind, 4); // TODO: need to know how big a float is
+ Uintptr = newBasicType("uintptr", UintptrKind, unsafe.Sizeof(uintptr(0)));
+ Float = newBasicType("float", FloatKind, unsafe.Sizeof(float(0)));
Float32 = newBasicType("float32", Float32Kind, 4);
Float64 = newBasicType("float64", Float64Kind, 8);
Float80 = newBasicType("float80", Float80Kind, 10); // TODO: strange size?
- String = newBasicType("string", StringKind, 8); // implemented as a pointer
+ // TODO(rsc): Sizeof("") should work, doesn't.
+ String = newBasicType("string", StringKind, unsafe.Sizeof(string(0)));
)
// Stub types allow us to defer evaluating type names until needed.
// -- Pointer
type PtrType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
Sub() Type
}
// -- Array
type ArrayType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
IsSlice() bool;
Len() int;
Elem() Type;
// -- Map
type MapType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
Key() Type;
Elem() Type;
}
// -- Chan
type ChanType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
Dir() int;
Elem() Type;
}
// -- Struct
type StructType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
Field(int) (name string, typ Type, tag string, offset int);
Len() int;
}
// -- Interface
type InterfaceType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
Field(int) (name string, typ Type, tag string, offset int);
Len() int;
}
// -- Func
type FuncType interface {
- // TODO: Type;
- Kind() int;
- Name() string;
- String() string;
- Size() int;
-
+ Type;
In() StructType;
Out() StructType;
}
// -- Missing
type MissingValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
+ Value;
}
type missingValueStruct struct {
// -- Int
type IntValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() int;
Set(int);
}
// -- Int8
type Int8Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() int8;
Set(int8);
}
// -- Int16
type Int16Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() int16;
Set(int16);
}
// -- Int32
type Int32Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() int32;
Set(int32);
}
// -- Int64
type Int64Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() int64;
Set(int64);
}
// -- Uint
type UintValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() uint;
Set(uint);
}
// -- Uint8
type Uint8Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() uint8;
Set(uint8);
}
// -- Uint16
type Uint16Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() uint16;
Set(uint16);
}
// -- Uint32
type Uint32Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() uint32;
Set(uint32);
}
// -- Uint64
type Uint64Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() uint64;
Set(uint64);
}
// -- Uintptr
type UintptrValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() uintptr;
Set(uintptr);
}
// -- Float
type FloatValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() float;
Set(float);
}
// -- Float32
type Float32Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() float32;
Set(float32);
}
// -- Float64
type Float64Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() float64;
Set(float64);
}
// -- Float80
type Float80Value interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() float80;
Set(float80);
}
// -- String
type StringValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() string;
Set(string);
}
// -- Bool
type BoolValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() bool;
Set(bool);
}
// -- Pointer
type PtrValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Sub() Value;
Get() Addr;
SetSub(Value);
// Slices and arrays are represented by the same interface.
type ArrayValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
IsSlice() bool;
Len() int;
Cap() int;
// -- Map TODO: finish and test
type MapValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Len() int;
Elem(key Value) Value;
}
// -- Chan
type ChanValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
+ Value;
}
type chanValueStruct struct {
// -- Struct
type StructValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Len() int;
Field(i int) Value;
}
// -- Interface
type InterfaceValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
-
+ Value;
Get() interface {};
}
// -- Func
type FuncValue interface {
- // TODO: Value;
- Kind() int;
- Type() Type;
- Addr() Addr;
- Interface() interface {};
+ Value;
}
type funcValueStruct struct {