mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
fix err when #define __platform_printf to printf
This commit is contained in:
parent
d249cb64e2
commit
83afef1906
@ -633,7 +633,7 @@ static enum shell_state __obj_shellLineHandler_input(PikaObj* self,
|
||||
char* PikaStdLib_SysObj_input(PikaObj* self, PikaTuple* info) {
|
||||
struct shell_config cfg = {.prefix = "", .context = NULL};
|
||||
if (tuple_getSize(info) > 0) {
|
||||
__platform_printf(tuple_getStr(info, 0));
|
||||
__platform_printf("%s", tuple_getStr(info, 0));
|
||||
}
|
||||
_temp_obj_shellLineProcess(self, __obj_shellLineHandler_input, &cfg);
|
||||
char* res = obj_cacheStr(self, arg_getStr(cfg.context));
|
||||
|
@ -633,7 +633,7 @@ static enum shell_state __obj_shellLineHandler_input(PikaObj* self,
|
||||
char* PikaStdLib_SysObj_input(PikaObj* self, PikaTuple* info) {
|
||||
struct shell_config cfg = {.prefix = "", .context = NULL};
|
||||
if (tuple_getSize(info) > 0) {
|
||||
__platform_printf(tuple_getStr(info, 0));
|
||||
__platform_printf("%s", tuple_getStr(info, 0));
|
||||
}
|
||||
_temp_obj_shellLineProcess(self, __obj_shellLineHandler_input, &cfg);
|
||||
char* res = obj_cacheStr(self, arg_getStr(cfg.context));
|
||||
|
@ -56,7 +56,7 @@ void ctypes_create_string_buffer___init__(PikaObj* self, int size) {
|
||||
uint8_t* buffer;
|
||||
obj_setBytes(self, "raw", NULL, size);
|
||||
buffer = obj_getBytes(self, "raw");
|
||||
__platform_printf("0x%x", &buffer);
|
||||
__platform_printf("0x%lx", (uintptr_t)&buffer);
|
||||
}
|
||||
|
||||
int ctypes_create_string_buffer___getitem__(PikaObj* self, int __key) {
|
||||
|
@ -8,8 +8,10 @@
|
||||
#include "pikaScript.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifndef __platform_printf
|
||||
void __platform_printf(char* format, ...) {
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
|
||||
|
@ -311,7 +311,7 @@ int LibObj_loadLibrary(LibObj* self, uint8_t* library_bytes) {
|
||||
/* check version num */
|
||||
if (version_num != LIB_VERSION_NUMBER) {
|
||||
__platform_printf(
|
||||
"Error: invalid version number. Expected %, got %\r\n",
|
||||
"Error: invalid version number. Expected %d, got %d\r\n",
|
||||
LIB_VERSION_NUMBER, version_num);
|
||||
return PIKA_RES_ERR_INVALID_VERSION_NUMBER;
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ static void _do__obj_runCharBeforeRun(PikaObj* self, struct shell_config* cfg) {
|
||||
/* create the line buff for the first time */
|
||||
obj_setBytes(self, "@sh_buff", NULL, PIKA_LINE_BUFF_SIZE);
|
||||
obj_setInt(self, "@sh_is_in_block", 0);
|
||||
__platform_printf(cfg->prefix);
|
||||
__platform_printf("%s", cfg->prefix);
|
||||
}
|
||||
|
||||
static void __obj_runCharBeforeRun(PikaObj* self) {
|
||||
@ -940,7 +940,7 @@ enum shell_state _do_obj_runChar(PikaObj* self,
|
||||
}
|
||||
input_line = rxBuff;
|
||||
enum shell_state state = __lineHandler_fun(self, input_line, cfg);
|
||||
__platform_printf(cfg->prefix);
|
||||
__platform_printf("%s", cfg->prefix);
|
||||
__clearBuff(rxBuff, PIKA_LINE_BUFF_SIZE);
|
||||
return state;
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ void obj_shellLineProcess(PikaObj* self,
|
||||
if (is_exit) {
|
||||
return;
|
||||
}
|
||||
__platform_printf(cfg->prefix);
|
||||
__platform_printf("%s", cfg->prefix);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1914,7 +1914,7 @@ static Arg* VM_instruction_handler_OPT(PikaObj* self,
|
||||
}
|
||||
VMState_setErrorCode(vm, PIKA_RES_ERR_OPERATION_FAILED);
|
||||
__platform_printf(
|
||||
"TypeError: unsupported operand type(s) for %: 'float'\n");
|
||||
"TypeError: unsupported operand type(s) for %%: 'float'\n");
|
||||
op.res = NULL;
|
||||
goto exit;
|
||||
case '-':
|
||||
@ -2217,7 +2217,7 @@ static Arg* VM_instruction_handler_ASS(PikaObj* self,
|
||||
res = VM_instruction_handler_RIS(self, vm, data, arg_ret_reg);
|
||||
if (vm->run_state->try_state == TRY_STATE_NONE) {
|
||||
if (arg_num == 1) {
|
||||
__platform_printf("AssertionError\n", data);
|
||||
__platform_printf("AssertionError\n");
|
||||
}
|
||||
if (arg_num == 2) {
|
||||
__platform_printf("AssertionError: %s\n", arg_getStr(arg2));
|
||||
@ -2834,7 +2834,7 @@ void VMState_solveUnusedStack(VMState* vm) {
|
||||
__platform_printf("%s\r\n", res);
|
||||
} else if (type == ARG_TYPE_INT) {
|
||||
#if PIKA_PRINT_LLD_ENABLE
|
||||
__platform_printf("%lld\r\n", arg_getInt(arg));
|
||||
__platform_printf("%ld\r\n", arg_getInt(arg));
|
||||
#else
|
||||
__platform_printf("%d\r\n", (int)arg_getInt(arg));
|
||||
#endif
|
||||
|
@ -2,4 +2,4 @@
|
||||
#define PIKA_VERSION_MINOR 11
|
||||
#define PIKA_VERSION_MICRO 5
|
||||
|
||||
#define PIKA_EDIT_TIME "2022/10/15 23:34:06"
|
||||
#define PIKA_EDIT_TIME "2022/10/19 13:16:48"
|
||||
|
@ -136,7 +136,7 @@ void pool_printBlocks(Pool* pool, uint32_t size_min, uint32_t size_max) {
|
||||
if (is_end) {
|
||||
break;
|
||||
}
|
||||
__platform_printf("0x%x\t: ", i * pool->aline, (i + 15) * pool->aline);
|
||||
__platform_printf("0x%x\t: 0x%d", i * pool->aline, (i + 15) * pool->aline);
|
||||
for (uint32_t j = i; j < i + 16; j += 4) {
|
||||
if (is_end) {
|
||||
break;
|
||||
|
@ -81,9 +81,9 @@ void stack_pushPyload(Stack* stack,
|
||||
"OverflowError: pika VM stack overflow, please use bigger "
|
||||
"PIKA_STACK_BUFF_SIZE\r\n");
|
||||
__platform_printf("Info: stack size request: %d\r\n",
|
||||
stack_size_after_push);
|
||||
(int)stack_size_after_push);
|
||||
__platform_printf("Info: stack size now: %d\r\n",
|
||||
stack->stack_totle_size);
|
||||
(int)stack->stack_totle_size);
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
char log_buff[LOG_BUFF_MAX][LOG_SIZE] = {0};
|
||||
uint32_t log_index = 0;
|
||||
|
||||
#ifndef __platform_printf
|
||||
/* save printf content to log_buff */
|
||||
void __platform_printf(char* fmt, ...) {
|
||||
va_list args;
|
||||
@ -19,6 +20,7 @@ void __platform_printf(char* fmt, ...) {
|
||||
vsnprintf(log_buff[0], LOG_SIZE - 1, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* quick_malloc is always open */
|
||||
uint8_t __is_quick_malloc(void) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user