Skip to content

Commit a7cb7b6

Browse files
committed
Merge branch 'develop' into 'main'
New GDX release 7.11.17 See merge request devel/gdx!111
2 parents 72b9186 + d97d40a commit a7cb7b6

21 files changed

Lines changed: 112 additions & 114 deletions

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ if (UNIX)
6666
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -funsigned-char") # aggressive signage warnings
6767
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DZ_HAVE_UNISTD_H")
6868
if (NOT APPLE AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
69-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-truncation=0 -Wno-cast-function-type")
69+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-truncation=0")
7070
endif ()
71+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-function-type")
7172
# strictly handle alignment and structure padding around flexible arrays (only newer compilers)
7273
if ((CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16) OR
7374
(CMAKE_CXX_COMPILER_ID MATCHES "GCC" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13))

changelog.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
- 7.11.17:
3+
- Include path to file that cannot be opened in error message after gdxOpenRead* failed due to missing file.
24
- 7.11.16:
35
- Drastically improve performance of `gdxOpenRead` for GDX files with many UELs by reducing the memory allocation count.
46
- Drop many GAMS infrastructure source files not actively used by GDX library.

generated/gdxcc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* C code generated by API Generator 1e87163 for gdx version 11
1+
/* C code generated by API Generator b6f04b9 for gdx version 11
22
*
33
* GAMS - Loading mechanism for GAMS Expert-Level APIs
44
*
5-
* Copyright (c) 2016-2024 GAMS Software GmbH <support@gams.com>
6-
* Copyright (c) 2016-2024 GAMS Development Corp. <support@gams.com>
5+
* Copyright (c) 2016-2025 GAMS Software GmbH <support@gams.com>
6+
* Copyright (c) 2016-2025 GAMS Development Corp. <support@gams.com>
77
*
88
* Permission is hereby granted, free of charge, to any person obtaining a copy
99
* of this software and associated documentation files (the "Software"), to deal
@@ -1180,7 +1180,7 @@ int GDX_CALLCONV d_gdxSymbolGetComment (gdxHandle_t pgdx, int SyNr, int N, char
11801180

11811181
/** Retrieve the domain of a symbol. Returns zero if the operation is not possible.
11821182
* @param pgdx gdx object handle
1183-
* @param SyNr The index number of the symbol (range 1..NrSymbols); SyNr = 0 reads universe.
1183+
* @param SyNr The index number of the symbol (must be in range 1..NrSymbols).
11841184
* @param DomainSyNrs Array (length=symbol dim) returning the set identifiers or "*"; DomainSyNrs[D] will contain the index number of the one dimensional set or alias used as the domain for index position D. A value of zero represents the universe "*".
11851185
*/
11861186
int GDX_CALLCONV d_gdxSymbolGetDomain (gdxHandle_t pgdx, int SyNr, int DomainSyNrs[])
@@ -1194,7 +1194,7 @@ int GDX_CALLCONV d_gdxSymbolGetDomain (gdxHandle_t pgdx, int SyNr, int DomainSy
11941194

11951195
/** Retrieve the domain of a symbol (using relaxed or domain information). Returns zero if the operation is not possible.
11961196
* @param pgdx gdx object handle
1197-
* @param SyNr The index number of the symbol (range 1..NrSymbols); SyNr = 0 reads universe.
1197+
* @param SyNr The index number of the symbol (must be in range 1..NrSymbols).
11981198
* @param DomainIDs DomainIDs[D] will contain the strings as they were stored with the call gdxSymbolSetDomainX. If gdxSymbolSetDomainX was never called, but gdxSymbolSetDomain was called, that information will be used instead. Length of this array should by dimensionality of the symbol. The special domain name "*" denotes the universe domain (all known UELs).
11991199
*/
12001200
int GDX_CALLCONV d_gdxSymbolGetDomainX (gdxHandle_t pgdx, int SyNr, char *DomainIDs[])

generated/gdxcc.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* gdxcc.h
22
* Header file for C-style interface to the GDX library
3-
* generated by API Generator 1e87163 for gdx version 11
3+
* generated by API Generator b6f04b9 for gdx version 11
44
*
55
* GAMS - Loading mechanism for GAMS Expert-Level APIs
66
*
7-
* Copyright (c) 2016-2024 GAMS Software GmbH <support@gams.com>
8-
* Copyright (c) 2016-2024 GAMS Development Corp. <support@gams.com>
7+
* Copyright (c) 2016-2025 GAMS Software GmbH <support@gams.com>
8+
* Copyright (c) 2016-2025 GAMS Development Corp. <support@gams.com>
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal
@@ -946,7 +946,7 @@ typedef int (GDX_CALLCONV *gdxSymbolGetDomain_t) (gdxHandle_t pgdx, int SyNr, i
946946
/** Retrieve the domain of a symbol. Returns zero if the operation is not possible.
947947
*
948948
* @param pgdx gdx object handle
949-
* @param SyNr The index number of the symbol (range 1..NrSymbols); SyNr = 0 reads universe.
949+
* @param SyNr The index number of the symbol (must be in range 1..NrSymbols).
950950
* @param DomainSyNrs Array (length=symbol dim) returning the set identifiers or "*"; DomainSyNrs[D] will contain the index number of the one dimensional set or alias used as the domain for index position D. A value of zero represents the universe "*".
951951
* @return Non-zero if the operation is possible, zero otherwise.
952952
*/
@@ -956,7 +956,7 @@ typedef int (GDX_CALLCONV *gdxSymbolGetDomainX_t) (gdxHandle_t pgdx, int SyNr,
956956
/** Retrieve the domain of a symbol (using relaxed or domain information). Returns zero if the operation is not possible.
957957
*
958958
* @param pgdx gdx object handle
959-
* @param SyNr The index number of the symbol (range 1..NrSymbols); SyNr = 0 reads universe.
959+
* @param SyNr The index number of the symbol (must be in range 1..NrSymbols).
960960
* @param DomainIDs DomainIDs[D] will contain the strings as they were stored with the call gdxSymbolSetDomainX. If gdxSymbolSetDomainX was never called, but gdxSymbolSetDomain was called, that information will be used instead. Length of this array should by dimensionality of the symbol. The special domain name "*" denotes the universe domain (all known UELs).
961961
* @return <ul><li>0: If operation was not possible (Bad SyNr)</li> <li>1: No domain information was available</li> <li>2: Data used was defined using gdxSymbolSetDomainX</li> <li>3: Data used was defined using gdxSymbolSetDomain</li></ul>
962962
*/

generated/gdxcclib.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* C library code generated by API Generator 1e87163 for gdx version 11
1+
/* C library code generated by API Generator b6f04b9 for gdx version 11
22
*
33
* GAMS - Loading mechanism for GAMS Expert-Level APIs
44
*
5-
* Copyright (c) 2016-2024 GAMS Software GmbH <support@gams.com>
6-
* Copyright (c) 2016-2024 GAMS Development Corp. <support@gams.com>
5+
* Copyright (c) 2016-2025 GAMS Software GmbH <support@gams.com>
6+
* Copyright (c) 2016-2025 GAMS Development Corp. <support@gams.com>
77
*
88
* Permission is hereby granted, free of charge, to any person obtaining a copy
99
* of this software and associated documentation files (the "Software"), to deal

generated/gdxcppwrap.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,19 +321,19 @@ class TGXFileObj
321321
return ::gdxDataWriteStrStart( pgx, SyId, ExplTxt, Dimen, Typ, UserInfo );
322322
}
323323

324-
int gdxGetDLLVersion( char *V )
324+
static int gdxGetDLLVersion( char *V )
325325
{
326-
return ::gdxGetDLLVersion( pgx, V );
326+
return ::gdxGetDLLVersion( nullptr, V );
327327
}
328328

329329
int gdxErrorCount() const
330330
{
331331
return ::gdxErrorCount( pgx );
332332
}
333333

334-
static int gdxErrorStr( int ErrNr, char *ErrMsg )
334+
int gdxErrorStr( int ErrNr, char *ErrMsg ) const
335335
{
336-
return ::gdxErrorStr( nullptr, ErrNr, ErrMsg );
336+
return ::gdxErrorStr( pgx, ErrNr, ErrMsg );
337337
}
338338

339339
int gdxFileInfo( int &FileVer, int &ComprLev ) const
@@ -590,11 +590,6 @@ class TGXFileObj
590590
{
591591
return ::gdxUELMaxLength( pgx );
592592
}
593-
594-
int gdxGetDLLVersion( char *V ) const
595-
{
596-
return ::gdxGetDLLVersion( pgx, V );
597-
}
598593
};
599594

600595
}// namespace gdx

src/examples/xp_associative.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ std::map<std::string, double> fillXLevelMapFromGDX(const std::string &filename)
6969
if( !rc || errNr != 0 )
7070
{
7171
std::array<char, GMS_SSSIZE> msgBuf{};
72-
gdx::TGXFileObj::gdxErrorStr( errNr, msgBuf.data() );
72+
gdx.gdxErrorStr( errNr, msgBuf.data() );
7373
throw std::runtime_error("*** Error opening trnsport.gdx: "s + msgBuf.data());
7474
}
7575

src/examples/xp_associative_vec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ std::map<std::vector<std::string>, double> loadXLevelMapFromGDX( const std::stri
7070
if( !rc || errNr != 0 )
7171
{
7272
std::array<char, GMS_SSSIZE> msgBuf {};
73-
gdx::TGXFileObj::gdxErrorStr( errNr, msgBuf.data() );
73+
gdx.gdxErrorStr( errNr, msgBuf.data() );
7474
throw std::runtime_error( "*** Error opening trnsport.gdx: "s + msgBuf.data() );
7575
}
7676

src/examples/xp_dataWrite.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class worker
6868

6969
static void ReportIOError( int N, const std::string &msg );
7070

71-
void ReportGDXError() const;
71+
void ReportGDXError(gdx::TGXFileObj &gdx) const;
7272

7373
void ReportGMDError() const;
7474

@@ -92,11 +92,11 @@ void worker::ReportIOError( int N, const std::string &msg )
9292
exit( 1 );
9393
}
9494

95-
void worker::ReportGDXError() const
95+
void worker::ReportGDXError(gdx::TGXFileObj &gdx) const
9696
{
9797
char s[GMS_SSSIZE];
9898
std::cout << "**** Fatal GDX Error" << std::endl;
99-
gdx::TGXFileObj::gdxErrorStr( gdx->gdxGetLastError(), s );
99+
gdx.gdxErrorStr( gdx.gdxGetLastError(), s );
100100
std::cout << "**** " << s << std::endl;
101101
exit( 1 );
102102
}
@@ -152,16 +152,16 @@ void worker::useStr( const std::string &fileName, const std::string &txt, writeM
152152
gdx->gdxOpenWrite( fileName.c_str(), "example", ErrNr );
153153
if( ErrNr ) ReportIOError( ErrNr, "gdxOpenWrite" );
154154

155-
if( !gdx->gdxUELRegisterStrStart() ) ReportGDXError();
155+
if( !gdx->gdxUELRegisterStrStart() ) ReportGDXError(*gdx);
156156
for( const auto &i: iarrayC )
157-
if( !gdx->gdxUELRegisterStr( i, dummy ) ) ReportGDXError();
157+
if( !gdx->gdxUELRegisterStr( i, dummy ) ) ReportGDXError(*gdx);
158158
for( const auto &j: jarrayC )
159-
if( !gdx->gdxUELRegisterStr( j, dummy ) ) ReportGDXError();
159+
if( !gdx->gdxUELRegisterStr( j, dummy ) ) ReportGDXError(*gdx);
160160
for( const auto &k: karrayC )
161-
if( !gdx->gdxUELRegisterStr( k, dummy ) ) ReportGDXError();
162-
if( !gdx->gdxUELRegisterDone() ) ReportGDXError();
161+
if( !gdx->gdxUELRegisterStr( k, dummy ) ) ReportGDXError(*gdx);
162+
if( !gdx->gdxUELRegisterDone() ) ReportGDXError(*gdx);
163163

164-
if( !gdx->gdxDataWriteStrStart( "Demand", "Demand data", 3, GMS_DT_PAR, 0 ) ) ReportGDXError();
164+
if( !gdx->gdxDataWriteStrStart( "Demand", "Demand data", 3, GMS_DT_PAR, 0 ) ) ReportGDXError(*gdx);
165165

166166
switch( mode )
167167
{
@@ -176,7 +176,7 @@ void worker::useStr( const std::string &fileName, const std::string &txt, writeM
176176
for( auto &k: karrayC )
177177
{
178178
strcpy( IndxC[2], k );
179-
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError();
179+
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError(*gdx);
180180
}
181181
}
182182
}
@@ -192,14 +192,14 @@ void worker::useStr( const std::string &fileName, const std::string &txt, writeM
192192
{
193193
strcpy( IndxC[2], karrayC[k] );
194194
if( i + j + k > 0 )
195-
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError();
195+
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError(*gdx);
196196
}
197197
}
198198
}
199199
strcpy( IndxC[0], iarrayC[0] );
200200
strcpy( IndxC[1], jarrayC[0] );
201201
strcpy( IndxC[2], karrayC[0] );
202-
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError();
202+
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError(*gdx);
203203
break;
204204
case reversed:
205205
for( int i = size - 1; i > -1; i-- )
@@ -211,7 +211,7 @@ void worker::useStr( const std::string &fileName, const std::string &txt, writeM
211211
for( int k = size - 1; k > -1; k-- )
212212
{
213213
strcpy( IndxC[2], karrayC[k] );
214-
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError();
214+
if( !gdx->gdxDataWriteStr( (const char **) IndxCPtrs, Values ) ) ReportGDXError(*gdx);
215215
}
216216
}
217217
}
@@ -220,7 +220,7 @@ void worker::useStr( const std::string &fileName, const std::string &txt, writeM
220220

221221
PrintDiff( "Before Done (" + txt + "): ", clock() );
222222

223-
if( !gdx->gdxDataWriteDone() ) ReportGDXError();
223+
if( !gdx->gdxDataWriteDone() ) ReportGDXError(*gdx);
224224
ErrNr = gdx->gdxClose();
225225
if( ErrNr ) ReportIOError( ErrNr, "gdxClose" );
226226

@@ -236,16 +236,16 @@ void worker::useRaw( const std::string &fileName, const std::string &txt )
236236
gdx->gdxOpenWrite( fileName.c_str(), "example", ErrNr );
237237
if( ErrNr ) ReportIOError( ErrNr, "gdxOpenWrite" );
238238

239-
if( !gdx->gdxUELRegisterRawStart() ) ReportGDXError();
239+
if( !gdx->gdxUELRegisterRawStart() ) ReportGDXError(*gdx);
240240
for( auto &i: iarrayC )
241-
if( !gdx->gdxUELRegisterRaw( i ) ) ReportGDXError();
241+
if( !gdx->gdxUELRegisterRaw( i ) ) ReportGDXError(*gdx);
242242
for( auto &j: jarrayC )
243-
if( !gdx->gdxUELRegisterRaw( j ) ) ReportGDXError();
243+
if( !gdx->gdxUELRegisterRaw( j ) ) ReportGDXError(*gdx);
244244
for( auto &k: karrayC )
245-
if( !gdx->gdxUELRegisterRaw( k ) ) ReportGDXError();
246-
if( !gdx->gdxUELRegisterDone() ) ReportGDXError();
245+
if( !gdx->gdxUELRegisterRaw( k ) ) ReportGDXError(*gdx);
246+
if( !gdx->gdxUELRegisterDone() ) ReportGDXError(*gdx);
247247

248-
if( !gdx->gdxDataWriteRawStart( "Demand", "Demand data", 3, GMS_DT_PAR, 0 ) ) ReportGDXError();
248+
if( !gdx->gdxDataWriteRawStart( "Demand", "Demand data", 3, GMS_DT_PAR, 0 ) ) ReportGDXError(*gdx);
249249

250250
for( int i = 0; i < size; i++ )
251251
{
@@ -256,14 +256,14 @@ void worker::useRaw( const std::string &fileName, const std::string &txt )
256256
for( int k = 0; k < size; k++ )
257257
{
258258
IndxI[2] = 2 * size + k + 1;
259-
if( !gdx->gdxDataWriteRaw( IndxI, Values ) ) ReportGDXError();
259+
if( !gdx->gdxDataWriteRaw( IndxI, Values ) ) ReportGDXError(*gdx);
260260
}
261261
}
262262
}
263263

264264
PrintDiff( "Before Done (" + txt + "): ", clock() );
265265

266-
if( !gdx->gdxDataWriteDone() ) ReportGDXError();
266+
if( !gdx->gdxDataWriteDone() ) ReportGDXError(*gdx);
267267
ErrNr = gdx->gdxClose();
268268
if( ErrNr ) ReportIOError( ErrNr, "gdxClose" );
269269

@@ -279,16 +279,16 @@ void worker::useMap( const std::string &fileName, const std::string &txt, writeM
279279
gdx->gdxOpenWrite( fileName.c_str(), "example", ErrNr );
280280
if( ErrNr ) ReportIOError( ErrNr, "gdxOpenWrite" );
281281

282-
if( !gdx->gdxUELRegisterMapStart() ) ReportGDXError();
282+
if( !gdx->gdxUELRegisterMapStart() ) ReportGDXError(*gdx);
283283
for( int i = 0; i < size; i++ )
284-
if( !gdx->gdxUELRegisterMap( i, iarrayC[i] ) ) ReportGDXError();
284+
if( !gdx->gdxUELRegisterMap( i, iarrayC[i] ) ) ReportGDXError(*gdx);
285285
for( int j = 0; j < size; j++ )
286-
if( !gdx->gdxUELRegisterMap( size + j, jarrayC[j] ) ) ReportGDXError();
286+
if( !gdx->gdxUELRegisterMap( size + j, jarrayC[j] ) ) ReportGDXError(*gdx);
287287
for( int k = 0; k < size; k++ )
288-
if( !gdx->gdxUELRegisterMap( 2 * size + k, karrayC[k] ) ) ReportGDXError();
289-
if( !gdx->gdxUELRegisterDone() ) ReportGDXError();
288+
if( !gdx->gdxUELRegisterMap( 2 * size + k, karrayC[k] ) ) ReportGDXError(*gdx);
289+
if( !gdx->gdxUELRegisterDone() ) ReportGDXError(*gdx);
290290

291-
if( !gdx->gdxDataWriteMapStart( "Demand", "Demand data", 3, GMS_DT_PAR, 0 ) ) ReportGDXError();
291+
if( !gdx->gdxDataWriteMapStart( "Demand", "Demand data", 3, GMS_DT_PAR, 0 ) ) ReportGDXError(*gdx);
292292

293293
switch( mode )
294294
{
@@ -302,7 +302,7 @@ void worker::useMap( const std::string &fileName, const std::string &txt, writeM
302302
for( int k = 0; k < size; k++ )
303303
{
304304
IndxI[2] = 2 * size + k;
305-
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError();
305+
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError(*gdx);
306306
}
307307
}
308308
}
@@ -318,15 +318,15 @@ void worker::useMap( const std::string &fileName, const std::string &txt, writeM
318318
{
319319
IndxI[2] = 2 * size + k;
320320
if( i + j + k > 0 )
321-
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError();
321+
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError(*gdx);
322322
}
323323
}
324324
}
325325

326326
IndxI[0] = 0;
327327
IndxI[1] = 0;
328328
IndxI[2] = 0;
329-
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError();
329+
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError(*gdx);
330330
break;
331331
case reversed:
332332
for( int i = size - 1; i > -1; i-- )
@@ -338,7 +338,7 @@ void worker::useMap( const std::string &fileName, const std::string &txt, writeM
338338
for( int k = size - 1; k > -1; k-- )
339339
{
340340
IndxI[2] = 2 * size + k;
341-
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError();
341+
if( !gdx->gdxDataWriteMap( IndxI, Values ) ) ReportGDXError(*gdx);
342342
}
343343
}
344344
}
@@ -347,7 +347,7 @@ void worker::useMap( const std::string &fileName, const std::string &txt, writeM
347347

348348
PrintDiff( "Before Done (" + txt + "): ", clock() );
349349

350-
if( !gdx->gdxDataWriteDone() ) ReportGDXError();
350+
if( !gdx->gdxDataWriteDone() ) ReportGDXError(*gdx);
351351
ErrNr = gdx->gdxClose();
352352
if( ErrNr ) ReportIOError( ErrNr, "gdxClose" );
353353

src/examples/xp_example1.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SimpleWriteReadExample
4747
gdxStrIndex_t IndxXXX {};
4848
gdxValues_t Values {};
4949

50-
void ReportGDXError();
50+
void ReportGDXError( TGXFileObj &pgx );
5151
void WriteData( const char *s, double V );
5252
static void ReportIOError( int N, const std::string &msg );
5353

@@ -61,11 +61,11 @@ class SimpleWriteReadExample
6161
void readFromFile( const std::string &gdxInputFilename );
6262
};
6363

64-
void SimpleWriteReadExample::ReportGDXError()
64+
void SimpleWriteReadExample::ReportGDXError( TGXFileObj &pgx )
6565
{
6666
std::array<char, GMS_SSSIZE> S {};
6767
std::string ostr = "**** Fatal GDX Error\n"s;
68-
TGXFileObj::gdxErrorStr( pgx.gdxGetLastError(), S.data() );
68+
pgx.gdxErrorStr( pgx.gdxGetLastError(), S.data() );
6969
ostr += "**** "s + S.data();
7070
throw std::runtime_error( ostr );
7171
}
@@ -107,11 +107,11 @@ void SimpleWriteReadExample::writeDemandData()
107107
pgx.gdxOpenWrite( "demanddata.gdx", "xp_example1", ErrNr );
108108
if( ErrNr ) ReportIOError( ErrNr, "gdxOpenWrite" );
109109
if( !pgx.gdxDataWriteStrStart( "Demand", "Demand data", 1, GMS_DT_PAR, 0 ) )
110-
ReportGDXError();
110+
ReportGDXError( pgx );
111111
WriteData( "New-York", 324.0 );
112112
WriteData( "Chicago", 299.0 );
113113
WriteData( "Topeka", 274.0 );
114-
if( !pgx.gdxDataWriteDone() ) ReportGDXError();
114+
if( !pgx.gdxDataWriteDone() ) ReportGDXError( pgx );
115115
std::cout << "Demand data written by example1" << std::endl;
116116
}
117117

@@ -143,7 +143,7 @@ void SimpleWriteReadExample::readFromFile( const std::string &gdxInputFilename )
143143
}
144144

145145
int NrRecs, N;
146-
if( !pgx.gdxDataReadStrStart( VarNr, NrRecs ) ) ReportGDXError();
146+
if( !pgx.gdxDataReadStrStart( VarNr, NrRecs ) ) ReportGDXError( pgx );
147147
std::cout << "Variable X has " << NrRecs << " records" << std::endl;
148148
while( pgx.gdxDataReadStr( Indx, Values, N ) )
149149
{

0 commit comments

Comments
 (0)