|
12 | 12 | staticconstsize_tkMaxDirNum =1000; |
13 | 13 |
|
14 | 14 | staticconstsize_tkWBUFF_len =2048; |
| 15 | + |
15 | 16 | staticchar wbuff[kWBUFF_len] = {0}; |
16 | 17 |
|
17 | 18 | static std::string __typeprint[] = |
@@ -70,9 +71,25 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, |
70 | 71 | mhead.fpath = mhead.dir +"/" + mhead.fname; |
71 | 72 |
|
72 | 73 | // 1 step is to define final directory for source code bunch |
73 | | - fwriter->AppendLine("#pragma once",3); |
| 74 | + fwriter->AppendLine("#pragma once",2); |
74 | 75 | fwriter->AppendLine("#ifdef __cplusplus\nextern\"C\" {\n#endif",2); |
75 | | - fwriter->AppendLine("#include <stdint.h>"); |
| 76 | + fwriter->AppendLine("#include <stdint.h>",2); |
| 77 | + |
| 78 | +snprintf(wbuff,kWBUFF_len,"#ifdef %s", usediag_str.c_str()); |
| 79 | + fwriter->AppendLine(wbuff); |
| 80 | + |
| 81 | + fwriter->AppendText( |
| 82 | +"// This file must define:\n" |
| 83 | +"// base monitor struct\n" |
| 84 | +"// function signature for CRC calculation\n" |
| 85 | +"// function signature for getting system tick value (100 us step)\n" |
| 86 | +"#include\"canmonitorutil.h\"\n" |
| 87 | +"\n" |
| 88 | + |
| 89 | + ); |
| 90 | + |
| 91 | +snprintf(wbuff,kWBUFF_len,"#endif // %s", usediag_str.c_str()); |
| 92 | + fwriter->AppendLine(wbuff,3); |
76 | 93 |
|
77 | 94 | for (size_t num =0; num < sigprt->sigs_expr.size(); num++) |
78 | 95 | { |
@@ -116,6 +133,9 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, |
116 | 133 | max_sig_name_len = s.Name.size(); |
117 | 134 | } |
118 | 135 |
|
| 136 | +// empty line before struct definition |
| 137 | + fwriter->AppendLine("\n"); |
| 138 | + |
119 | 139 | snprintf(wbuff,kWBUFF_len,"typedef struct"); |
120 | 140 | fwriter->AppendLine(wbuff); |
121 | 141 |
|
@@ -145,13 +165,17 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, |
145 | 165 | snprintf(wbuff,kWBUFF_len,"#endif // %s", usebits_str.c_str()); |
146 | 166 | fwriter->AppendLine(wbuff,2); |
147 | 167 |
|
148 | | -//if (CodeSett.Code.UseMonitors == 1) |
149 | | -// fwriter->AppendLine(" FrameMonitor_t mon1;"); |
| 168 | +// start mon1 section |
| 169 | +snprintf(wbuff,kWBUFF_len,"#ifdef %s", usebits_str.c_str()); |
| 170 | + fwriter->AppendLine(wbuff,2); |
| 171 | + |
| 172 | + fwriter->AppendLine(" FrameMonitor_t mon1;",2); |
| 173 | + |
| 174 | +snprintf(wbuff,kWBUFF_len,"#endif // %s", usebits_str.c_str()); |
| 175 | + fwriter->AppendLine(wbuff,2); |
150 | 176 |
|
151 | 177 | snprintf(wbuff,kWBUFF_len,"} %s_t;", m.Name.c_str()); |
152 | 178 | fwriter->AppendLine(wbuff,2); |
153 | | -//fwriter->AppendLine("} " + msg.MessageName + "_t;"); |
154 | | -//fwriter->AppendLine(); |
155 | 179 | } |
156 | 180 |
|
157 | 181 | fwriter->AppendLine("#ifdef __cplusplus\n}\n#endif"); |
|