diff --git a/src/BaseObj.h b/src/BaseObj.h index 7ed7c51f6..1d8d6a31f 100644 --- a/src/BaseObj.h +++ b/src/BaseObj.h @@ -25,6 +25,10 @@ * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _PikaObj_baseObj__H #define _PikaObj_baseObj__H #include "PikaObj.h" @@ -36,3 +40,7 @@ PikaObj* New_BaseObj(Args* args); void Baseobj_print(PikaObj* self, Args* args); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/PikaCompiler.h b/src/PikaCompiler.h index 24a3668dc..ebbb6ad2b 100644 --- a/src/PikaCompiler.h +++ b/src/PikaCompiler.h @@ -1,3 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PIKA_COMPILER__H #define __PIKA_COMPILER__H #include "PikaObj.h" @@ -63,3 +67,6 @@ PIKA_RES pikafs_unpack_files(char* pack_name, char* out_path); PIKA_RES pikafs_pack_files(char* pack_name, int file_num, ...); #endif +#ifdef __cplusplus +} +#endif diff --git a/src/PikaObj.h b/src/PikaObj.h index 820df1364..509ee3413 100644 --- a/src/PikaObj.h +++ b/src/PikaObj.h @@ -25,6 +25,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _Process__H #define _Process__H @@ -664,3 +667,6 @@ int pika_GIL_EXIT(void); int pika_GIL_ENTER(void); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/PikaParser.h b/src/PikaParser.h index d01a70db2..e49f6d744 100644 --- a/src/PikaParser.h +++ b/src/PikaParser.h @@ -24,6 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef __PIKA_PARSER__H #define __PIKA_PARSER__H @@ -166,3 +169,7 @@ ByteCodeFrame* byteCodeFrame_appendFromAsm(ByteCodeFrame* bf, char* pikaAsm); uint16_t TokenStream_getSize(char* tokenStream); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/PikaPlatform.h b/src/PikaPlatform.h index 8213d119b..3ce05bce4 100644 --- a/src/PikaPlatform.h +++ b/src/PikaPlatform.h @@ -24,6 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif /* adapter for old api */ #include "./pika_adapter_old_api.h" @@ -295,3 +298,7 @@ void pika_platform_clear(void); pika_platform_panic_handle(); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/PikaVM.h b/src/PikaVM.h index 65fd69c90..6641e3523 100644 --- a/src/PikaVM.h +++ b/src/PikaVM.h @@ -24,6 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef __PIKA_VM__H #define __PIKA_VM__H @@ -371,3 +374,7 @@ typedef struct { } VMLocals; #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/PikaVersion.h b/src/PikaVersion.h index 8aa7229c2..3c4f45400 100644 --- a/src/PikaVersion.h +++ b/src/PikaVersion.h @@ -1,5 +1,13 @@ +#ifdef __cplusplus +extern "C" { +#endif + #define PIKA_VERSION_MAJOR 1 #define PIKA_VERSION_MINOR 12 #define PIKA_VERSION_MICRO 0 #define PIKA_EDIT_TIME "2023/03/08 09:54:07" + +#ifdef __cplusplus +} +#endif diff --git a/src/TinyObj.h b/src/TinyObj.h index 85c6ed48a..b7d891ab0 100644 --- a/src/TinyObj.h +++ b/src/TinyObj.h @@ -25,8 +25,16 @@ * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __TYNYOBJ__H #define __TYNYOBJ__H #include "PikaObj.h" PikaObj* New_TinyObj(Args* args); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/__default_filter_msg_def.h b/src/__default_filter_msg_def.h index bb86e6d01..38a4e32e4 100644 --- a/src/__default_filter_msg_def.h +++ b/src/__default_filter_msg_def.h @@ -24,7 +24,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #undef add_filter_msg #undef add_filter_item #undef __add_filter_msg diff --git a/src/__default_filter_msg_table.h b/src/__default_filter_msg_table.h index 3f607b666..cf4301696 100644 --- a/src/__default_filter_msg_table.h +++ b/src/__default_filter_msg_table.h @@ -71,4 +71,5 @@ add_filter_msg(bye_pika, "###bye pika", .is_case_insensitive = PIKA_TRUE) #if defined(__clang__) # pragma clang diagnostic pop -#endif \ No newline at end of file +#endif + diff --git a/src/__instruction_table.h b/src/__instruction_table.h index 0b92630b1..f11396378 100644 --- a/src/__instruction_table.h +++ b/src/__instruction_table.h @@ -25,6 +25,7 @@ * SOFTWARE. */ + #include "__instruction_def.h" //! just append ins to the end, insert ins would brake the pre-compiled diff --git a/src/__pika_ooc.h b/src/__pika_ooc.h index 9fb3f1336..64cd4056f 100644 --- a/src/__pika_ooc.h +++ b/src/__pika_ooc.h @@ -26,6 +26,9 @@ * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef __PIKA_OOC_H__ #define __PIKA_OOC_H__ @@ -39,3 +42,7 @@ #if PIKA_PLOOC_ENABLE #include "../pikascript-lib/PLOOC/plooc_class.h" #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/dataArg.h b/src/dataArg.h index 1bb4e7ad2..509abee74 100644 --- a/src/dataArg.h +++ b/src/dataArg.h @@ -25,6 +25,10 @@ * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _arg__H #define _arg__H @@ -301,3 +305,7 @@ PIKA_BOOL arg_isEqual(Arg* self, Arg* other); Hash hash_time33EndWith(char* str, char end); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/dataArgs.h b/src/dataArgs.h index d4d0db1ef..c7b9faeae 100644 --- a/src/dataArgs.h +++ b/src/dataArgs.h @@ -25,6 +25,10 @@ * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _dataArgs__H #define _dataArgs__H #include "dataArg.h" @@ -279,3 +283,7 @@ char* args_cacheStr(Args* self, char* str); char* strsFormatArg(Args* out_buffs, char* fmt, Arg* arg); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/dataLink.h b/src/dataLink.h index 5f723c3d9..83b52a66c 100644 --- a/src/dataLink.h +++ b/src/dataLink.h @@ -25,6 +25,10 @@ * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _link2__H #define _link2__H #include "dataLinkNode.h" @@ -50,3 +54,7 @@ LinkNode* link_getNode(Link* self, int64_t id); int32_t link_getSize(Link* self); Link* New_link(void* args); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/dataLinkNode.h b/src/dataLinkNode.h index 41a852adf..0970787d3 100644 --- a/src/dataLinkNode.h +++ b/src/dataLinkNode.h @@ -24,7 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef _linkNode__H #define _linkNode__H @@ -40,3 +42,6 @@ void linkNode_init(LinkNode* self, void* args); LinkNode* New_linkNode(void* args); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/dataMemory.h b/src/dataMemory.h index 5b81d3b2d..bf6c9b466 100644 --- a/src/dataMemory.h +++ b/src/dataMemory.h @@ -24,7 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef __MEMORY_H__ #define __MEMORY_H__ @@ -88,3 +90,6 @@ void mem_pool_init(void); #undef __DATA_MEMORY_CLASS_IMPLEMENT__ #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/dataQueue.h b/src/dataQueue.h index f43c8ff15..30f65c97f 100644 --- a/src/dataQueue.h +++ b/src/dataQueue.h @@ -25,7 +25,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef __DATA_QUEUE__H #define __DATA_QUEUE__H #include "dataArgs.h" @@ -84,3 +86,6 @@ uint_fast16_t byteQueue_peekAvailableCount(ByteQueue *queue); PIKA_BOOL byteQueue_writeOne(ByteQueue *queue, uint8_t byte); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/dataQueueObj.h b/src/dataQueueObj.h index fffa258d3..2e2f61d5e 100644 --- a/src/dataQueueObj.h +++ b/src/dataQueueObj.h @@ -24,7 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef __DATA_QUEUE_OBJ__H #define __DATA_QUEUE_OBJ__H #include "PikaObj.h" @@ -46,3 +48,6 @@ PikaObj* queueObj_popObj(QueueObj* self); PikaObj* queueObj_getCurrentObj(QueueObj* self); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/dataStack.h b/src/dataStack.h index a0c14194d..ad5a9876d 100644 --- a/src/dataStack.h +++ b/src/dataStack.h @@ -24,7 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef __DATA_STACK__H #define __DATA_STACK__H #include "dataArgs.h" @@ -52,3 +54,6 @@ int32_t stack_popSize(Stack* stack); void stack_pushSize(Stack* stack, int32_t size); void stack_reset(Stack* stack); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/dataString.h b/src/dataString.h index 97473fe69..504d5a0ca 100644 --- a/src/dataString.h +++ b/src/dataString.h @@ -24,7 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef __MY_TEST_TOOLS_H #define __MY_TEST_TOOLS_H #include "PikaPlatform.h" @@ -71,3 +73,6 @@ int strGetIndent(char* string); int strIsBlank(char* string); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/dataStrs.h b/src/dataStrs.h index b09e805e2..5475164ad 100644 --- a/src/dataStrs.h +++ b/src/dataStrs.h @@ -24,7 +24,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - +#ifdef __cplusplus +extern "C" { +#endif #ifndef __STR_ARGS__H #define __STR_ARGS__H #include "dataArgs.h" @@ -52,3 +54,6 @@ char* strsPathJoin(Args* buffs_p, char* input1, char* input2); char* strsPathFormat(Args* buffs_p, char* input); #endif +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/pika_adapter_mpy.h b/src/pika_adapter_mpy.h index c60449a7f..7a0dc8deb 100644 --- a/src/pika_adapter_mpy.h +++ b/src/pika_adapter_mpy.h @@ -1,3 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PIKA_ADAPTER_MPY_H__ #define __PIKA_ADAPTER_MPY_H__ #include @@ -335,3 +339,6 @@ typedef struct _mp_obj_list_t { #endif +#ifdef __cplusplus +} +#endif diff --git a/src/pika_adapter_old_api.h b/src/pika_adapter_old_api.h index 642d48884..3c0de692e 100644 --- a/src/pika_adapter_old_api.h +++ b/src/pika_adapter_old_api.h @@ -1,3 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PIKA_ADAPTER_OLD_API_H__ #define __PIKA_ADAPTER_OLD_API_H__ @@ -83,3 +87,7 @@ #endif #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/pika_adapter_rtt.h b/src/pika_adapter_rtt.h index a8c824c85..164e03f4c 100644 --- a/src/pika_adapter_rtt.h +++ b/src/pika_adapter_rtt.h @@ -1,3 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PIKA_ADAPTER_RTT_H__ #include #include "PikaPlatform.h" @@ -52,3 +56,7 @@ #define RT_ASSERT(...) pika_assert(__VA_ARGS__) #endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/pika_config_valid.h b/src/pika_config_valid.h index c1de5c445..79bea43e5 100644 --- a/src/pika_config_valid.h +++ b/src/pika_config_valid.h @@ -24,6 +24,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PIKA_CFG_VALID_H__ #define __PIKA_CFG_VALID_H__ @@ -462,3 +466,6 @@ /* configuration validation */ #endif +#ifdef __cplusplus +} +#endif diff --git a/test/test_common.h b/test/test_common.h index 9a0c0ec4f..c447fc35e 100644 --- a/test/test_common.h +++ b/test/test_common.h @@ -1,23 +1,25 @@ #define __OOC_CPP__ #define __OOC_DEBUG__ -extern "C" { #include "BaseObj.h" #include "PikaCompiler.h" -#include "PikaMain.h" -#include "PikaMath_Operator.h" #include "PikaParser.h" -#include "PikaStdLib_MemChecker.h" -#include "PikaStdLib_SysObj.h" #include "PikaVM.h" #include "TinyObj.h" #include "dataArgs.h" #include "dataMemory.h" #include "dataStrs.h" + +extern "C" { +#include "PikaMain.h" +#include "PikaMath_Operator.h" +#include "PikaStdLib_MemChecker.h" +#include "PikaStdLib_SysObj.h" #include "pikaScript.h" #include "pika_config_gtest.h" #include "pika_hal.h" #include + extern PikaMemInfo g_PikaMemInfo; /* the log_buff of printf */ extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];