Remove bestline from project
This commit is contained in:
parent
ee9cd987e7
commit
1632ef74af
@ -13,7 +13,7 @@ VERSION := $(MAJOR).$(MINOR).$(PATCH)-dev+$(COMMIT)
|
||||
|
||||
CXXFLAGS:=$(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=return-type -Werror=unused-result
|
||||
CPPFLAGS:=$(CPPFLAGS) -DMusique_Version='"$(VERSION)"' \
|
||||
-Ilib/expected/ -I. -Ilib/bestline/ -Ilib/rtmidi/ -Ilib/link/include -Ilib/asio/include/ -Ilib/edit_distance.cc/ -Ilib/replxx/include -DREPLXX_STATIC
|
||||
-Ilib/expected/ -I. -Ilib/rtmidi/ -Ilib/link/include -Ilib/asio/include/ -Ilib/edit_distance.cc/ -Ilib/replxx/include -DREPLXX_STATIC
|
||||
LDFLAGS=-flto
|
||||
LDLIBS= -lpthread
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
Bestline is released under the 2-clause BSD license.
|
||||
|
||||
Copyright (c) 2018-2021 Justine Tunney <jtunney@gmail.com>
|
||||
Copyright (c) 2010-2016 Salvatore Sanfilippo <antirez@gmail.com>
|
||||
Copyright (c) 2010-2013 Pieter Noordhuis <pcnoordhuis@gmail.com>
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct bestlineCompletions {
|
||||
unsigned long len;
|
||||
char **cvec;
|
||||
} bestlineCompletions;
|
||||
|
||||
typedef void(bestlineCompletionCallback)(const char *, bestlineCompletions *);
|
||||
typedef char *(bestlineHintsCallback)(const char *, const char **,
|
||||
const char **);
|
||||
typedef void(bestlineFreeHintsCallback)(void *);
|
||||
typedef unsigned(bestlineXlatCallback)(unsigned);
|
||||
|
||||
void bestlineSetCompletionCallback(bestlineCompletionCallback *);
|
||||
void bestlineSetHintsCallback(bestlineHintsCallback *);
|
||||
void bestlineSetFreeHintsCallback(bestlineFreeHintsCallback *);
|
||||
void bestlineAddCompletion(bestlineCompletions *, const char *);
|
||||
void bestlineSetXlatCallback(bestlineXlatCallback *);
|
||||
|
||||
char *bestline(const char *);
|
||||
char *bestlineRaw(const char *, int, int);
|
||||
char *bestlineWithHistory(const char *, const char *);
|
||||
int bestlineHistoryAdd(const char *);
|
||||
int bestlineHistorySave(const char *);
|
||||
int bestlineHistoryLoad(const char *);
|
||||
void bestlineFreeCompletions(bestlineCompletions *);
|
||||
void bestlineHistoryFree(void);
|
||||
void bestlineClearScreen(int);
|
||||
void bestlineMaskModeEnable(void);
|
||||
void bestlineMaskModeDisable(void);
|
||||
void bestlineDisableRawMode(void);
|
||||
void bestlineFree(void *);
|
||||
|
||||
char bestlineIsSeparator(unsigned);
|
||||
char bestlineNotSeparator(unsigned);
|
||||
char bestlineIsXeparator(unsigned);
|
||||
unsigned bestlineUppercase(unsigned);
|
||||
unsigned bestlineLowercase(unsigned);
|
||||
long bestlineReadCharacter(int, char *, unsigned long);
|
@ -1,79 +0,0 @@
|
||||
#include "bestline.h"
|
||||
|
||||
#ifndef __COSMOPOLITAN__
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// should be ~50kb statically linked
|
||||
// will save history to ~/.foo_history
|
||||
// cc -fno-jump-tables -Os -o foo foo.c bestline.c
|
||||
int main() {
|
||||
char *line;
|
||||
while ((line = bestlineWithHistory("IN> ", "foo"))) {
|
||||
fputs("OUT> ", stdout);
|
||||
fputs(line, stdout);
|
||||
fputs("\n", stdout);
|
||||
free(line);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void completion(const char *buf, bestlineCompletions *lc) {
|
||||
if (buf[0] == 'h') {
|
||||
bestlineAddCompletion(lc,"hello");
|
||||
bestlineAddCompletion(lc,"hello there");
|
||||
}
|
||||
}
|
||||
|
||||
char *hints(const char *buf, const char **ansi1, const char **ansi2) {
|
||||
if (!strcmp(buf,"hello")) {
|
||||
*ansi1 = "\033[35m"; /* magenta foreground */
|
||||
*ansi2 = "\033[39m"; /* reset foreground */
|
||||
return " World";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *line;
|
||||
|
||||
/* Set the completion callback. This will be called every time the
|
||||
* user uses the <tab> key. */
|
||||
bestlineSetCompletionCallback(completion);
|
||||
bestlineSetHintsCallback(hints);
|
||||
|
||||
/* Load history from file. The history file is just a plain text file
|
||||
* where entries are separated by newlines. */
|
||||
bestlineHistoryLoad("history.txt"); /* Load the history at startup */
|
||||
|
||||
/* Now this is the main loop of the typical bestline-based application.
|
||||
* The call to bestline() will block as long as the user types something
|
||||
* and presses enter.
|
||||
*
|
||||
* The typed string is returned as a malloc() allocated string by
|
||||
* bestline, so the user needs to free() it. */
|
||||
|
||||
while((line = bestline("hello> ")) != NULL) {
|
||||
/* Do something with the string. */
|
||||
if (line[0] != '\0' && line[0] != '/') {
|
||||
fputs("echo: '", stdout);
|
||||
fputs(line, stdout);
|
||||
fputs("'\n", stdout);
|
||||
bestlineHistoryAdd(line); /* Add to the history. */
|
||||
bestlineHistorySave("history.txt"); /* Save the history on disk. */
|
||||
} else if (!strncmp(line, "/mask", 5)) {
|
||||
bestlineMaskModeEnable();
|
||||
} else if (!strncmp(line, "/unmask", 7)) {
|
||||
bestlineMaskModeDisable();
|
||||
} else if (line[0] == '/') {
|
||||
fputs("Unreconized command: ", stdout);
|
||||
fputs(line, stdout);
|
||||
fputs("\n", stdout);
|
||||
}
|
||||
free(line);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -2,5 +2,4 @@ CC=gcc
|
||||
CXX=g++
|
||||
CPPFLAGS:=$(CPPFLAGS) -D __LINUX_ALSA__ -D LINK_PLATFORM_LINUX
|
||||
LDLIBS:=-lasound $(LDLIBS) -static-libgcc -static-libstdc++
|
||||
Bestline=bin/$(os)/bestline.o
|
||||
Target=musique
|
||||
|
@ -3,5 +3,4 @@ CXX=clang++
|
||||
CPPFLAGS:=$(CPPFLAGS) -D __MACOSX_CORE__ -D LINK_PLATFORM_MACOSX
|
||||
LDLIBS:=-framework CoreMIDI -framework CoreAudio -framework CoreFoundation $(LDLIBS)
|
||||
Release_Obj=$(addprefix bin/,$(Obj))
|
||||
Bestline=bin/$(os)/bestline.o
|
||||
Target=musique
|
||||
|
Loading…
Reference in New Issue
Block a user