Browse Source

v2.20pl2

Patch level 2 release by Jon B. Volkoff,
                             11 October 1997

LIST OF PATCHES TO 2.20:

bwb_cmd.c
   Fixed calling stack level logic in RETURN statement to prevent erroneous
   "RETURN without GOSUB" messages.

bwb_cnd.c
bwb_stc.c

   Changed continuation condition for WHILE, ELSEIF, and LOOP UNTIL
   to be != FALSE, not == TRUE.  More in line with common commercial
   BASIC implementations.

bwb_mth.c
   Fixed initialization in VAL function so that old results are not later
   returned as values.

bwb_var.c
   Added parenthesis level checking to dim_getparams. Using multi-level
   expressions as array subscripts was causing the program to bomb.

bwx_iqc.c
bwx_tty.c
bwb_mes.h
   Added second copyright notice.

bwb_dio.c
bwb_str.c
   Added support for strings longer than 255 characters.

bwb_prn.c
   Disabled tab expansion and print width checks when not printing to a file.

bwb_inp.c
   Fixed LINE INPUT file reads to accommodate strings of length MAXSTRINGSIZE.

bwx_ncu.h
bwx_ncu.c
   New files.  Code for UNIX ncurses interface, compliments of L.C. Benschop,
   Eindhoven, The Netherlands.

Makefile.ncu
   New files.  Sample makefile for ncurses implementation.

bwbasic.h
   Revised defines for MININTSIZE and MAXINTSIZE from 16-bit to 32-bit limits.
   Revised define for MAXSTRINGSIZE from 255 to 5000 characters.
   Changed string length from unsigned char to unsigned int to support strings
   longer than 255 characters.
   Added support for new ncurses package.
   Revised VERSION define to reflect above changes.

To implement these patches simply replace the old versions of the above source
files with the new ones and remake bwbasic.
tags/v2.20pl2
Jon Foster 3 years ago
parent
commit
9b67a56abb
17 changed files with 1169 additions and 13 deletions
  1. +128
    -0
      Makefile.ncu
  2. +75
    -0
      README.patch02
  3. +18
    -0
      bwb_cmd.c
  4. +2
    -2
      bwb_cnd.c
  5. +1
    -1
      bwb_dio.c
  6. +2
    -1
      bwb_inp.c
  7. +7
    -0
      bwb_mes.h
  8. +2
    -3
      bwb_mth.c
  9. +17
    -0
      bwb_prn.c
  10. +3
    -2
      bwb_stc.c
  11. +2
    -1
      bwb_str.c
  12. +35
    -0
      bwb_var.c
  13. +16
    -3
      bwbasic.h
  14. +2
    -0
      bwx_iqc.c
  15. +815
    -0
      bwx_ncu.c
  16. +42
    -0
      bwx_ncu.h
  17. +2
    -0
      bwx_tty.c

+ 128
- 0
Makefile.ncu View File

@@ -0,0 +1,128 @@
# Generated automatically from Makefile.in by configure.
# Unix Makefile for Bywater BASIC Interpreter

##---------------------------------------------------------------##
## NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, ##
## 10/1995 (eidetics@cerf.net). ##
##---------------------------------------------------------------##

srcdir = .
VPATH = .

CC = cc

INSTALL = cp
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

DEFS = -DHAVE_STRING=1 -DHAVE_STDLIB=1 -DHAVE_RAISE=1 -DHAVE_UNISTD=1

# Revised by JBV
#CFLAGS = -O
CFLAGS = -g -ansi

# Revised by JBV
#LDFLAGS = -s

prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin

SHELL = /bin/sh

#CFILES= bwbasic.c bwb_int.c bwb_tbl.c bwb_cmd.c bwb_prn.c\
# bwb_exp.c bwb_var.c bwb_inp.c bwb_fnc.c bwb_cnd.c\
# bwb_ops.c bwb_dio.c bwb_str.c bwb_elx.c bwb_mth.c\
# bwb_stc.c bwb_par.c bwx_tty.c

CFILES= bwbasic.c bwb_int.c bwb_tbl.c bwb_cmd.c bwb_prn.c\
bwb_exp.c bwb_var.c bwb_inp.c bwb_fnc.c bwb_cnd.c\
bwb_ops.c bwb_dio.c bwb_str.c bwb_elx.c bwb_mth.c\
bwb_stc.c bwb_par.c bwx_ncu.c

#OFILES= bwbasic.o bwb_int.o bwb_tbl.o bwb_cmd.o bwb_prn.o\
# bwb_exp.o bwb_var.o bwb_inp.o bwb_fnc.o bwb_cnd.o\
# bwb_ops.o bwb_dio.o bwb_str.o bwb_elx.o bwb_mth.o\
# bwb_stc.o bwb_par.o bwx_tty.o
OFILES= bwbasic.o bwb_int.o bwb_tbl.o bwb_cmd.o bwb_prn.o\
bwb_exp.o bwb_var.o bwb_inp.o bwb_fnc.o bwb_cnd.o\
bwb_ops.o bwb_dio.o bwb_str.o bwb_elx.o bwb_mth.o\
bwb_stc.o bwb_par.o bwx_ncu.o
#HFILES= bwbasic.h bwb_mes.h bwx_tty.h
HFILES= bwbasic.h bwb_mes.h bwx_ncu.h
MISCFILES= COPYING INSTALL Makefile.in README bwbasic.doc\
bwbasic.mak configure.in configure makefile.qcl\
bwb_tcc.c bwx_iqc.c bwx_iqc.h bwx_ncu.c bwx_ncu.h

TESTFILES= \
abs.bas assign.bas callfunc.bas callsub.bas chain1.bas\
chain2.bas dataread.bas deffn.bas dim.bas doloop.bas\
dowhile.bas elseif.bas end.bas err.bas fncallfn.bas\
fornext.bas function.bas gosub.bas gotolabl.bas ifline.bas\
index.txt input.bas lof.bas loopuntl.bas main.bas\
mlifthen.bas on.bas onerr.bas onerrlbl.bas ongosub.bas\
opentest.bas option.bas putget.bas random.bas selcase.bas\
snglfunc.bas stop.bas term.bas whilwend.bas width.bas\
writeinp.bas pascaltr.bas

DISTFILES= $(CFILES) $(HFILES) $(MISCFILES)

# Revised by JBV
#all: bwbasic
all: bwbasic renum

bwbasic: $(OFILES)
$(CC) $(OFILES) -lm -lcurses -o $@ $(LDFLAGS)

