1 |
#include "StdAfx.h" |
2 |
#include "grannyfile.h" |
3 |
#include "granny.h" |
4 |
#include "GrannyAPILogger.h" |
5 |
#include <stdio.h> |
6 |
#include <iostream> |
7 |
#include <stdlib.h> |
8 |
#include <assert.h> |
9 |
|
10 |
namespace gr2lib |
11 |
{ |
12 |
namespace core |
13 |
{ |
14 |
GRANNY_CALLBACK(void) Callback(granny_log_message_type Type, granny_log_message_origin Origin, char const * Message, void * UserData); |
15 |
GRANNY_CALLBACK(void) Callback(granny_log_message_type Type, granny_log_message_origin Origin, char const * Message, void * UserData) |
16 |
{ |
17 |
assert(Message); |
18 |
} |
19 |
grannyfile::grannyfile(const char* filename) |
20 |
{ |
21 |
GrannyAPIVersion = new apiversion::granny2apiversion(); |
22 |
grannyfile::parse_granny_file(); |
23 |
|
24 |
} |
25 |
grannyfile::grannyfile(const char* filename,granny_int32x ExpectedMajor, granny_int32x ExpectedMinor, granny_int32x ExpectedCustomization, granny_int32x ExpectedBuild) |
26 |
{ |
27 |
GrannyAPIVersion = new apiversion::granny2apiversion(ExpectedMajor,ExpectedMinor,ExpectedCustomization,ExpectedBuild); |
28 |
_GrannyFilename = filename; |
29 |
grannyfile::parse_granny_file(); |
30 |
} |
31 |
void grannyfile::parse_granny_file() |
32 |
{ |
33 |
granny_log_callback* NewCallback = new granny_log_callback(); |
34 |
NewCallback->Function = &Callback; |
35 |
NewCallback->UserData = NULL; |
36 |
GrannySetLogCallback(NewCallback); |
37 |
|
38 |
_grn_file = GrannyReadEntireFile(_GrannyFilename); |
39 |
if (_grn_file != 0) |
40 |
{ |
41 |
GrannyFileInfo = GrannyGetFileInfo(_grn_file); |
42 |
} |
43 |
|
44 |
|
45 |
|
46 |
} |
47 |
const char* grannyfile::GrannyFilename() |
48 |
{ |
49 |
return _GrannyFilename; |
50 |
} |
51 |
} |
52 |
} |