![]() |
Multi Weather |
---|
MultiWeather
Features Requirements Documentation README FAQ Changelog Screenshots Support Development Status Projects Hacking Guide Download Current Archive |
FAQ: Hacking MultiWeatherMultiWeather FAQ, version 0.1, Dec. 02, 2001 by psluis@caiw.nl [PJS] This document contains helpful hints for anyone who is interested in adding to or modifying MultiWeather, or simply fixing bugs. This document concentrates on the types of hacks that I think people are most likely to want to implement. What you want to do may not be covered in this document, but you should read it anyway to get some idea of how you might have to proceed.
1: Code Style and Data TypesThis section describes the central C-code and simple data types that MultiWeather relies on. In order to do any serious work with MultiWeather, you will need to be familiar with these types in order to make your code compile easily, interact properly with the rest of MultiWeather, and maintain MultiWeather's the level of portability. MultiWeather's source code is Doxygen enabled. This means that it's comments have been tagged in such a manner, that doxygen can generate class/code documentation. In order to do this, you need to: cd mweather-x.x.x doxygen mweather.cfg Doxygen generates Javadoc-style documentation which make browsing class hierarchies much easier. If you want to work with multiweather and be able to browse the source, I recommend doing this as a first step. 1.1: Coding styleMultiWeather follows the GNU coding standard available on the GNU homepage. Use consecutive spaces to indent lines and avoid tab characters. Turn on tab expansion in your editor to avoid tab/space mixture hell. Keeping the code consistant makes the code base easier to read, but also allows code to be moved around between files without reformatting. A brief stylistic overview is given here:
1.2: Simple data typesMultiWeather uses glib datatypes to avoid problems caused by machine or compiler specific definitions of datatypes. Use gint8, gint16, gint32, guint8, guint16, guint32, gfloat, gdouble, gchar, gint (and the rest) instead of types such as short, long, unsigned short, unsigned long, etc. Note that MultiWeather is a work in progress, and does not itself always adhere to these guidelines. Future code cleanups will address these issues. 1.3: Naming conventionsIt is important to give variables meaningful names. MultiWeather attempts to follow some naming conventions used by Gtk+. Abbreviations are avoided except when they are well established.
2: A brief tour of MultiWeather's source code[To be written.]3: Adding new source filesIf your changes are minor, such as fixing a bug, you should strive to work within the existing set of source code files. Unless the "bug" is a fundemantal design flaw or something equally serious, you shouldn't have to add or remove any source files. If you are considering a bug fix of such significant scope, you should probably contact PJS before proceeding. If you've gotten this far and you are still convinced that you need to create some new source files, for reasons of code sharing, keeping functionality isolated in well defined modules, or whatever, then that's ok. In this case, you should probably contact PJS before proceeding, to make sure he hasn't already taken the filenames you propose to use, and to make sure that your reasons for adding new source files are sound. Keep in mind that PJS is more likely to accept changes that do not involve radical changes to the code base. The type of modification that most commonly involves adding new source files are ones that involve creating new dialog boxes for the user to interact with. This is a consequence of the general method of writing code that uses the gdk/GTK+ toolkits. Of course, new features almost always require some type of user interaction, so if you're adding new functionality you can almost bet on having to create a dialog box or two and add some source files for that. MultiWeather uses the autoconf system to generate its Makefiles, so adding new source files is easy. Just put them in MultiWeather's src/ directory, add the filename to src/Makefile.am and then then re-run the configure script in your MultiWeather directory in order to generate new Makefiles that will recognize your new source files. 4: Debugging Support[To be written]9: Submitting your changesOnce you have implemented all your modifications, confirmed them against the most recent version of MultiWeather, and debugged your work, then you should submit your new code to the MultiWeather Mailing List. That way other users can see and comment on your code, and PJS can, if he finds it worthy, add your code to the main MultiWeather source distribution. Here's one way to do that, using tcsh. There are many other ways, of course:
Note that your tar file should be named with your username and the version of multiweather to which your changes apply, as in the above example. Further, if you have made substantial changes to any of the multiweather source files such that a diff would be impractical, then you may choose to simply include that whole file in your .tgz file. However, please use diffs wherever possible. |