Skip to content

Commit d3ea19d

Browse files
committed
initial commit of efivim
0 parents  commit d3ea19d

File tree

10 files changed

+1159
-0
lines changed

10 files changed

+1159
-0
lines changed

Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
TARGET=DEBUG
2+
ARCH=X64
3+
TOOLCHAIN=GCC49
4+
PLATFORM=vim.dsc
5+
MODULE=vim.inf
6+
7+
EFIBIN=vim.efi
8+
BUILDDIR=edk2/Build/vim/$(TARGET)_$(TOOLCHAIN)/$(ARCH)
9+
10+
APP=$(BUILDDIR)/vim/$(TARGET)/$(EFIBIN)
11+
12+
$(EFIBIN): $(APP)
13+
cp $? $@
14+
15+
qemu: $(APP)
16+
qemu-system-x86_64 -bios efi-bios.bin -enable-kvm -serial mon:stdio -net none -display sdl -drive file=fat:$(BUILDDIR)/vim/$(TARGET)
17+
18+
$(APP): edk2 vim
19+
pushd edk2; WORKSPACE="$(PWD)/edk2" PACKAGES_PATH="$(PWD)" source ./edksetup.sh; popd; build -v -a $(ARCH) -p $(PLATFORM) -m $(MODULE) -b $(TARGET) -t $(TOOLCHAIN)
20+
21+
vim:
22+
git clone https://github.com/vim/vim.git
23+
patch -d vim -p1 < efivim.patch
24+
# we didn't run autoconf, so make the source cope.
25+
touch vim/src/auto/config.h
26+
27+
edk2:
28+
git clone https://github.com/tianocore/edk2.git
29+
cd edk2
30+
make -C edk2/BaseTools
31+
32+
clean:
33+
rm -f $(EFIBIN)
34+
rm -rf $(BUILDDIR)
35+
36+
nuke: clean
37+
rm -rf vim edk2
38+
39+
.PHONY: qemu clean nuke
40+
41+
.DELETE_ON_ERROR:
42+

efivim.patch

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/src/eval.c b/src/eval.c
2+
index 3b1172e..745f6d0 100644
3+
--- a/src/eval.c
4+
+++ b/src/eval.c
5+
@@ -8393,7 +8393,9 @@ static struct fst
6+
{"range", 1, 3, f_range},
7+
{"readfile", 1, 3, f_readfile},
8+
{"reltime", 0, 2, f_reltime},
9+
+#ifdef FEAT_FLOAT
10+
{"reltimefloat", 1, 1, f_reltimefloat},
11+
+#endif
12+
{"reltimestr", 1, 1, f_reltimestr},
13+
{"remote_expr", 2, 3, f_remote_expr},
14+
{"remote_foreground", 1, 1, f_remote_foreground},
15+
diff --git a/src/json.c b/src/json.c
16+
index 7b85cd2..b628ba2 100644
17+
--- a/src/json.c
18+
+++ b/src/json.c
19+
@@ -647,9 +647,9 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
20+
default:
21+
if (VIM_ISDIGIT(*p) || *p == '-')
22+
{
23+
+#ifdef FEAT_FLOAT
24+
char_u *sp = p;
25+
26+
-#ifdef FEAT_FLOAT
27+
if (*sp == '-')
28+
{
29+
++sp;

include/efivim.h

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#include <errno.h>
2+
#include <sys/fcntl.h>
3+
#include <sys/stat.h>
4+
#include <unistd.h>
5+
#include <stdlib.h>
6+
#include <string.h>
7+
8+
#define USR_VIMRC_FILE "fs0:\\.vimrc"
9+
#define USR_EXRC_FILE "fs0:\\.exrc"
10+
#define VIMINFO_FILE "fs0:\\.viminfo"
11+
#define FTOFF_FILE "ftoff.vim"
12+
#define INDOFF_FILE "indoff.vim"
13+
#define FILETYPE_FILE "filetype.vim"
14+
#define FTPLUGIN_FILE "ftplugin.vim"
15+
#define FTPLUGOF_FILE "ftplugof.vim"
16+
#define INDENT_FILE "indent.vim"
17+
18+
#define SYNTAX_FNAME "fs0:\\vim\\vimfiles\\syntax\\%s.vim"
19+
#define SYS_VIMRC_FILE "fs0:\\vim\\vimfiles\\vimrc"
20+
21+
#define EVIM_FILE "evim.vim"
22+
#define VIMRC_FILE ".vimrc"
23+
#define EXRC_FILE ".exrc"
24+
25+
#define DFLT_BDIR "."
26+
#define DFLT_VDIR "."
27+
#define DFLT_DIR "."
28+
#define DFLT_RUNTIMEPATH "."
29+
#define DFLT_HELPFILE "notexist"
30+
#define DFLT_MAXMEM (2*1024)
31+
#define DFLT_MAXMEMTOT (10*1024)
32+
33+
#define DFLT_ERRORFILE "errors.err"
34+
35+
#define BASENAMELEN 128
36+
37+
#define TEMPNAME "efi_tmp.XXXXXX"
38+
#define TEMPNAMELEN 128
39+
40+
#define mch_rmdir(x) rmdir((char *)(x))
41+
#define vim_mkdir(x, y) mkdir((char *)(x), y)
42+
43+
/* vim mch fns */
44+
void mch_early_init(void);
45+
int mch_init(void);
46+
void mch_exit(int);
47+
void mch_suspend(void);
48+
void mch_breakcheck(void);
49+
void mch_hide(unsigned char *name);
50+
51+
int mch_get_shellsize(void);
52+
void mch_set_shellsize(void);
53+
void mch_new_shellsize(void);
54+
55+
void mch_get_host_name(unsigned char *s, int len);
56+
long mch_get_pid(void);
57+
58+
unsigned char* mch_getenv(unsigned char *name);
59+
60+
int mch_has_wildcard(unsigned char *p);
61+
int mch_has_exp_wildcard(unsigned char *p);
62+
63+
int mch_expandpath(void *gap /* garray_T* */, unsigned char *pat, int flags);
64+
65+
long mch_getperm(unsigned char *name);
66+
int mch_setperm(unsigned char *name, long perm);
67+
68+
int mch_nodetype(unsigned char *name);
69+
70+
int mch_screenmode(unsigned char *arg);
71+
int mch_check_win(int argc, char **argv);
72+
void mch_settitle(unsigned char *title, unsigned char *icon);
73+
void mch_restore_title(int which);
74+
int mch_can_restore_icon(void);
75+
int mch_can_restore_title(void);
76+
void mch_setmouse(int on);
77+
78+
void mch_delay(long msec, int ignoreinput);
79+
int mch_inchar(unsigned char *buf, int maxlen, long wtime, int tb_change_cnt);
80+
void mch_write(unsigned char *s, int len);
81+
int mch_char_avail(void);
82+
83+
int mch_rename(const char *src, const char *dest);
84+
int mch_remove(unsigned char *name);
85+
int mch_isdir(unsigned char *name);
86+
int mch_dirname(unsigned char *buf, int len);
87+
int mch_chdir(char *path);
88+
long mch_getperm(unsigned char *name);
89+
int mch_isFullName(unsigned char *fname);
90+
int mch_FullName(unsigned char *fname, unsigned char *buf, int len, int force);
91+
92+
int mch_input_isatty(void);
93+
void mch_settmode(int tmode);
94+
95+
int mch_can_exe(unsigned char *name, unsigned char **path, int use_path);
96+
int mch_call_shell(unsigned char *cmd, int options);
97+
int mch_get_user_name(unsigned char *s, int len);
98+
99+
/* misc stuff */
100+
int putenv(const char *string);
101+
102+
void slash_adjust(unsigned char *p);
103+

include/lauxlib.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <Lua/lauxlib.h>
2+

include/lua.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <Lua/lua.h>
2+

include/lualib.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <Lua/lualib.h>
2+

0 commit comments

Comments
 (0)