newLisp and readline

Started by kinghajj, July 15, 2007, 01:28:04 PM

Previous topic - Next topic

kinghajj

When I first compiled newLisp, the biggest problem I had with the console was that arrow keys did not move back and forth within the line, but instead outputted strange characters. That makes it very hard to play around and test new ideas, especially for beginners who make mistakes.



I did some browsing through the code, and found that if I enabled "readline" then my problem would be fixed. So I added the necessary text to the Makefile to enable readline. This is the Makefile I used, based on "makefile_linux64LP64_utf8", is:

# makefile for newLISP v. 9.x.x UTF-8 on 64 bit LINUX and 64-bit memory pointers tested on AMD64
#
# Note, that readline support may require different libraries on different OSs
#

OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o
nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o

CFLAGS = -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O3 -DSUPPORT_UTF8 -DLINUX -DNEWLISP64 -DREADLINE

CC = gcc

default: $(OBJS)
$(CC) $(OBJS)  -g -lm -ldl -lreadline -o newlisp
strip newlisp

.c.o:
$(CC) $(CFLAGS) $<

$(OBJS): primes.h protos.h makefile_linux64LP64_utf8


My question is, shouldn't readline be enabled by default? Not all new newLispers will have knowledge in C programming and Makefiles, so they will not be able to enable it themselves.



P.S. Thanks for writing a program that compiles with no warnings. Too much FOSS has thousands of compiler warnings; you'd think that the programmers would look at those warnings and fix them, so as to make the program safer and more standard, but they don't.

Lutz

#1
QuoteMy question is, shouldn't readline be enabled by default?


I would love to make readline support the default on LINUX too (like it is  already on all BSD's and Mac OS X). It used to be the default on Linux, but I got too many complains, that it wouldn't compile. Most distributions still don't distribute libreadline.so by default. One of the few exceptions is UBUNTU which is shipped with libreadline support by default.



A note on compiling as Linux64: I would only recommend this flavor if you must use it because your Linux64 installation doesn't let you compile for 32-bit or if you want to use more than 4G of memory. Many Linux64 distributions are installed with 64-bit and 32-bit libc support, many applications libraries shipped with Linux only support 32-bit. You may have to force 32-but using the -m32 flag in the CFLAGS in the makefile when compliling, depending on how gcc is installed.



The speed advantage you get with newLISP 64 is not that big (allthough notable), but memory requirements are double in many instances.



Lutz



ps: welcome to the group and newLISP

kinghajj

#2
Ah, I use Ubuntu, so I had readline already.



Thanks for the reply.



The memory for newLisp when I first start it is 420 kb. But, as I have 1 GB of memory,  and I've yet to actually use more than half of that at a time in Linux, I don't think I'll have problems with memory shortages. Thanks for the concern, though.