# Added by JBV
renum:
$(CC) renum.c -o renum

$(OFILES): $(HFILES)

.c.o:
$(CC) -c $(CPPFLAGS) -I$(srcdir) $(DEFS) $(CFLAGS) $<

install: all
$(INSTALL_PROGRAM) bwbasic $(bindir)/bwbasic

uninstall:
rm -f $(bindir)/bwbasic

Makefile: Makefile.in config.status
$(SHELL) config.status
config.status: configure
$(SHELL) config.status --recheck
configure: configure.in
cd $(srcdir); autoconf

TAGS: $(CFILES)
etags $(CFILES)

clean:
rm -f *.o bwbasic core

mostlyclean: clean

distclean: clean
rm -f Makefile config.status

realclean: distclean
rm -f TAGS

# Version number changed from 2.10 to 2.20 by JBV
dist: $(DISTFILES)
echo bwbasic-2.20 > .fname
rm -rf `cat .fname`
mkdir `cat .fname`
ln $(DISTFILES) `cat .fname`
mkdir `cat .fname`/bwbtest
cd bwbtest; ln $(TESTFILES) ../`cat ../.fname`/bwbtest
tar czhf `cat .fname`.tar.gz `cat .fname`
rm -rf `cat .fname` .fname

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:

+ 75
- 0
README.patch02 View File

@@ -0,0 +1,75 @@


README.patch02 file for


Bywater BASIC Interpreter/Shell, version 2.20
---------------------------------------------

Copyright (c) 1993, Ted A. Campbell
for bwBASIC version 2.10, 11 October 1993

Version 2.20 modifications by Jon B. Volkoff,
25 November 1995

Patch level 1 release by Jon B. Volkoff,
15 March 1996

Patch level 2 release by Jon B. Volkoff,
11 October 1997


LIST OF PATCHES TO 2.20:

bwb_cmd.c
Fixed calling stack level logic in RETURN statement to prevent erroneous
"RETURN without GOSUB" messages.

bwb_cnd.c
bwb_stc.c

Changed continuation condition for WHILE, ELSEIF, and LOOP UNTIL
to be != FALSE, not == TRUE. More in line with common commercial
BASIC implementations.

bwb_mth.c
Fixed initialization in VAL function so that old results are not later
returned as values.

bwb_var.c
Added parenthesis level checking to dim_getparams. Using multi-level
expressions as array subscripts was causing the program to bomb.

bwx_iqc.c
bwx_tty.c
bwb_mes.h
Added second copyright notice.

bwb_dio.c
bwb_str.c
Added support for strings longer than 255 characters.

bwb_prn.c
Disabled tab expansion and print width checks when not printing to a file.

bwb_inp.c
Fixed LINE INPUT file reads to accommodate strings of length MAXSTRINGSIZE.

bwx_ncu.h
bwx_ncu.c
New files. Code for UNIX ncurses interface, compliments of L.C. Benschop,
Eindhoven, The Netherlands.

Makefile.ncu
New files. Sample makefile for ncurses implementation.

bwbasic.h
Revised defines for MININTSIZE and MAXINTSIZE from 16-bit to 32-bit limits.
Revised define for MAXSTRINGSIZE from 255 to 5000 characters.
Changed string length from unsigned char to unsigned int to support strings
longer than 255 characters.
Added support for new ncurses package.
Revised VERSION define to reflect above changes.

To implement these patches simply replace the old versions of the above source
files with the new ones and remake bwbasic.

+ 18
- 0
bwb_cmd.c View File

@@ -482,10 +482,28 @@ bwb_return( l )


/* see if old position was "GOSUB" */ /* see if old position was "GOSUB" */


/* JBV 1/20/97 */
/*
if ( CURTASK excs[ CURTASK exsc ].code != EXEC_GOSUB ) if ( CURTASK excs[ CURTASK exsc ].code != EXEC_GOSUB )
{ {
bwb_error( err_retnogosub ); bwb_error( err_retnogosub );
} }
*/

/*--------------------------------------------------------------*/
/* Make sure we are at the right stack level! */
/* If we aren't (which could happen for legit reasons), fix the */
/* exec stack. */
/* JBV, 1/20/97 */
/*--------------------------------------------------------------*/
while ( CURTASK excs[ CURTASK exsc ].code != EXEC_GOSUB )
{
bwb_decexec();
if ( CURTASK excs[ CURTASK exsc ].code == EXEC_NORM ) /* End of the line? */
{
bwb_error( err_retnogosub );
}
}


/* decrement the EXEC stack counter */ /* decrement the EXEC stack counter */




+ 2
- 2
bwb_cnd.c View File

@@ -551,7 +551,7 @@ bwb_elseif( l )


e = bwb_exp( l->buffer, FALSE, &( l->position ) ); e = bwb_exp( l->buffer, FALSE, &( l->position ) );


