199767f8919635c4928607450d9e0abb932109ceToomas Soome/* linenoise.h -- VERSION 1.0
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Guerrilla line editing library against the idea that a line editing lib
199767f8919635c4928607450d9e0abb932109ceToomas Soome * needs to be 20,000 lines of C code.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * See linenoise.c for more information.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ------------------------------------------------------------------------
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2010-2014, Salvatore Sanfilippo <antirez at gmail dot com>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions are
199767f8919635c4928607450d9e0abb932109ceToomas Soome * met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * * Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * * Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef __LINENOISE_H
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define __LINENOISE_H
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef __cplusplus
199767f8919635c4928607450d9e0abb932109ceToomas Soomeextern "C" {
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct linenoiseCompletions {
199767f8919635c4928607450d9e0abb932109ceToomas Soome size_t len;
199767f8919635c4928607450d9e0abb932109ceToomas Soome char **cvec;
199767f8919635c4928607450d9e0abb932109ceToomas Soome} linenoiseCompletions;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef void(linenoiseCompletionCallback)(const char *, linenoiseCompletions *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid linenoiseSetCompletionCallback(linenoiseCompletionCallback *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid linenoiseAddCompletion(linenoiseCompletions *, const char *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soomechar *linenoise(const char *prompt);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint linenoiseHistoryAdd(const char *line);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint linenoiseHistorySetMaxLen(int len);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint linenoiseHistorySave(const char *filename);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint linenoiseHistoryLoad(const char *filename);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid linenoiseClearScreen(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid linenoiseSetMultiLine(int ml);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid linenoisePrintKeyCodes(void);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef __cplusplus
199767f8919635c4928607450d9e0abb932109ceToomas Soome}
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __LINENOISE_H */