void PYGenerator::generate() { std::string fn = gOptions.output_ + gOptions.inputFS_ + ".py"; CodeFile f(fn); f.output("from bintalk import protocol_writer"); f.output("from bintalk import protocol_reader"); for(std::set<std::string>::iterator iter = gContext.imported_.begin(); iter != gContext.imported_.end(); ++iter) { std::string incFilename = *iter; incFilename = incFilename.substr(0,incFilename.find('.')); f.output("from %s import *", incFilename.c_str()); } for(size_t i = 0; i < gContext.definitions_.size(); i++) { Definition* definition = gContext.definitions_[i]; if(definition->file_ != gOptions.inputFN_) continue; if (definition->getEnum()) generateEnum(f, definition->getEnum()); else if (definition->getStruct()) generateStruct(f, definition->getStruct()); else if (definition->getService()) generateService(f, definition->getService()); } }
void CSGenerator::generate() { CodeFile f(gOptions.output_ + gOptions.inputFS_ + ".cs"); f.output("using System.Collections.Generic;"); for(size_t i = 0; i < gContext.definitions_.size(); i++) { Definition* definition = gContext.definitions_[i]; if(definition->file_ != gOptions.inputFN_) continue; if (definition->getEnum()) generateEnum(f, definition->getEnum()); else if (definition->getStruct()) generateStruct(f, definition->getStruct()); else if (definition->getService()) generateService(f, definition->getService()); } }