def _constant_to_string(constant_type, constant_value): if constant_type == exprtypes.BoolType(): return str(constant_value).lower() elif constant_type == exprtypes.IntType(): return str(constant_value) elif constant_type == exprtypes.StringType(): return '"%s"' % constant_value else: return utils.bitvector_to_string(constant_value, constant_type.size)
def value_to_string(the_value): if (the_value.value_type.type_code == exprtypes.TypeCodes.boolean_type): if (the_value.value_object == True): return 'true' else: return 'false' elif (the_value.value_type.type_code == exprtypes.TypeCodes.integer_type): return str(the_value.value_object) elif (the_value.value_type.type_code == exprtypes.TypeCodes.bit_vector_type): return utils.bitvector_to_string(the_value.value_object, the_value.value_type.size)