This may be overkill and may not be easy or desireable to tie together with a humble ww calculator, but... If you haven't heard, have a look at the "NUT" application, a command line tool for working with the USDA food nutrient database. http://nut.sourceforge.net/