Fix trace node id parser error

This commit is contained in:
Lew Rossman
2023-09-11 18:23:49 -04:00
parent e420380248
commit a2c0ff7889
3 changed files with 9 additions and 11 deletions

View File

@@ -45,3 +45,4 @@ This document describes the changes and updates that have been made in version 2
- `EN_SET_CLOSED` and `EN_SET_OPEN` constants were added that can be used with `EN_setcontrol` to fix the status of pipes and valves to completely closed or completely open. - `EN_SET_CLOSED` and `EN_SET_OPEN` constants were added that can be used with `EN_setcontrol` to fix the status of pipes and valves to completely closed or completely open.
- `EN_EMITTERFLOW` can now be used with `EN_getnodevalue` to retrieve a node's emitter flow rate. - `EN_EMITTERFLOW` can now be used with `EN_getnodevalue` to retrieve a node's emitter flow rate.
- `EN_STATUS_REPORT` can now be used with `EN_getoption` and `EN_setoption` to get or set the type of status report that EPANET will generate (`EN_NO_REPORT`, `EN_NORMAL_REPORT` or `EN_FULL_REPORT`). - `EN_STATUS_REPORT` can now be used with `EN_getoption` and `EN_setoption` to get or set the type of status report that EPANET will generate (`EN_NO_REPORT`, `EN_NORMAL_REPORT` or `EN_FULL_REPORT`).
- A possible parser error that could result in a Trace Node ID in an input file not being recognized was fixed.

View File

@@ -3,7 +3,7 @@ unit epanet2;
{ Declarations of imported procedures from the EPANET PROGRAMMERs TOOLKIT } { Declarations of imported procedures from the EPANET PROGRAMMERs TOOLKIT }
{ (EPANET2.DLL) } { (EPANET2.DLL) }
{Last updated on 05/13/2023} {Last updated on 09/11/2023}
interface interface
@@ -12,9 +12,9 @@ const
{ These are codes used by the DLL functions } { These are codes used by the DLL functions }
EN_MAXID = 31; { Max. # characters in ID name } EN_MAXID = 31; { Max. # characters in ID name }
EN_MAXMSG = 255; { Max. # characters in strings } EN_MAXMSG = 255; { Max. # characters in strings }
EN_MISSING = -1.E10; EN_MISSING = -1.0E10;
EN_SET_CLOSED = -1.E10; EN_SET_CLOSED = -1.0E10;
EN_SET_OPEN = 1.E10; EN_SET_OPEN = 1.0E10;
EN_ELEVATION = 0; { Node parameters } EN_ELEVATION = 0; { Node parameters }
EN_BASEDEMAND = 1; EN_BASEDEMAND = 1;
@@ -271,7 +271,7 @@ const
EN_R_IS_CLOSED = 2; EN_R_IS_CLOSED = 2;
EN_R_IS_ACTIVE = 3; EN_R_IS_ACTIVE = 3;
{$ifdef WINDOWS} {$ifdef MSWINDOWS}
EpanetLib = 'epanet2.dll'; EpanetLib = 'epanet2.dll';
{$else} {$else}
EpanetLib = 'libepanet2.so'; EpanetLib = 'libepanet2.so';

View File

@@ -7,7 +7,7 @@ Description: parses network data from a line of an EPANET input file
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE License: see LICENSE
Last Updated: 02/05/2023 Last Updated: 09/11/2023
****************************************************************************** ******************************************************************************
*/ */
@@ -1842,10 +1842,7 @@ int optionchoice(Project *pr, int n)
} }
if (qual->Qualflag == TRACE) if (qual->Qualflag == TRACE)
{ {
// Copy Trace Node ID to parser->Tok[0] for error reporting
strcpy(parser->Tok[0], "");
if (n < 2) return 201; if (n < 2) return 201;
strcpy(parser->Tok[0], parser->Tok[2]);
qual->TraceNode = findnode(net, parser->Tok[2]); qual->TraceNode = findnode(net, parser->Tok[2]);
if (qual->TraceNode == 0) return setError(parser, 2, 212); if (qual->TraceNode == 0) return setError(parser, 2, 212);
strncpy(qual->ChemName, u_PERCENT, MAXID); strncpy(qual->ChemName, u_PERCENT, MAXID);