if ( (int) exp_getnval( e ) == TRUE )
if ( (int) exp_getnval( e ) != FALSE ) /* Was == TRUE (JBV 10/1996) */
{ {


/* ELSEIF condition is TRUE: proceed to the next line */ /* ELSEIF condition is TRUE: proceed to the next line */
@@ -1507,7 +1507,7 @@ bwb_while( l )


e = bwb_exp( l->buffer, FALSE, &( l->position ) ); e = bwb_exp( l->buffer, FALSE, &( l->position ) );


if ( (int) exp_getnval( e ) == TRUE )
if ( (int) exp_getnval( e ) != FALSE ) /* Was == TRUE (JBV 10/1996) */
{ {
bwb_setexec( l, l->position, EXEC_WHILE ); bwb_setexec( l, l->position, EXEC_WHILE );
return bwb_zline( l ); return bwb_zline( l );


+ 1
- 1
bwb_dio.c View File

@@ -1339,7 +1339,7 @@ bwb_field( l )
#endif #endif


b->sbuffer = dev_table[ dev_number ].buffer + current_pos; b->sbuffer = dev_table[ dev_number ].buffer + current_pos;
b->length = (unsigned char) length;
b->length = (unsigned int) length; /* Was unsigned char (JBV 9/4/97) */
b->rab = TRUE; b->rab = TRUE;


current_pos += length; current_pos += length;


+ 2
- 1
bwb_inp.c View File

@@ -1458,7 +1458,8 @@ bwb_line( l )
} }
else else
{ {
fgets( tbuf, MAXSTRINGSIZE, inp_device );
/* Was MAXSTRINGSIZE (JBV 9/8/97) */
fgets( tbuf, MAXSTRINGSIZE + 2, inp_device );
} }
bwb_stripcr( tbuf ); bwb_stripcr( tbuf );
str_ctob( var_findsval( v, v->array_pos ), tbuf ); str_ctob( var_findsval( v, v->array_pos ), tbuf );


+ 7
- 0
bwb_mes.h View File

@@ -56,6 +56,7 @@
#if LATIN #if LATIN
#define MES_SIGNON "Interpres <Super Flumina> ad linguam BASIC, versionis" #define MES_SIGNON "Interpres <Super Flumina> ad linguam BASIC, versionis"
#define MES_COPYRIGHT "Iure proprio scriptoris (c) 1993, Eduardi de Campobello" #define MES_COPYRIGHT "Iure proprio scriptoris (c) 1993, Eduardi de Campobello"
#define MES_COPYRIGHT_2 "Iure proprio scriptoris (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE "Cum nuntiis latinis ab ipso E. de C." #define MES_LANGUAGE "Cum nuntiis latinis ab ipso E. de C."
#define PROMPT "bwBASIC: " #define PROMPT "bwBASIC: "
#define ERROR_HEADER "ERRANT praecepta in ordine" #define ERROR_HEADER "ERRANT praecepta in ordine"
@@ -95,6 +96,7 @@
#if POL_ENGLISH #if POL_ENGLISH
#define MES_SIGNON "Bywater BASIC Interpreter/Shell, version" #define MES_SIGNON "Bywater BASIC Interpreter/Shell, version"
#define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell" #define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell"
#define MES_COPYRIGHT_2 "Copyright (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE "Polite English messages courtesy of t.a.c." #define MES_LANGUAGE "Polite English messages courtesy of t.a.c."
#define PROMPT "How may we help you? " #define PROMPT "How may we help you? "
#define ERROR_HEADER "Very sorry. There is a problem in line" #define ERROR_HEADER "Very sorry. There is a problem in line"
@@ -134,6 +136,7 @@
#if IMP_ENGLISH #if IMP_ENGLISH
#define MES_SIGNON "Bywater BASIC Interpreter/Shell, version" #define MES_SIGNON "Bywater BASIC Interpreter/Shell, version"
#define MES_COPYRIGHT "Watch it: Copyright (c) 1993, Ted A. Campbell" #define MES_COPYRIGHT "Watch it: Copyright (c) 1993, Ted A. Campbell"
#define MES_COPYRIGHT_2 "This means you: Copyright (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE "Impolite English messages courtesy of Oscar the Grouch" #define MES_LANGUAGE "Impolite English messages courtesy of Oscar the Grouch"
#define PROMPT "(*sigh) What now? " #define PROMPT "(*sigh) What now? "
#define ERROR_HEADER "YOU SCREWED UP at line" #define ERROR_HEADER "YOU SCREWED UP at line"
@@ -173,6 +176,7 @@
#if STD_RUSSIAN #if STD_RUSSIAN
#define MES_SIGNON "iNTERPRETATOR Bywater BASIC, WERSIQ" #define MES_SIGNON "iNTERPRETATOR Bywater BASIC, WERSIQ"
#define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell" #define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell"
#define MES_COPYRIGHT_2 "Copyright (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE "" #define MES_LANGUAGE ""
#define PROMPT "gOTOWO" #define PROMPT "gOTOWO"
#define ERROR_HEADER "o{ibka W STROKE" #define ERROR_HEADER "o{ibka W STROKE"
@@ -213,6 +217,7 @@
#if STD_GERMAN #if STD_GERMAN
#define MES_SIGNON "Bywater BASIC Interpreter/Shell, version" #define MES_SIGNON "Bywater BASIC Interpreter/Shell, version"
#define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell" #define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell"
#define MES_COPYRIGHT_2 "Copyright (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE "Ausgegeben auf Deutsch von Joerg Rieger" #define MES_LANGUAGE "Ausgegeben auf Deutsch von Joerg Rieger"
#define PROMPT "bwBASIC: " #define PROMPT "bwBASIC: "
#define ERROR_HEADER "Irrtum in Zeile" #define ERROR_HEADER "Irrtum in Zeile"
@@ -254,6 +259,7 @@
#if ESPERANTO #if ESPERANTO
#define MES_SIGNON "Bywater BASIC Tradukilo/SXelo, vario" #define MES_SIGNON "Bywater BASIC Tradukilo/SXelo, vario"
#define MES_COPYRIGHT "Kopirajtita (c) 1993, Ted A. Campbell" #define MES_COPYRIGHT "Kopirajtita (c) 1993, Ted A. Campbell"
#define MES_COPYRIGHT_2 "Kopirajtita (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE "Esperanta traduko farigxi per Ricxjo Muelisto." #define MES_LANGUAGE "Esperanta traduko farigxi per Ricxjo Muelisto."
#define PROMPT "bwBASIC: " #define PROMPT "bwBASIC: "
#define ERROR_HEADER "ERARO en vico" #define ERROR_HEADER "ERARO en vico"
@@ -297,6 +303,7 @@
#ifndef MES_SIGNON #ifndef MES_SIGNON
#define MES_SIGNON "Bywater BASIC Interpreter/Shell, version" #define MES_SIGNON "Bywater BASIC Interpreter/Shell, version"
#define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell" #define MES_COPYRIGHT "Copyright (c) 1993, Ted A. Campbell"
#define MES_COPYRIGHT_2 "Copyright (c) 1995-1997, Jon B. Volkoff"
#define MES_LANGUAGE " " #define MES_LANGUAGE " "
#define PROMPT "bwBASIC: " #define PROMPT "bwBASIC: "
#define ERROR_HEADER "ERROR in line" #define ERROR_HEADER "ERROR in line"


+ 2
- 3
bwb_mth.c View File

@@ -1093,9 +1093,8 @@ fnc_val( argc, argv, unique_id )
/* read the value */ /* read the value */


str_btoc( tbuf, var_getsval( &( argv[ 0 ] ) )); str_btoc( tbuf, var_getsval( &( argv[ 0 ] ) ));
if ( strlen( tbuf ) == 0 ) /* JBV */
*var_findnval( &nvar, nvar.array_pos ) = (bnumber) 0;
else
*var_findnval( &nvar, nvar.array_pos ) = (bnumber) 0; /* JBV 1/97 */
if ( strlen( tbuf ) != 0 ) /* JBV 1/97 (was == 0 with else) */
#if NUMBER_DOUBLE #if NUMBER_DOUBLE
sscanf( tbuf, "%lf", sscanf( tbuf, "%lf",
var_findnval( &nvar, nvar.array_pos ) ); var_findnval( &nvar, nvar.array_pos ) );


+ 17
- 0
bwb_prn.c View File

@@ -1030,6 +1030,15 @@ xputc( f, c )
{ {
static int tab_pending = FALSE; static int tab_pending = FALSE;


/*--------------------------------------------------------------------*/
/* Don't expand tabs if not printing to stdout or stderr (JBV 9/4/97) */
/*--------------------------------------------------------------------*/
if (( f != stdout ) && ( f != stderr ))
{
xxputc( f, c );
return TRUE;
}

/* check for pending TAB */ /* check for pending TAB */


if ( tab_pending == TRUE ) if ( tab_pending == TRUE )
@@ -1092,6 +1101,14 @@ xxputc( f, c )
#endif #endif
{ {


/*--------------------------------------------------------------------*/
/* Don't check width if not printing to stdout or stderr (JBV 9/4/97) */
/*--------------------------------------------------------------------*/
if (( f != stdout ) && ( f != stderr ))
{
return xxxputc( f, c );
}

/* check to see if width has been exceeded */ /* check to see if width has been exceeded */


if ( * prn_getcol( f ) >= prn_getwidth( f )) if ( * prn_getcol( f ) >= prn_getwidth( f ))


+ 3
- 2
bwb_stc.c View File

@@ -1607,7 +1607,7 @@ bwb_loopuntil( l )


e = bwb_exp( l->buffer, FALSE, &( l->position ) ); e = bwb_exp( l->buffer, FALSE, &( l->position ) );


if ( (int) exp_getnval( e ) == TRUE )
if ( (int) exp_getnval( e ) != FALSE ) /* Was == TRUE (JBV 10/1996) */
{ {
CURTASK excs[ CURTASK exsc ].while_line = NULL; CURTASK excs[ CURTASK exsc ].while_line = NULL;
r = CURTASK excs[ CURTASK exsc ].wend_line; r = CURTASK excs[ CURTASK exsc ].wend_line;
@@ -1746,7 +1746,8 @@ bwb_exitdo( l )
{ {


#if PROG_ERRORS #if PROG_ERRORS
sprintf( bwb_ebuf, "in bwb_exitfor(): EXIT DO without DO" );
/* JBV 1/97 (was "bwb_exitfor") */
sprintf( bwb_ebuf, "in bwb_exitdo(): EXIT DO without DO" );
bwb_error( bwb_ebuf ); bwb_error( bwb_ebuf );
#else #else
bwb_error( err_syntax ); bwb_error( err_syntax );


+ 2
- 1
bwb_str.c View File

@@ -256,7 +256,8 @@ str_ctob( s, buffer )


/* reassign length */ /* reassign length */


s->length = (unsigned char) strlen( buffer );
/* Was unsigned char (JBV 9/4/97) */
s->length = (unsigned int) strlen( buffer );


#if INTENSIVE_DEBUG #if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in str_ctob(): exit length <%d> string <%s>", sprintf( bwb_ebuf, "in str_ctob(): exit length <%d> string <%s>",


+ 35
- 0
bwb_var.c View File

@@ -1849,6 +1849,7 @@ dim_getparams( buffer, pos, n_params, pp )
int x_pos, s_pos; int x_pos, s_pos;
struct exp_ese *e; struct exp_ese *e;
char tbuf[ MAXSTRINGSIZE + 1 ]; char tbuf[ MAXSTRINGSIZE + 1 ];
int paren_level, quote_level; /* JBV 1/97 */
#if INTENSIVE_DEBUG #if INTENSIVE_DEBUG
register int n; register int n;
#endif #endif
@@ -1880,11 +1881,26 @@ dim_getparams( buffer, pos, n_params, pp )
s_pos = 0; s_pos = 0;
tbuf[ 0 ] = '\0'; tbuf[ 0 ] = '\0';
loop = TRUE; loop = TRUE;
paren_level = 1; /* JBV 1/97 */
quote_level = 0; /* JBV 1/97 */
while( loop == TRUE ) while( loop == TRUE )
{ {
switch( buffer[ *pos ] ) switch( buffer[ *pos ] )
{ {
case ')': /* end of parameter list */ case ')': /* end of parameter list */
/*-----------------------------------------------------*/
/* paren_level and quote_level check added by JBV 1/97 */
/*-----------------------------------------------------*/
if ( quote_level == 0 ) --paren_level;
if ( paren_level != 0 || quote_level != 0 ) /* Still not done? */
{
tbuf[ s_pos ] = buffer[ *pos ];
++(*pos);
++s_pos;
tbuf[ s_pos ] = '\0';
break;
}

x_pos = 0; x_pos = 0;
if ( tbuf[ 0 ] == '\0' ) if ( tbuf[ 0 ] == '\0' )
{ {
@@ -1909,6 +1925,18 @@ dim_getparams( buffer, pos, n_params, pp )
break; break;


case ',': /* end of a parameter */ case ',': /* end of a parameter */
/*-----------------------------------------------------*/
/* paren_level and quote_level check added by JBV 1/97 */
/*-----------------------------------------------------*/
if ( paren_level != 1 || quote_level != 0 ) /* Still not done? */
{
tbuf[ s_pos ] = buffer[ *pos ];
++(*pos);
++s_pos;
tbuf[ s_pos ] = '\0';
break;
}

x_pos = 0; x_pos = 0;
if ( tbuf[ 0 ] == '\0' ) if ( tbuf[ 0 ] == '\0' )
{ {
@@ -1935,6 +1963,13 @@ dim_getparams( buffer, pos, n_params, pp )
break; break;


default: default:
if( buffer[ *pos ] == '(' && quote_level == 0 )
++paren_level; /* JBV 1/97 */
if( buffer[ *pos ] == (char) 34 )
{
if (quote_level == 0) quote_level = 1;
else quote_level = 0;
}
tbuf[ s_pos ] = buffer[ *pos ]; tbuf[ s_pos ] = buffer[ *pos ];
++(*pos); ++(*pos);
++s_pos; ++s_pos;


+ 16
- 3
bwbasic.h View File

@@ -41,7 +41,7 @@


/* Version number */ /* Version number */


#define VERSION "2.20 patch level 1" /* Current version number */
#define VERSION "2.20 patch level 2" /* Current version number */


/*************************************************************** /***************************************************************


@@ -61,6 +61,7 @@


#define IMP_TTY TRUE /* simple TTY-style interface using stdio */ #define IMP_TTY TRUE /* simple TTY-style interface using stdio */
#define IMP_IQC FALSE /* IBM PC, Microsoft QuickC Compiler */ #define IMP_IQC FALSE /* IBM PC, Microsoft QuickC Compiler */
#define IMP_NCU FALSE /* Linux, ncurses */
#define ALLOW_RENUM TRUE /* Added by JBV */ #define ALLOW_RENUM TRUE /* Added by JBV */


#if IMP_TTY #if IMP_TTY
@@ -71,6 +72,10 @@
#include "bwx_iqc.h" #include "bwx_iqc.h"
#endif #endif


#if IMP_NCU
#include "bwx_ncu.h"
#endif

/*************************************************************** /***************************************************************


bwbasic.h: Part I-B: Define Compiler Implementation bwbasic.h: Part I-B: Define Compiler Implementation
@@ -210,7 +215,7 @@
***************************************************************/ ***************************************************************/


#define DEBUG FALSE /* current debugging */ #define DEBUG FALSE /* current debugging */
#define PROG_ERRORS FALSE /* identify serious programming errors */
#define PROG_ERRORS TRUE /* identify serious programming errors */
/* and print extensive error messages */ /* and print extensive error messages */
/* This will override messages defined in */ /* This will override messages defined in */
/* bwb_mes.h, and almost all messages will be in English */ /* bwb_mes.h, and almost all messages will be in English */
@@ -431,7 +436,10 @@
#define MAXLINENO 32766 /* maximum line number */ #define MAXLINENO 32766 /* maximum line number */
#define MAXVARNAMESIZE 40 /* maximum size for variable name */ #define MAXVARNAMESIZE 40 /* maximum size for variable name */
#define MAXFILENAMESIZE 40 /* maximum size for file name */ #define MAXFILENAMESIZE 40 /* maximum size for file name */
#if 0 /* JBV 9/4/97 */
#define MAXSTRINGSIZE 255 /* maximum string length */ #define MAXSTRINGSIZE 255 /* maximum string length */
#endif
#define MAXSTRINGSIZE 5000 /* maximum string length */
#define EXECLEVELS 64 /* EXEC stack levels */ #define EXECLEVELS 64 /* EXEC stack levels */
#define MAX_GOLINES 12 /* Maximum # of lines for ON...GOTO statements */ #define MAX_GOLINES 12 /* Maximum # of lines for ON...GOTO statements */
#define MAX_FARGS 6 /* maximum # arguments to function */ #define MAX_FARGS 6 /* maximum # arguments to function */
@@ -441,8 +449,12 @@
#define N_OPERATORS 25 /* number of operators defined */ #define N_OPERATORS 25 /* number of operators defined */
#define N_ERRORS 25 /* number of errors defined */ #define N_ERRORS 25 /* number of errors defined */
#define MAX_PRECEDENCE 20 /* highest (last) level of precedence */ #define MAX_PRECEDENCE 20 /* highest (last) level of precedence */
#if 0 /* JBV 9/96 */
#define MININTSIZE -32767 /* minimum integer size */ #define MININTSIZE -32767 /* minimum integer size */
#define MAXINTSIZE 32767 /* maximum integer size */ #define MAXINTSIZE 32767 /* maximum integer size */
#endif
#define MININTSIZE -2147483647 /* minimum integer size */
#define MAXINTSIZE 2147483647 /* maximum integer size */
#define DEF_SUBSCRIPT 11 /* default subscript */ #define DEF_SUBSCRIPT 11 /* default subscript */
#define DEF_DEVICES 16 /* default number of devices available */ #define DEF_DEVICES 16 /* default number of devices available */
#define DEF_WIDTH 128 /* default width for devices */ #define DEF_WIDTH 128 /* default width for devices */
@@ -573,7 +585,8 @@ typedef float bnumber;


typedef struct bstr typedef struct bstr
{ {
unsigned char length; /* length of string */
/* unsigned int was unsigned char (JBV 9/4/97) */
unsigned int length; /* length of string */
char *sbuffer; /* pointer to string buffer */ char *sbuffer; /* pointer to string buffer */
int rab; /* is it a random-access buffer? */ int rab; /* is it a random-access buffer? */
#if TEST_BSTRING #if TEST_BSTRING


+ 2
- 0
bwx_iqc.c View File

@@ -133,6 +133,8 @@ bwx_signon( void )
prn_xprintf( stdout, bwb_ebuf ); prn_xprintf( stdout, bwb_ebuf );
sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT ); sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT );
prn_xprintf( stdout, bwb_ebuf ); prn_xprintf( stdout, bwb_ebuf );
sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT_2 ); /* JBV 1/97 */
prn_xprintf( stdout, bwb_ebuf );
#if PERMANENT_DEBUG #if PERMANENT_DEBUG
sprintf( bwb_ebuf, "\r%s\n", "Debugging Mode" ); sprintf( bwb_ebuf, "\r%s\n", "Debugging Mode" );
prn_xprintf( stdout, bwb_ebuf ); prn_xprintf( stdout, bwb_ebuf );


+ 815
- 0
bwx_ncu.c View File

@@ -0,0 +1,815 @@
/***************************************************************

bwx_ncu.c Environment-dependent implementation
of Bywater BASIC Interpreter
for Linux (and others?) using Ncurses
library,
This BWBASIC file hacked together by L.C. Benschop,
Eindhoven, The Netherlands. 1997/01/14 and
1997/01/15 derived from the iqc version.
(benschop@eb.ele.tue.nl)

All the shell commands (like FILES) interact badly
with curses. I should replace them with popen/addch
Copyright (c) 1993, Ted A. Campbell
Bywater Software

email: tcamp@delphi.com

Copyright and Permissions Information:

All U.S. and international rights are claimed by the author,
Ted A. Campbell.

This software is released under the terms of the GNU General
Public License (GPL), which is distributed with this software
in the file "COPYING". The GPL specifies the terms under
which users may copy and use the software in this distribution.

A separate license is available for commercial distribution,
for information on which you should contact the author.

***************************************************************/

/*---------------------------------------------------------------*/
/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */
/* 11/1995 (eidetics@cerf.net). */
/* */
/* Those additionally marked with "DD" were at the suggestion of */
/* Dale DePriest (daled@cadence.com). */
/*---------------------------------------------------------------*/

#include <stdio.h>
#include <stdlib.h>
#include <curses.h> /* Should be the ncurses version */
#include <setjmp.h>
#include <signal.h>
#undef TRUE
#undef FALSE

/* So curses TRUE and FALSE conflict with the ones defined by bwbasic.
Doesn't this suck big time?
*/

#include "bwbasic.h"
#include "bwb_mes.h"

extern int prn_col;
extern jmp_buf mark;
short oldfgd;
long oldbgd;
int reset_mode = FALSE;

static int ncu_setpos( void );

/***************************************************************

FUNCTION: main()

DESCRIPTION: As in any C program, main() is the basic
function from which the rest of the
program is called. Some environments,
however, provide their own main() functions
(Microsoft Windows (tm) is an example).
In these cases, the following code will
have to be included in the initialization
function that is called by the environment.

***************************************************************/


static int col_arr[]={COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_YELLOW,
COLOR_BLUE,COLOR_MAGENTA,COLOR_CYAN,COLOR_WHITE};

int /* Nobody shall declare main() as void!!!!! (L.C. Benschop)*/
main( int argc, char **argv )
{
int i,j;
initscr();
start_color();
if(has_colors()) {
/* so there are 63 color pairs, from 1 to 63. Just 1 too few for
all the foreground/background combinations. */
for(i=0;i<8;i++)
for(j=0;j<8;j++)
if(i||j) init_pair(i*8+j,col_arr[i],col_arr[j]);
}
cbreak();
nonl();
noecho();
scrollok(stdscr,1);
bwb_init( argc, argv );

#if INTERACTIVE
setjmp( mark );
#endif

while( !feof( stdin ) ) /* condition !feof( stdin ) added in v1.11 */
{
bwb_mainloop();
}
}

/***************************************************************

FUNCTION: bwx_signon()

DESCRIPTION:

***************************************************************/

int
bwx_signon( void )
{

sprintf( bwb_ebuf, "\r%s %s\n", MES_SIGNON, VERSION );
prn_xprintf( stdout, bwb_ebuf );
sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT );
prn_xprintf( stdout, bwb_ebuf );
sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT_2 ); /* JBV 1/97 */
prn_xprintf( stdout, bwb_ebuf );
#if PERMANENT_DEBUG
sprintf( bwb_ebuf, "\r%s\n", "Debugging Mode" );
prn_xprintf( stdout, bwb_ebuf );
#else
sprintf( bwb_ebuf, "\r%s\n", MES_LANGUAGE );
prn_xprintf( stdout, bwb_ebuf );
#endif

return TRUE;

}

/***************************************************************

FUNCTION: bwx_message()

DESCRIPTION:

***************************************************************/

int
bwx_message( char *m )
{

#if DEBUG
addstr( "<MES>" );
#endif

addstr( m );
refresh();
return TRUE;

}

/***************************************************************

FUNCTION: bwx_putc()

DESCRIPTION:

***************************************************************/

extern int
bwx_putc( char c )
{
addch(c);
refresh();
}

/***************************************************************

FUNCTION: bwx_error()

DESCRIPTION:

***************************************************************/

int
bwx_errmes( char *m )
{
static char tbuf[ MAXSTRINGSIZE + 1 ]; /* this memory should be
permanent in case of memory
overrun errors */

if (( prn_col != 1 ) && ( errfdevice == stderr ))
{
prn_xprintf( errfdevice, "\n" );
}
if ( CURTASK number == 0 )
{
sprintf( tbuf, "\n%s: %s\n", ERRD_HEADER, m );
}
else
{
sprintf( tbuf, "\n%s %d: %s\n", ERROR_HEADER, CURTASK number, m );
}

#if INTENSIVE_DEBUG
prn_xprintf( stderr, "<ERR>" );
#endif

prn_xprintf( errfdevice, tbuf );

return TRUE;

}

/***************************************************************

FUNCTION: bwx_input()

DESCRIPTION: (w)get(n)str seems to interact badly with last line
on screen condition and scrolling.


***************************************************************/

int
bwx_input( char *prompt, char *buffer )
{
int y,x,my,mx;
#if INTENSIVE_DEBUG
prn_xprintf( stdout, "<INP>" );
#endif
prn_xprintf( stdout, prompt );
getyx(stdscr,y,x);
echo();
wgetnstr(stdscr, buffer, MAXREADLINESIZE);
noecho();
getmaxyx(stdscr,my,mx);
/* printf("%d %d",my,mx);*/
if(y+1==my)scroll(stdscr);
/* So this is an extreeeeemely ugly kludge to work around some
bug/feature/wart in ncurses FIXME
I should replace it with getch/addch in a loop */

/* prn_xprintf( stdout, "\n" );*/ /* let _outtext catch up */

* prn_getcol( stdout ) = 1; /* reset column */
return TRUE;

}

/***************************************************************

FUNCTION: bwx_terminate()

DESCRIPTION:

***************************************************************/

void
bwx_terminate( void )
{
nodelay(stdscr,FALSE);
echo();
nl();
nocbreak();
endwin();
exit( 0 );
}

/***************************************************************

FUNCTION: bwx_shell()

DESCRIPTION:

***************************************************************/

#if COMMAND_SHELL
extern int
bwx_shell( struct bwb_line *l )
{
static char *s_buffer;
static int init = FALSE;
static int position;

/* get memory for temporary buffer if necessary */

if ( init == FALSE )
{
init = TRUE;

/* Revised to CALLOC pass-thru call by JBV */
if ( ( s_buffer = CALLOC( MAXSTRINGSIZE + 1, sizeof( char ),"bwx_shell" )) == NULL )
{
bwb_error( err_getmem );
return FALSE;
}
}

/* get the first element and check for a line number */

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in bwx_shell(): line buffer is <%s>.", l->buffer );
bwb_debug( bwb_ebuf );
#endif

position = 0;
adv_element( l->buffer, &position, s_buffer );
if ( is_numconst( s_buffer ) != TRUE ) /* not a line number */
{

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in bwx_shell(): no line number, command <%s>.",
l->buffer );
bwb_debug( bwb_ebuf );
#endif
nl();
endwin(); /* Added by JBV 10/11/97 */
if ( system( l->buffer ) == 0 )
{
refresh(); /* Added by JBV 10/11/97 */
nonl();
ncu_setpos();
return TRUE;
}
else
{
refresh(); /* Added by JBV 10/11/97 */
nonl();
ncu_setpos();
return FALSE;
}
}

else /* advance past line number */
{
adv_ws( l->buffer, &position ); /* advance past whitespace */

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in bwx_shell(): line number, command <%s>.",
l->buffer );
bwb_debug( bwb_ebuf );
#endif
nl();
endwin(); /* Added by JBV 10/11/97 */
if ( system( &( l->buffer[ position ] ) ) == 0 )
{
refresh(); /* Added by JBV 10/11/97 */
nonl();
ncu_setpos();
return TRUE;
}
else
{
refresh(); /* Added by JBV 10/11/97 */
nonl();
ncu_setpos();
return FALSE;
}
}
}
#endif

/***************************************************************

FUNCTION: ncu_setpos()

DESCRIPTION:

***************************************************************/

static int
ncu_setpos( void )
{
int x,y;
getyx(stdscr,y,x);
move(y,x);
/* and move down one position */

prn_xprintf( stdout, "\n" );

return TRUE;
}


#if COMMON_CMDS

/***************************************************************

FUNCTION: bwb_edit()

DESCRIPTION:

***************************************************************/

struct bwb_line *
bwb_edit( struct bwb_line *l )
{
char tbuf[ MAXSTRINGSIZE + 1 ];
char edname[ MAXSTRINGSIZE + 1 ];
struct bwb_variable *ed;
FILE *loadfile;

ed = var_find( DEFVNAME_EDITOR );
str_btoc( edname, var_getsval( ed ));

sprintf( tbuf, "%s %s", edname, CURTASK progfile );

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in bwb_edit(): command line <%s>", tbuf );
bwb_debug( bwb_ebuf );
#else
nl();
endwin(); /* Added by JBV 10/11/97 */
system( tbuf );

/*-----------------------*/
/* Added by JBV 10/11/97 */
/*-----------------------*/
fprintf( stderr, "Press RETURN when ready..." );
fgets( tbuf, MAXREADLINESIZE, stdin );
refresh();

nonl();
#endif

/* open edited file for read */

if ( ( loadfile = fopen( CURTASK progfile, "r" )) == NULL )
{
sprintf( bwb_ebuf, err_openfile, CURTASK progfile );
bwb_error( bwb_ebuf );

ncu_setpos();
return bwb_zline( l );
}

/* clear current contents */

bwb_new( l ); /* Relocated by JBV (bug found by DD) */

/* and (re)load the file into memory */

bwb_fload( loadfile );


ncu_setpos();
return bwb_zline( l );
}

/***************************************************************

FUNCTION: bwb_renum()

DESCRIPTION: This function implements the BASIC RENUM
command by shelling out to a default
renumbering program called "renum".
Added by JBV 10/95

SYNTAX: RENUM

***************************************************************/

#if ANSI_C
struct bwb_line *
bwb_renum( struct bwb_line *l )
#else
struct bwb_line *
bwb_renum( l )
struct bwb_line *l;
#endif
{
char tbuf[ MAXSTRINGSIZE + 1 ];
FILE *loadfile;

sprintf( tbuf, "renum %s\0", CURTASK progfile );

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in bwb_renum(): command line <%s>", tbuf );
bwb_debug( bwb_ebuf );
#else
nl();
endwin(); /* Added by JBV 10/11/97 */
system( tbuf );

/*-----------------------*/
/* Added by JBV 10/11/97 */
/*-----------------------*/
fprintf( stderr, "Press RETURN when ready..." );
fgets( tbuf, MAXREADLINESIZE, stdin );
refresh();

nonl();
#endif

/* open edited file for read */

if ( ( loadfile = fopen( CURTASK progfile, "r" )) == NULL )
{
sprintf( bwb_ebuf, err_openfile, CURTASK progfile );
bwb_error( bwb_ebuf );

ncu_setpos();
return bwb_zline( l );
}

/* clear current contents */

bwb_new( l ); /* Relocated by JBV (bug found by DD) */

/* and (re)load the file into memory */

bwb_fload( loadfile );


ncu_setpos();
return bwb_zline( l );
}

/***************************************************************

FUNCTION: bwb_files()

DESCRIPTION:

***************************************************************/

struct bwb_line *
bwb_files( struct bwb_line *l )
{
char tbuf[ MAXVARNAMESIZE + 1 ];
char finame[ MAXVARNAMESIZE + 1 ];
char argument[ MAXVARNAMESIZE + 1 ];
struct bwb_variable *fi;
struct exp_ese *e;

fi = var_find( DEFVNAME_FILES );
str_btoc( finame, var_getsval( fi ));

/* get argument */

adv_ws( l->buffer, &( l->position ));
switch( l->buffer[ l->position ] )
{
case '\0':
case '\r':
case '\n':
argument[ 0 ] = '\0';
break;
default:
e = bwb_exp( l->buffer, FALSE, &( l->position ) );
if ( e->type != STRING )
{
bwb_error( err_mismatch );
return bwb_zline( l );
}
str_btoc( argument, exp_getsval( e ) );
break;
}


sprintf( tbuf, "%s %s", finame, argument );

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "in bwb_files(): command line <%s>", tbuf );
bwb_debug( bwb_ebuf );
#else
nl();
endwin(); /* Added by JBV 10/11/97 */
system( tbuf );

/*-----------------------*/
/* Added by JBV 10/11/97 */
/*-----------------------*/
fprintf( stderr, "Press RETURN when ready..." );
fgets( tbuf, MAXREADLINESIZE, stdin );
refresh();

nonl();
#endif

ncu_setpos();
return bwb_zline( l );

}

#endif /* COMMON_CMDS */

#if INTERACTIVE

/***************************************************************

FUNCTION: fnc_inkey()

DESCRIPTION: This C function implements the BASIC INKEY$
function. It is implementation-specific.

***************************************************************/

extern struct bwb_variable *
fnc_inkey( int argc, struct bwb_variable *argv,int unique)
{
static struct bwb_variable nvar;
char tbuf[ MAXSTRINGSIZE + 1 ];
static int init = FALSE;
int c;

/* initialize the variable if necessary */

if ( init == FALSE )
{
init = TRUE;
var_make( &nvar, STRING);
}

/* check arguments */

#if PROG_ERRORS
if ( argc > 0 )
{
sprintf( bwb_ebuf, "Two many arguments to function INKEY$()" );
bwb_error( bwb_ebuf );
return &nvar;
}

#else
if ( fnc_checkargs( argc, argv, 0, 0 ) == FALSE )
{
return NULL;
}
#endif

/* body of the INKEY$ function */
nodelay(stdscr,1);
if ( (c=getch())==EOF )
{
tbuf[ 0 ] = '\0';
}
else
{
tbuf[ 0 ] = (char) c;
tbuf[ 1 ] = '\0';
}
nodelay(stdscr,0);
/* assign value to nvar variable */

str_ctob( var_findsval( &nvar, nvar.array_pos ), tbuf );

/* return value contained in nvar */

return &nvar;

}

#endif /* INTERACTIVE */

#if MS_CMDS

/***************************************************************

FUNCTION: bwb_cls()

DESCRIPTION: This C function implements the BASIC CLS
command. It is implementation-specific.

***************************************************************/

extern struct bwb_line *
bwb_cls( struct bwb_line *l )
{

clear();
refresh();

return bwb_zline( l );
}

/***************************************************************

FUNCTION: bwb_locate()

DESCRIPTION: This C function implements the BASIC LOCATE
command. It is implementation-specific.

***************************************************************/

extern struct bwb_line *
bwb_locate( struct bwb_line *l )
{
struct exp_ese *e;
int row, column;

/* get first argument */

e = bwb_exp( l->buffer, FALSE, &( l->position ));
row = (int) exp_getnval( e );

/* advance past comma */

adv_ws( l->buffer, &( l->position ));
if ( l->buffer[ l->position ] != ',' )
{
bwb_error( err_syntax );
return bwb_zline( l );
}
++( l->position );

/* get second argument */

e = bwb_exp( l->buffer, FALSE, &( l->position ));
column = (int) exp_getnval( e );

/* position the cursor */

move( row-1, column-1 );

return bwb_zline( l );
}

/***************************************************************

FUNCTION: bwb_color()

DESCRIPTION: This C function implements the BASIC COLOR
command. It is implementation-specific.

***************************************************************/


extern struct bwb_line *
bwb_color( struct bwb_line *l )
{
struct exp_ese *e;
int fgcolor,bgcolor;

/* get first argument */

e = bwb_exp( l->buffer, FALSE, &( l->position ));
fgcolor = (int) exp_getnval( e );

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "Setting text color to %d", fgcolor );
bwb_debug( bwb_ebuf );
#endif


#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "Set text color to %d", fgcolor );
bwb_debug( bwb_ebuf );
#endif

/* advance past comma */

adv_ws( l->buffer, &( l->position ));
if ( l->buffer[ l->position ] == ',' )
{

++( l->position );

/* get second argument */

e = bwb_exp( l->buffer, FALSE, &( l->position ));
bgcolor = (int) exp_getnval( e );

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "Setting background color to %d", bgcolor );
bwb_debug( bwb_ebuf );
#endif

/* set the foreground and background color */
if (has_colors()) {
attrset(A_NORMAL);
bkgdset(COLOR_PAIR((bgcolor&7))|' ');
if((fgcolor&7)==0 && (bgcolor&7)==0){
/* we didn't reserve a color pair for fg and bg both black.
Bright black(color 8)==dark gray as foreground color A_DIM
A_INVIS doesn't seem to work. wait for next version of
ncurses, don't bother for now.*/
if(fgcolor<8) attrset(A_INVIS); else attrset(A_DIM);
} else
attrset(COLOR_PAIR((8*(fgcolor&7)+(bgcolor&7))) |
((fgcolor>7)*A_BOLD));
/* fg colors 8--15 == extra brightness */
} else { /* no colors, have a go at it with reverse/bold/dim */
attrset(A_NORMAL);
bkgdset(A_REVERSE*((fgcolor&7)<(bgcolor&7))|' ');
attrset(A_BOLD*(fgcolor>8)|
A_REVERSE*((fgcolor&7)<(bgcolor&7))|A_INVIS*(fgcolor==bgcolor));
}

#if INTENSIVE_DEBUG
sprintf( bwb_ebuf, "Setting background color to %d\n", bgcolor );
bwb_debug( bwb_ebuf );
#endif

}

return bwb_zline( l );
}
#endif /* MS_CMDS */







+ 42
- 0
bwx_ncu.h View File

@@ -0,0 +1,42 @@
/***************************************************************

bwx_ncu.h Header File for Linux (and others?) using Ncurses
library,
This BWBASIC file hacked together by L.C. Benschop,
Eindhoven, The Netherlands.
(benschop@eb.ele.tue.nl)
Copyright (c) 1993, Ted A. Campbell
Bywater Software

email: tcamp@delphi.com

Copyright and Permissions Information:

All U.S. and international rights are claimed by the author,
Ted A. Campbell.

This software is released under the terms of the GNU General
Public License (GPL), which is distributed with this software
in the file "COPYING". The GPL specifies the terms under
which users may copy and use the software in this distribution.

A separate license is available for commercial distribution,
for information on which you should contact the author.

***************************************************************/

#define IMP_IDSTRING "NCU" /* unique ID string for this implementation */

/* Definitions indicating which commands and functions are implemented */

#define IMP_FNCINKEY 1 /* 0 if INKEY$ is not implemented, 1 if it is */
#define IMP_CMDCLS 1 /* 0 if CLS is not implemented, 1 if it is */
#define IMP_CMDLOC 1 /* 0 if LOCATE is not implemented, 1 if it is */
#define IMP_CMDCOLOR 1 /* 0 if COLOR is not implemented, 1 if it is */

#define UNIX_CMDS TRUE
#define MKDIR_ONE_ARG FALSE /* TRUE if your mkdir has but one argument;
FALSE if it has two */
#define PERMISSIONS 644 /* permissions to set in Unix-type system */

+ 2
- 0
bwx_tty.c View File

@@ -117,6 +117,8 @@ bwx_signon()
prn_xprintf( stdout, bwb_ebuf ); prn_xprintf( stdout, bwb_ebuf );
sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT ); sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT );
prn_xprintf( stdout, bwb_ebuf ); prn_xprintf( stdout, bwb_ebuf );
sprintf( bwb_ebuf, "\r%s\n", MES_COPYRIGHT_2 ); /* JBV 1/97 */
prn_xprintf( stdout, bwb_ebuf );
#if PERMANENT_DEBUG #if PERMANENT_DEBUG
sprintf( bwb_ebuf, "\r%s\n", "Debugging Mode" ); sprintf( bwb_ebuf, "\r%s\n", "Debugging Mode" );
prn_xprintf( stdout, bwb_ebuf ); prn_xprintf( stdout, bwb_ebuf );


Loading…
Cancel
Save