Adding support for VB

Also supporting C89 compiler.
This commit is contained in:
Elad Salomons
2023-01-19 20:45:30 +02:00
parent 2705f8adc1
commit e2df3e87ac
4 changed files with 14 additions and 5 deletions

View File

@@ -253,6 +253,12 @@ Public Const EN_R_IS_OPEN = 1 ' Rule status types
Public Const EN_R_IS_CLOSED = 2
Public Const EN_R_IS_ACTIVE = 3
Public Const EN_STEP_REPORT = 0 ' Types of events that can cause a timestep to end
Public Const EN_STEP_HYD = 1
Public Const EN_STEP_WQ = 2
Public Const EN_STEP_TANKEVENT = 3
Public Const EN_STEP_CONTROLEVENT = 4
Public Const EN_MISSING As Double = -1.0E10
'These are the external functions that comprise the DLL
@@ -302,6 +308,7 @@ Public Const EN_MISSING As Double = -1.0E10
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Long, ByVal errmsg As String, ByVal maxLen As Long) As Long
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Long, ByRef value As Single) As Long
Declare Function ENgetresultindex Lib "epanet2.dll" (ByVal type_ As Long, ByVal index As Long, ByRef value As Long) As Long
Declare Function ENtimetonextevent Lib "epanet2.dll" (eventType As Long, duration As Long, elementIndex As Long) As Long
'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option_ As Long, value As Single) As Long

View File

@@ -131,3 +131,4 @@ EXPORTS
ENstepQ = _ENstepQ@4
ENusehydfile = _ENusehydfile@4
ENwriteline = _ENwriteline@4
ENtimetonextevent = _ENtimetonextevent@12

View File

@@ -1629,13 +1629,14 @@ int DLLEXPORT EN_timetonextevent(EN_Project p, int *eventType, long *duration,
{
Times *time = &p->times;
long hydStep, tankStep, controlStep;
int iTank, iControl;
hydStep = time->Hstep;
tankStep = hydStep;
controlStep = hydStep;
int iTank = tanktimestep(p, &tankStep);
int iControl = controltimestep(p, &controlStep);
iTank = tanktimestep(p, &tankStep);
iControl = controltimestep(p, &controlStep);
// return the lesser of the three step lengths
if (controlStep < tankStep) {

View File

@@ -885,14 +885,14 @@ void writeline(Project *pr, char *s)
**--------------------------------------------------------------
*/
{
Report *rpt = &pr->report;
if (pr->report.reportCallback != NULL)
{
pr->report.reportCallback(pr->report.reportCallbackUserData, pr, s);
return;
}
Report *rpt = &pr->report;
if (rpt->RptFile == NULL) return;
if (rpt->Rptflag)
{