CSex1.gms : Test expert level C# API to read and write GDX

Description

Contributor: Lutz Westermann, October 2012


Small Model of Type : .Net


Category : GAMS API library


Main file : CSex1.gms

$title 'Test expert level C# API to read and write GDX' (CSEX1,SEQ=4)

$onText
Contributor: Lutz Westermann, October 2012
$offText


$set srcRoot %gams.sysdir%apifiles%system.dirsep%CSharp%system.dirsep%

$escape &
$if %system.filesys% == UNIX
$if %sysenv.MPATH% == %&sysenv.MPATH%& $abort.noError Need Mono to run this on Unix

$                             set COMP csc.exe
$if %system.filesys% == UNIX $set COMP $MPATH/mcs
$                             set EXEC
$if %system.filesys% == UNIX $set EXEC $MPATH/mono

$if %system.platform% == WEX
$if not set flags $set flags /platform:x64
$if %system.platform% == LEX
$if not set flags $set flags
$if %system.platform% == DEX
$if not set flags $set flags /define:__APPLE__
$if %system.platform% == DAX
$if not set flags $set flags /define:__APPLE__

$call rm -rf demanddata.gdx

$call %COMP% %flags% -out:xp_example1.exe "%srcRoot%xp_example1%system.dirsep%xp_example1.cs" "%srcRoot%api%system.dirsep%gdxcs.cs" "%srcRoot%api%system.dirsep%gamsglobals.cs"
$if errorlevel 1 $abort 'Problem compiling xp_example1.cs'
$call %EXEC% xp_example1.exe "%gams.sysdir%."
$if errorlevel 1 $abort 'Problem executing xp_example1 writing GDX file'
$call gdxdiff demanddata.gdx demandwant.gdx
$if errorlevel 1 $abort 'Demanddata not as expected'
$call %EXEC% xp_example1.exe "%gams.sysdir%." trnsport.gdx
$if errorlevel 1 $abort 'Problem executing xp_example1 reading GDX file'