diff --git a/include/pocketpy/pocketpy.h b/include/pocketpy/pocketpy.h index 547af499..dcb26d0e 100644 --- a/include/pocketpy/pocketpy.h +++ b/include/pocketpy/pocketpy.h @@ -71,7 +71,7 @@ typedef struct py_Callbacks { /// Flush the output buffer of `print`. void (*flush)(); /// Used by `input` to get a character. - int (*getchar)(); + int (*getch)(); } py_Callbacks; /// Native function signature. diff --git a/src/interpreter/vm.c b/src/interpreter/vm.c index d9986d8a..cafb575e 100644 --- a/src/interpreter/vm.c +++ b/src/interpreter/vm.c @@ -76,7 +76,7 @@ void VM__ctor(VM* self) { self->callbacks.importfile = pk_default_importfile; self->callbacks.print = pk_default_print; self->callbacks.flush = pk_default_flush; - self->callbacks.getchar = getchar; + self->callbacks.getch = getchar; self->last_retval = *py_NIL(); self->curr_exception = *py_NIL(); @@ -822,7 +822,7 @@ int py_replinput(char* buf, int max_size) { printf(">>> "); while(true) { - int c = pk_current_vm->callbacks.getchar(); + int c = pk_current_vm->callbacks.getch(); if(c == EOF) return -1; if(c == '\n') { diff --git a/src/public/modules.c b/src/public/modules.c index bd47e3b3..1875f8cd 100644 --- a/src/public/modules.c +++ b/src/public/modules.c @@ -205,7 +205,7 @@ static bool builtins_input(int argc, py_Ref argv) { c11_sbuf buf; c11_sbuf__ctor(&buf); while(true) { - int c = py_callbacks()->getchar(); + int c = py_callbacks()->getch(); if(c == '\n' || c == '\r') break; if(c == EOF) break; c11_sbuf__write_char(&buf, c);