Browse Source

v2.40

* Bug fixes from Bill Chatfield
 * Updated documentation
 * Added support for compiling on CMS (another IBM mainframe OS)
tags/v2.40
Jon Foster 3 years ago
parent
commit
8ae257a878
20 changed files with 372 additions and 170 deletions
  1. +2
    -2
      Makefile.in
  2. +2
    -2
      Makefile.ncu
  3. +152
    -34
      README
  4. +0
    -40
      README.patch01
  5. +0
    -75
      README.patch02
  6. +9
    -0
      allcms.bat
  7. +67
    -0
      allcms.exec
  8. +0
    -0
      allmvs.bat
  9. +3
    -4
      bwb_str.c
  10. +11
    -2
      bwb_var.c
  11. +5
    -3
      bwbasic.h
  12. +2
    -3
      bwbasic6.jcl
  13. +6
    -3
      bwbasic7.jcl
  14. +1
    -1
      bwbmvs.txt
  15. +5
    -0
      example.bas
  16. +101
    -0
      makefile.wcl386
  17. +1
    -0
      profile.bas
  18. +1
    -0
      stdbwb.parm
  19. +1
    -1
      zipall.bat
  20. +3
    -0
      zipcms.bat

+ 2
- 2
Makefile.in View File

@@ -101,9 +101,9 @@ distclean: clean
realclean: distclean
rm -f TAGS

# Version number changed from 2.10 to 2.20 by JBV
# Version number changed from 2.20 to 2.40 by PE
dist: $(DISTFILES)
echo bwbasic-2.20 > .fname
echo bwbasic-2.40 > .fname
rm -rf `cat .fname`
mkdir `cat .fname`
ln $(DISTFILES) `cat .fname`


+ 2
- 2
Makefile.ncu View File

@@ -113,9 +113,9 @@ distclean: clean
realclean: distclean
rm -f TAGS

# Version number changed from 2.10 to 2.20 by JBV
# Version number changed from 2.20 to 2.40 by PE
dist: $(DISTFILES)
echo bwbasic-2.20 > .fname
echo bwbasic-2.40 > .fname
rm -rf `cat .fname`
mkdir `cat .fname`
ln $(DISTFILES) `cat .fname`


+ 152
- 34
README View File

@@ -3,7 +3,7 @@
README file for


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

Copyright (c) 1993, Ted A. Campbell
@@ -12,6 +12,21 @@
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

Version 2.30 modifications by Paul Edwards,
5 March 2008

Version 2.40 modifications by Paul Edwards,
26 Jan 2009






DESCRIPTION:
@@ -32,50 +47,22 @@ DESCRIPTION:
for information on which you should contact the author.


IMPROVEMENTS OVER PREVIOUS VERSION (2.10):

* Plugged numerous memory leaks, resolved memory overruns and allocation
difficulties.

* General cleanup and bug fixes, too many to list in detail here.
The major problem areas addressed were:

- RUN command with file name argument
- nested and cascaded FOR-NEXT loops
- PRINT USING
- EOF, LOF functions
- string concatenation
- operator hierarchy
- multi-level expression evaluation
- hex constant interpretation
- hex and octal constants in INPUT and DATA statements

* Added a CLOSE all files feature (when no argument supplied).

* Added a unary minus sign operator.

* Added a MID$ command to complement the MID$ function.

* Added a RENUM facility in a standalone program.

* Added checking in configure for unistd.h (important on Sun systems).


OBTAINING THE SOURCE CODE:

The source code for bwBASIC 2.20 is available immediately by
anonymous ftp. To obtain the source code, ftp to site ftp.netcom.com,
cd to pub/rh/rhn and get the file bwbasic-2.20.uu. Or you may receive
a copy by e-mail by writing to Jon Volkoff at eidetics@cerf.net.
The source code for bwBASIC is available from
http://bwbasic.sourceforge.net



COMMUNICATIONS:

email: tcamp@delphi.com (for Ted Campbell)
eidetics@cerf.net (for Jon Volkoff)
fight.subjugation@gmail.com (for Paul Edwards)


A LIST OF BASIC COMMANDS AND FUNCTIONS IMPLEMENTED in bwBASIC 2.20:
A LIST OF BASIC COMMANDS AND FUNCTIONS IMPLEMENTED in bwBASIC:

Be aware that many of these commands and functions will not be
available unless you have set certain flags in the header files.
@@ -201,3 +188,134 @@ A LIST OF BASIC COMMANDS AND FUNCTIONS IMPLEMENTED in bwBASIC 2.20:
WHILE expression
WIDTH [# device-number,] number
WRITE [# device-number,] element [, element ]....




CHANGE HISTORY




CHANGES FROM 2.30 to 2.40

* Bug fixes from Bill Chatfield
* Updated documentation

* Added support for compiling on CMS (another IBM mainframe OS)


CHANGES FROM 2.20pl2 to 2.30

* Minor bug fixes, cosmetic improvements and portability improvements

* Added support for compiling on MVS (IBM mainframe)


CHANGES FROM 2.20pl1 to 2.20pl2

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.


CHANGES FROM 2.20 to 2.20pl1

bwb_cnd.c

Moved init routine for bwb_while so that it would be initialized regardless
of expression value, not just if TRUE. This was causing some segmentation
faults in WHILE-WEND loops.

bwb_elx.c

Plugged gaping memory leak. Temp variable space for expression evaluation
was being allocated but not freed when done (oops!).

bwb_fnc.c

Added check for NULL return from getenv to prevent segmentation faults.

bwbasic.h
Revised VERSION define to reflect above changes.



CHANGES FROM 2.10 to 2.20:

* Plugged numerous memory leaks, resolved memory overruns and allocation
difficulties.

* General cleanup and bug fixes, too many to list in detail here.
The major problem areas addressed were:

- RUN command with file name argument
- nested and cascaded FOR-NEXT loops
- PRINT USING
- EOF, LOF functions
- string concatenation
- operator hierarchy
- multi-level expression evaluation
- hex constant interpretation
- hex and octal constants in INPUT and DATA statements

* Added a CLOSE all files feature (when no argument supplied).

* Added a unary minus sign operator.

* Added a MID$ command to complement the MID$ function.

* Added a RENUM facility in a standalone program.

* Added checking in configure for unistd.h (important on Sun systems).





+ 0
- 40
README.patch01 View File

@@ -1,40 +0,0 @@


README.patch01 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


LIST OF PATCHES TO 2.20:

bwb_cnd.c

Moved init routine for bwb_while so that it would be initialized regardless
of expression value, not just if TRUE. This was causing some segmentation
faults in WHILE-WEND loops.

bwb_elx.c

Plugged gaping memory leak. Temp variable space for expression evaluation
was being allocated but not freed when done (oops!).

bwb_fnc.c

Added check for NULL return from getenv to prevent segmentation faults.

bwbasic.h
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.

+ 0
- 75
README.patch02 View File

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


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.

+ 9
- 0
allcms.bat View File

@@ -0,0 +1,9 @@
del output.txt
call zipcms

rem for S/380 testing, use this
call runcms allcms.exec output.txt all.zip

rem for S/390 testing, use this
rem mvsendec encb all.zip all.dat
rem loc2ebc all.dat xfer.card

+ 67
- 0
allcms.exec View File

@@ -0,0 +1,67 @@
* Usage - ALLCMS <SRC> <EXE>

* This script compiles all the files on SRC disk (default is A)
* and copies the resultant modules to the EXE disk (default B)

&SRC = A
&EXE = B


&IF &INDEX EQ 0 &GOTO -FINARGS
&SRC = &1
&ARGS &2 &3 &4 &5 &6 &7 &8 &9

&IF &INDEX EQ 0 &GOTO -FINARGS
&EXE = &1

-FINARGS


EXEC GCCE BWBASIC C &SRC (PARM STDBWB
EXEC GCCE BWB_INT C &SRC (PARM STDBWB
EXEC GCCE BWB_TBL C &SRC (PARM STDBWB
EXEC GCCE BWB_CMD C &SRC (PARM STDBWB
EXEC GCCE BWB_PRN C &SRC (PARM STDBWB
EXEC GCCE BWB_EXP C &SRC (PARM STDBWB
EXEC GCCE BWB_VAR C &SRC (PARM STDBWB
EXEC GCCE BWB_INP C &SRC (PARM STDBWB
EXEC GCCE BWB_FNC C &SRC (PARM STDBWB
EXEC GCCE BWB_CND C &SRC (PARM STDBWB
EXEC GCCE BWB_OPS C &SRC (PARM STDBWB
EXEC GCCE BWB_DIO C &SRC (PARM STDBWB
EXEC GCCE BWB_STR C &SRC (PARM STDBWB
EXEC GCCE BWB_ELX C &SRC (PARM STDBWB
EXEC GCCE BWB_MTH C &SRC (PARM STDBWB
EXEC GCCE BWB_STC C &SRC (PARM STDBWB
EXEC GCCE BWX_TTY C &SRC (PARM STDBWB
EXEC GCCE UNIXIO C &SRC (PARM STDBWB


&STACK HT
LOAD BWBASIC (NOAUTO
INCLUDE BWB_INT (NOAUTO
INCLUDE BWB_TBL (NOAUTO
INCLUDE BWB_CMD (NOAUTO
INCLUDE BWB_PRN (NOAUTO
INCLUDE BWB_EXP (NOAUTO
INCLUDE BWB_VAR (NOAUTO
INCLUDE BWB_INP (NOAUTO
INCLUDE BWB_FNC (NOAUTO
INCLUDE BWB_CND (NOAUTO
INCLUDE BWB_OPS (NOAUTO
INCLUDE BWB_DIO (NOAUTO
INCLUDE BWB_STR (NOAUTO
INCLUDE BWB_ELX (NOAUTO
INCLUDE BWB_MTH (NOAUTO
INCLUDE BWB_STC (NOAUTO
INCLUDE BWX_TTY (NOAUTO
&STACK RT
INCLUDE UNIXIO (NOAUTO

GENMOD BWBASIC
COPY BWBASIC MODULE &SRC = = &EXE (REPLACE
COPY PROFILE BAS &SRC = = &EXE (REPLACE


* Quick test of bwbasic
BWBASIC "EXAMPLE BAS"

allbwb.bat → allmvs.bat View File


+ 3
- 4
bwb_str.c View File

@@ -337,10 +337,10 @@ str_btoc( buffer, s )
***************************************************************/

#if ANSI_C
char *
bstring *
str_cat( bstring *a, bstring *b )
#else
char *
bstring *
str_cat( a, b )
bstring *a;
bstring *b;
@@ -348,7 +348,6 @@ str_cat( a, b )
{
char abuf[ MAXSTRINGSIZE + 1 ];
char bbuf[ MAXSTRINGSIZE + 1 ];
char *r;

str_btoc( abuf, a );
str_btoc( bbuf, b );
@@ -366,7 +365,7 @@ str_cat( a, b )
bwb_debug( bwb_ebuf );
#endif

return r;
return a;
}

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


+ 11
- 2
bwb_var.c View File

@@ -376,7 +376,7 @@ bwb_swap( l )
lhs->array_pos = rhs->array_pos;
lhs->dimensions = rhs->dimensions;

if ( lhs->type = NUMBER )
if ( lhs->type == NUMBER )
{
rhs->memnum = tmp.memnum;
}
@@ -2513,6 +2513,15 @@ var_islocal( buffer )
bwb_debug( bwb_ebuf );
#endif

/* Prevent the expression in the initial value of the for loop below
from violating the lower bound of the "excs" array. This would
happen during startup when "exsc" is initially set to -1 and
bwbasic.exe would fail with a memory exception when compiled with
Open Watcom C. */

if ( CURTASK exsc >= 0 )
{

/* run through the local variable list and try to find a match */

for ( v = CURTASK excs[ CURTASK exsc ].local_variable; v != NULL; v = v->next )
@@ -2550,7 +2559,7 @@ var_islocal( buffer )
}

}
} /* check of exsc >= 0 */
/* search failed, return NULL */

#if INTENSIVE_DEBUG


+ 5
- 3
bwbasic.h View File

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

/* Version number */

#define VERSION "2.30" /* Current version number */
#define VERSION "2.40" /* Current version number */

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

@@ -451,6 +451,8 @@
#define ERRFILE "err.out" /* Filename for redirected error messages */
#if defined(__MVS__)
#define PROFILENAME "dd:profile"
#elif defined(__CMS__)
#define PROFILENAME "PROFILE BAS"
#else
#define PROFILENAME "profile.bas" /* Filename for profile execution */
#endif
@@ -1029,7 +1031,7 @@ extern int str_btoc( char *buffer, bstring *s );
extern int str_btob( bstring *d, bstring *s );
extern int str_ctob( bstring *s, char *buffer );
extern int str_cmp( bstring *s, bstring *t );
extern char * str_cat( bstring *s, bstring *t );
extern bstring * str_cat( bstring *s, bstring *t );
extern int exp_findop( char *expression );
extern int exp_isop( char *expression );
extern int exp_isfn( char *expression );
@@ -1334,7 +1336,7 @@ extern int str_btoc();
extern int str_btob();
extern int str_ctob();
extern int str_cmp();
extern char * str_cat();
extern bstring * str_cat();
extern int exp_findop();
extern int exp_isop();
extern int exp_isfn();


+ 2
- 3
bwbasic6.jcl View File

@@ -5,7 +5,7 @@
//SYSPRINT DD SYSOUT=*
//SYSLIB DD DSN=&PDPPREF..NCALIB,DISP=SHR,DCB=BLKSIZE=32760
// DD DSN=&BWBPREF..NCALIB,DISP=SHR
//SYSLMOD DD DSN=&BWBPREF..LINKLIB,DISP=SHR
//SYSLMOD DD DSN=&BWBPREF..LINKLIB(BWBASIC),DISP=SHR
// PEND
//DOLINK EXEC LINK
//LKED.SYSLIN DD *
@@ -27,7 +27,6 @@
INCLUDE SYSLIB(BWB@STC)
INCLUDE SYSLIB(BWX@TTY)
INCLUDE SYSLIB(UNIXIO)
ENTRY @@CRT0
NAME BWBASIC(R)
ENTRY @@MAIN
/*
//

+ 6
- 3
bwbasic7.jcl View File

@@ -1,7 +1,7 @@
//BWBGEN JOB CLASS=C,REGION=0K
//*
//RUNBW PROC BWBPREF='BWBASIC'
//BWBASIC EXEC PGM=BWBASIC
//BWBASIC EXEC PGM=BWBASIC,PARM='DD:INPUT'
//STEPLIB DD DSN=&BWBPREF..LINKLIB,DISP=SHR
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*,DCB=(RECFM=F,LRECL=132,BLKSIZE=132)
@@ -15,8 +15,11 @@
// PEND
//*
//S1 EXEC RUNBW
//SYSIN DD *
print "hello, world"
//INPUT DD *
x = 1
print "hello, world",x
x = 2
print "hello, world",x
quit
/*
//S2 EXEC CLEAN


+ 1
- 1
bwbmvs.txt View File

@@ -10,5 +10,5 @@ subjobs
after taking a look at what they do and seeing if they
are appropriate to your environment.

Or just run "allbwb" which will do all of that.
Or just run "allmvs" which will do all of that.


+ 5
- 0
example.bas View File

@@ -0,0 +1,5 @@
x = 1
print "hello, world",x
x = 2
print "hello, world",x
quit

+ 101
- 0
makefile.wcl386 View File

@@ -0,0 +1,101 @@
# Open Watcom C (http://www.openwatcom.org) Makefile
# for Bywater BASIC Interpreter
#
# Adapted from makefile.qcl
# by Bill Chatfield <bill_chatfield@yahoo.com>
#
# To make the program type: wmake -f makefile.wcl386
#
# To implement the bwx_iqc implementation (using specific
# features for the IBM PC and compatibles), chainge each
# instance of "bwx_tty" to "bwx_iqc".
#
# The WATCOM environment variable should have been set
# to the top directory of the Open Watcom C installation.
# It is used below, so it needs to be set.

#
# Watcom looks a the INCLUDE variable to find its include
# files.
#
.BEFORE
set INCLUDE=$(%WATCOM)\h;$(%WATCOM)\h\nt


PROJ= bwbasic
CC= wcl386
LINK= wlink

#
# Open Watcom options
# -bc Build a console application
# -c Compile only; no link
# -d2 Generate code for the debugger
# -ox Optimize at maximum level
# -q Quiet operation
# -wx Display warnings at maximum level
# -za ANSI C syntax only; no language extensions
#
CFLAGS= -bc -c -ox -q -wx -za -DMSDOS

LFLAGS= OPTION QUIET

OFILES= bwbasic.obj bwb_int.obj bwb_tbl.obj bwb_cmd.obj bwb_prn.obj &
bwb_exp.obj bwb_var.obj bwb_inp.obj bwb_fnc.obj bwb_cnd.obj &
bwb_ops.obj bwb_dio.obj bwb_str.obj bwb_elx.obj bwb_mth.obj &
bwb_stc.obj bwx_tty.obj

HFILES= bwbasic.h bwb_mes.h

ZFILES= bwbasic.exe bwbasic.doc INSTALL COPYING README &
README.patch01 README.patch02

all: $(PROJ).exe

$(PROJ).exe: $(OFILES)
$(LINK) $(LFLAGS) FILE $(OFILES: =,) NAME $@

clean: .SYMBOLIC
del $(OFILES) *.err $(PROJ).exe

dist: .SYMBOLIC
zip bwbasic-2.30-win32.zip $(ZFILES)


.c.obj: .AUTODEPEND
$(CC) $(CFLAGS) $[@

bwbasic.obj: bwbasic.c $(HFILES) $(__MAKEFILES__)

bwb_int.obj: bwb_int.c $(HFILES) $(__MAKEFILES__)

bwb_tbl.obj: bwb_tbl.c $(HFILES) $(__MAKEFILES__)

bwb_cmd.obj: bwb_cmd.c $(HFILES) $(__MAKEFILES__)

bwb_prn.obj: bwb_prn.c $(HFILES) $(__MAKEFILES__)

bwb_exp.obj: bwb_exp.c $(HFILES) $(__MAKEFILES__)

bwb_var.obj: bwb_var.c $(HFILES) $(__MAKEFILES__)

bwb_inp.obj: bwb_inp.c $(HFILES) $(__MAKEFILES__)

bwb_fnc.obj: bwb_fnc.c $(HFILES) $(__MAKEFILES__)

bwb_cnd.obj: bwb_cnd.c $(HFILES) $(__MAKEFILES__)

bwb_ops.obj: bwb_ops.c $(HFILES) $(__MAKEFILES__)

bwb_dio.obj: bwb_dio.c $(HFILES) $(__MAKEFILES__)

bwb_str.obj: bwb_str.c $(HFILES) $(__MAKEFILES__)

bwb_elx.obj: bwb_elx.c $(HFILES) $(__MAKEFILES__)

bwb_mth.obj: bwb_mth.c $(HFILES) $(__MAKEFILES__)

bwb_stc.obj: bwb_stc.c $(HFILES) $(__MAKEFILES__)

bwx_tty.obj: bwx_tty.c $(HFILES) $(__MAKEFILES__)


+ 1
- 0
profile.bas View File

@@ -0,0 +1 @@
rem dummy

+ 1
- 0
stdbwb.parm View File

@@ -0,0 +1 @@
-w -S -ansi -o dd:out -

+ 1
- 1
zipall.bat View File

@@ -7,5 +7,5 @@ del alljcl.jcl
del alljcl.txt
zip -0 -X -ll -j bwbsrc.zip *.c
zip -0 -X -ll -j bwbinc.zip *.h
zip -0 -X -ll -j bwbjcl.zip *.jcl README
zip -0 -X -ll -j bwbjcl.zip *.jcl README COPYING
zip -0 -X all *.zip

+ 3
- 0
zipcms.bat View File

@@ -0,0 +1,3 @@
del all.zip
del alljcl.txt
zip -0 -X -ll -j all *.c *.h *.exec *.bas *.parm README COPYING

Loading…
Cancel
Save