Skip to content
Snippets Groups Projects
Select Git revision
  • a31dae65c783f15451a463d60472c742d814f58e
  • master default
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.1
  • v2014.0
  • v2013.0
10 results

C_CodeGen.jrag

Blame
  • Forked from Anders Blomdell / LabComm
    Source project has a limited visibility.
    example_encoder.py 585 B
    #!/usr/bin/python
    
    import labcomm
    import sys
    import simple
    
    if __name__ == '__main__':
        version = sys.argv[2] if len(sys.argv) == 3 else "LabComm2013"
        encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')), version)
        encoder.add_decl(simple.theTwoInts.signature)
        encoder.add_decl(simple.IntString.signature)
        foo = simple.theTwoInts()
        foo.a = 13
        foo.b = 37
        encoder.encode(foo, simple.theTwoInts.signature)
    
        bar = simple.IntString()
        bar.x = 1742
        bar.s = "A string from Python"
        encoder.encode(bar, simple.IntString.signature)