| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6e9fed9 commit 464080f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,8 +82,20 @@ public class Runtime | |||
| 82 | 82 | { | |
| 83 | 83 | #if UCS4 | |
| 84 | 84 | public const int UCS = 4; | |
| 85 | + | ||
| 86 | + /// <summary> | ||
| 87 | + /// EntryPoint to be used in DllImport to map to correct Unicode | ||
| 88 | + /// methods prior to PEP393. Only used for PY27. | ||
| 89 | + /// </summary> | ||
| 90 | + private const string PyUnicodeEntryPoint = "PyUnicodeUCS4_"; | ||
| 85 | 91 | #elif UCS2 | |
| 86 | 92 | public const int UCS = 2; | |
| 93 | + | ||
| 94 | + /// <summary> | ||
| 95 | + /// EntryPoint to be used in DllImport to map to correct Unicode | ||
| 96 | + /// methods prior to PEP393. Only used for PY27. | ||
| 97 | + /// </summary> | ||
| 98 | + private const string PyUnicodeEntryPoint = "PyUnicodeUCS2_"; | ||
| 87 | 99 | #else | |
| 88 | 100 | #error You must define either UCS2 or UCS4! | |
| 89 | 101 | #endif | |
@@ -1270,44 +1282,26 @@ internal static IntPtr PyUnicode_FromUnicode(string s, int size) | |||
| 1270 | 1282 | ||
| 1271 | 1283 | [DllImport(PythonDll)] | |
| 1272 | 1284 | internal static extern IntPtr PyUnicode_FromOrdinal(int c); | |
| 1273 | - #elif UCS2 && PYTHON2 | ||
| 1274 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS2_FromObject")] | ||
| 1275 | - internal static extern IntPtr PyUnicode_FromObject(IntPtr ob); | ||
| 1276 | - | ||
| 1277 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS2_FromEncodedObject")] | ||
| 1278 | - internal static extern IntPtr PyUnicode_FromEncodedObject(IntPtr ob, IntPtr enc, IntPtr err); | ||
| 1279 | - | ||
| 1280 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS2_FromUnicode", CharSet = CharSet.Unicode)] | ||
| 1281 | - internal static extern IntPtr PyUnicode_FromUnicode(string s, int size); | ||
| 1282 | - | ||
| 1283 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS2_GetSize")] | ||
| 1284 | - internal static extern int PyUnicode_GetSize(IntPtr ob); | ||
| 1285 | - | ||
| 1286 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS2_AsUnicode")] | ||
| 1287 | - internal static extern IntPtr PyUnicode_AsUnicode(IntPtr ob); | ||
| 1288 | - | ||
| 1289 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS2_FromOrdinal")] | ||
| 1290 | - internal static extern IntPtr PyUnicode_FromOrdinal(int c); | ||
| 1291 | - #elif UCS4 && PYTHON2 | ||
| 1292 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS4_FromObject")] | ||
| 1285 | + #elif PYTHON2 | ||
| 1286 | + [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "FromObject")] | ||
| 1293 | 1287 | internal static extern IntPtr PyUnicode_FromObject(IntPtr ob); | |
| 1294 | 1288 | ||
| 1295 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS4_FromEncodedObject")] | ||
| 1289 | + [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "FromEncodedObject")] | ||
| 1296 | 1290 | internal static extern IntPtr PyUnicode_FromEncodedObject(IntPtr ob, IntPtr enc, IntPtr err); | |
| 1297 | 1291 | ||
| 1298 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS4_FromUnicode")] | ||
| 1292 | + [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "FromUnicode")] | ||
| 1299 | 1293 | internal static extern IntPtr PyUnicode_FromUnicode( | |
| 1300 | 1294 | [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StrMarshaler))] string s, | |
| 1301 | 1295 | int size | |
| 1302 | 1296 | ); | |
| 1303 | 1297 | ||
| 1304 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS4_GetSize")] | ||
| 1298 | + [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "GetSize")] | ||
| 1305 | 1299 | internal static extern int PyUnicode_GetSize(IntPtr ob); | |
| 1306 | 1300 | ||
| 1307 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS4_AsUnicode")] | ||
| 1301 | + [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "AsUnicode")] | ||
| 1308 | 1302 | internal static extern IntPtr PyUnicode_AsUnicode(IntPtr ob); | |
| 1309 | 1303 | ||
| 1310 | - [DllImport(PythonDll, EntryPoint = "PyUnicodeUCS4_FromOrdinal")] | ||
| 1304 | + [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "FromOrdinal")] | ||
| 1311 | 1305 | internal static extern IntPtr PyUnicode_FromOrdinal(int c); | |
| 1312 | 1306 | #endif | |
| 1313 | 1307 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments