From 096167af8b0d07664caf223795592b3c161cee8f Mon Sep 17 00:00:00 2001 From: Elad Salomons Date: Sat, 28 Nov 2015 00:21:36 +0200 Subject: [PATCH] Change ENgetheadcurve to ENgetheadcurveindex Closes #31 --- build/WinSDK/epanet2.def | 2 +- include/epanet2.bas | 2 +- include/epanet2.h | 2 +- include/epanet2.vb | 2 +- src/epanet.c | 10 ++++------ 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/build/WinSDK/epanet2.def b/build/WinSDK/epanet2.def index 1e2bd35..8d1087b 100644 --- a/build/WinSDK/epanet2.def +++ b/build/WinSDK/epanet2.def @@ -66,7 +66,7 @@ EXPORTS ENgetqualinfo = _ENgetqualinfo@16 ENsetbasedemand = _ENsetbasedemand@12 ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8 - ENgetheadcurve = _ENgetheadcurve@8 + ENgetheadcurveindex = _ENgetheadcurveindex@8 ENgetpumptype = _ENgetpumptype@8 ENgetcurveindex = _ENgetcurveindex@8 ENgetcurveid = _ENgetcurveid@8 diff --git a/include/epanet2.bas b/include/epanet2.bas index 9ceeb2b..1c1435c 100644 --- a/include/epanet2.bas +++ b/include/epanet2.bas @@ -206,7 +206,7 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, Value As Single) As Long Declare Function ENgetcurve Lib "epanet2.dll" (ByVal CurveIndex As Long, ByVal CurveID As String, nValues As Long, xValues As Any, yValues As Any) As Long - Declare Function ENgetheadcurve Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) As Long + Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal PumpIndex As Long, ByVal CurveIndex As Long) As Long Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Long, PumpType As Long) As Long Declare Function ENgetversion Lib "epanet2.dll" (Value As Long) As Long diff --git a/include/epanet2.h b/include/epanet2.h index 5908ec9..515af28 100755 --- a/include/epanet2.h +++ b/include/epanet2.h @@ -258,7 +258,7 @@ extern "C" { int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value); int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues); - int DLLEXPORT ENgetheadcurve(int index, char *id); + int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex); int DLLEXPORT ENgetpumptype(int index, int *type); int DLLEXPORT ENgetversion(int *version); diff --git a/include/epanet2.vb b/include/epanet2.vb index 1e86417..9cd3e2c 100644 --- a/include/epanet2.vb +++ b/include/epanet2.vb @@ -200,7 +200,7 @@ Public Const EN_CUSTOM = 2 ' user-defined custom curve Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByRef Value As Single) As Int32 Declare Function ENgetcurve Lib "epanet2.dll" (ByVal CurveIndex As Int32, ByRef nValues As Int32, ByRef xValues As Single, ByRef yValues As Single) As Int32 'ES - Declare Function ENgetheadcurve Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32 'ES + Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal Index As Int32, ByVal CurveIndex As int32) As Int32 'ES Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Int32, ByRef PumpType As Int32) As Int32 'ES Declare Function ENgetversion Lib "epanet2.dll" (ByRef Value As Int32) As Int32 diff --git a/src/epanet.c b/src/epanet.c index 18ef1c6..b088447 100755 --- a/src/epanet.c +++ b/src/epanet.c @@ -2764,21 +2764,19 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, return(0); } -int DLLEXPORT ENgetheadcurve(int index, char *id) +int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex) /*---------------------------------------------------------------- ** Input: index = index of pump in list of links -** Output: id = head curve ID +** Output: curveindex = head curve index ** Returns: error code -** Purpose: retrieves ID of a head curve for specific link index +** Purpose: retrieves index of a head curve for specific link index ** -** NOTE: 'id' must be able to hold MAXID characters **---------------------------------------------------------------- */ { - strcpy(id,""); if (!Openflag) return(102); if (index < 1 || index > Nlinks || PUMP != Link[index].Type) return(204); - strcpy(id,Curve[Pump[PUMPINDEX(index)].Hcurve].ID); + *curveindex = Pump[PUMPINDEX(index)].Hcurve; return(0); }