cleanup
This commit is contained in:
+46
-74
@@ -643,27 +643,22 @@ EXPresolve_op_default( Expression e, Scope s ) {
|
||||
}
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Type
|
||||
EXPresolve_op_unknown( Expression e, Scope s ) {
|
||||
Type EXPresolve_op_unknown( Expression e, Scope s ) {
|
||||
ERRORreport( ERROR_internal_unrecognized_op_in_EXPresolve );
|
||||
return Type_Bad;
|
||||
}
|
||||
|
||||
typedef Type Resolve_expr_func PROTO( ( Expression , Scope ) );
|
||||
|
||||
Type
|
||||
EXPresolve_op_logical( Expression e, Scope s ) {
|
||||
Type EXPresolve_op_logical( Expression e, Scope s ) {
|
||||
EXPresolve_op_default( e, s );
|
||||
return( Type_Logical );
|
||||
}
|
||||
|
||||
Type
|
||||
EXPresolve_op_array_like( Expression e, Scope s ) {
|
||||
Type op1type, lasttype = 0;
|
||||
Type EXPresolve_op_array_like( Expression e, Scope s ) {
|
||||
|
||||
EXPresolve_op_default( e, s );
|
||||
op1type = e->e.op1->return_type;
|
||||
Type op1type = e->e.op1->return_type;
|
||||
|
||||
if( TYPEis_aggregate( op1type ) ) {
|
||||
return( op1type->u.type->body->base );
|
||||
@@ -726,21 +721,18 @@ EXPresolve_op_array_like( Expression e, Scope s ) {
|
||||
return( Type_Unknown );
|
||||
}
|
||||
|
||||
Type
|
||||
EXPresolve_op_entity_constructor( Expression e, Scope s ) {
|
||||
Type EXPresolve_op_entity_constructor( Expression e, Scope s ) {
|
||||
EXPresolve_op_default( e, s );
|
||||
/* perhaps should return Type_Runtime? */
|
||||
return Type_Entity;
|
||||
}
|
||||
|
||||
Type
|
||||
EXPresolve_op_int_div_like( Expression e, Scope s ) {
|
||||
Type EXPresolve_op_int_div_like( Expression e, Scope s ) {
|
||||
EXPresolve_op_default( e, s );
|
||||
return Type_Integer;
|
||||
}
|
||||
|
||||
Type
|
||||
EXPresolve_op_plus_like( Expression e, Scope s ) {
|
||||
Type EXPresolve_op_plus_like( Expression e, Scope s ) {
|
||||
/* i.e., Integer or Real */
|
||||
EXPresolve_op_default( e, s );
|
||||
if( is_resolve_failed( e ) ) {
|
||||
@@ -769,8 +761,7 @@ EXPresolve_op_plus_like( Expression e, Scope s ) {
|
||||
return Type_Integer;
|
||||
}
|
||||
|
||||
Type
|
||||
EXPresolve_op_unary_minus( Expression e, Scope s ) {
|
||||
Type EXPresolve_op_unary_minus( Expression e, Scope s ) {
|
||||
EXPresolve_op_default( e, s );
|
||||
return e->e.op1->return_type;
|
||||
}
|
||||
@@ -780,8 +771,8 @@ resolve_func: resolves an expression of this type
|
||||
type_func: returns final type of expression of this type
|
||||
avoids resolution if possible
|
||||
*/
|
||||
void
|
||||
EXPop_create( int token_number, char * string, Resolve_expr_func * resolve_func ) {
|
||||
|
||||
void EXPop_create( int token_number, char * string, Resolve_expr_func * resolve_func ) {
|
||||
EXPop_table[token_number].token = string;
|
||||
EXPop_table[token_number].resolve = resolve_func;
|
||||
}
|
||||
@@ -900,19 +891,15 @@ EXPresolve_qualification( Expression expression, Scope scope, Error * experrc )
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: TERN_EXPcreate
|
||||
** Parameters: Op_Code op - operation
|
||||
** Expression operand1 - first operand
|
||||
** Expression operand2 - second operand
|
||||
** Expression operand3 - third operand
|
||||
** Error* experrc - buffer for error code
|
||||
** Returns: Ternary_Expression - the expression created
|
||||
** Description: Create a ternary operation Expression.
|
||||
/** \fn TERN_EXPcreate
|
||||
** \param op operation
|
||||
** \param operand1 - first operand
|
||||
** \param operand2 - second operand
|
||||
** \param operand3 - third operand
|
||||
** \returns Ternary_Expression - the expression created
|
||||
** Create a ternary operation Expression.
|
||||
*/
|
||||
|
||||
Expression
|
||||
TERN_EXPcreate( Op_Code op, Expression operand1, Expression operand2, Expression operand3 ) {
|
||||
Expression TERN_EXPcreate( Op_Code op, Expression operand1, Expression operand2, Expression operand3 ) {
|
||||
Expression e = EXPcreate( Type_Expression );
|
||||
|
||||
e->e.op_code = op;
|
||||
@@ -950,18 +937,15 @@ TERN_EXPget_third_operand( Ternary_Expression expression ) {
|
||||
|
||||
#endif /*0*/
|
||||
|
||||
/*
|
||||
** Procedure: BIN_EXPcreate
|
||||
** Parameters: Op_Code op - operation
|
||||
** Expression operand1 - first operand
|
||||
** Expression operand2 - second operand
|
||||
** Error* experrc - buffer for error code
|
||||
** Returns: Binary_Expression - the expression created
|
||||
** Description: Create a binary operation Expression.
|
||||
/**
|
||||
** \fn BIN_EXPcreate
|
||||
** \param op operation
|
||||
** \param operand1 - first operand
|
||||
** \param operand2 - second operand
|
||||
** \returns Binary_Expression - the expression created
|
||||
** Create a binary operation Expression.
|
||||
*/
|
||||
|
||||
Expression
|
||||
BIN_EXPcreate( Op_Code op, Expression operand1, Expression operand2 ) {
|
||||
Expression BIN_EXPcreate( Op_Code op, Expression operand1, Expression operand2 ) {
|
||||
Expression e = EXPcreate( Type_Expression );
|
||||
|
||||
e->e.op_code = op;
|
||||
@@ -989,17 +973,13 @@ BIN_EXPget_second_operand( Binary_Expression expression ) {
|
||||
}
|
||||
|
||||
#endif /*0*/
|
||||
/*
|
||||
** Procedure: UN_EXPcreate
|
||||
** Parameters: Op_Code op - operation
|
||||
** Expression operand - operand
|
||||
** Error* experrc - buffer for error code
|
||||
** Returns: Unary_Expression - the expression created
|
||||
** Description: Create a unary operation Expression.
|
||||
/** \fn UN_EXPcreate
|
||||
** \param op operation
|
||||
** \param operand operand
|
||||
** \returns the expression created
|
||||
** Create a unary operation Expression.
|
||||
*/
|
||||
|
||||
Expression
|
||||
UN_EXPcreate( Op_Code op, Expression operand ) {
|
||||
Expression UN_EXPcreate( Op_Code op, Expression operand ) {
|
||||
Expression e = EXPcreate( Type_Expression );
|
||||
|
||||
e->e.op_code = op;
|
||||
@@ -1424,18 +1404,14 @@ BIN_LITget_value( Binary_Literal literal, Error * experrc ) {
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: QUERYcreate
|
||||
** Parameters: String ident - local identifier for source elements
|
||||
** Expression source - source aggregate to query
|
||||
** Expression discriminant - discriminating expression for query
|
||||
** Error* experrc - buffer for error code
|
||||
** Returns: Query - the query expression created
|
||||
** Description: Create a query Expression.
|
||||
/** \fn QUERYcreate
|
||||
** \param local local identifier for source elements
|
||||
** \param aggregate source aggregate to query
|
||||
** \returns the query expression created
|
||||
** Create a query Expression.
|
||||
** NOTE Dec 2011 - MP - function description did not match actual params. Had to guess.
|
||||
*/
|
||||
|
||||
Expression
|
||||
QUERYcreate( Symbol * local, Expression aggregate ) {
|
||||
Expression QUERYcreate( Symbol * local, Expression aggregate ) {
|
||||
Expression e = EXPcreate_from_symbol( Type_Query, local );
|
||||
Scope s = SCOPEcreate_tiny( OBJ_QUERY );
|
||||
Expression e2 = EXPcreate_from_symbol( Type_Attribute, local );
|
||||
@@ -1512,16 +1488,13 @@ QUERYget_discriminant( Query expression ) {
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Procedure: EXPget_integer_value
|
||||
** Parameters: Expression expression - expression to evaluate
|
||||
** Error* experrc - buffer for error code
|
||||
** Returns: int - value of expression
|
||||
** Description: Compute the value of an integer expression.
|
||||
/** \fn EXPget_integer_value
|
||||
** \param expression expression to evaluate
|
||||
** \param experrc buffer for error code
|
||||
** \returns value of expression
|
||||
** Compute the value of an integer expression.
|
||||
*/
|
||||
|
||||
int
|
||||
EXPget_integer_value( Expression expression ) {
|
||||
int EXPget_integer_value( Expression expression ) {
|
||||
experrc = ERROR_none;
|
||||
if( expression == EXPRESSION_NULL ) {
|
||||
return 0;
|
||||
@@ -1534,8 +1507,7 @@ EXPget_integer_value( Expression expression ) {
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
opcode_print( Op_Code o ) {
|
||||
char * opcode_print( Op_Code o ) {
|
||||
switch( o ) {
|
||||
case OP_AND:
|
||||
return( "OP_AND" );
|
||||
|
||||
Reference in New Issue
Block a user