Matt Godbolt’s blog

Self-indulgent postings

Vim's quickfix and GCC 4.5

I’ve been using Vim more and more as my primary editor both at home and at work. Recently I’ve started using its quickfix support too to run make and then navigate to the errors.

I hit a problem where in the version of Vim in Ubuntu doesn’t have support for the newer format error messages in gcc 4.5, misinterpreting the “In file XX at line YY:ZZ” message. The most recent Vim has a fix, but if, like me, you don’t have much appetite for installing non-system versions of things like Vim, then you can fix up the error parsing by putting this in your .vimrc:

set errorformat=%*[^"]"%f"%*\D%l:\ %m,"%f"%*\D%l:\ %m,%-G%f:%l:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once,%-G%f:%l:\ for\ each\ function\ it\ appears\ in.),%-GIn\ file\ included\ from\ %f:%l:%c:,%-GIn\ file\ included\ from\ %f:%l:%c,%-GIn\ file\ included\ from\ %f:%l,%-Gfrom\ %f:%l:%c,%-Gfrom\ %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\,\ line\ %l%*\D%c%*[^\ ]\ %m,%D%*\a[%*\d]:\ Entering\ directory\ `%f’,%X%*\a[%*\d]:\ Leaving\ directory\ `%f’,%D%*\a:\ Entering\ directory\ `%f’,%X%*\a:\ Leaving\ directory\ `%f’,%DMaking\ %*\a\ in\ %f,%f\|%l\|\ %m

I’m also experimenting with some alternative bindings to replace me typing :make. So far I’m using control-F10 to build and show errors, and F3, F4 to navigate between errors with:

function Make() 
    silent make
    redraw!
    cw 8
    echo getqflist()[-1].text
endfunction

nnoremap <c-F10> :call Make()<CR>
nnoremap <F4> :cnext<CR>
nnoremap <F3> :cprev<CR>

It’s by no means perfect as you get no feedback during the make process itself (which is rubbish), but it’s a start.

Filed under: Coding

Posted at 20:30:30 BST on 27th August 2011.


An update to Miracle

Again I find my blog has fallen into disrepair due to lack of updates…but I have my excuses!

Firstly, I’ve been incredibly busy at work, continuing to enjoy learning lots about how trading systems work. I’ve ended up travelling quite a lot to our satellite office in Greenwich, Connecticut too, which eats into my time.

I’ve also moved house since the last update, now living opposite Lake Michigan in the town of Winnetka. Ness, the boys and I are all really enjoying our new suburban living. Both boys have had birthdays too — Isaac is now 1, and William is 3.

So anyway, to the other time sink in my life: Miracle. Since the last update I’ve added a lot of bug fixes, optimized it a load, integrated a debugger (complete with persistent labelling of memory addresses), and most importantly of all, have added early sound support.

It requires an up-to-date browser (bleeding edge Chrome, for example), and probably needs you to fiddle with enabling alpha settings (see here), but you can now enjoy Sonic with sound!

Take it for a spin here, or check the code out on Github.

Filed under: Coding

Posted at 23:30:30 BST on 8th July 2011.


Introducing Miracle

This weekend was a long weekend in the US (Presidents’ Day, apparently). As well as spending some time with my family, I set myself the goal of doing something “cool”, programming-wise.

Inspired by JSNES and JSSpeccy, I decided to port Richard Talbot-Watkins and my old Sega Master System emulator, !Miracle, to JavaScript.

I borrowed the Z80 emulator from JSSpeccy and thankfully Richard’s Master System documentation is still on the web, so I had a great head-start.

Miracle, showing Sonic the Hedgehog
Sonic wags his fingers at me.

You can take it for a spin here (I’ll hack it later to allow me to embed it here). Keys are W, S, A and D for movement, Enter and Space for the fire buttons. I’ve rather cheekily embedded two ROMs that work quite well, Sonic and Teddy Boy.

The source code is on github if you want to take a peek.

There’s a ton of bugs and things to implement (most notably sound), but I’m pretty damn pleased with the results.

Next up, fix some bugs and then perhaps think about a BBC Micro emulator…

Filed under: Coding

Posted at 05:00:00 GMT on 24th February 2011.


Hello Chicago!

We’ve successfully survived our first week in Chicago! It hardly seems like yesterday we were panicking about getting the house in Horsham packed up before the taxi to the airport arrived.

The boys were amazingly patient on the flight — eight and a half hours and not a peep from either. Isaac played happily in Ness’s lap, and William slept or watched CBeebies on the British Airways in-flight entertainment.

Clearing through immigration was far less traumatic than we were anticipating: as we had small children and lots of hand luggage an airport employee took pity on us and let us through the fast track line. The immigration officer was friendly and helpful and processed our visas in no time. Past immigration, we found a porter to help us pick up our six large suitcases, two car seats, pram and buggy board and load them onto a taxi. Before we knew it we were sitting, somewhat shell-shocked, in our new apartment overlooking Millennium Park.

Last weekend flew by; we explored the surrounding area on foot (it’s not as cold as we were anticipating here); we picked up our hire car and went to the fantastic Shedd Aquarium; we shopped for warmer clothes and stocked up on staple foods.

The boys at the bean
Matt, William and Isaac pose under the Cloud Gate (a.k.a. “The Bean”) sculpture in Millennium Park.

The week also flew by; I was at work (minus some time sorting out a bank account and social security number), and Ness and the boys continued to explore Chicago, checking out the Willis Tower, visiting the art museum (rude not to; it’s next door), touring the city on the trolley bus and generally getting their bearings.

We’ve just been out for a lovely meal at the Park Grill and now Ness and I are enjoying a lovely cup of tea. We had to import two large boxes of Yorkshire tea and an electric kettle that works on 110V to do so as the US tea is so awful.

Filed under: Blog

Posted at 05:00:00 GMT on 16th January 2011.