Skip to content

Commit

Permalink
REPL now working, plus basic tab completion.
Browse files Browse the repository at this point in the history
REPL functionality has been added, based upon code from Node.js and libuv.
"luanode.repl" and "luanode.readline" modules were added to accomplish this.

Also:
 - tty has been reworked and refactored.
 - Windows tty codes are transformed into ansi codes.
 - console has been simplified.
 - writing to stdout is now blocking if attached to a console
 - version bumped to 0.0.1

Not working:
 - stdin does not work on anything other than a tty yet.
 - stdout and stderr work when bound to a tty, a file or a pipe (not on
   Windows, though).
  • Loading branch information
ignacio committed Jun 8, 2012
1 parent 4bc5c39 commit fab7288
Show file tree
Hide file tree
Showing 40 changed files with 5,718 additions and 1,584 deletions.
22 changes: 9 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,28 @@ ELSE()
SET(OS src/luanode_file_linux.cpp src/platform_linux.cpp src/luanode_stdio_linux.cpp)
ENDIF()

IF(WIN32)
SET(LUA_OS lib/luanode/tty_win)
ELSE()
SET(LUA_OS lib/luanode/tty_posix)
ENDIF()

SET(LUAS
lib/luanode/child_process
lib/luanode/class
lib/luanode/console
lib/luanode/crypto
lib/luanode/datagram
lib/luanode/dns
lib/luanode/event_emitter
lib/luanode/free_list
lib/luanode/fs
lib/luanode/http
lib/luanode/net
lib/luanode/datagram
lib/luanode/path
lib/luanode/querystring
lib/luanode/readline
lib/luanode/repl
lib/luanode/script
lib/luanode/stream
lib/luanode/timers
lib/luanode/tty
lib/luanode/url
lib/luanode/utils
lib/luanode/script
lib/luanode/tty
${LUA_OS}
src/node
deps/StackTracePlus/src/StackTracePlus
Expand All @@ -62,21 +58,21 @@ ENDFOREACH(filename)
SET(SOURCES
deps/http-parser/http_parser.c
src/blogger.cpp
src/lua_vm.cpp
src/luanode.cpp
src/luanode_child_process.cpp
src/luanode_constants.cpp
src/luanode_crypto.cpp
src/luanode_datagram_udp.cpp
src/luanode_dns.cpp
src/luanode_hrtime.cpp
src/luanode_http_parser.cpp
src/luanode_module_api.cpp
src/luanode_net.cpp
src/luanode_datagram_udp.cpp
src/luanode_net_acceptor.cpp
src/luanode_timer.cpp
src/luanode_os.cpp
src/luanode_hrtime.cpp
src/luanode_timer.cpp
${OS}
src/lua_vm.cpp
lib/preloader.cpp
)

Expand Down
27 changes: 17 additions & 10 deletions build/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ LIB_DIR ?= /usr/local/lib

PREFIX ?= /usr/local

BOOST_VERSION ?=1_44
BOOST_DIR ?=$(INCLUDE_DIR)/boost-$(BOOST_VERSION)
BOOST_LIBS ?=$(LIB_DIR)
BOOST_VERSION ?= 1_44
BOOST_DIR ?= $(INCLUDE_DIR)/boost-$(BOOST_VERSION)
BOOST_LIBS ?= $(LIB_DIR)

# Lua includes directory
#LUA_INC = -I$(PACKAGES)/lua5.1/include
Expand Down Expand Up @@ -63,7 +63,7 @@ BOOST_SYSTEM_LIBD ?=boost_system-gcc$(GCC_VERSION)-mt-d-$(BOOST_VERSION)

ifeq ($(Target), Debug)
OUTPUT = $(OUTPUT_BASE)_d
CFLAGS = -Wall -c -g -D_DEBUG -DENABLE_LIBBLOGGER -Werror
CFLAGS = -Wall -c -g -D_DEBUG -D_SOURCE_PATH="\"$(BASE_SRC_DIR)\"" -DENABLE_LIBBLOGGER -Werror
LFLAGS = -Wall -g -Wl,-E
SPECIFIC_LIBS = -l$(BOOST_SYSTEM_LIBD) \
$(LUA_LIB) \
Expand All @@ -74,7 +74,7 @@ ifeq ($(Target), Debug)
-lblogger2_d
else
OUTPUT = $(OUTPUT_BASE)
CFLAGS = -Wall -c -O2 -D_NDEBUG -D_SOURCE_PATH=$(BASE_SRC_DIR) -Wno-strict-aliasing -Werror
CFLAGS = -Wall -c -O2 -D_NDEBUG -D_SOURCE_PATH="\"$(BASE_SRC_DIR)\"" -Wno-strict-aliasing -Werror
LFLAGS = -Wall -Wl,-E
SPECIFIC_LIBS = -l$(BOOST_SYSTEM_LIB) \
$(LUA_LIB) \
Expand All @@ -99,40 +99,43 @@ OBJS = $(PACKAGES)/Lua5.1/src/liblua.a \
$(BUILD_TEMP_DIR)/luanode_crypto.o \
$(BUILD_TEMP_DIR)/luanode_dns.o \
$(BUILD_TEMP_DIR)/luanode_file_linux.o \
$(BUILD_TEMP_DIR)/luanode_hrtime.o \
$(BUILD_TEMP_DIR)/luanode_http_parser.o \
$(BUILD_TEMP_DIR)/luanode_module_api.o \
$(BUILD_TEMP_DIR)/luanode_net.o \
$(BUILD_TEMP_DIR)/luanode_datagram_udp.o \
$(BUILD_TEMP_DIR)/luanode_net_acceptor.o \
$(BUILD_TEMP_DIR)/luanode_posix_stream.o \
$(BUILD_TEMP_DIR)/luanode_timer.o \
$(BUILD_TEMP_DIR)/luanode_os.o \
$(BUILD_TEMP_DIR)/luanode_stdio_linux.o \
$(BUILD_TEMP_DIR)/luanode_hrtime.o \
$(BUILD_TEMP_DIR)/lua_vm.o \
$(BUILD_TEMP_DIR)/platform_linux.o \
$(BUILD_TEMP_DIR)/preloader.o \
$(BUILD_TEMP_DIR)/tty_stream.o \
$(BUILD_TEMP_DIR)/http_parser.o

LUAS = $(BUILD_TEMP_DIR)/child_process.precomp \
$(BUILD_TEMP_DIR)/class.precomp \
$(BUILD_TEMP_DIR)/console.precomp \
$(BUILD_TEMP_DIR)/crypto.precomp \
$(BUILD_TEMP_DIR)/datagram.precomp \
$(BUILD_TEMP_DIR)/dns.precomp \
$(BUILD_TEMP_DIR)/event_emitter.precomp \
$(BUILD_TEMP_DIR)/free_list.precomp \
$(BUILD_TEMP_DIR)/fs.precomp \
$(BUILD_TEMP_DIR)/http.precomp \
$(BUILD_TEMP_DIR)/datagram.precomp \
$(BUILD_TEMP_DIR)/net.precomp \
$(BUILD_TEMP_DIR)/path.precomp \
$(BUILD_TEMP_DIR)/querystring.precomp \
$(BUILD_TEMP_DIR)/readline.precomp \
$(BUILD_TEMP_DIR)/repl.precomp \
$(BUILD_TEMP_DIR)/script.precomp \
$(BUILD_TEMP_DIR)/stream.precomp \
$(BUILD_TEMP_DIR)/timers.precomp \
$(BUILD_TEMP_DIR)/tty.precomp \
$(BUILD_TEMP_DIR)/url.precomp \
$(BUILD_TEMP_DIR)/utils.precomp \
$(BUILD_TEMP_DIR)/script.precomp \
$(BUILD_TEMP_DIR)/tty.precomp \
$(BUILD_TEMP_DIR)/tty_posix.precomp \
$(BUILD_TEMP_DIR)/node.precomp \
$(BUILD_TEMP_DIR)/StackTracePlus/StackTracePlus.precomp

Expand All @@ -146,6 +149,10 @@ $(BUILD_TEMP_DIR)/%.o : $(BASE_SRC_DIR)/src/%.cpp
@echo ""
$(COMPILE)

$(BUILD_TEMP_DIR)/%.o : $(BASE_SRC_DIR)/src/detail/posix/%.cpp
@echo ""
$(COMPILE)

$(BUILD_TEMP_DIR)/%.precomp : $(BASE_SRC_DIR)/lib/luanode/%.lua
@echo ""
$(COMPILE_LUA)
Expand Down
23 changes: 23 additions & 0 deletions build/vc10/LuaNode.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaNode", "LuaNode.vcxproj", "{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release Debuggable|Win32 = Release Debuggable|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}.Debug|Win32.ActiveCfg = Debug|Win32
{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}.Debug|Win32.Build.0 = Debug|Win32
{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}.Release Debuggable|Win32.ActiveCfg = Release Debuggable|Win32
{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}.Release Debuggable|Win32.Build.0 = Release Debuggable|Win32
{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}.Release|Win32.ActiveCfg = Release|Win32
{4D9B134E-CC54-4175-8F80-EEFC3B635ED7}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit fab7288

Please sign in to comment.