KRASCHE
&
BYRNE
         ELZED  HOME       NEWS       DOCS       DOWNLOADS       LICENSING       SUPPORT       FAQ       ABOUT  US

What's An Elzed?
Features
Licensing
Downloads
Documentation
Elzed News
    ELZED 
 Documentation 
 Examples 
 Sample Code 

Select-Case Demo Sample Code

void SelectDemo( void )
{
	char	theExpression[ 128 ];
	char	szDemoFile[ 128 ];
	long	expLength;
	bool	keepLooping = true;
	long	lDefineOpResult = 0;

	lzCreatePublicContext( "SelectContext" );
	lzSetContext( "SelectContext", false );

	sprintf( szDemoFile, "%s%s", TEST_FILE_PATH_PREFIX, "select.lzo" );

	lDefineOpResult = lzReadExpOp(	kGlobalScope,
					"stepfunc",
					"prefix",
					"number",
					"number x",
					"sin",
					szDemoFile );

	if ( lDefineOpResult )
	{
		cout << "Failed to load STEPFUNC operator.\r\n";
		cout << lzGetLastErrorText() << "\r\n\n";
	}

	while ( keepLooping )
	{
		GetInputString( theExpression, 128 );
		expLength = strlen( theExpression );
		
		if ( expLength == 0 )
			keepLooping = false;

		else if ( (expLength == 1) && (theExpression[ 0 ] == '\r') )
			keepLooping = false;
			
		else if (theExpression[ 0 ] == '\\')
			keepLooping = false;

		else
		{
			cout << "  " << lzEvalExpStrToStr( theExpression ) << '\n';
			
			if ( lzGetLastErrorID() )
				cout << lzGetLastErrorText() << '\n';
				
			cout.flush();
		}
	}

	lzDestroyPublicContext( "SelectContext" );
}


  Copyright  ©  MMXXV  by  R R Le Cropane   •   All Rights Reserved   •   Terms of Use   •   Privacy Policy