|
of_performmath
|
|
Full name
|
pfc_u_calculator.of_performmath
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_performmath(ref double,string,double)
|
protected function integer of_performmath (ref double adbl_value, string as_operator, double idbl_operand);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_PerformMath
//
// Access: Protected
//
// Arguments:
// adbl_value(by reference) The running value.
// as_operator The operator.
// idbl_operand The number to be used on the calculation.
//
// Returns: Integer
// 1 if it succeeds
// -1 if an error occurs.
//
// Description: Perform the math according to the operator.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
CHOOSE CASE as_operator
CASE '/'
If idbl_operand = 0 Then
of_MessageBox('pfc_calculator_dividezero', 'Division', &
'Division by zero is not valid', Exclamation!, Ok!, 1)
Return -1
Else
adbl_value /= idbl_operand
End If
CASE '*'
adbl_value *= idbl_operand
CASE '+'
adbl_value += idbl_operand
CASE '-'
adbl_value -= idbl_operand
CASE ELSE
Return -1
END CHOOSE
Return 1
end function