readline.c.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. PyDoc_STRVAR(readline_parse_and_bind__doc__,
  9. "parse_and_bind($module, string, /)\n"
  10. "--\n"
  11. "\n"
  12. "Execute the init line provided in the string argument.");
  13. #define READLINE_PARSE_AND_BIND_METHODDEF \
  14. {"parse_and_bind", (PyCFunction)readline_parse_and_bind, METH_O, readline_parse_and_bind__doc__},
  15. PyDoc_STRVAR(readline_read_init_file__doc__,
  16. "read_init_file($module, filename=None, /)\n"
  17. "--\n"
  18. "\n"
  19. "Execute a readline initialization file.\n"
  20. "\n"
  21. "The default filename is the last filename used.");
  22. #define READLINE_READ_INIT_FILE_METHODDEF \
  23. {"read_init_file", _PyCFunction_CAST(readline_read_init_file), METH_FASTCALL, readline_read_init_file__doc__},
  24. static PyObject *
  25. readline_read_init_file_impl(PyObject *module, PyObject *filename_obj);
  26. static PyObject *
  27. readline_read_init_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  28. {
  29. PyObject *return_value = NULL;
  30. PyObject *filename_obj = Py_None;
  31. if (!_PyArg_CheckPositional("read_init_file", nargs, 0, 1)) {
  32. goto exit;
  33. }
  34. if (nargs < 1) {
  35. goto skip_optional;
  36. }
  37. filename_obj = args[0];
  38. skip_optional:
  39. return_value = readline_read_init_file_impl(module, filename_obj);
  40. exit:
  41. return return_value;
  42. }
  43. PyDoc_STRVAR(readline_read_history_file__doc__,
  44. "read_history_file($module, filename=None, /)\n"
  45. "--\n"
  46. "\n"
  47. "Load a readline history file.\n"
  48. "\n"
  49. "The default filename is ~/.history.");
  50. #define READLINE_READ_HISTORY_FILE_METHODDEF \
  51. {"read_history_file", _PyCFunction_CAST(readline_read_history_file), METH_FASTCALL, readline_read_history_file__doc__},
  52. static PyObject *
  53. readline_read_history_file_impl(PyObject *module, PyObject *filename_obj);
  54. static PyObject *
  55. readline_read_history_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  56. {
  57. PyObject *return_value = NULL;
  58. PyObject *filename_obj = Py_None;
  59. if (!_PyArg_CheckPositional("read_history_file", nargs, 0, 1)) {
  60. goto exit;
  61. }
  62. if (nargs < 1) {
  63. goto skip_optional;
  64. }
  65. filename_obj = args[0];
  66. skip_optional:
  67. return_value = readline_read_history_file_impl(module, filename_obj);
  68. exit:
  69. return return_value;
  70. }
  71. PyDoc_STRVAR(readline_write_history_file__doc__,
  72. "write_history_file($module, filename=None, /)\n"
  73. "--\n"
  74. "\n"
  75. "Save a readline history file.\n"
  76. "\n"
  77. "The default filename is ~/.history.");
  78. #define READLINE_WRITE_HISTORY_FILE_METHODDEF \
  79. {"write_history_file", _PyCFunction_CAST(readline_write_history_file), METH_FASTCALL, readline_write_history_file__doc__},
  80. static PyObject *
  81. readline_write_history_file_impl(PyObject *module, PyObject *filename_obj);
  82. static PyObject *
  83. readline_write_history_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  84. {
  85. PyObject *return_value = NULL;
  86. PyObject *filename_obj = Py_None;
  87. if (!_PyArg_CheckPositional("write_history_file", nargs, 0, 1)) {
  88. goto exit;
  89. }
  90. if (nargs < 1) {
  91. goto skip_optional;
  92. }
  93. filename_obj = args[0];
  94. skip_optional:
  95. return_value = readline_write_history_file_impl(module, filename_obj);
  96. exit:
  97. return return_value;
  98. }
  99. #if defined(HAVE_RL_APPEND_HISTORY)
  100. PyDoc_STRVAR(readline_append_history_file__doc__,
  101. "append_history_file($module, nelements, filename=None, /)\n"
  102. "--\n"
  103. "\n"
  104. "Append the last nelements items of the history list to file.\n"
  105. "\n"
  106. "The default filename is ~/.history.");
  107. #define READLINE_APPEND_HISTORY_FILE_METHODDEF \
  108. {"append_history_file", _PyCFunction_CAST(readline_append_history_file), METH_FASTCALL, readline_append_history_file__doc__},
  109. static PyObject *
  110. readline_append_history_file_impl(PyObject *module, int nelements,
  111. PyObject *filename_obj);
  112. static PyObject *
  113. readline_append_history_file(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  114. {
  115. PyObject *return_value = NULL;
  116. int nelements;
  117. PyObject *filename_obj = Py_None;
  118. if (!_PyArg_CheckPositional("append_history_file", nargs, 1, 2)) {
  119. goto exit;
  120. }
  121. nelements = _PyLong_AsInt(args[0]);
  122. if (nelements == -1 && PyErr_Occurred()) {
  123. goto exit;
  124. }
  125. if (nargs < 2) {
  126. goto skip_optional;
  127. }
  128. filename_obj = args[1];
  129. skip_optional:
  130. return_value = readline_append_history_file_impl(module, nelements, filename_obj);
  131. exit:
  132. return return_value;
  133. }
  134. #endif /* defined(HAVE_RL_APPEND_HISTORY) */
  135. PyDoc_STRVAR(readline_set_history_length__doc__,
  136. "set_history_length($module, length, /)\n"
  137. "--\n"
  138. "\n"
  139. "Set the maximal number of lines which will be written to the history file.\n"
  140. "\n"
  141. "A negative length is used to inhibit history truncation.");
  142. #define READLINE_SET_HISTORY_LENGTH_METHODDEF \
  143. {"set_history_length", (PyCFunction)readline_set_history_length, METH_O, readline_set_history_length__doc__},
  144. static PyObject *
  145. readline_set_history_length_impl(PyObject *module, int length);
  146. static PyObject *
  147. readline_set_history_length(PyObject *module, PyObject *arg)
  148. {
  149. PyObject *return_value = NULL;
  150. int length;
  151. length = _PyLong_AsInt(arg);
  152. if (length == -1 && PyErr_Occurred()) {
  153. goto exit;
  154. }
  155. return_value = readline_set_history_length_impl(module, length);
  156. exit:
  157. return return_value;
  158. }
  159. PyDoc_STRVAR(readline_get_history_length__doc__,
  160. "get_history_length($module, /)\n"
  161. "--\n"
  162. "\n"
  163. "Return the maximum number of lines that will be written to the history file.");
  164. #define READLINE_GET_HISTORY_LENGTH_METHODDEF \
  165. {"get_history_length", (PyCFunction)readline_get_history_length, METH_NOARGS, readline_get_history_length__doc__},
  166. static PyObject *
  167. readline_get_history_length_impl(PyObject *module);
  168. static PyObject *
  169. readline_get_history_length(PyObject *module, PyObject *Py_UNUSED(ignored))
  170. {
  171. return readline_get_history_length_impl(module);
  172. }
  173. PyDoc_STRVAR(readline_set_completion_display_matches_hook__doc__,
  174. "set_completion_display_matches_hook($module, function=None, /)\n"
  175. "--\n"
  176. "\n"
  177. "Set or remove the completion display function.\n"
  178. "\n"
  179. "The function is called as\n"
  180. " function(substitution, [matches], longest_match_length)\n"
  181. "once each time matches need to be displayed.");
  182. #define READLINE_SET_COMPLETION_DISPLAY_MATCHES_HOOK_METHODDEF \
  183. {"set_completion_display_matches_hook", _PyCFunction_CAST(readline_set_completion_display_matches_hook), METH_FASTCALL, readline_set_completion_display_matches_hook__doc__},
  184. static PyObject *
  185. readline_set_completion_display_matches_hook_impl(PyObject *module,
  186. PyObject *function);
  187. static PyObject *
  188. readline_set_completion_display_matches_hook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  189. {
  190. PyObject *return_value = NULL;
  191. PyObject *function = Py_None;
  192. if (!_PyArg_CheckPositional("set_completion_display_matches_hook", nargs, 0, 1)) {
  193. goto exit;
  194. }
  195. if (nargs < 1) {
  196. goto skip_optional;
  197. }
  198. function = args[0];
  199. skip_optional:
  200. return_value = readline_set_completion_display_matches_hook_impl(module, function);
  201. exit:
  202. return return_value;
  203. }
  204. PyDoc_STRVAR(readline_set_startup_hook__doc__,
  205. "set_startup_hook($module, function=None, /)\n"
  206. "--\n"
  207. "\n"
  208. "Set or remove the function invoked by the rl_startup_hook callback.\n"
  209. "\n"
  210. "The function is called with no arguments just\n"
  211. "before readline prints the first prompt.");
  212. #define READLINE_SET_STARTUP_HOOK_METHODDEF \
  213. {"set_startup_hook", _PyCFunction_CAST(readline_set_startup_hook), METH_FASTCALL, readline_set_startup_hook__doc__},
  214. static PyObject *
  215. readline_set_startup_hook_impl(PyObject *module, PyObject *function);
  216. static PyObject *
  217. readline_set_startup_hook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  218. {
  219. PyObject *return_value = NULL;
  220. PyObject *function = Py_None;
  221. if (!_PyArg_CheckPositional("set_startup_hook", nargs, 0, 1)) {
  222. goto exit;
  223. }
  224. if (nargs < 1) {
  225. goto skip_optional;
  226. }
  227. function = args[0];
  228. skip_optional:
  229. return_value = readline_set_startup_hook_impl(module, function);
  230. exit:
  231. return return_value;
  232. }
  233. #if defined(HAVE_RL_PRE_INPUT_HOOK)
  234. PyDoc_STRVAR(readline_set_pre_input_hook__doc__,
  235. "set_pre_input_hook($module, function=None, /)\n"
  236. "--\n"
  237. "\n"
  238. "Set or remove the function invoked by the rl_pre_input_hook callback.\n"
  239. "\n"
  240. "The function is called with no arguments after the first prompt\n"
  241. "has been printed and just before readline starts reading input\n"
  242. "characters.");
  243. #define READLINE_SET_PRE_INPUT_HOOK_METHODDEF \
  244. {"set_pre_input_hook", _PyCFunction_CAST(readline_set_pre_input_hook), METH_FASTCALL, readline_set_pre_input_hook__doc__},
  245. static PyObject *
  246. readline_set_pre_input_hook_impl(PyObject *module, PyObject *function);
  247. static PyObject *
  248. readline_set_pre_input_hook(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  249. {
  250. PyObject *return_value = NULL;
  251. PyObject *function = Py_None;
  252. if (!_PyArg_CheckPositional("set_pre_input_hook", nargs, 0, 1)) {
  253. goto exit;
  254. }
  255. if (nargs < 1) {
  256. goto skip_optional;
  257. }
  258. function = args[0];
  259. skip_optional:
  260. return_value = readline_set_pre_input_hook_impl(module, function);
  261. exit:
  262. return return_value;
  263. }
  264. #endif /* defined(HAVE_RL_PRE_INPUT_HOOK) */
  265. PyDoc_STRVAR(readline_get_completion_type__doc__,
  266. "get_completion_type($module, /)\n"
  267. "--\n"
  268. "\n"
  269. "Get the type of completion being attempted.");
  270. #define READLINE_GET_COMPLETION_TYPE_METHODDEF \
  271. {"get_completion_type", (PyCFunction)readline_get_completion_type, METH_NOARGS, readline_get_completion_type__doc__},
  272. static PyObject *
  273. readline_get_completion_type_impl(PyObject *module);
  274. static PyObject *
  275. readline_get_completion_type(PyObject *module, PyObject *Py_UNUSED(ignored))
  276. {
  277. return readline_get_completion_type_impl(module);
  278. }
  279. PyDoc_STRVAR(readline_get_begidx__doc__,
  280. "get_begidx($module, /)\n"
  281. "--\n"
  282. "\n"
  283. "Get the beginning index of the completion scope.");
  284. #define READLINE_GET_BEGIDX_METHODDEF \
  285. {"get_begidx", (PyCFunction)readline_get_begidx, METH_NOARGS, readline_get_begidx__doc__},
  286. static PyObject *
  287. readline_get_begidx_impl(PyObject *module);
  288. static PyObject *
  289. readline_get_begidx(PyObject *module, PyObject *Py_UNUSED(ignored))
  290. {
  291. return readline_get_begidx_impl(module);
  292. }
  293. PyDoc_STRVAR(readline_get_endidx__doc__,
  294. "get_endidx($module, /)\n"
  295. "--\n"
  296. "\n"
  297. "Get the ending index of the completion scope.");
  298. #define READLINE_GET_ENDIDX_METHODDEF \
  299. {"get_endidx", (PyCFunction)readline_get_endidx, METH_NOARGS, readline_get_endidx__doc__},
  300. static PyObject *
  301. readline_get_endidx_impl(PyObject *module);
  302. static PyObject *
  303. readline_get_endidx(PyObject *module, PyObject *Py_UNUSED(ignored))
  304. {
  305. return readline_get_endidx_impl(module);
  306. }
  307. PyDoc_STRVAR(readline_set_completer_delims__doc__,
  308. "set_completer_delims($module, string, /)\n"
  309. "--\n"
  310. "\n"
  311. "Set the word delimiters for completion.");
  312. #define READLINE_SET_COMPLETER_DELIMS_METHODDEF \
  313. {"set_completer_delims", (PyCFunction)readline_set_completer_delims, METH_O, readline_set_completer_delims__doc__},
  314. PyDoc_STRVAR(readline_remove_history_item__doc__,
  315. "remove_history_item($module, pos, /)\n"
  316. "--\n"
  317. "\n"
  318. "Remove history item given by its zero-based position.");
  319. #define READLINE_REMOVE_HISTORY_ITEM_METHODDEF \
  320. {"remove_history_item", (PyCFunction)readline_remove_history_item, METH_O, readline_remove_history_item__doc__},
  321. static PyObject *
  322. readline_remove_history_item_impl(PyObject *module, int entry_number);
  323. static PyObject *
  324. readline_remove_history_item(PyObject *module, PyObject *arg)
  325. {
  326. PyObject *return_value = NULL;
  327. int entry_number;
  328. entry_number = _PyLong_AsInt(arg);
  329. if (entry_number == -1 && PyErr_Occurred()) {
  330. goto exit;
  331. }
  332. return_value = readline_remove_history_item_impl(module, entry_number);
  333. exit:
  334. return return_value;
  335. }
  336. PyDoc_STRVAR(readline_replace_history_item__doc__,
  337. "replace_history_item($module, pos, line, /)\n"
  338. "--\n"
  339. "\n"
  340. "Replaces history item given by its position with contents of line.\n"
  341. "\n"
  342. "pos is zero-based.");
  343. #define READLINE_REPLACE_HISTORY_ITEM_METHODDEF \
  344. {"replace_history_item", _PyCFunction_CAST(readline_replace_history_item), METH_FASTCALL, readline_replace_history_item__doc__},
  345. static PyObject *
  346. readline_replace_history_item_impl(PyObject *module, int entry_number,
  347. PyObject *line);
  348. static PyObject *
  349. readline_replace_history_item(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  350. {
  351. PyObject *return_value = NULL;
  352. int entry_number;
  353. PyObject *line;
  354. if (!_PyArg_CheckPositional("replace_history_item", nargs, 2, 2)) {
  355. goto exit;
  356. }
  357. entry_number = _PyLong_AsInt(args[0]);
  358. if (entry_number == -1 && PyErr_Occurred()) {
  359. goto exit;
  360. }
  361. if (!PyUnicode_Check(args[1])) {
  362. _PyArg_BadArgument("replace_history_item", "argument 2", "str", args[1]);
  363. goto exit;
  364. }
  365. if (PyUnicode_READY(args[1]) == -1) {
  366. goto exit;
  367. }
  368. line = args[1];
  369. return_value = readline_replace_history_item_impl(module, entry_number, line);
  370. exit:
  371. return return_value;
  372. }
  373. PyDoc_STRVAR(readline_add_history__doc__,
  374. "add_history($module, string, /)\n"
  375. "--\n"
  376. "\n"
  377. "Add an item to the history buffer.");
  378. #define READLINE_ADD_HISTORY_METHODDEF \
  379. {"add_history", (PyCFunction)readline_add_history, METH_O, readline_add_history__doc__},
  380. PyDoc_STRVAR(readline_set_auto_history__doc__,
  381. "set_auto_history($module, enabled, /)\n"
  382. "--\n"
  383. "\n"
  384. "Enables or disables automatic history.");
  385. #define READLINE_SET_AUTO_HISTORY_METHODDEF \
  386. {"set_auto_history", (PyCFunction)readline_set_auto_history, METH_O, readline_set_auto_history__doc__},
  387. static PyObject *
  388. readline_set_auto_history_impl(PyObject *module,
  389. int _should_auto_add_history);
  390. static PyObject *
  391. readline_set_auto_history(PyObject *module, PyObject *arg)
  392. {
  393. PyObject *return_value = NULL;
  394. int _should_auto_add_history;
  395. _should_auto_add_history = PyObject_IsTrue(arg);
  396. if (_should_auto_add_history < 0) {
  397. goto exit;
  398. }
  399. return_value = readline_set_auto_history_impl(module, _should_auto_add_history);
  400. exit:
  401. return return_value;
  402. }
  403. PyDoc_STRVAR(readline_get_completer_delims__doc__,
  404. "get_completer_delims($module, /)\n"
  405. "--\n"
  406. "\n"
  407. "Get the word delimiters for completion.");
  408. #define READLINE_GET_COMPLETER_DELIMS_METHODDEF \
  409. {"get_completer_delims", (PyCFunction)readline_get_completer_delims, METH_NOARGS, readline_get_completer_delims__doc__},
  410. static PyObject *
  411. readline_get_completer_delims_impl(PyObject *module);
  412. static PyObject *
  413. readline_get_completer_delims(PyObject *module, PyObject *Py_UNUSED(ignored))
  414. {
  415. return readline_get_completer_delims_impl(module);
  416. }
  417. PyDoc_STRVAR(readline_set_completer__doc__,
  418. "set_completer($module, function=None, /)\n"
  419. "--\n"
  420. "\n"
  421. "Set or remove the completer function.\n"
  422. "\n"
  423. "The function is called as function(text, state),\n"
  424. "for state in 0, 1, 2, ..., until it returns a non-string.\n"
  425. "It should return the next possible completion starting with \'text\'.");
  426. #define READLINE_SET_COMPLETER_METHODDEF \
  427. {"set_completer", _PyCFunction_CAST(readline_set_completer), METH_FASTCALL, readline_set_completer__doc__},
  428. static PyObject *
  429. readline_set_completer_impl(PyObject *module, PyObject *function);
  430. static PyObject *
  431. readline_set_completer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  432. {
  433. PyObject *return_value = NULL;
  434. PyObject *function = Py_None;
  435. if (!_PyArg_CheckPositional("set_completer", nargs, 0, 1)) {
  436. goto exit;
  437. }
  438. if (nargs < 1) {
  439. goto skip_optional;
  440. }
  441. function = args[0];
  442. skip_optional:
  443. return_value = readline_set_completer_impl(module, function);
  444. exit:
  445. return return_value;
  446. }
  447. PyDoc_STRVAR(readline_get_completer__doc__,
  448. "get_completer($module, /)\n"
  449. "--\n"
  450. "\n"
  451. "Get the current completer function.");
  452. #define READLINE_GET_COMPLETER_METHODDEF \
  453. {"get_completer", (PyCFunction)readline_get_completer, METH_NOARGS, readline_get_completer__doc__},
  454. static PyObject *
  455. readline_get_completer_impl(PyObject *module);
  456. static PyObject *
  457. readline_get_completer(PyObject *module, PyObject *Py_UNUSED(ignored))
  458. {
  459. return readline_get_completer_impl(module);
  460. }
  461. PyDoc_STRVAR(readline_get_history_item__doc__,
  462. "get_history_item($module, index, /)\n"
  463. "--\n"
  464. "\n"
  465. "Return the current contents of history item at one-based index.");
  466. #define READLINE_GET_HISTORY_ITEM_METHODDEF \
  467. {"get_history_item", (PyCFunction)readline_get_history_item, METH_O, readline_get_history_item__doc__},
  468. static PyObject *
  469. readline_get_history_item_impl(PyObject *module, int idx);
  470. static PyObject *
  471. readline_get_history_item(PyObject *module, PyObject *arg)
  472. {
  473. PyObject *return_value = NULL;
  474. int idx;
  475. idx = _PyLong_AsInt(arg);
  476. if (idx == -1 && PyErr_Occurred()) {
  477. goto exit;
  478. }
  479. return_value = readline_get_history_item_impl(module, idx);
  480. exit:
  481. return return_value;
  482. }
  483. PyDoc_STRVAR(readline_get_current_history_length__doc__,
  484. "get_current_history_length($module, /)\n"
  485. "--\n"
  486. "\n"
  487. "Return the current (not the maximum) length of history.");
  488. #define READLINE_GET_CURRENT_HISTORY_LENGTH_METHODDEF \
  489. {"get_current_history_length", (PyCFunction)readline_get_current_history_length, METH_NOARGS, readline_get_current_history_length__doc__},
  490. static PyObject *
  491. readline_get_current_history_length_impl(PyObject *module);
  492. static PyObject *
  493. readline_get_current_history_length(PyObject *module, PyObject *Py_UNUSED(ignored))
  494. {
  495. return readline_get_current_history_length_impl(module);
  496. }
  497. PyDoc_STRVAR(readline_get_line_buffer__doc__,
  498. "get_line_buffer($module, /)\n"
  499. "--\n"
  500. "\n"
  501. "Return the current contents of the line buffer.");
  502. #define READLINE_GET_LINE_BUFFER_METHODDEF \
  503. {"get_line_buffer", (PyCFunction)readline_get_line_buffer, METH_NOARGS, readline_get_line_buffer__doc__},
  504. static PyObject *
  505. readline_get_line_buffer_impl(PyObject *module);
  506. static PyObject *
  507. readline_get_line_buffer(PyObject *module, PyObject *Py_UNUSED(ignored))
  508. {
  509. return readline_get_line_buffer_impl(module);
  510. }
  511. #if defined(HAVE_RL_COMPLETION_APPEND_CHARACTER)
  512. PyDoc_STRVAR(readline_clear_history__doc__,
  513. "clear_history($module, /)\n"
  514. "--\n"
  515. "\n"
  516. "Clear the current readline history.");
  517. #define READLINE_CLEAR_HISTORY_METHODDEF \
  518. {"clear_history", (PyCFunction)readline_clear_history, METH_NOARGS, readline_clear_history__doc__},
  519. static PyObject *
  520. readline_clear_history_impl(PyObject *module);
  521. static PyObject *
  522. readline_clear_history(PyObject *module, PyObject *Py_UNUSED(ignored))
  523. {
  524. return readline_clear_history_impl(module);
  525. }
  526. #endif /* defined(HAVE_RL_COMPLETION_APPEND_CHARACTER) */
  527. PyDoc_STRVAR(readline_insert_text__doc__,
  528. "insert_text($module, string, /)\n"
  529. "--\n"
  530. "\n"
  531. "Insert text into the line buffer at the cursor position.");
  532. #define READLINE_INSERT_TEXT_METHODDEF \
  533. {"insert_text", (PyCFunction)readline_insert_text, METH_O, readline_insert_text__doc__},
  534. PyDoc_STRVAR(readline_redisplay__doc__,
  535. "redisplay($module, /)\n"
  536. "--\n"
  537. "\n"
  538. "Change what\'s displayed on the screen to reflect contents of the line buffer.");
  539. #define READLINE_REDISPLAY_METHODDEF \
  540. {"redisplay", (PyCFunction)readline_redisplay, METH_NOARGS, readline_redisplay__doc__},
  541. static PyObject *
  542. readline_redisplay_impl(PyObject *module);
  543. static PyObject *
  544. readline_redisplay(PyObject *module, PyObject *Py_UNUSED(ignored))
  545. {
  546. return readline_redisplay_impl(module);
  547. }
  548. #ifndef READLINE_APPEND_HISTORY_FILE_METHODDEF
  549. #define READLINE_APPEND_HISTORY_FILE_METHODDEF
  550. #endif /* !defined(READLINE_APPEND_HISTORY_FILE_METHODDEF) */
  551. #ifndef READLINE_SET_PRE_INPUT_HOOK_METHODDEF
  552. #define READLINE_SET_PRE_INPUT_HOOK_METHODDEF
  553. #endif /* !defined(READLINE_SET_PRE_INPUT_HOOK_METHODDEF) */
  554. #ifndef READLINE_CLEAR_HISTORY_METHODDEF
  555. #define READLINE_CLEAR_HISTORY_METHODDEF
  556. #endif /* !defined(READLINE_CLEAR_HISTORY_METHODDEF) */
  557. /*[clinic end generated code: output=9097fcb749c19e27 input=a9049054013a1b77]*/