root/src/simh/linehistory.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * vim: filetype=c:tabstop=4:ai:expandtab
   3  * SPDX-License-Identifier: BSD-2-Clause
   4  * scspell-id: 736ea385-f62a-11ec-9ef9-80ee73e9b8e7
   5  *
   6  * -------------------------------------------------------------------------
   7  *
   8  * linehistory.h
   9  *
  10  * linehistory is forked from linenoise; the original version
  11  * is available from https://github.com/antirez/linenoise
  12  *
  13  * ------------------------------------------------------------------------
  14  *
  15  * Copyright (c) 2010-2014 Salvatore Sanfilippo <antirez@gmail.com>
  16  * Copyright (c) 2010-2013 Pieter Noordhuis <pcnoordhuis@gmail.com>
  17  * Copyright (c) 2020-2021 Jeffrey H. Johnson <trnsz@pobox.com>
  18  * Copyright (c) 2021-2024 The DPS8M Development Team
  19  *
  20  * All rights reserved.
  21  *
  22  * Redistribution and use in source and binary forms, with or without
  23  * modification, are permitted provided that the following conditions are
  24  * met:
  25  *
  26  *  *  Redistributions of source code must retain the above copyright
  27  *     notice, this list of conditions and the following disclaimer.
  28  *
  29  *  *  Redistributions in binary form must reproduce the above copyright
  30  *     notice, this list of conditions and the following disclaimer in the
  31  *     documentation and/or other materials provided with the distribution.
  32  *
  33  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  34  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  35  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  36  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  37  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  38  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  39  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  40  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  41  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  42  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  43  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44  *
  45  * -------------------------------------------------------------------------
  46  */
  47 
  48 #if !defined(_POSIX_C_SOURCE)
  49 # define _POSIX_C_SOURCE 200809L
  50 #endif /* if !defined(_POSIX_C_SOURCE) */
  51 
  52 #if _POSIX_C_SOURCE < 200809L
  53 # undef _POSIX_C_SOURCE
  54 # define _POSIX_C_SOURCE 200809L
  55 #endif /* if _POSIX_C_SOURCE < 200809L */
  56 
  57 #if !defined(__LINENOISE_H)
  58 # define __LINENOISE_H
  59 
  60 # if !defined(__MINGW32__) && !defined(CROSS_MINGW32) && !defined(CROSS_MINGW64) && \
  61      !defined(__MINGW64__) && !defined(_MSC_VER) && !defined(_MSC_BUILD)
  62 
  63 #  if !defined(HAVE_LINEHISTORY)
  64 #   define HAVE_LINEHISTORY
  65 #  endif /* if !defined(HAVE_LINEHISTORY) */
  66 
  67 #  include <stddef.h>
  68 #  include <signal.h> /* raise */
  69 
  70 #  if defined(LH_COMPLETION)
  71 typedef struct linenoiseCompletions
  72 {
  73   size_t len;
  74   char   **cvec;
  75 } linenoiseCompletions;
  76 
  77 typedef void (linenoiseCompletionCallback) (const char *,
  78                                             linenoiseCompletions *);
  79 void    linenoiseSetCompletionCallback(linenoiseCompletionCallback *);
  80 void    linenoiseAddCompletion(linenoiseCompletions *, const char *);
  81 #  endif /* if defined(LH_COMPLETION) */
  82 
  83 #  if defined(LH_HINTS)
  84 typedef void (linenoiseFreeHintsCallback) (void *);
  85 typedef char *(linenoiseHintsCallback)(const char *, int *color, int *bold);
  86 void    linenoiseSetHintsCallback(linenoiseHintsCallback *);
  87 void    linenoiseSetFreeHintsCallback(linenoiseFreeHintsCallback *);
  88 #  endif /* if defined(LH_HINTS) */
  89 
  90 char *linenoise(const char *prompt);
  91 void linenoiseFree(void *ptr);
  92 int  linenoiseHistoryAdd(const char *line);
  93 int  linenoiseHistorySetMaxLen(int len);
  94 int  linenoiseHistorySave(const char *filename);
  95 int  linenoiseHistoryLoad(const char *filename);
  96 void linenoiseClearScreen(void);
  97 void linenoiseSetMultiLine(int ml);
  98 void linenoisePrintKeyCodes(void);
  99 #  if defined(LH_MASKMODE)
 100 void linenoiseMaskModeEnable(void);
 101 void linenoiseMaskModeDisable(void);
 102 #  endif /* if defined(LH_MASKMODE) */
 103 
 104 # endif
 105 
 106 #endif

/* [previous][next][first][last][top][bottom][index][help] */