1*5f7ddb14SDimitry Andric //===-- SWIGPythonBridge.cpp ----------------------------------------------===//
2*5f7ddb14SDimitry Andric //
3*5f7ddb14SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*5f7ddb14SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*5f7ddb14SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*5f7ddb14SDimitry Andric //
7*5f7ddb14SDimitry Andric //===----------------------------------------------------------------------===//
8*5f7ddb14SDimitry Andric 
9*5f7ddb14SDimitry Andric #include "lldb/Host/Config.h"
10*5f7ddb14SDimitry Andric #include "lldb/lldb-enumerations.h"
11*5f7ddb14SDimitry Andric 
12*5f7ddb14SDimitry Andric #if LLDB_ENABLE_PYTHON
13*5f7ddb14SDimitry Andric 
14*5f7ddb14SDimitry Andric // LLDB Python header must be included first
15*5f7ddb14SDimitry Andric #include "lldb-python.h"
16*5f7ddb14SDimitry Andric 
17*5f7ddb14SDimitry Andric #include "SWIGPythonBridge.h"
18*5f7ddb14SDimitry Andric 
19*5f7ddb14SDimitry Andric using namespace lldb;
20*5f7ddb14SDimitry Andric 
21*5f7ddb14SDimitry Andric namespace lldb_private {
22*5f7ddb14SDimitry Andric 
23*5f7ddb14SDimitry Andric template <typename T> const char *GetPythonValueFormatString(T t);
GetPythonValueFormatString(char *)24*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(char *) { return "s"; }
GetPythonValueFormatString(char)25*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(char) { return "b"; }
GetPythonValueFormatString(unsigned char)26*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(unsigned char) {
27*5f7ddb14SDimitry Andric   return "B";
28*5f7ddb14SDimitry Andric }
GetPythonValueFormatString(short)29*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(short) { return "h"; }
GetPythonValueFormatString(unsigned short)30*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(unsigned short) {
31*5f7ddb14SDimitry Andric   return "H";
32*5f7ddb14SDimitry Andric }
GetPythonValueFormatString(int)33*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(int) { return "i"; }
GetPythonValueFormatString(unsigned int)34*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(unsigned int) { return "I"; }
GetPythonValueFormatString(long)35*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(long) { return "l"; }
GetPythonValueFormatString(unsigned long)36*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(unsigned long) {
37*5f7ddb14SDimitry Andric   return "k";
38*5f7ddb14SDimitry Andric }
GetPythonValueFormatString(long long)39*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(long long) { return "L"; }
GetPythonValueFormatString(unsigned long long)40*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(unsigned long long) {
41*5f7ddb14SDimitry Andric   return "K";
42*5f7ddb14SDimitry Andric }
GetPythonValueFormatString(float)43*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(float) { return "f"; }
GetPythonValueFormatString(double)44*5f7ddb14SDimitry Andric template <> const char *GetPythonValueFormatString(double) { return "d"; }
45*5f7ddb14SDimitry Andric 
46*5f7ddb14SDimitry Andric } // namespace lldb_private
47*5f7ddb14SDimitry Andric 
48*5f7ddb14SDimitry Andric #endif // LLDB_ENABLE_PYTHON
49