New version!
AGROS 0.3.2. Not a major improvement over the old one. New features (from the CHANGELOG):
* Allows launch in background with '&'
This was a lot easier to implement than it sounds. All it takes is for the parent process not to wait for the end of execution of child process :)
* Adds 'help' command, similar to '?'
* Enhances 'help' output
This is part of a revamping of the help function. I am thinking of building an embedded manual. Have you seen the inline help of programs such as git? They rock! That's what I want.
* Fixes memory issues (builtins and cmd struct)
It's so easy to forget about a free() call. I caught a few (thanks arithma btw). Also I found out that the preprocessor can give you a much needed flexibility to reduce memory footprint :)
These changes are not impressive, especially since so much time has passed since release of previous version. The reason is that I spent my summer working on two features that ultimately resulted in a fail :( I guess it's okay, since I'm doing this for learning after all. Bummer.
1- Modularity.
I decided to separate the code of AGROS into 5 different files. (Not to mention the separation into 5 header files). The idea was to have different AGROS modules. The problem was when writing the Makefile, I got completely lost :S. Not to mention that those nested includes drove me insane. I lost a couple of months trying to implement that.
2- Parsing.
This is what killed me really. In an effort to reduce outside dependencies (and improve portability) I decided to write my own INI file parsing library. To make things worse, I thought it would be a good time to try and pick up C++. Let's just say that language is
definitely not for me!. After the code became a big pile of messy classes and functions, I still wouldn't admit the fiasco. I tried to port my existing C++ code into C thinking I would pick up things easier from here. Oh what a mess!
If I learned one thing from this it is: Keep a "stable" branch somewhere in your source control. In other words, don't push to github unless really tested and stable. Reverting to old state is possible, but the implications of such a move can be very annoying. For instance, in the process of reverting, I lost a functionality that I particularly enjoyed:
the ability to read commands from an input file. I promise it will come in the next
version.
I have decided to put off the separation in modules for a while. Even though my main .c file is now 450 lines. I guess I can wait a bit before going through that ordeal again. As for parsing, I have found an external library that is much better than the one I'm using now. Small, open source, and easily embeddable in my code (
iniparser). It's better than the bulky GNOME library I'm using today.
For those of you following my story with AGROS, thanks :)