Beispiel #1
0
def _add_aliases():
    for name, info in _concrete_typeinfo.items():
        # these are handled by _add_integer_aliases
        if name in _int_ctypes or name in _uint_ctypes:
            continue

        # insert bit-width version for this class (if relevant)
        base, bit, char = bitname(info.type)

        myname = "%s%d" % (base, bit)

        # ensure that (c)longdouble does not overwrite the aliases assigned to
        # (c)double
        if name in ('longdouble', 'clongdouble') and myname in allTypes:
            continue

        base_capitalize = english_capitalize(base)
        if base == 'complex':
            na_name = '%s%d' % (base_capitalize, bit // 2)
        elif base == 'bool':
            na_name = base_capitalize
        else:
            na_name = "%s%d" % (base_capitalize, bit)

        allTypes[myname] = info.type

        # add mapping for both the bit name and the numarray name
        sctypeDict[myname] = info.type
        sctypeDict[na_name] = info.type

        # add forward, reverse, and string mapping to numarray
        sctypeNA[na_name] = info.type
        sctypeNA[info.type] = na_name
        sctypeNA[info.char] = na_name

        sctypeDict[char] = info.type
        sctypeNA[char] = na_name
Beispiel #2
0
def _add_aliases():
    for name, info in _concrete_typeinfo.items():
        # these are handled by _add_integer_aliases
        if name in _int_ctypes or name in _uint_ctypes:
            continue

        # insert bit-width version for this class (if relevant)
        base, bit, char = bitname(info.type)

        myname = "%s%d" % (base, bit)

        # ensure that (c)longdouble does not overwrite the aliases assigned to
        # (c)double
        if name in ('longdouble', 'clongdouble') and myname in allTypes:
            continue

        base_capitalize = english_capitalize(base)
        if base == 'complex':
            na_name = '%s%d' % (base_capitalize, bit//2)
        elif base == 'bool':
            na_name = base_capitalize
        else:
            na_name = "%s%d" % (base_capitalize, bit)

        allTypes[myname] = info.type

        # add mapping for both the bit name and the numarray name
        sctypeDict[myname] = info.type
        sctypeDict[na_name] = info.type

        # add forward, reverse, and string mapping to numarray
        sctypeNA[na_name] = info.type
        sctypeNA[info.type] = na_name
        sctypeNA[info.char] = na_name

        sctypeDict[char] = info.type
        sctypeNA[char] = na_name