1
0

config.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #pragma once
  2. // clang-format off
  3. #define PK_VERSION "2.1.0"
  4. #define PK_VERSION_MAJOR 2
  5. #define PK_VERSION_MINOR 1
  6. #define PK_VERSION_PATCH 0
  7. /*************** feature settings ***************/
  8. #ifndef PK_ENABLE_OS // can be overridden by cmake
  9. #define PK_ENABLE_OS 1
  10. #endif
  11. #ifndef PK_ENABLE_THREADS // can be overridden by cmake
  12. #define PK_ENABLE_THREADS 1
  13. #endif
  14. #ifndef PK_ENABLE_DETERMINISM // must be enabled from cmake
  15. #define PK_ENABLE_DETERMINISM 0
  16. #endif
  17. #ifndef PK_ENABLE_WATCHDOG // can be overridden by cmake
  18. #define PK_ENABLE_WATCHDOG 0
  19. #endif
  20. #ifndef PK_ENABLE_CUSTOM_SNAME // can be overridden by cmake
  21. #define PK_ENABLE_CUSTOM_SNAME 0
  22. #endif
  23. // GC min threshold
  24. #ifndef PK_GC_MIN_THRESHOLD // can be overridden by cmake
  25. #define PK_GC_MIN_THRESHOLD 32768
  26. #endif
  27. // Memory allocation functions
  28. #ifndef PK_MALLOC
  29. #ifndef __cplusplus
  30. #define PK_MALLOC(size) malloc(size)
  31. #define PK_REALLOC(ptr, size) realloc(ptr, size)
  32. #define PK_FREE(ptr) free(ptr)
  33. #else
  34. #define PK_MALLOC(size) std::malloc(size)
  35. #define PK_REALLOC(ptr, size) std::realloc(ptr, size)
  36. #define PK_FREE(ptr) std::free(ptr)
  37. #endif
  38. #endif
  39. // This is the maximum size of the value stack in py_TValue units
  40. // The actual size in bytes equals `sizeof(py_TValue) * PK_VM_STACK_SIZE`
  41. #ifndef PK_VM_STACK_SIZE // can be overridden by cmake
  42. #define PK_VM_STACK_SIZE 16384
  43. #endif
  44. // This is the maximum number of local variables in a function
  45. // (not recommended to change this)
  46. #ifndef PK_MAX_CO_VARNAMES // can be overridden by cmake
  47. #define PK_MAX_CO_VARNAMES 64
  48. #endif
  49. /*************** internal settings ***************/
  50. // This is the maximum character length of a module path
  51. #define PK_MAX_MODULE_PATH_LEN 63
  52. // This is some math constants
  53. #define PK_M_PI 3.1415926535897932384
  54. #define PK_M_E 2.7182818284590452354
  55. #define PK_M_DEG2RAD 0.017453292519943295
  56. #define PK_M_RAD2DEG 57.29577951308232
  57. // Hash table load factor (smaller ones mean less collision but more memory)
  58. // For class instance
  59. #define PK_INST_ATTR_LOAD_FACTOR 0.67f
  60. // For class itself
  61. #define PK_TYPE_ATTR_LOAD_FACTOR 0.5f
  62. #ifdef _WIN32
  63. #define PK_PLATFORM_SEP '\\'
  64. #else
  65. #define PK_PLATFORM_SEP '/'
  66. #endif
  67. #ifdef __cplusplus
  68. #ifndef restrict
  69. #define restrict
  70. #endif
  71. #endif