cash.h 936 Bytes
Newer Older
Marc G. Fournier's avatar
Marc G. Fournier committed
1
/*
2 3 4 5
 * cash.h
 * Written by D'Arcy J.M. Cain
 *
 * Functions to allow input and output of money normally but store
6
 *  and handle it as int4.
7
 */
Marc G. Fournier's avatar
Marc G. Fournier committed
8

9 10
#ifndef CASH_H
#define CASH_H
Marc G. Fournier's avatar
Marc G. Fournier committed
11

12 13
/* if we store this as 4 bytes, we better make it int, not long, bjm */
typedef signed int Cash;
Marc G. Fournier's avatar
Marc G. Fournier committed
14

Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
extern const char *cash_out(Cash *value);
extern Cash *cash_in(const char *str);

extern bool cash_eq(Cash *c1, Cash *c2);
extern bool cash_ne(Cash *c1, Cash *c2);
extern bool cash_lt(Cash *c1, Cash *c2);
extern bool cash_le(Cash *c1, Cash *c2);
extern bool cash_gt(Cash *c1, Cash *c2);
extern bool cash_ge(Cash *c1, Cash *c2);

extern Cash *cash_pl(Cash *c1, Cash *c2);
extern Cash *cash_mi(Cash *c1, Cash *c2);
extern Cash *cash_mul(Cash *c, float8 *f);
extern Cash *cash_div(Cash *c, float8 *f);

extern Cash *cashlarger(Cash *c1, Cash *c2);
extern Cash *cashsmaller(Cash *c1, Cash *c2);

extern const char *cash_words_out(Cash *value);
34 35

#endif /* CASH_H */