1 /*
2  * hhutil.h
3  *
4  *  Created on: Mar 28, 2014
5  *      Author: meiermark
6  */
7 
8 #ifndef HHUTIL_H_
9 #define HHUTIL_H_
10 
11 #include <errno.h>
12 
13 #include "hhdecl.h"
14 #include "hhutil-inl.h"
15 
16 int FormatError(const char infile[], const char* file, const int line, const char* func, const char details[]="");
17 
18 int OpenFileError(const char outfile[], const char* file, const int line, const char* func);
19 
20 int MemoryError(const char arrayname[], const char* file, const int line, const char* func);
21 
22 int SyntaxError(const char* file, const int line, const char* func, const char details[]="");
23 
24 int InternalError(const char errstr[], const char* file, const int line, const char* func);
25 
26 // Count number of lines in <file>
27 int CountLinesInFile(const char* file);
28 
29 void float_to_8_bit(float input, unsigned char& result);
30 
31 void bit_8_to_float(unsigned char input, float& result);
32 
33 void float_to_16_bit(float input, unsigned short int& result);
34 
35 void bit_16_to_float(unsigned short int input, float& result);
36 
37 void writeU16(std::ostream& file, unsigned short int val);
38 void writeS16(std::ostream& file, signed short int val);
39 
40 #endif /* HHUTIL_H_ */
41