C# 클래스 ABT.TypeCast

상속: Expr
파일 보기 프로젝트 열기: phisiart/C-Compiler 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Expr Expr
Kind TypeCastType

공개 메소드들

메소드 설명
CGenAddress ( CGenState state ) : void
CGenValue ( CGenState state ) : System.Reg
EqualType ( ExprType t1, ExprType t2 ) : System.Boolean
FloatToArith ( Expr expr, ExprType type ) : Expr

From: float, double To: char, uchar, short, ushort, long, ulong, float, double

According to MSDN "Conversions from Floating-Point Types", float cannot convert to unsigned char. I don't know why, but I follow it.

FromPointer ( Expr expr, ExprType type, Env env ) : Expr

From: pointer To: pointer, integral

IntegralPromotion ( Expr expr ) : ExprTypeKind>.Tuple

All integrals are converted to LongType or ULongType.

MakeCast ( Expr expr, ExprType type ) : Expr
MakeCast ( Expr expr, ExprType type, Env env ) : Expr
SignedIntegralToArith ( Expr expr, ExprType type ) : Expr

From: char, short, long To: char, uchar, short, ushort, long, ulong, float double

ToPointer ( Expr expr, ExprType type, Env env ) : Expr

From: pointer, integral To: pointer

TypeCast ( TypeCastType kind, Expr expr, ExprType type ) : System
UnsignedIntegralToArith ( Expr expr, ExprType type ) : Expr

From: uchar, ushort, ulong To: char, uchar, short, ushort, long, ulong, float, double

Aaccording to MSDN "Conversions from Unsigned Integral Types", unsigned long converts directly to double. However, I just treat unsigned long as long.

UsualArithmeticConversion ( Expr e1, Expr e2 ) : Tuple

Perform the usual arithmetic conversion on two expressions.

If either expression is DoubleType, then both are converted to DoubleType.

Else, if either expression is FloatType, then both are converted to FloatType.

Else, if either expression is ULongType, then both are converted to ULongType.

Else, both are converted to LongType.

UsualScalarConversion ( Expr e1, Expr e2 ) : Tuple

First, convert pointers to ULongType's, then do UsualArithmeticConversion.

비공개 메소드들

메소드 설명
TypeCast ( TypeCastType kind, Expr expr, ExprType type, Env env ) : System

메소드 상세

CGenAddress() 공개 메소드

public CGenAddress ( CGenState state ) : void
state CodeGeneration.CGenState
리턴 void

CGenValue() 공개 메소드

public CGenValue ( CGenState state ) : System.Reg
state CodeGeneration.CGenState
리턴 System.Reg

EqualType() 공개 정적인 메소드

public static EqualType ( ExprType t1, ExprType t2 ) : System.Boolean
t1 ExprType
t2 ExprType
리턴 System.Boolean

FloatToArith() 공개 정적인 메소드

From: float, double To: char, uchar, short, ushort, long, ulong, float, double
According to MSDN "Conversions from Floating-Point Types", float cannot convert to unsigned char. I don't know why, but I follow it.
public static FloatToArith ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
리턴 Expr

FromPointer() 공개 정적인 메소드

From: pointer To: pointer, integral
public static FromPointer ( Expr expr, ExprType type, Env env ) : Expr
expr Expr
type ExprType
env Env
리턴 Expr

IntegralPromotion() 공개 정적인 메소드

All integrals are converted to LongType or ULongType.
public static IntegralPromotion ( Expr expr ) : ExprTypeKind>.Tuple
expr Expr /// The integral expression to be casted. ///
리턴 ExprTypeKind>.Tuple

MakeCast() 공개 정적인 메소드

public static MakeCast ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
리턴 Expr

MakeCast() 공개 정적인 메소드

public static MakeCast ( Expr expr, ExprType type, Env env ) : Expr
expr Expr
type ExprType
env Env
리턴 Expr

SignedIntegralToArith() 공개 정적인 메소드

From: char, short, long To: char, uchar, short, ushort, long, ulong, float double
public static SignedIntegralToArith ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
리턴 Expr

ToPointer() 공개 정적인 메소드

From: pointer, integral To: pointer
public static ToPointer ( Expr expr, ExprType type, Env env ) : Expr
expr Expr
type ExprType
env Env
리턴 Expr

TypeCast() 공개 메소드

public TypeCast ( TypeCastType kind, Expr expr, ExprType type ) : System
kind TypeCastType
expr Expr
type ExprType
리턴 System

UnsignedIntegralToArith() 공개 정적인 메소드

From: uchar, ushort, ulong To: char, uchar, short, ushort, long, ulong, float, double
Aaccording to MSDN "Conversions from Unsigned Integral Types", unsigned long converts directly to double. However, I just treat unsigned long as long.
public static UnsignedIntegralToArith ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
리턴 Expr

UsualArithmeticConversion() 공개 정적인 메소드

Perform the usual arithmetic conversion on two expressions.

If either expression is DoubleType, then both are converted to DoubleType.

Else, if either expression is FloatType, then both are converted to FloatType.

Else, if either expression is ULongType, then both are converted to ULongType.

Else, both are converted to LongType.

public static UsualArithmeticConversion ( Expr e1, Expr e2 ) : Tuple
e1 Expr The first expression to be casted. Must have .
e2 Expr The second expression to be casted. Must have .
리턴 Tuple

UsualScalarConversion() 공개 정적인 메소드

First, convert pointers to ULongType's, then do UsualArithmeticConversion.
public static UsualScalarConversion ( Expr e1, Expr e2 ) : Tuple
e1 Expr /// The first expression to be casted. ///
e2 Expr /// The second expression to be casted. ///
리턴 Tuple

프로퍼티 상세

Expr 공개적으로 프로퍼티

public Expr,ABT Expr
리턴 Expr

Kind 공개적으로 프로퍼티

public TypeCastType Kind
리턴 TypeCastType