Shell got a nice boost today, with a 62k patch from
sca, re-structuring the command handling. Also, as pointed out by Xaignar, std::string::data() is lot faster than c_str() that we were using at few (possibly performance-critical) locations, so a slight performance improvement there (altough not noticable).
I'v been working on some prototypes for new shell parser (sca's patch still doesn't give us tab-completition), but they need more work. What we need there is two parsers really - first pass the stream through telnet protocol parser, that strips out all telnet-protocol related stuff, and after that send to main command parser. The main parser will parse the stream, per-byte, and use signals to message the user, e.g. onTabComplete signal requests user-code to attempt to tab-complete the token, onSpecialChar signal sends the special-char to any user-defined handler(s) (optional), for example, if user wanted to handle up/down/left/right arrows somehow. onCommand signal indicates EOL and full command ready for processing.
To onCommand signal, we'll connect a command-lookup function, which determines how to handle the command. That function must look at (a) current object's commands, (b) globally declared commands, and then pass the command to, in (a) case, to the object, or (b) to internal shell function for handling. The internal shell functions should be implemented using a map lookup (already done in sca's patch).
On other news, I'm reviewing site content, and preparing to update the on-site documentation - it's in pretty bad/old shape right now, many things are out of date, or simply rusty. Documentation also needs same amount of maintainance as code does, but I never seem to have time to maintain docs ... but as they say - "You never have time, you have to
take time."
Madcat.