1
0

config.h 2.6 KB

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