Commit 40ca1cc7 authored by Boxiang Sun's avatar Boxiang Sun

add readline module with some pyston changes

parent 67973cf6
...@@ -123,6 +123,7 @@ add_custom_command(OUTPUT ...@@ -123,6 +123,7 @@ add_custom_command(OUTPUT
${CMAKE_BINARY_DIR}/lib_pyston/bz2.pyston.so ${CMAKE_BINARY_DIR}/lib_pyston/bz2.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/_ctypes.pyston.so ${CMAKE_BINARY_DIR}/lib_pyston/_ctypes.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/grp.pyston.so ${CMAKE_BINARY_DIR}/lib_pyston/grp.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/readline.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/termios.pyston.so ${CMAKE_BINARY_DIR}/lib_pyston/termios.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/_curses.pyston.so ${CMAKE_BINARY_DIR}/lib_pyston/_curses.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/mmap.pyston.so ${CMAKE_BINARY_DIR}/lib_pyston/mmap.pyston.so
...@@ -149,6 +150,7 @@ add_custom_command(OUTPUT ...@@ -149,6 +150,7 @@ add_custom_command(OUTPUT
Modules/_elementtree.c Modules/_elementtree.c
Modules/bz2module.c Modules/bz2module.c
Modules/grpmodule.c Modules/grpmodule.c
Modules/readline.c
Modules/termios.c Modules/termios.c
Modules/_cursesmodule.c Modules/_cursesmodule.c
Modules/mmapmodule.c Modules/mmapmodule.c
......
...@@ -1063,8 +1063,10 @@ readline_until_enter_or_signal(char *prompt, int *signal) ...@@ -1063,8 +1063,10 @@ readline_until_enter_or_signal(char *prompt, int *signal)
#endif /*defined(HAVE_RL_CALLBACK) && defined(HAVE_SELECT) */ #endif /*defined(HAVE_RL_CALLBACK) && defined(HAVE_SELECT) */
// Pyston changes: change the type of 3rd argument from char* to const char*
// To match the type of Pyston PyOS_ReadlineFunctionPointer.
static char * static char *
call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
{ {
size_t n; size_t n;
char *p, *q; char *p, *q;
...@@ -1085,7 +1087,7 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) ...@@ -1085,7 +1087,7 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
#endif #endif
} }
p = readline_until_enter_or_signal(prompt, &signal); p = readline_until_enter_or_signal((char*)prompt, &signal);
/* we got an interrupt signal */ /* we got an interrupt signal */
if (signal) { if (signal) {
...@@ -1167,6 +1169,6 @@ initreadline(void) ...@@ -1167,6 +1169,6 @@ initreadline(void)
if (m == NULL) if (m == NULL)
return; return;
PyOS_ReadlineFunctionPointer = call_readline; PyOS_ReadlineFunctionPointer = &call_readline;
setup_readline(); setup_readline();
} }
...@@ -82,6 +82,12 @@ def curses_ext(): ...@@ -82,6 +82,12 @@ def curses_ext():
"Modules/_cursesmodule.c", "Modules/_cursesmodule.c",
]), libraries = ['curses']) ]), libraries = ['curses'])
@unique
def readline_ext():
return Extension("readline", sources = map(relpath, [
"Modules/readline.c",
]))
@unique @unique
def termios_ext(): def termios_ext():
return Extension("termios", sources = map(relpath, [ return Extension("termios", sources = map(relpath, [
...@@ -142,6 +148,7 @@ ext_modules = [future_builtins_ext(), ...@@ -142,6 +148,7 @@ ext_modules = [future_builtins_ext(),
ctypes_test_ext(), ctypes_test_ext(),
grp_ext(), grp_ext(),
curses_ext(), curses_ext(),
readline_ext(),
termios_ext(), termios_ext(),
mmap_ext(), mmap_ext(),
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment