| 1 |
/* |
| 2 |
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2020 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-runtime-lib |
| 6 |
* Created on: 29 авг. 2019 г. |
| 7 |
* |
| 8 |
* lsp-runtime-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-runtime-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#include <lsp-plug.in/common/types.h> |
| 23 |
#include <lsp-plug.in/fmt/java/defs.h> |
| 24 |
#include <lsp-plug.in/fmt/java/Object.h> |
| 25 |
|
| 26 |
namespace lsp |
| 27 |
{ |
| 28 |
namespace java |
| 29 |
{ |
| 30 |
ftype_t decode_primitive_type(size_t tcode) |
| 31 |
{ |
| 32 |
switch (tcode) |
| 33 |
{ |
| 34 |
#define XDEC(a, b) case a: return b; |
| 35 |
XDEC(PTC_BYTE, JFT_BYTE) |
| 36 |
XDEC(PTC_CHAR, JFT_CHAR) |
| 37 |
XDEC(PTC_DOUBLE, JFT_DOUBLE) |
| 38 |
XDEC(PTC_FLOAT, JFT_FLOAT) |
| 39 |
XDEC(PTC_INTEGER, JFT_INTEGER) |
| 40 |
XDEC(PTC_LONG, JFT_LONG) |
| 41 |
XDEC(PTC_SHORT, JFT_SHORT) |
| 42 |
XDEC(PTC_BOOL, JFT_BOOL) |
| 43 |
XDEC(PTC_ARRAY, JFT_ARRAY) |
| 44 |
XDEC(PTC_OBJECT, JFT_OBJECT) |
| 45 |
#undef XDEC |
| 46 |
default: break; |
| 47 |
} |
| 48 |
|
| 49 |
return JFT_UNKNOWN; |
| 50 |
} |
| 51 |
|
| 52 |
const char *primitive_type_name(ftype_t tcode) |
| 53 |
{ |
| 54 |
switch (tcode) |
| 55 |
{ |
| 56 |
#define XDEC(a, b) case a: return #b; |
| 57 |
XDEC(JFT_BYTE, byte) |
| 58 |
XDEC(JFT_CHAR, char) |
| 59 |
XDEC(JFT_DOUBLE, double) |
| 60 |
XDEC(JFT_FLOAT, float) |
| 61 |
XDEC(JFT_INTEGER, int) |
| 62 |
XDEC(JFT_LONG, long) |
| 63 |
XDEC(JFT_SHORT, short) |
| 64 |
XDEC(JFT_BOOL, bool) |
| 65 |
#undef XDEC |
| 66 |
default: break; |
| 67 |
} |
| 68 |
|
| 69 |
return NULL; |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
|