For five weeks in row we have been working on the enhancement of the code. I really don’t know why it’s taking that much time. Is that what usually happens in any project developing?! Feel like we are in infinite loop… Hopefully we will reach the “break;” statement soon. Lol !!
Let’s start first with the front end. By using codeMirror show-hint addon the auto-completion capability can be accessed. The addon has function called “showhint” which takes the editor instance and other function called “gethint” as parameters. (refer to codemirror manual for more info) and in return the widget will be displayed with the contents that have been returned by “gethint()”. The “gethint” function can be defined by you (otherwise default values will be used ) and it should return the array of strings that represents the completions.
So the question now from where can the “gethint” function get those C++ completions? In order to get intelligent auto-completion an intelligent system is needed indeed. The system should provide the completion of user built classes and function plus the C++ standard libraries ones therefore this kind of system should parse the C++ code and define its structure and block and … . Don’t worry..! We don’t have to do that from scratch since there’s some helpful tool such as CLANG. CLANG is front end compiler that has the functionality of autocompletion and all you have to do is to provide the incomplete code and the position where you want the autocompletion to take place using the following command line.
clang -fsyntax-only -Xclang -code-completion-macros -Xclang -code-completion-at=xxxx.cpp:line:ch line.cpp
This compiling command will return the list of possible completion in such form:
COMPLETION: puts :[#int#]puts(<#const char *__s#>)
I also had to build more wrappers modules for our project- Ethernet and SDCard – Building the wrappers for those two modules was not an issue but integrating them in the system was what confused me. Unlike others modules those two should only be instantiated once in the whole system, which means there has to be a way to limit the multi-declaration for their C++ classes, and they can only be connected to specific pins in the FPGA. These pins are not limited only to those modules ports and can be also used by others modules as well, .. hmm Does that somehow necessitate the creation function of the top module to check for the availability of those ports whenever the user instantiate any Ethernet or SDCard ?
Logging messages are needed to help you keep track of your system operations. They are really useful for debugging as well and whenever the system crashes. This week I worked also in adding these logging messages to my code using witty function WT::log() . Different logging messages were implemented. Some show errors and other show info while other only show the warning messages .
That is it for this week… Stay safe 🙂