Add further tests to test_record_dtype

These test:

- Use of structured arrays as well as recarrays. Numpy doesn't
  support attribute access on structured arrays but Numba does, so
  changes are made to the test to allow it to use structured
  arrays for Numba code whilst comparing against Numpy code using
  recarrays for reference. Use of structured arrays exercises the
  caching of typecodes for ndarrays of void types in the
  dispatcher.
- Use of more than one recarray or structured array as an argument
  to a jitted function.
- Use of recarrays or structured arrays of differing type as
  arguments to a jitted function. This exposes a bug in the
  typecode caching, which erroneously considers all structured
  arrays to be of the same type, and therefore causes errors in
  the dispatcher which fails to correctly match argument types.
Remove dead function Dispatcher_Find
Allow the dispatcher to keep references to types

When the dispatcher uses typecode_fallback to look up the typecode
of a type, it is possible for the object with the typecode it
returns to be GC'd before typecode_fallback is finished, therefore
returning a typecode for a now non-existent type.

This generally can occur in the first execution of a jitted
function, and is not problematic, except when typecodes are to be
cached - if the typecode is stored for future use, it cannot
legitimately be used to match argument types in future.

This commit makes it possible to prevent deletion of a type used
by typecode_fallback, which will be required to correct the
behaviour of the typecode cache for record types. When
typecode_fallback is called with retain_reference=1, it avoids
calling Py_DECREF on the type it obtains. The reference to the
type is not retained as it is not used from the dispatcher code -
it only needs to prevent deletion.
Fix caching of record arrays and add for scalars

The implementation of caching for ndarrays of structured types
erroneously uses the type_num to distinguish between different
types - unfortunately in the case of structured arrays, the
type_num is always NPY_VOID, so it treats all structured array
types as being the same type.

As a more correct alternative, this commit changes the
implementation to store a mapping between types and typecodes in a
dict, whose keys are a tuple of the PyArray_Descr* for the array,
the layout, and the dimension.

Additionally, this commit adds caching for scalar record types
using similar logic.
Adding myself
Remove commented code
Rename npsample to refsample

In order to distinguish it from nbsample.
Explain constraints for keeping type objects alive
Merge pull request #880 from gmarkall/dict_cache

Fixes for record type typecode caching, and additional tests (attempt 2)