From 12d3ae80555effe7a709f07358f2d017f76a54a1 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 4 May 2024 23:18:05 +0800 Subject: [PATCH] Update 1_5_0.md --- docs/1_5_0.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/1_5_0.md b/docs/1_5_0.md index 7fb753f5..78cd4b1c 100644 --- a/docs/1_5_0.md +++ b/docs/1_5_0.md @@ -146,3 +146,31 @@ from __builtins import next ``` Related C++ APIs do not change. They still return `vm->StopIteration` to indicate the end of iteration. + +## User config support + +We used to read `user_config.h` file to override the default configurations. +In `v1.5.0`, this is no longer supported. +Please use config macros before `#include "pocketpy.h"` directly. + +```cpp +#define PK_ENABLE_OS 1 +#define PK_ENABLE_THREAD 1 +#define PK_ENABLE_PROFILER 1 +// for all config macros, please refer to `include/pocketpy/config.h` +#include "pocketpy.h" +``` + +## Debugger and profiler + +We added a macro `PK_ENABLE_PROFILER` (default is 0) to control the availability of the builtin debugger and profiler. +If you want to use them, for example, you want to call `breakpoint()` or `import line_profiler`, you need to set `PK_ENABLE_PROFILER` to 1 before `#include "pocketpy.h"`. + +```cpp +#define PK_ENABLE_PROFILER 1 +#include "pocketpy.h" +``` + +!!! +Enabling the profiler has a performance overhead. Only enable it when you need it. +!!!