664 </xsd:sequence> |
664 </xsd:sequence> |
665 <xsd:attribute name="Compiler" type="xsd:string" use="optional" default="gcc"/> |
665 <xsd:attribute name="Compiler" type="xsd:string" use="optional" default="gcc"/> |
666 <xsd:attribute name="CFLAGS" type="xsd:string" use="required"/> |
666 <xsd:attribute name="CFLAGS" type="xsd:string" use="required"/> |
667 <xsd:attribute name="Linker" type="xsd:string" use="optional" default="ld"/> |
667 <xsd:attribute name="Linker" type="xsd:string" use="optional" default="ld"/> |
668 <xsd:attribute name="LDFLAGS" type="xsd:string" use="required"/> |
668 <xsd:attribute name="LDFLAGS" type="xsd:string" use="required"/> |
|
669 <xsd:attribute name="Sync_Align_Ratio" use="optional" default="50"> |
|
670 <xsd:simpleType> |
|
671 <xsd:restriction base="xsd:integer"> |
|
672 <xsd:minInclusive value="1"/> |
|
673 <xsd:maxInclusive value="99"/> |
|
674 </xsd:restriction> |
|
675 </xsd:simpleType> |
|
676 </xsd:attribute> |
669 </xsd:complexType> |
677 </xsd:complexType> |
670 </xsd:element> |
678 </xsd:element> |
671 </xsd:schema> |
679 </xsd:schema> |
672 """ |
680 """ |
673 |
681 |
953 try: |
961 try: |
954 LocationCFilesAndCFLAGS,LDFLAGS = self._Generate_C( |
962 LocationCFilesAndCFLAGS,LDFLAGS = self._Generate_C( |
955 buildpath, |
963 buildpath, |
956 self.PLCGeneratedLocatedVars, |
964 self.PLCGeneratedLocatedVars, |
957 logger) |
965 logger) |
958 except Exception, msg: |
966 except Exception, exc: |
959 logger.write_error("Plugins code generation Failed !\n") |
967 logger.write_error("Plugins code generation Failed !\n") |
960 logger.write_error(str(msg)) |
968 logger.write_error(traceback.format_exc()) |
961 return False |
969 return False |
962 |
970 |
963 |
971 |
964 #debug |
972 #debug |
965 #import pprint |
973 #import pprint |
974 ["int __init_%(s)s(int argc,char **argv);\nvoid __cleanup_%(s)s();\nvoid __retrieve_%(s)s();\nvoid __publish_%(s)s();"% |
982 ["int __init_%(s)s(int argc,char **argv);\nvoid __cleanup_%(s)s();\nvoid __retrieve_%(s)s();\nvoid __publish_%(s)s();"% |
975 {'s':locstr} for locstr in locstrs]), |
983 {'s':locstr} for locstr in locstrs]), |
976 "retrieve_calls":"\n ".join(["__retrieve_%(s)s();"%{'s':locstr} for locstr in locstrs]), |
984 "retrieve_calls":"\n ".join(["__retrieve_%(s)s();"%{'s':locstr} for locstr in locstrs]), |
977 "publish_calls":"\n ".join(["__publish_%(s)s();"%{'s':locstr} for locstr in locstrs]), |
985 "publish_calls":"\n ".join(["__publish_%(s)s();"%{'s':locstr} for locstr in locstrs]), |
978 "init_calls":"\n ".join(["init_level++; if(res = __init_%(s)s(argc,argv)) return res;"%{'s':locstr} for locstr in locstrs]), |
986 "init_calls":"\n ".join(["init_level++; if(res = __init_%(s)s(argc,argv)) return res;"%{'s':locstr} for locstr in locstrs]), |
979 "cleanup_calls":"\n ".join(["if(init_level-- > 0) __cleanup_%(s)s();"%{'s':locstr} for locstr in locstrs])} |
987 "cleanup_calls":"\n ".join(["if(init_level-- > 0) __cleanup_%(s)s();"%{'s':locstr} for locstr in locstrs]), |
|
988 "sync_align_ratio":self.BeremizRoot.getSync_Align_Ratio()} |
980 target_name = self.BeremizRoot.TargetType.content["name"] |
989 target_name = self.BeremizRoot.TargetType.content["name"] |
981 plc_main += runtime.code("plc_%s_main"%target_name) |
990 plc_main += runtime.code("plc_%s_main"%target_name) |
982 |
991 |
983 main_path = os.path.join(buildpath, "main.c" ) |
992 main_path = os.path.join(buildpath, "main.c" ) |
984 f = open(main_path,'w') |
993 f = open(main_path,'w') |