Tcl Binding to Protocol Buffers edit
Areas | (De)serialization, RPC |
Good if student knows | Tcl, C |
Priority | Medium to Low |
Difficulty | Medium to High |
Benefits to the student | Learning about data serialization, the challenges therein. |
Benefits to Tcl | Enhanced ability to exchange data with other languages |
Mentor | AK |
Related Project Ideas | GSoC Idea: Tcl Binding to Thrift GSoC Idea: Tcl Binding to MessagePack GSoC Idea: Updated Tcl bindings for ZeroMQ |
Project Description edit
Protocol Buffers
Requirements: edit
- ...
- ...
Notes: edit
EF I might be able to provide some mentorship help around this, though not entirely.KPV Here's something I wrote when I needed a way to ingest simple protocol buffers by converting them into a tcl dictionary.proc Proto2Dict {protoFile} { set fin [open $protoFile r] set lines [split [string trim [read $fin]] \n] ; list lappend lines "done: @ done" ; list close $fin set protoDict {} set currentSection "" set currentData "" foreach line $lines { set newSection [regexp {^ *(.*): +@ } $line . sectionName] if {$newSection} { if {$currentSection ne ""} { dict set protoDict $currentSection $currentData puts "adding $currentSection" } set currentSection $sectionName set currentData "" } else { if {[regexp {(\w*): (.*)} line . key value]} { append currentData "$key $value\n" } else { append currentData "$line\n" } } } return $protoDict }