diff options
author | Kenneth Graunke <[email protected]> | 2010-11-03 12:47:06 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2011-01-12 23:55:33 -0800 |
commit | daeb0c646e0d652bfa16d326028753ecf092c0c9 (patch) | |
tree | 989d8ba697d400d22b6db5d123d290046de14515 /src/glut | |
parent | 407184fe08ced99875c3abfac743a1d60857ccf2 (diff) |
ir_reader: Add a pattern matching system and use it everywhere.
Previously, the IR reader was riddled with code that:
1. Checked for the right number of list elements (via a linked list walk)
2. Retrieved references to each component (via ->next->next pointers)
3. Downcasted as necessary to make sure that each sub-component was the
right type (i.e. symbol, int, list).
4. Checking that the tag (i.e. "declare") was correct.
This was all very ad-hoc and a bit ugly. Error checking had to be done
at both steps 1, 3, and 4. Most code didn't even check the tag, relying
on the caller to do so. Not all callers did.
The new pattern matching module performs the whole process in a single
straightforward function call, resulting in shorter, more readable code.
Unfortunately, MSVC does not support C99-style anonymous arrays, so the
pattern must be declared outside of the match call.
Diffstat (limited to 'src/glut')
0 files changed, 0 insertions, 0 deletions