-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathif97.c
More file actions
36 lines (32 loc) · 889 Bytes
/
if97.c
File metadata and controls
36 lines (32 loc) · 889 Bytes
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
/*
* Filename: if97.c
*/
extern "C" {
#include <postgres.h>
#include <fmgr.h>
#include <utils/elog.h>
PG_MODULE_MAGIC;
}
#include "../../IF97.h"
extern "C" {
// double hmass(double T, double p)
PG_FUNCTION_INFO_V1(if97_hmass_Tp);
Datum if97_hmass_Tp(PG_FUNCTION_ARGS) {
try {
PG_RETURN_FLOAT8(IF97::hmass_Tp(PG_GETARG_FLOAT8(0),PG_GETARG_FLOAT8(1)));
} catch (const std::exception& e) {
elog(WARNING, "if97: %s",e.what());
PG_RETURN_NULL();
}
}
// double Tsat97(double p)
PG_FUNCTION_INFO_V1(if97_Tsat97);
Datum if97_Tsat97(PG_FUNCTION_ARGS) {
try {
PG_RETURN_FLOAT8(IF97::Tsat97(PG_GETARG_FLOAT8(0)));
} catch (const std::exception& e) {
elog(WARNING, "if97: %s",e.what());
PG_RETURN_NULL();
}
}
}