updated examples for documentation

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/ErrorHandling@6186 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2012-02-07 22:41:30 +00:00
parent 5c2b30516c
commit b4b4fc0288
3 changed files with 29 additions and 25 deletions

View File

@ -43,16 +43,14 @@ PROGRAM example
CALL OutputAccumulatedLines(id)
IF (RunAccumulated(id).NE.0) THEN
CALL OutputErrorString(id)
WRITE(*,*) "Error:"
DO i=1,GetErrorStringLineCount(id)
CALL GetErrorStringLine(id, i, line)
WRITE(*,*) TRIM(line)
END DO
STOP
END IF
WRITE(*,*) "Error:"
DO i=1,GetErrorStringLineCount(id)
CALL GetErrorStringLine(id, i, line)
WRITE(*,*) TRIM(line)
END DO
IF (DestroyIPhreeqc(id).NE.IPQ_OK) THEN
CALL OutputErrorString(id)
STOP

View File

@ -5,41 +5,39 @@
#define TRUE 1
const char input[] =
"SOLUTION 1 Pure water \n"
"EQUILIBRIUM_PHASES 1 \n"
" Calcite 0 10 \n"
"SAVE solution 1 \n"
"SAVE equilibrium_phases 1 \n"
"DUMP \n"
" -solution 1 \n"
" -equilibrium_phases 1\n"
"SOLUTION 1 Pure water \n"
"EQUILIBRIUM_PHASES 1 \n"
" Calcite 0 10 \n"
"SAVE solution 1 \n"
"SAVE equilibrium_phases 1 \n"
"DUMP \n"
" -solution 1 \n"
" -equilibrium_phases 1\n";
int main(void)
{
int id;
id = CreateIPhreeqc();
if (id < 0) {
return EXIT_FAILURE;
}
if (SetErrorStringOn(id, TRUE) != IPQ_OK) {
OutputErrorString(id);
return EXIT_FAILURE;
}
if (RunString(id, input) != 0) {
OutputErrorString(id);
printf("Error:\n");
printf("%s\n", GetErrorString(id));
return EXIT_FAILURE;
}
printf("Error:\n");
printf("%s\n", GetErrorString(id));
if (DestroyIPhreeqc(id) != IPQ_OK) {
OutputErrorString(id);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -16,6 +16,7 @@ TARGETS = \
CreateIPhreeqc \
GetComponent \
GetDumpString \
GetErrorString \
GetLogString \
GetOutputString \
GetSelectedOutputString \
@ -27,6 +28,7 @@ F90_TARGETS = \
F90CreateIPhreeqc \
F90GetComponent \
F90GetDumpStringLine \
F90GetErrorStringLine \
F90GetLogStringLine \
F90GetOutputStringLine \
F90ClearAccumulatedLines \
@ -48,6 +50,9 @@ GetComponent: GetComponent.lo $(IPHREEQC_LA)
GetDumpString: GetDumpString.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $< $(IPHREEQC_LA)
GetErrorString: GetErrorString.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $< $(IPHREEQC_LA)
GetLogString: GetLogString.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $< $(IPHREEQC_LA)
@ -76,6 +81,9 @@ F90GetComponent: F90GetComponent.lo $(IPHREEQC_LA)
F90GetDumpStringLine: F90GetDumpStringLine.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $< $(IPHREEQC_LA) $(FCLIBS)
F90GetErrorStringLine: F90GetErrorStringLine.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $< $(IPHREEQC_LA) $(FCLIBS)
F90GetLogStringLine: F90GetLogStringLine.lo $(IPHREEQC_LA)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $< $(IPHREEQC_LA) $(FCLIBS)
@ -115,7 +123,7 @@ LO_FILES = \
DestroyIPhreeqc.lo \
GetComponent.lo \
GetDumpString.lo \
GetErrorString.lo
GetErrorString.lo \
GetLogString.lo \
GetOutputString.lo \
GetSelectedOutputString.lo \