LCOV - code coverage report
Current view: top level - Modules/clinic - readline.c.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit 5e6661bce9] Lines: 0 167 0.0 %
Date: 2023-03-20 08:15:36 Functions: 0 23 0.0 %
Branches: 0 96 0.0 %

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

Generated by: LCOV version 1.14