Back to home page

Enduro/X

 
 

    


0001 /* linenoise.h -- VERSION 1.0
0002  *
0003  * Guerrilla line editing library against the idea that a line editing lib
0004  * needs to be 20,000 lines of C code.
0005  *
0006  * See linenoise.c for more information.
0007  *
0008  * ------------------------------------------------------------------------
0009  *
0010  * Copyright (c) 2010-2014, Salvatore Sanfilippo <antirez at gmail dot com>
0011  * Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
0012  *
0013  * All rights reserved.
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions are
0017  * met:
0018  *
0019  *  *  Redistributions of source code must retain the above copyright
0020  *     notice, this list of conditions and the following disclaimer.
0021  *
0022  *  *  Redistributions in binary form must reproduce the above copyright
0023  *     notice, this list of conditions and the following disclaimer in the
0024  *     documentation and/or other materials provided with the distribution.
0025  *
0026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0027  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0028  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0029  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0030  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0031  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0032  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0033  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0034  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0035  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0036  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0037  */
0038 
0039 #ifndef __LINENOISE_H
0040 #define __LINENOISE_H
0041 
0042 #ifdef __cplusplus
0043 extern "C" {
0044 #endif
0045 
0046 typedef struct linenoiseCompletions {
0047   size_t len;
0048   char **cvec;
0049 } linenoiseCompletions;
0050 
0051 typedef void(linenoiseCompletionCallback)(const char *, linenoiseCompletions *);
0052 typedef char*(linenoiseHintsCallback)(const char *, int *color, int *bold);
0053 typedef void(linenoiseFreeHintsCallback)(void *);
0054 void linenoiseSetCompletionCallback(linenoiseCompletionCallback *);
0055 void linenoiseSetHintsCallback(linenoiseHintsCallback *);
0056 void linenoiseSetFreeHintsCallback(linenoiseFreeHintsCallback *);
0057 void linenoiseAddCompletion(linenoiseCompletions *, const char *);
0058 
0059 char *linenoise(const char *prompt);
0060 void linenoiseFree(void *ptr);
0061 int linenoiseHistoryAdd(const char *line);
0062 int linenoiseHistorySetMaxLen(int len);
0063 int linenoiseHistorySave(const char *filename);
0064 int linenoiseHistoryLoad(const char *filename);
0065 void linenoiseClearScreen(void);
0066 void linenoiseSetMultiLine(int ml);
0067 void linenoisePrintKeyCodes(void);
0068 
0069 #ifdef __cplusplus
0070 }
0071 #endif
0072 
0073 #endif /* __LINENOISE_H */