-
Notifications
You must be signed in to change notification settings - Fork 0
/
write_vstats.c
115 lines (83 loc) · 2.68 KB
/
write_vstats.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*+
* United States Geological Survey
*
* PROJECT : Modular Modeling System (MMS)
* NAME : write_vstats.c
* AUTHOR : Pedro Restrepo CADSWES
* DATE : June 1990
* FUNCTION : write_vstats
* COMMENT : saves values of stat variables into a temporary file.
* The temporary file was open in user_input
* REF :
* REVIEW :
* PR NRS :
*
* $Id: write_vstats.c 3058 2007-01-25 22:25:59Z rsregan $
*
$Revision: 3058 $
$Log: write_vstats.c,v $
Revision 1.4 1996/02/19 20:01:24 markstro
Now lints pretty clean
Revision 1.3 1994/10/24 14:19:09 markstro
(1) Integration of CADSWES's work on GIS.
(2) Prototypes were added to the files referenced in "mms_proto.h".
* Revision 1.2 1994/01/31 20:17:56 markstro
* Make sure that all source files have CVS log.
*
-*/
/**1************************ INCLUDE FILES ****************************/
#define WRITE_VSTATS_C
#include <stdio.h>
#include "mms.h"
/**2************************* LOCAL MACROS ****************************/
/**3************************ LOCAL TYPEDEFS ***************************/
/**4***************** DECLARATION LOCAL FUNCTIONS *********************/
/**5*********************** LOCAL VARIABLES ***************************/
/**6**************** EXPORTED FUNCTION DEFINITIONS ********************/
/*--------------------------------------------------------------------*\
| FUNCTION : write_vstats
| COMMENT :
| PARAMETERS :
| RETURN VALUE : void
| RESTRICTIONS :
\*--------------------------------------------------------------------*/
void write_vstats (FILE *statvar_file) {
STAT_LIST_TYPE *stat_list;
/*
* writes first record number, date and time info
*/
(void)fprintf(statvar_file, "%ld %ld %ld %ld %ld %ld %ld ",
Mnsteps, Mnowtime->year,
Mnowtime->month, Mnowtime->day, Mnowtime->hour,
Mnowtime->min, Mnowtime->sec);
/*
* Initializes linked list to first pointer
*/
stat_list = Mfirst_stat_list;
/*
* The list is NULL-terminated
*/
while (stat_list) {
/*
* Gets variable value
*/
switch (stat_list->type) {
case M_FLOAT:
(void)fprintf(statvar_file,"%f ", *(float *)stat_list->value);
break;
case M_DOUBLE:
(void)fprintf(statvar_file,"%lf ", *(double *)stat_list->value);
break;
case M_LONG:
(void)fprintf(statvar_file,"%ld ", *(long *)stat_list->value);
break;
}
/*
* Updates pointer
*/
stat_list = stat_list->next;
}
(void)fprintf(statvar_file,"\n");
}
/**7****************** LOCAL FUNCTION DEFINITIONS *********************/
/**8************************** TEST DRIVER ****************************/