Managing Multiple Versions of Visual Studio

In my previous post, I described how to build an old version of GNU Make for Windows. While working on that I wanted to be able to test out different versions of Visual Studio to see if it builds successfully. Quickly switching between versions of Visual Studio was difficult so I created a batch file to help make it a lot easier.

This script takes a single argument that specifies which version of visual studio you want to set up and it then calls the appropriate vsvars32.bat file for that version of Visual Studio.

@echo off

if "%1" == "vs4" goto vs4
if "%1" == "vs6" goto vs6
if "%1" == "vs2003" goto vs2003

goto argerror

pushd C:\msdev\bin
call vcvars32 x86
goto done

pushd C:\Program Files\Microsoft Visual Studio\VC98\Bin
call vcvars32
goto done

pushd "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\"
call vsvars32.bat
goto done

echo no Visual Studio version specified!
echo usage: setupenv [version]
echo    where version is one of the following: vs4, vs6, vs2003



Using CERN’s Root Library for Plotting

This is a post about something I did at least a year ago. I was modifying the firmware of a board as a customer wanted to change the way calibration of the product worked. The old method used a table containing points in a curve, each point contained the desired set point, and the actual value you get. The code then interpolated between the points in the curve as needed to get the actual value you need to set in order to get the desired value.

The customer wanted to use a single polynomial expression for calibration instead as that is what their existing products used. The new system would only need the coefficients of the polynomial instead of the large table of numbers. I wanted to experiment a bit with the polynomial code I had just written on the PC and at the time I did not know Scilab or numpy/matplotlib, but I had just read about CERN’s Root library which is a C++ library that includes really good plotting libraries. So I thought I’d try it out.

As you can see the plots look really good. Although I haven’t really used Root since I still remember it can sometimes consider it for doing plots even though I typically choose Gnuplot or matplotlib. On big advantage is that because it is a C++ library I can use the C code I wrote for the firmware directly without modification.