Commit 65bc30b1 authored by kollo's avatar kollo

version 1.19

parent da4faa04
--these instructions are outdated--
PREREQUISITS
============
In order to function properly on a LINUX system, following software
should be present:
* The readline library
* The X server and X-linbraries
* The gnu c compiler (otherwise the X11-Basic compiler will not work)
On ubuntu you should have installed following packages:
sudo apt-get install libreadline5
INSTALLATION INSTRUCTIONS
=========================
In order to compile X11Basic, you will need the following:
* A C compiler, preferably GNU C (but some ANSI C compilers, like DEC's
will do)
* An ANSI C compiler, preferably GNU C compiler (gcc) (but any ANSI
C compiler, e.g. tcc, the tiny C compile or others, like DEC's
will do)
* a `csh'-compatible shell
* X11R5 or R6 libraries
* X11R5 or R6 libraries (or the SDL library)
* the readline library
* the curses or ncurses library
These will suffice to get you started.
On debian systems like ubuntu, following packets should be installed:
sudo apt-get install readline <...tobecompleted...>
and optionally
sudo apt-get install <...tobecompleted...>
INSTALLATION
============
......@@ -35,9 +58,18 @@ This will generate a `Makefile'
and generate dependencies for the Makefile. It will
also generate some more sources.
The default installation path is /usr/local. If you want to install X11-Basic
to another directory, you should run it with an argument, like:
./configure --prefix=/usr
Then do the compilation:
make
And the installation:
sudo make install
......@@ -50,12 +82,12 @@ that you might need to change is GERMAN, which should be defined if you
like to have a german version of X11-Basic. The default language is english.
COMPILING
=========
COMPILING a standalone excecutable
==================================
To compile the X11-Basic interpreter (called xbasic), simply type
make
make static
at the shell prompt.
......@@ -67,11 +99,16 @@ by typing
The command-line options can be listed with the `-h' option (`./xbasic -h').
INSTALLING
==========
INSTALLING the standalone excecutable
=====================================
Put the executable wherever you like. I have mine in ${HOME}/bin/.
A system wide installation can be done with
sudo make install
remove the installation with
sudo make uninstall
make the pseudo-compiler work, libraries:
=========================================
......
......@@ -18,7 +18,7 @@ INCDIR=@prefix@/include/x11basic
LIBNO=@version@
# Register variables (-ffixed-reg) -Wall
REGS= @regs@ -fPIC
REGS= @regs@
# Optimization and debugging options
OPT=@copt@
......@@ -74,17 +74,19 @@ EXTRAOBJS= bytecode.o xbbc.o xbvm.o xb2c.o framebuffer.o spat-a-fnt.o 5x7.o
WINLIBOBJS= $(OBJS) mathematics.o Windows.extension/fnmatch.o Windows.extension/memfrob.o
AOBJS= main.o $(LIBOBJS)
BOBJS= main.o blowfish.o $(LIBOBJS)
CSRC= $(DISTOBJS:.o=.c) fdata.c 5x7-rev.c $(EXTRAOBJS:.o=.c)
CSRC= $(DISTOBJS:.o=.c) 5x7-rev.c $(EXTRAOBJS:.o=.c)
DISTCSRC=$(DISTOBJS:.o=.c)
LIBCSRC=$(LIBOBJS:.o=.c)
DEPSRC= $(CSRC)
# Headerfiles which should be added to the distribution
HSRC= aes.h array.h bitmap.h defs.h file.h functions.h gkommandos.h kommandos.h \
HSRC= aes.h android.h array.h bitmap.h defs.h file.h functions.h gkommandos.h kommandos.h \
options.h xbasic.h window.h bytecode.h number.h parameter.h \
framebuffer.h parser.h io.h afunctions.h sfunctions.h graphics.h \
sound.h wort_sep.h variablen.h mathematics.h sysVstuff.h x11basic.h \
decode.h xb2csol.h
decode.h xb2csol.h virtual-machine.h terminal.h
EXAMPLES=examples2/calculation/randomminmax.bas \
examples2/calculation/sieve.bas \
......@@ -212,8 +214,8 @@ config.h: config.h.in
libx11basic.so: libx11basic.so.$(LIBNO)
ln -s -f $< libx11basic.so.1
ln -s -f libx11basic.so.1 libx11basic.so
libx11basic.so.$(LIBNO) : $(LIBOBJS)
$(CC) -fPIC -shared -Wl,-soname,$@ -o $@ $(LIBOBJS)
libx11basic.so.$(LIBNO) : $(LIBCSRC)
$(CC) -fPIC -shared -Wl,-soname,$@ -o $@ $(LIBCSRC) $(LIBS) $(XLIBS)
strip $@
# Make the (static) library
......@@ -245,7 +247,7 @@ xbbcstatic : xbbc.c bytecode.h bytecode.o x11basic.a
# Make the virtual machine for interpreting the bytecode
xbvm : bytecode.h xbvm.c
gcc -o $@ xbvm.c -L .$(LIBS) -lx11basic -L /usr/X11/lib/ -lX11
gcc -o $@ xbvm.c -L . $(LIBS) -lx11basic -L /usr/X11/lib/ -lX11
strip $@
xbvmstatic : bytecode.h xbvm.c bytecode.h x11basic.a
gcc -o xbvm xbvm.c x11basic.a -lm -L /usr/X11/lib/ $(LIBS) -lX11
......@@ -455,12 +457,12 @@ tinexbasic : $(OBJS) main.o mathematics.o
strip $@
doocsxbasic.dyn : $(OBJS) main.o mathematics.o doocs-wrapper.o
$(CC) -DTINE -DDOOCS $(LINKFLAGS) -o $@ $(AOBJS) doocs-wrapper.o \
$(LIBS)$(XLIBS) -ltine -lDOOCSclient -lDOOCSserver -lpthread
$(LIBS) $(XLIBS) -ltine -lDOOCSclient -lDOOCSserver
strip $@
doocsxbasic : $(OBJS) main.o mathematics.o doocs-wrapper.o
g++ -DTINE -DDOOCS $(OPT) $(LINKFLAGS) -o $@ $(AOBJS) \
$(LIBS) /usr/lib/libtine.a /usr/lib/libDOOCSclient.a \
/usr/lib/libDOOCSserver.a doocs-wrapper.o $(XLIBS) -lpthread
/usr/lib/libDOOCSserver.a doocs-wrapper.o $(XLIBS)
strip $@
......@@ -538,6 +540,8 @@ uninstall :
clean :
rm -f *.o a.out b.out b.b Makefile.bak \
backup-*.tgz
moreclean : clean
rm -f xbasic xbbc xbvm xbc xb2c bas2x11basic libx11basic.so.1.* x11basic.a
distclean : clean
rm -f Makefile config.cache config.status config.log config.h 11.c xbasic xbc xbvm \
......
......@@ -10,17 +10,17 @@
VERSION 1.18
VERSION 1.19
(C) 1997-2011 by Markus Hoffmann
(C) 1997-2012 by Markus Hoffmann
(kollo@users.sourceforge.net)
Name : X11Basic
Version : 1.18 Vendor: Markus Hoffmann
Version : 1.19 Vendor: Markus Hoffmann
Group : Development/Languages License: GPL
Packager : Markus Hoffmann <kollo@users.sourceforge.net>
URL : http://x11-basic.sourceforge.net/
Summary : A Basic Interpreter with X11-Graphics capabilities
Summary : A Basic Interpreter and compiler with graphics capabilities
Description :
X11-Basic is a dialect of the BASIC programming language with graphics
......@@ -33,8 +33,7 @@ Description :
On UNIX and linux systems, the X11 graphics engine can be used as well as the
SDL library, the framebuffer devices or no graphics at all. The MS WINDOWS
version supports only SDL (or no graphics at all). On LINUX systems the ALSA
sound engine can be used.
version supports only SDL (or no graphics at all).
This package includes the basic interpreter named xbasic and a set of different
compilers. The interpreter can be used as a shell, and can so run basic-scripts.
......@@ -43,8 +42,8 @@ You can make excecutable scripts p.ex. *.cgi-Scripts for handling web-input.
A compiler (xbc) is included which makes stand alone binaries out of the
scripts, which run more than 10 times faster than the interpreted code. The
compiler can either pseudo-compile the X11-Basic sources by attaching the
source to a run-only interpreter (In which case the program will not run faster
than is the interpreter is used, but you have everythin in one excecutable
source to a run-only interpreter (in which case the program will not run faster
than is the interpreter is used, but you have everything in one excecutable
file), or the compiler can do a real compilation of the BASIC source into
bytecode, then c, and finally machine language. This way the code excecutes
about 10 times faster. (** This is a relatively new feature, so be prepared to
......@@ -53,14 +52,14 @@ catch errors here. Please report them. **)
X11-Basic programs can also be compiled into a bytecode (see xbbc). This bytecode
can be interpreted by a virtual machine (see xbvm). Finally, the bytecode can be
converted to c sourcefiles (see xb2c) which can be compiles with the gnu C
compiler to native excecutables.
compiler (or the tiny c compiler) to native excecutables.
Ancient ANSI-Basic programs (with line numbers) can be converted to X11-Basic
with the bas2x11basic program (see the man page bas2x11basic(1) ).
You will find the compiler sourcecode and some other sample programs in
/usr/share/doc/packages/X11Basic/examples. A variety of other sample programs
can be found in X11-Basic-examples-1.18.zip, which you can download from the
can be found in X11-Basic-examples-1.19.zip, which you can download from the
homepage (http://x11-basic.sourceforge.net/). Also an up-to-date pdf-version
of the manual can be found there.
......
Release notes for Version 1.18 (Sept 2011)
Release notes for Version 1.19 (Mai 2012)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Reworked variable management
- Reworked xb2c compiler, produced code is now much(!) faster.
- interpreter is now 8% faster
- virtual machine is 20 times faster than interpreter
- compiled code is 30 times faster than interpreter
- improved detection of const expressions.
- improved detection of fieldindex too large (less segfaults now)
- fixed a memory leak
- updated the documentation
- changed DIM behavior: DIM a(10) means elements a(0) to a(9) are there.
- fixed some bugs.
- New command: CURVE
- Implemented DEFFN
- Optimized Compiler: simple math functions and Square
- Android version
- virtual machine now included in library
- new GPS and SENSOR commands (for Android version)
- new SPEAK kommand (for Android version)
- improved framebuffer graphics routines
- new command: PLAYSOUNDFILE (for Android version)
- new command: GET_LOCATION
- BUGFIX: SOUND, WAVE, AND(), OR(), XOR(), NOT()
- BUGFIX: FOR with integer variable
- BUGFIX: SELECT CASE ENDSELECT
- NEW: "!" is now allowed at the beginning of a line
- BUGFIX: SELECT/CONTINUE
- some minor changes for 64bit version
This diff is collapsed.
......@@ -12,7 +12,7 @@
#define GEMFONTSMALL "-*-fixed-medium-r-normal-*-10-*-iso8859-*"
#define WORD short
#define LONG unsigned int
#define LONG unsigned long
......@@ -95,8 +95,11 @@
#define ALL_BLACK 15
/* font types */
#define FONT_IBM 3
#define FONT_SMALL 5
#define FONT_BIG 1
#define FONT_SMALLIBM 5
#define FONT_BIGIBM 6
#define FONT_SMALL 40
#define FONT_BIG 10
#define FONT_LARGE 20
#define FONT_DEFAULT FONT_IBM
#define EDSTART 0
......
......@@ -17,6 +17,7 @@
#include "xbasic.h"
#include "array.h"
#include "afunctions.h"
#include "mathematics.h"
ARRAY f_smula(PARAMETER *plist, int e) {
ARRAY ergeb;
......@@ -36,55 +37,6 @@ ARRAY f_einsmat(PARAMETER *plist, int e) {
return(einheitsmatrix(FLOATTYP,2,dimlist));
}
extern double *SVD(double *a, double *w, double *v,int anzzeilen, int anzspalten);
extern double *backsub(double *, double *, double *, double *,int,int);
double *makeSVD(double *v1,double *m1,int anzzeilen, int anzspalten) {
int i,elim=0,fsing=0;
double maxsing=0;
double *ergebnis;
double *u = malloc(sizeof(double)*anzzeilen*anzspalten);
double *v = malloc(sizeof(double)*anzspalten*anzspalten);
double *singulars = malloc(sizeof(double)*anzspalten);
memcpy(u,m1,sizeof(double)*anzzeilen*anzspalten);
singulars=SVD(u,singulars,v,anzzeilen,anzspalten);
#ifdef DEBUG
printf("Eigenwerte:\n");
for(i=0;i<anzspalten;i++) printf("%g\n",singulars[i]);
#endif
/* Groessten Singulaerwert rausfinden */
for(i=0;i<anzspalten;i++) {
if(fabs(singulars[i])>maxsing) maxsing=fabs(singulars[i]);
}
/* Zaehle Anzahl der Singulaeren Werte (d.h. Eigenwerte=0) */
/* Akzeptiere nur Eigenwerte die mindestens 1e-10 vom groessten sind,
ansonsten setze sie zu 0 */
for(i=0;i<anzspalten;i++) {
if(singulars[i]==0) fsing++;
if(fabs(singulars[i])/maxsing<1e-10 && singulars[i]) {
printf("** %g\n",singulars[i]);
singulars[i]=0;
elim++;
}
}
if(fsing || elim) printf("Found %d singularities and eliminated another %d.\n",fsing,elim);
ergebnis=backsub(singulars,u,v,v1,anzzeilen,anzspalten);
free(u);free(v);
free(singulars);
return(ergebnis);
}
void makeSVD2(double *v1,double *m1,int anzzeilen, int anzspalten, double *ergeb) {
double *x;
x=makeSVD(v1,m1,anzzeilen,anzspalten);
memcpy(ergeb,x,sizeof(double)*anzspalten);
}
/* Gleichungssystem loesen d=Mx x()=SOLVE(m(),d())*/
ARRAY f_solvea(PARAMETER *plist, int e) {
......
/* android.h Kommandos (c) Markus Hoffmann */
/* This file is part of X11BASIC, the basic interpreter for Unix/X
* ============================================================
* X11BASIC is free software and comes with NO WARRANTY - read the file
* COPYING for details
*/
#define LOG_TAG "libx11basic"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#define NLOG(a) ringbufin(a)
extern int android_init;
extern AndroidBitmapInfo screen_info;
extern int out_pipe[];
extern int in_pipe[];
extern char lastcommand[];
void ringbufin(char *a);
void backlog(char *n);
void android_sigaction(int signal, siginfo_t *info, void *reserved);
void invalidate_screen();
char *flush_terminal();
void thread_function ( void *ptr );
......@@ -18,25 +18,13 @@
#include "wort_sep.h"
#include "array.h"
#include "parser.h"
#include "mathematics.h"
static ARRAY form_array(int, int, int *, char *);
char *arrptr(PARAMETER *p,int e) {return((char *)variablen[p->integer].pointer.a); }
/* Zurueck: 0 -- Arrayelement
1 -- subarray
2 -- ganzes array */
int isarray(int *indexliste,int n) {
if(n==0 || indexliste==NULL) return(2);
while(--n>=0) {
if(indexliste[n]==-1) return(1);
}
return(0);
}
......@@ -128,6 +116,7 @@ ARRAY create_array(int typ, int dimension, int *dimlist) {
return(ergebnis);
}
void free_array(ARRAY *arr) {
// printf("free_array: %d\n",arr->typ);
if(arr->typ==NOTYP) return;
if(arr->typ==STRINGTYP) {
int j,anz=1;
......@@ -632,9 +621,10 @@ ARRAY string_to_array(STRING in) {
char *ppp=in.pointer+2*sizeof(int)+arraylen*typlaenge(out.typ);
STRING *a=(STRING *)(out.pointer+INTSIZE*out.dimension);
/* Alle Strings anlegen und pointer relozieren */
unsigned int i,offset;
unsigned int i;
unsigned long offset;
for(i=0;i<arraylen;i++) {
offset=(unsigned int)a[i].pointer;
offset=(unsigned long)a[i].pointer;
a[i].pointer=malloc(a[i].len);
memcpy(a[i].pointer,ppp+offset,a[i].len);
}
......
......@@ -6,8 +6,6 @@
* COPYING for details
*/
extern double *SVD(double *a, double *w, double *v,int anzzeilen, int anzspalten);
extern double *backsub(double *, double *, double *, double *,int,int);
ARRAY create_array(int , int ,int *);
ARRAY create_int_array(int dimension, int *dimlist,int value);
......@@ -42,7 +40,6 @@ void fill_float_array (ARRAY *,double);
int do_dimension (VARIABLE *v);
int anz_eintraege(ARRAY *a);
char *arrptr(PARAMETER *,int);
void *arrayvarptr(int vnr, char *n,int size);
void *arrayvarptr2(int vnr, int *indexliste,int size);
STRING array_to_string(ARRAY inhalt);
......
......@@ -43,7 +43,7 @@ void memdump(unsigned char *adr,int l);
/* swap some long ints. (n is number of BYTES, not number of longs) */
static void swapdws (char *bp, unsigned n) {
static void swapdws (char *bp, unsigned int n) {
register char c;
register char *ep = bp + n;
register char *sp;
......@@ -67,9 +67,9 @@ char *imagetoxwd(XImage *image,Visual *visual,XColor *pixc, int *len) {
colortable_len=ncolors*sizeof(XWDColor);
*len=header_len+colortable_len+image->height*image->bytes_per_line;
data=malloc(header_len+colortable_len+image->height*image->bytes_per_line);
color=(XWDColor *)((int)data+header_len);
memcpy((void *)((int)data+header_len+colortable_len),image->data,image->height*image->bytes_per_line);
memcpy((void *)((int)data+sizeof(XWDFileHeader)),image_name,strlen(image_name));
color=(XWDColor *)((long)data+header_len);
memcpy((void *)((long)data+header_len+colortable_len),image->data,image->height*image->bytes_per_line);
memcpy((void *)((long)data+sizeof(XWDFileHeader)),image_name,strlen(image_name));
data->header_size=(CARD32)header_len;
data->file_version=(CARD32)XWD_FILE_VERSION;
data->pixmap_format=(CARD32)image->format;
......@@ -139,13 +139,13 @@ int bmp2bitmap(char *data,char *fbp,int x, int bw,int bh,int depth, char *mask)
if(compression!=BI_RGB && compression!=BI_BITFIELDS) {
printf("\033[H BITMAPINFOHEADERLEN=%d \n",BITMAPINFOHEADERLEN);
printf("&iheader-data =%d \n",(int)iheader-(int)data);
printf("bisize-data =%d %d \n",(int)(&(iheader->biSize))-(int)data,iheader->biSize);
printf("biwidth-data =%d %d \n",(int)(&(iheader->biWidth))-(int)data,iheader->biWidth);
printf("biHeight-data =%d %d \n",(int)(&(iheader->biHeight))-(int)data,iheader->biHeight);
printf("biPlanes-data =%d %d \n",(int)(&(iheader->biPlanes))-(int)data,iheader->biPlanes);
printf("biBitCount-data =%d %d \n",(int)(&(iheader->biBitCount))-(int)data,iheader->biBitCount);
printf("biCompression-data =%d %d \n",(int)(&(iheader->biCompression))-(int)data,iheader->biCompression);
printf("&iheader-data =%d\n", (long)iheader-(long)data);
printf("bisize-data =%d %d\n",(long)(&(iheader->biSize))- (long)data,iheader->biSize);
printf("biwidth-data =%d %d\n",(long)(&(iheader->biWidth))- (long)data,iheader->biWidth);
printf("biHeight-data =%d %d\n",(long)(&(iheader->biHeight))- (long)data,iheader->biHeight);
printf("biPlanes-data =%d %d\n",(long)(&(iheader->biPlanes))- (long)data,iheader->biPlanes);
printf("biBitCount-data =%d %d\n",(long)(&(iheader->biBitCount))- (long)data,iheader->biBitCount);
printf("biCompression-data =%d %d\n",(long)(&(iheader->biCompression))-(long)data,iheader->biCompression);
printf("Put-Image: Compressed Bitmaps (%d) are not supported !\n",iheader->biCompression);
memdump((unsigned char *)data,64);
return(-1);
......@@ -253,11 +253,12 @@ int bmp2bitmap(char *data,char *fbp,int x, int bw,int bh,int depth, char *mask)
((char *)ptr1)[j*4+3+i*bw*4]=a;
}
}
buf2=(char *)(((((int)buf2-(int)buf3)+3)&0xfffffffc)+(int)buf3); /* align to 4 */
buf2=(char *)(((((long)buf2-(long)buf3)+3)&0xfffffffc)+(long)buf3); /* align to 4 */
}
return(usealpha);
}
void bitmap_scale(char *oadr,int depth,int ow,int oh,char *adr,int w,int h) {
static void bitmap_scale(char *oadr,int depth,int ow,int oh,char *adr,int w,int h) {
int rl=depth/8;
int x,y;
int sx,sy;
......@@ -277,7 +278,7 @@ void bitmap_scale(char *oadr,int depth,int ow,int oh,char *adr,int w,int h) {
}
void extend_mask(char *a, char *b, int n, unsigned char thres) {
static void extend_mask(char *a, char *b, int n, unsigned char thres) {
int i=0;
for(i=0;i<n;i++) {
if(((*a++)&0xff)>=thres) {
......@@ -293,7 +294,7 @@ void extend_mask(char *a, char *b, int n, unsigned char thres) {
}
}
}
void extend_mask16(char *a, char *b, int n, unsigned char thres) {
static void extend_mask16(char *a, char *b, int n, unsigned char thres) {
int i=0;
for(i=0;i<n;i++) {
if(((*a++)&0xff)>=thres) {
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
#define BC_STACKLEN 256
#define BC_VERSION 0x118
#define BC_VERSION 0x1197 /* Version 1.19 release 7*/
typedef struct {
unsigned char BRAs; /* DC_BRAs */
......@@ -195,14 +195,10 @@ typedef struct {
/* Protos */
PARAMETER *virtual_machine(STRING, int *);
void bc_jumptosr2(int ziel);
void plist_to_stack(PARAMETER *pp, short *pliste, int anz, int pmin, int pmax);
void compile();
void bc_pushv_name(char *var);
void bc_pushv(int vnr);
void bc_zuweis_name(char *var);
int vm_x2i(PARAMETER *sp);
int vm_x2f(PARAMETER *sp);
void compile(int verbose);
int bc_parser(char *funktion);
#if 0
int vm_add(PARAMETER *sp);
int vm_sub(PARAMETER *sp);
int vm_mul(PARAMETER *sp);
......@@ -217,6 +213,7 @@ int vm_asysvar(PARAMETER *sp,int n);
int vm_dup(PARAMETER *sp);
int vm_exch(PARAMETER *sp);
int vm_neg(PARAMETER *sp);
void cast_to_real(PARAMETER *sp);
void cast_to_int(PARAMETER *sp);
int vm_sfunc(PARAMETER *sp,int i, int anzarg);
......@@ -230,3 +227,4 @@ int vm_pusharrayelem(int vnr,PARAMETER *sp, int dim);
int vm_pushv(int vnr,PARAMETER *sp);
void push_v(PARAMETER *p, VARIABLE *v);
int vm_eval(PARAMETER *sp);
#endif
......@@ -17,26 +17,22 @@
#include "variablen.h"
#include "xbasic.h"
int ccs_err;
#if defined CONTROL || defined TINE
static int ccs_err;
int v_ccserr() {return(ccs_err);}
#endif
/* Falls mit Kontrollsystem */
#define MAXPIDS 250
#ifdef CONTROL
int notify_handler(int , int , int );
int pids[MAXPIDS];
int isubs[MAXPIDS];
int pidanz=0;
#endif
#ifdef TINE
#if defined CONTROL || defined TINE
int notify_handler(int , int , int );
int pids[MAXPIDS];
int isubs[MAXPIDS];
int pidanz=0;
#endif
#ifndef WINDOWS
#ifdef CONTROL
#include "ccsdef.h"
......@@ -48,6 +44,7 @@ int pidanz=0;
#include "resourcebaseman.h"
int v_ccsaplid() {return(aplid);}
/* Kontrollsystemstuff */
......@@ -71,16 +68,8 @@ void cs_exit() {
ccs_detach_control();
}
#endif
#endif
#ifdef CONTROL
#define CT
#endif
#ifdef TINE
#define CT
#endif
#ifdef CT
#if defined CONTROL || defined TINE
int notify_handler(int pid, int overflow, int entries) {
int i,pc2,flag=0;
printf("ent=%d\n",entries);
......
This diff is collapsed.
# configure.in file for X11-Basic (c) Markus Hoffmann
# used by autoconf
#
AC_INIT([X11-Basic], [1.18], [kollo@users.sourceforge.net])
AC_INIT([X11-Basic], [1.19], [kollo@users.sourceforge.net])
version=$PACKAGE_VERSION
vdate=`date`
AC_REVISION($Revision: 0.12 $)
......@@ -127,10 +127,12 @@ AC_CHECK_LIB([m], [log1p], AC_DEFINE(HAVE_LOG1P,1,[log1p in Mathlib]))
# `-ltermcap':
#AC_CHECK_LIB([termcap], [main], libs="$libs -ltermcap")
# `-lcurses':
AC_CHECK_LIB([curses], [main], libs="$libs -lcurses")
# `-lncurses':
AC_CHECK_LIB([ncurses], [main], libs="$libs -lncurses")
AC_CHECK_LIB([ncurses], [main], libs="$libs -lncurses", [
# `-lcurses':
AC_CHECK_LIB([curses], [main], libs="$libs -lcurses")
])
AC_CHECK_LIB([pthread], [pthread_create], libs="$libs -lpthread")
# `-lasound':
AC_CHECK_LIB([asound], [snd_pcm_recover], [
......
......@@ -20,7 +20,6 @@
#define MAXSTRLEN 1024 /* in Bytes */
#define MAXPRGLEN 64000 /* in Bytes */
#define MAXLINELEN 1024 /* in Bytes */
#define MAXVARNAMLEN 64 /* in Bytes */
#define ANZFILENR 64
#define STACKSIZE 256
#define ANZVARS 1024
......@@ -30,7 +29,6 @@
#define MAXSTRLEN 4096 /* in Bytes */
#define MAXPRGLEN 100000 /* in Bytes */
#define MAXLINELEN 4096 /* in Bytes */
#define MAXVARNAMLEN 64 /* in Bytes */
#define ANZFILENR 100
#define STACKSIZE 512
#define ANZVARS 4096
......@@ -41,7 +39,6 @@
#define INTSIZE sizeof(double)
#define round(a) ((int)(a+0.5))
#ifdef min
#undef min
......
......@@ -10,10 +10,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
//#undef HAVE_READLINE
#ifdef HAVE_READLINE
#include <readline/readline.h>
#endif
#ifdef ANDROID
#include "terminal.h"
#endif
/* **************************************************************** */
......@@ -23,58 +30,179 @@
/* A static variable for holding the line. */
static char *line_read = (char *)NULL;
#ifndef HAVE_READLINE
#define MAX_HISTORY 100
static int historyp=-1;
static char *history[MAX_HISTORY];
void add_history(const char *line) {
int i;
if(historyp<0) {
for(i=0;i<MAX_HISTORY;i++) history[i]=NULL;
historyp=0;
}
if(historyp<MAX_HISTORY) {
history[historyp++]=strdup(line);
} else {
free(history[0]);
for(i=0;i<MAX_HISTORY-1;i++) history[i]=history[i+1];
history[historyp-1]=strdup(line);
}
// printf("Add history: %s --> %d\n",line,historyp);
}
void out_line(const char *prompt,const char *edittext, const int cursorpos) {
int i;
/* ESC sequenz fuer ganze Zeile l"oschen, cursor an*/
putchar(13);
putchar(27);
printf("[K%s%s ",prompt,edittext);
putchar(8);