1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 # -*- coding: utf-8 -*- |
2 # -*- coding: utf-8 -*- |
3 copyright_notice="""/* |
3 |
4 This file is part of CanFestival, a library implementing CanOpen Stack. |
4 #This file is part of CanFestival, a library implementing CanOpen Stack. |
5 |
5 # |
6 Copyright (C): Edouard TISSERANT and Francis DUPIN |
6 #Copyright (C): Edouard TISSERANT and Francis DUPIN |
7 |
7 # |
8 See COPYING file for copyrights details. |
8 #See COPYING file for copyrights details. |
9 |
9 # |
10 This library is free software; you can redistribute it and/or |
10 #This library is free software; you can redistribute it and/or |
11 modify it under the terms of the GNU Lesser General Public |
11 #modify it under the terms of the GNU Lesser General Public |
12 License as published by the Free Software Foundation; either |
12 #License as published by the Free Software Foundation; either |
13 version 2.1 of the License, or (at your option) any later version. |
13 #version 2.1 of the License, or (at your option) any later version. |
14 |
14 # |
15 This library is distributed in the hope that it will be useful, |
15 #This library is distributed in the hope that it will be useful, |
16 but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 #but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 Lesser General Public License for more details. |
18 #Lesser General Public License for more details. |
19 |
19 # |
20 You should have received a copy of the GNU Lesser General Public |
20 #You should have received a copy of the GNU Lesser General Public |
21 License along with this library; if not, write to the Free Software |
21 #License along with this library; if not, write to the Free Software |
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 */ |
|
24 """ |
|
25 |
23 |
26 from node import * |
24 from node import * |
27 from types import * |
25 from types import * |
28 |
26 |
29 import re, os |
27 import re, os |
326 texts["nombre"] = 0 |
324 texts["nombre"] = 0 |
327 entry_infos = Manager.GetEntryInfos(0x1016) |
325 entry_infos = Manager.GetEntryInfos(0x1016) |
328 texts["EntryName"] = entry_infos["name"] |
326 texts["EntryName"] = entry_infos["name"] |
329 indexContents[0x1016] = """\n/* index 0x1016 : %(EntryName)s */ |
327 indexContents[0x1016] = """\n/* index 0x1016 : %(EntryName)s */ |
330 UNS8 %(NodeName)s_highestSubIndex_obj1016 = 0; |
328 UNS8 %(NodeName)s_highestSubIndex_obj1016 = 0; |
331 UNS32 %(NodeName)s_obj1016[0]; |
329 UNS32 %(NodeName)s_obj1016[]; |
332 subindex %(NodeName)s_Index1016[0]; |
330 subindex %(NodeName)s_Index1016[]; |
333 """%texts |
331 """%texts |
334 if texts["nombre"] > 0: |
332 if texts["nombre"] > 0: |
335 strTimers = "TIMER_HANDLE %(NodeName)s_heartBeatTimers[%(nombre)d] = {TIMER_NONE,};\n"%texts |
333 strTimers = "TIMER_HANDLE %(NodeName)s_heartBeatTimers[%(nombre)d] = {TIMER_NONE,};\n"%texts |
336 else: |
334 else: |
337 strTimers = "TIMER_HANDLE %(NodeName)s_heartBeatTimers[0];\n"%texts |
335 strTimers = "TIMER_HANDLE %(NodeName)s_heartBeatTimers[0];\n"%texts |
379 |
377 |
380 #------------------------------------------------------------------------------- |
378 #------------------------------------------------------------------------------- |
381 # Write File Content |
379 # Write File Content |
382 #------------------------------------------------------------------------------- |
380 #------------------------------------------------------------------------------- |
383 |
381 |
384 fileContent = copyright_notice + generated_tag + """ |
382 fileContent = generated_tag + """ |
385 #include "%s" |
383 #include "%s" |
386 """%(headerfilepath) |
384 """%(headerfilepath) |
387 |
385 |
388 fileContent += """ |
386 fileContent += """ |
389 /**************************************************************************/ |
387 /**************************************************************************/ |
461 |
459 |
462 #------------------------------------------------------------------------------- |
460 #------------------------------------------------------------------------------- |
463 # Write Header File Content |
461 # Write Header File Content |
464 #------------------------------------------------------------------------------- |
462 #------------------------------------------------------------------------------- |
465 |
463 |
466 HeaderFileContent = copyright_notice + generated_tag + """ |
464 HeaderFileContent = generated_tag + """ |
467 #include "data.h" |
465 #include "data.h" |
468 |
466 |
469 // prototypes of function provided by object dictionnary |
467 // prototypes of function provided by object dictionnary |
470 UNS32 %(NodeName)s_valueRangeTest (UNS8 typeValue, void * value); |
468 UNS32 %(NodeName)s_valueRangeTest (UNS8 typeValue, void * value); |
471 const indextable * %(NodeName)s_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks); |
469 const indextable * %(NodeName)s_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks); |