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/dmcs
$                             set EXEC
$if %system.filesys% == UNIX $set EXEC $MPATH/mono

$if %system.buildcode% == VS8
$if not set flags $set flags /platform:x86
$if %system.buildcode% == WEI
$if not set flags $set flags /platform:x64
$if %system.buildcode% == LEG
$if not set flags $set flags
$if %system.buildcode% == DEG
$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'