2
0
Justine Tunney 8 сар өмнө
parent
commit
fc6fa331d2
4 өөрчлөгдсөн 417 нэмэгдсэн , 388 устгасан
  1. 6 3
      .gitignore
  2. 386 373
      bestline.c
  3. 25 10
      bestline.h
  4. 0 2
      lisp.c

+ 6 - 3
.gitignore

@@ -1,4 +1,7 @@
+*.o
+*.bin
+*.bin.dbg
+*.com.dbg
+*.elf
+.aarch64
 /lisp
-/*.o
-/*.bin
-/*.bin.dbg

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 386 - 373
bestline.c


+ 25 - 10
bestline.h

@@ -1,13 +1,16 @@
 #pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 typedef struct bestlineCompletions {
-  unsigned long len;
-  char **cvec;
+    unsigned long len;
+    char **cvec;
 } bestlineCompletions;
 
-typedef void(bestlineCompletionCallback)(const char *, bestlineCompletions *);
-typedef char *(bestlineHintsCallback)(const char *, const char **,
-                                       const char **);
+typedef void(bestlineCompletionCallback)(const char *, int,
+                                         bestlineCompletions *);
+typedef char *(bestlineHintsCallback)(const char *, const char **, const char **);
 typedef void(bestlineFreeHintsCallback)(void *);
 typedef unsigned(bestlineXlatCallback)(unsigned);
 
@@ -18,18 +21,26 @@ void bestlineAddCompletion(bestlineCompletions *, const char *);
 void bestlineSetXlatCallback(bestlineXlatCallback *);
 
 char *bestline(const char *);
+char *bestlineInit(const char *, const char *);
 char *bestlineRaw(const char *, int, int);
+char *bestlineRawInit(const char *, 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);
+int bestlineHistorySave(const char *);
+void bestlineBalanceMode(char);
+void bestlineEmacsMode(char);
 void bestlineClearScreen(int);
-void bestlineMaskModeEnable(void);
-void bestlineMaskModeDisable(void);
 void bestlineDisableRawMode(void);
 void bestlineFree(void *);
+void bestlineFreeCompletions(bestlineCompletions *);
+void bestlineHistoryFree(void);
+void bestlineLlamaMode(char);
+void bestlineMaskModeDisable(void);
+void bestlineMaskModeEnable(void);
+
+void bestlineUserIO(int (*)(int, void *, int), int (*)(int, const void *, int),
+                    int (*)(int, int, int));
 
 char bestlineIsSeparator(unsigned);
 char bestlineNotSeparator(unsigned);
@@ -37,3 +48,7 @@ char bestlineIsXeparator(unsigned);
 unsigned bestlineUppercase(unsigned);
 unsigned bestlineLowercase(unsigned);
 long bestlineReadCharacter(int, char *, unsigned long);
+
+#ifdef __cplusplus
+}
+#endif

+ 0 - 2
lisp.c

@@ -18,14 +18,12 @@
 ╚─────────────────────────────────────────────────────────────────────────────*/
 #include "bestline.h"
 
-#ifndef __COSMOPOLITAN__
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <locale.h>
 #include <limits.h>
-#endif
 
 /*───────────────────────────────────────────────────────────────────────────│─╗
 │ The LISP Challenge § LISP Machine                                        ─╬─│┼

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно