| Command Line Demo Sample Code
void CommandLine( void )
{
char theExpression[ 1024 ];
bool keepLooping = true;
lzClearContext();
lzSetRadixMark( kRadixPeriod );
lzSetAllowImpliedMult( false );
//lzSetBooleanTrue( kTrueNegOne );
lzCreatePrivateContext( "RadixTest" );
lzSetContext( "RadixTest", false );
//lzSetCoordinateFormat( kCoordPolar );
//lzSetAngleUnit( kAngleDegrees );
lzSetErrorCallback( MyErrorCallback );
while ( keepLooping )
{
GetInputString( theExpression, 1024 );
if ( (theExpression[ 0 ] == '\r') ||
(theExpression[ 0 ] == '\0') ||
(theExpression[ 0 ] == '\\') )
keepLooping = false;
else
{
cout << " " << lzEvalExpStrToStr( theExpression ) << '\n';
//cout << " " << lzEvalExpStrToNum( theExpression ) << '\n';
//cout << " " << lzEvalExpStrToBool( theExpression ) << '\n';
//cout << "type: " << lzGetLastResultType() << '\n';
//cout << "imaginary: " << lzGetLastImagResult() << '\n';
//cout << "real: " << lzGetLastRealResult() << '\n';
//cout << "numeric: " << lzGetLastNumResult() << '\n';
//cout << "string: " << lzGetLastStrResult() << '\n';
//cout << "boolean: " << lzGetLastBoolResult() << '\n';
if ( lzGetLastErrorID() )
cout << lzGetLastErrorText() << '\n';
cout.flush();
}
lzClearErrorCallback();
}
lzClearContext();
lzDestroyPrivateContext( "RadixTest" );
lzReset();
}
|