You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working on a library that allows the sending and receiving of messages in C++ without knowing their types at compile time.
While reviewing the code that generates the message definition and md5 sum (which is very well written and easy to read btw) to replicate it in C++, I came across the load_srv_from_string function
defload_srv_from_string(msg_context, text, full_name):
""" Load :class:`SrvSpec` from the .srv file. :param msg_context: :class:`MsgContext` instance to load request/response messages into. :param text: .msg text , ``str`` :param package_name: context to use for msg type name, i.e. the package name, or '' to use local naming convention. ``str`` :returns: :class:`SrvSpec` instance :raises :exc:`InvalidMsgSpec` If syntax errors or other problems are detected in file """text_in=StringIO()
text_out=StringIO()
accum=text_inforlintext.split('\n'):
l=l.split(COMMENTCHAR)[0].strip() #strip comments ifl.startswith(IODELIM): #lenient, by requestaccum=text_outelse:
accum.write(l+'\n')
# create separate MsgSpec objects for each half of filemsg_in=load_msg_from_string(msg_context, text_in.getvalue(), '%sRequest'%(full_name))
msg_out=load_msg_from_string(msg_context, text_out.getvalue(), '%sResponse'%(full_name))
returnSrvSpec(msg_in, msg_out, text, full_name)
I haven't tested it which is why I said possibly in the title but wouldn't the comment stripping result in the incorrect removal of parts of valid constant definitions such as
string EXAMPLE="#comments" are ignored, and leading and trailing whitespace removed
I am currently working on a library that allows the sending and receiving of messages in C++ without knowing their types at compile time.
While reviewing the code that generates the message definition and md5 sum (which is very well written and easy to read btw) to replicate it in C++, I came across the load_srv_from_string function
I haven't tested it which is why I said possibly in the title but wouldn't the comment stripping result in the incorrect removal of parts of valid constant definitions such as
taken from the msg wiki.
The text was updated successfully, but these errors were encountered: