apps/system/vi: Add new tiny VI work-alike editor. Still a work in progress.

This commit is contained in:
Gregory Nutt 2014-01-20 13:17:21 -06:00
parent 2b6a1fa186
commit e5a0a2fafb
7 changed files with 3353 additions and 3 deletions

View File

@ -802,3 +802,5 @@
* apps/nshlib/nsh.h, nsh_command.c, and nsh_parse.c: Add a break
command that can be executed with a loop to terminate the loop
immediately (2014-1-17).
* apps/system/vi: Add support for a tiny, VI work-alike editor. This
is still very much a work-in-progress on initial check-in (2014-1-20).

View File

@ -63,6 +63,10 @@ menu "USB Monitor"
source "$APPSDIR/system/usbmonitor/Kconfig"
endmenu
menu "VI Work-Alike Editor"
source "$APPSDIR/system/vi/Kconfig"
endmenu
menu "Stack Monitor"
source "$APPSDIR/system/stackmonitor/Kconfig"
endmenu

View File

@ -2,7 +2,7 @@
# apps/system/Make.defs
# Adds selected applications to apps/ build
#
# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2012-2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -102,6 +102,10 @@ ifeq ($(CONFIG_SYSTEM_USBMSC),y)
CONFIGURED_APPS += system/usbmsc
endif
ifeq ($(CONFIG_SYSTEM_VI),y)
CONFIGURED_APPS += system/vi
endif
ifeq ($(CONFIG_SYSTEM_ZMODEM),y)
CONFIGURED_APPS += system/zmodem
endif

View File

@ -1,7 +1,7 @@
############################################################################
# apps/system/Makefile
#
# Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
# Copyright (C) 2011-2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
SUBDIRS = cdcacm composite flash_eraseall free i2c inifile install
SUBDIRS += nxplayer poweroff ramtest ramtron readline sdcard stackmonitor
SUBDIRS += sysinfo usbmonitor usbmsc zmodem
SUBDIRS += sysinfo usbmonitor usbmsc vi zmodem
# Create the list of installed runtime modules (INSTALLED_DIRS)

56
system/vi/Kconfig Normal file
View File

@ -0,0 +1,56 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config SYSTEM_VI
bool "Tiny VI work-alike text editor"
default n
---help---
Enable support for NuttX tiny VI work-alike editor.
Omitted features:
- No keypad cursor control support
- No word oriented operations.
Assumptions and Limitations:
- A VT100 host terminal is assumed.
- A fixed width character set (like Courier) is assumed
- Files are edited in memory so unless you have a lot of memory
to spare, this editor will only be useful for very small files.
if SYSTEM_VI
config SYSTEM_VI_COLS
int "Display width (columns)"
default 64
---help---
The editor does not have the capability to query the display for
its width or height. This setting provides the default width of
the display in columns. The actually width can be overridden using
command line options.
config SYSTEM_VI_ROWS
int "Display height (rows)"
default 16
---help---
The editor does not have the capability to query the display for
its width or height. This setting provides the default height of
the display in rows. The actually width can be overridden using
command line options.
config SYSTEM_VI_DEBUGLEVEL
int "Debug level"
default 0
range 0 2
---help---
0=Debug off; 1=Print errors on console; 2=Print debug information
on the console.
Debug output is generated with syslog. The editor works on
/dev/console. In order to get both a usable display and also
readable debug output, syslog'ing should sent to some device other
than /dev/console (which is the default).
endif

116
system/vi/Makefile Normal file
View File

@ -0,0 +1,116 @@
############################################################################
# apps/system/vi/Makefile
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. 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.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# 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 OWNER 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.
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
# Hello Application
# TODO: appname can be automatically extracted from the directory name
APPNAME = vi
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 1024
ASRCS =
CSRCS = vi.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ROOTDEPPATH = --dep-path .
# Common build
VPATH =
all: .built
.PHONY: context depend clean distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
$(Q) touch .built
# Register application
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
context:
endif
# Create dependencies
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep

3168
system/vi/vi.c Normal file

File diff suppressed because it is too large Load Diff