Example #1
0
        meth << "doc.Accept(writer);"
        meth << ""
        meth << "return strbuf.GetString();"

    @export(VOID)
    def JsonSet(self, meth):
        meth.args = [OArg("json", "const char*")]

        meth << "rapidjson::Document doc;"
        meth << "doc.Parse(json);"
        for v in self.dbargs:
            meth << v.name + " = doc[" + q(v.name) + "];"

#-----------------------------------------------------------------------
ct = Measure("TblMeasure", FLDS_SERVER)
handleExports(ct)
write_file_cpp(ct, "tmp/")


cs = Measure("TblWeather", FLDS_WEATHER)
handleExports(cs)
write_file_cpp(cs, "tmp/")


cs = Measure("TblStock", FLDS_STOCK)
handleExports(cs)
write_file_cpp(cs, "tmp/")


cs = Measure("TblVdr", FLDS_VDR)
handleExports(cs)
Example #2
0
        if mname == "init":
            for cl in ccode:
                m << cl
        if mname.startswith("_"):
            m = OMethod(mname[1:], "void", args, mods={PRIVATE})
        c << m
    writeFile2(s, c)


# Read STM32 pin configuration from text file and generate macros to access output pins.
#
p = ParseOrg("stm32.org")


c = Port()
gen.handleExports(c)

spi = Spi()
gen.handleExports(spi)

c.m << "GPIO_InitTypeDef ioInit;"

pins = []
for i in ['A', 'B', 'C']:
    pout = []
    pin = []
    paf = []
    for bit, af, desc, direction in p.parse()[1:]:
        af = af.strip()
        #print "AF:",af,len(af)
        if len(af) > 0: