c_ext/c_ext.py
changeset 729 25054c592dc4
parent 725 31dade089db5
child 734 5c42cafaee15
equal deleted inserted replaced
728:e0424e96e3fd 729:25054c592dc4
     1 import wx
       
     2 import os
     1 import os
     3 from xml.dom import minidom
     2 from xml.dom import minidom
     4 import cPickle
     3 import cPickle
     5 
     4 
     6 from xmlclass import *
     5 from xmlclass import *
     7 
     6 
     8 from ConfigTreeNode import ConfigTreeNode, opjimg
       
     9 from CFileEditor import CFileEditor
     7 from CFileEditor import CFileEditor
    10 from PLCControler import PLCControler, UndoBuffer, LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
     8 from PLCControler import UndoBuffer, LOCATION_CONFNODE, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT 
    11 
     9 
    12 CFileClasses = GenerateClassesFromXSD(os.path.join(os.path.dirname(__file__), "cext_xsd.xsd"))
    10 CFileClasses = GenerateClassesFromXSD(os.path.join(os.path.dirname(__file__), "cext_xsd.xsd"))
    13 
    11 
    14 TYPECONVERSION = {"BOOL" : "X", "SINT" : "B", "INT" : "W", "DINT" : "D", "LINT" : "L",
    12 TYPECONVERSION = {"BOOL" : "X", "SINT" : "B", "INT" : "W", "DINT" : "D", "LINT" : "L",
    15     "USINT" : "B", "UINT" : "W", "UDINT" : "D", "ULINT" : "L", "REAL" : "D", "LREAL" : "L",
    13     "USINT" : "B", "UINT" : "W", "UDINT" : "D", "ULINT" : "L", "REAL" : "D", "LREAL" : "L",
    16     "STRING" : "B", "BYTE" : "B", "WORD" : "W", "DWORD" : "D", "LWORD" : "L", "WSTRING" : "W"}
    14     "STRING" : "B", "BYTE" : "B", "WORD" : "W", "DWORD" : "D", "LWORD" : "L", "WSTRING" : "W"}
    17 
    15 
    18 class _Cfile:
    16 class CFile:
    19     XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
    17     XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
    20     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    18     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    21       <xsd:element name="CExtension">
    19       <xsd:element name="CExtension">
    22         <xsd:complexType>
    20         <xsd:complexType>
    23           <xsd:attribute name="CFLAGS" type="xsd:string" use="required"/>
    21           <xsd:attribute name="CFLAGS" type="xsd:string" use="required"/>
   303     def GetBufferState(self):
   301     def GetBufferState(self):
   304         first = self.CFileBuffer.IsFirst() and not self.Buffering
   302         first = self.CFileBuffer.IsFirst() and not self.Buffering
   305         last = self.CFileBuffer.IsLast()
   303         last = self.CFileBuffer.IsLast()
   306         return not first, not last
   304         return not first, not last
   307 
   305 
   308 class RootClass:
       
   309 
       
   310     CTNChildrenTypes = [("C_File",_Cfile, "C file")]
       
   311     
       
   312     def CTNGenerate_C(self, buildpath, locations):
       
   313         return [],"",False
       
   314 
       
   315