@@ -24,7 +24,7 @@ const char* extend_func_body =
2424 " // n+1 bits where n is the largest signed signal width. For example if\n "
2525 " // the most wide signed signal has a width of 31 bits you need to set\n "
2626 " // bitext_t as int32_t and ubitext_t as uint32_t\n "
27- " // Defined these typedefs in @dbccodeconf.h or locally in 'dbcdrvname'-config.h \n "
27+ " // Defined these typedefs in @dbccodeconf.hpp or locally in 'dbcdrvname'-config.hpp \n "
2828 " static bitext_t %s(ubitext_t val, uint8_t bits)\n "
2929 " {\n "
3030 " ubitext_t const m = 1u << (bits - 1);\n "
@@ -66,10 +66,10 @@ void CiMainGenerator::Generate(DbcMessageList_t& dlist, const AppSettings_t& fsd
6666
6767 if (!fsd.gen .no_config )
6868 {
69- // 6 step is to print template for drv-config.h
69+ // 6 step is to print template for drv-config.hpp
7070 Gen_ConfigHeader ();
7171
72- // 8 step is to print dbccodeconf.h template
72+ // 8 step is to print dbccodeconf.hpp template
7373 Gen_DbcCodeConf ();
7474 }
7575
@@ -93,8 +93,6 @@ void CiMainGenerator::Gen_MainHeader()
9393
9494 fwriter.Append (" #pragma once" );
9595 fwriter.Append ();
96- fwriter.Append (" #ifdef __cplusplus\n extern \" C\" {\n #endif" );
97- fwriter.Append ();
9896 fwriter.Append (" #include <stdint.h>" );
9997 fwriter.Append ();
10098
@@ -104,15 +102,15 @@ void CiMainGenerator::Gen_MainHeader()
104102 fwriter.Append ();
105103
106104 fwriter.Append (" // include current dbc-driver compilation config" );
107- fwriter.Append (" #include \" %s-config.h \" " , fdesc->gen .drvname .c_str ());
105+ fwriter.Append (" #include \" %s-config.hpp \" " , fdesc->gen .drvname .c_str ());
108106 fwriter.Append ();
109107
110108 fwriter.Append (" #ifdef %s" , fdesc->gen .usemon_def .c_str ());
111109
112110 fwriter.Append (
113111 " // This file must define:\n "
114112 " // base monitor struct\n "
115- " #include \" canmonitorutil.h \"\n "
113+ " #include \" canmonitorutil.hpp \"\n "
116114 " \n "
117115 );
118116
@@ -169,10 +167,7 @@ void CiMainGenerator::Gen_MainHeader()
169167 fwriter.Append (" #define %s_DLC (%uU)" , m.Name .c_str (), m.DLC );
170168 fwriter.Append (" #define %s_CANID (%#xU)" , m.Name .c_str (), m.MsgID );
171169
172- if (m.Cycle > 0 )
173- {
174- fwriter.Append (" #define %s_CYC (%dU)" , m.Name .c_str (), m.Cycle );
175- }
170+ fwriter.Append (" #define %s_CYC (%dU)" , m.Name .c_str (), m.Cycle );
176171
177172 size_t max_sig_name_len = 27 ;
178173
@@ -328,8 +323,6 @@ void CiMainGenerator::Gen_MainHeader()
328323 fwriter.Append ();
329324 }
330325
331- fwriter.Append (" #ifdef __cplusplus\n }\n #endif" );
332-
333326 // save fwrite cached text to file
334327 fwriter.Flush (fdesc->file .core_h .fpath );
335328}
@@ -362,15 +355,15 @@ void CiMainGenerator::Gen_MainSource()
362355 " // Function prototypes to be called each time CAN frame is unpacked\n "
363356 " // FMon function may detect RC, CRC or DLC violation\n " );
364357
365- fwriter.Append (" #include \" %s-fmon.h \" " , fdesc->gen .drvname .c_str ());
358+ fwriter.Append (" #include \" %s-fmon.hpp \" " , fdesc->gen .drvname .c_str ());
366359 fwriter.Append ();
367360
368361 fwriter.Append (" #endif // %s" , fdesc->gen .usemon_def .c_str ());
369362 fwriter.Append (" " );
370363 fwriter.Append (" // This macro guard for the case when you need to enable" );
371364 fwriter.Append (" // using diag monitors but there is no necessity in proper" );
372365 fwriter.Append (" // SysTick provider. For providing one you need define macro" );
373- fwriter.Append (" // before this line - in dbccodeconf.h " );
366+ fwriter.Append (" // before this line - in dbccodeconf.hpp " );
374367 fwriter.Append (" " );
375368 fwriter.Append (" #ifndef GetSystemTick" );
376369 fwriter.Append (" #define GetSystemTick() (0u)" );
@@ -452,7 +445,7 @@ void CiMainGenerator::Gen_ConfigHeader()
452445 ConfigGenerator confgen;
453446 confgen.FillHeader (fwriter, fdesc->gen );
454447
455- fwriter.Flush (fdesc->file .confdir + ' /' + fdesc->gen .drvname + " -config.h " );
448+ fwriter.Flush (fdesc->file .confdir + ' /' + fdesc->gen .drvname + " -config.hpp " );
456449}
457450
458451void CiMainGenerator::Gen_FMonHeader ()
@@ -475,10 +468,6 @@ void CiMainGenerator::Gen_CanMonUtil()
475468 fwriter.Append (" " );
476469 fwriter.Append (" #include <stdint.h>" );
477470 fwriter.Append (" " );
478- fwriter.Append (" #ifdef __cplusplus" );
479- fwriter.Append (" extern \" C\" {" );
480- fwriter.Append (" #endif" );
481- fwriter.Append (" " );
482471 fwriter.Append (" // declare here all availible checksum algorithms" );
483472 fwriter.Append (" typedef enum" );
484473 fwriter.Append (" {" );
@@ -520,12 +509,8 @@ void CiMainGenerator::Gen_CanMonUtil()
520509 fwriter.Append (" " );
521510 fwriter.Append (" } FrameMonitor_t;" );
522511 fwriter.Append (" " );
523- fwriter.Append (" #ifdef __cplusplus" );
524- fwriter.Append (" }" );
525- fwriter.Append (" #endif" );
526- fwriter.Append (" " );
527512
528- fwriter.Flush (fdesc->file .incdir + ' /' + " canmonitorutil.h " );
513+ fwriter.Flush (fdesc->file .incdir + ' /' + " canmonitorutil.hpp " );
529514}
530515
531516void CiMainGenerator::Gen_DbcCodeConf ()
@@ -562,7 +547,7 @@ void CiMainGenerator::Gen_DbcCodeConf()
562547 fwriter.Append (" // #define GetFrameHash(a,b,c,d,e) __get_hash__(a,b,c,d,e)" );
563548 fwriter.Append (" " );
564549
565- fwriter.Flush (fdesc->file .confdir + ' /' + " dbccodeconf.h " );
550+ fwriter.Flush (fdesc->file .confdir + ' /' + " dbccodeconf.hpp " );
566551}
567552
568553void CiMainGenerator::WriteSigStructField (const SignalDescriptor_t& sig, bool bits, size_t padwidth)
0 commit comments