Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bmq-codegen

XSD schema compiler that generates BDE-compliant C++ message types for BlazingMQ.

Replaces Bloomberg's internal bas_codegen.pl with a standalone Python tool so external contributors can regenerate protocol types without proprietary dependencies.

What it does

Parses Bloomberg-style XSD schemas and emits C++ header/source pairs following BDE coding standards. Handles sequences, choices, hybrid types, self-referential cycles (via NullableAllocatedValue), forward declaration ordering, and alignment-based member layout.

One schema in, two files out:

bmqp_ctrlmsg.xsd (1,792 lines)  →  bmqp_ctrlmsg_messages.h   (39,030 lines)
                                     bmqp_ctrlmsg_messages.cpp  (17,677 lines)

Usage

python -m blazingmq.codegen \
    --package bmqp_ctrlmsg \
    --msgComponent messages \
    --output-dir src/groups/bmq/bmqp/ \
    bmqp_ctrlmsg.xsd

Pipeline

XSD  →  parser  →  model  →  resolver  →  emitter_{h,cpp}
                     ↑            ↑              ↑
                  hybrid.py   naming.py    emit_{enum,sequence,choice}.py
                  ordering.py              formatting.py
                                           writer.py

parser builds a typed IR (Schema, ComplexType, EnumType, Field). resolver maps XSD types to C++ types, detects self-referential cycles via DFS, and determines allocator requirements. ordering topologically sorts types and orders members by alignment. Emitters produce formatted output through a Writer abstraction.

Validation

Output is diffed line-for-line against Bloomberg's checked-in generated files across 6 production schemas. Zero divergence.

License

Apache 2.0

About

Python XSD-to-C++ code generator for BlazingMQ protocol types

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages