Skip to content

Commit

Permalink
* Version 1.13.
Browse files Browse the repository at this point in the history
* libedit support and updated manual.
  • Loading branch information
jorgicor committed Feb 14, 2018
1 parent 4353401 commit 22b68d4
Show file tree
Hide file tree
Showing 36 changed files with 1,026 additions and 929 deletions.
2 changes: 1 addition & 1 deletion COPYING
@@ -1,4 +1,4 @@
Copyright (c) 2014-2017 Jorge Giner Cordero
Copyright (C) 2018 Jorge Giner Cordero

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
4 changes: 4 additions & 0 deletions Makefile.am
@@ -1,3 +1,7 @@
# ===========================================================================
# bas55, an implementation of the Minimal BASIC programming language.
# ===========================================================================

# bas55.1 man page depends on bas55 executable being built.
# This order of SUBDIRS ensures it.
SUBDIRS = src doc . tests
Expand Down
20 changes: 20 additions & 0 deletions NEWS
@@ -1,3 +1,23 @@
1.13 2018-02-14

* Added support for the NetBSD libedit library to add enhanced editing
capabilities on GNU/Linux or BSD systems, like a history of previous
typed lines, command autocompletion, direct access to a line by its
number to edit it, etc. See the manual for details and the README
file to know how to compile bas55 with libedit support.

Note: This does not apply to the Windows version.

Source changes
--------------

* Updated the manual, to talk about the editing capabilites on Windows
and Unix-like systems. Also fixed some typographical errors.

* Removed all permission notices from source files. The license and
the copyright is at the top level of the project in the file COPYING
and applies to all the project except otherwise noted.

1.12 2017-11-20

Source changes
Expand Down
49 changes: 39 additions & 10 deletions README
@@ -1,14 +1,14 @@
bas55 - ECMA-55 Minimal BASIC Interpreter
=========================================
bas55 - ECMA-55 Minimal BASIC System
====================================

`bas55` is an interpreter for the *Minimal BASIC* programming language as
described by the ECMA standard 55 [1].
`bas55` is an implementation of the *Minimal BASIC* programming language as
described by the ECMA standard 55 [1]. bas55 provides an interpreter and an
editor with line renumbering capabilities.

bas55 is free software. See the file `COPYING` for copying conditions.

Copyright (c) 2014-2017 Jorge Giner Cordero

Home page: http://jorgicor.sdfeu.org/bas55
GitHub: https://github.com/jorgicor/bas55
Send bug reports to: jorge.giner@hotmail.com

[1]: http://www.ecma-international.org/publications/standards/Standardwithdrawn.htm
Expand Down Expand Up @@ -52,10 +52,10 @@ to generate the required files. You will need *GNU autoconf*, *GNU automake*,
Compiling from the source distribution
--------------------------------------

If you have the official source package, and you are building on a Unix
environment (this includes *Cygwin* on *Windows*), you can find detailed
instructions in the file `INSTALL`. The complete source distribution can always
be found at http://jorgicor.sdfeu.org/bas55 .
If you have the official source package, and you are building on a Unix-like
environment (this includes *Cygwin* on *Windows*), you can find generic
instructions in the file `INSTALL`. The complete source distribution can
always be found at http://jorgicor.sdfeu.org/bas55 .

After installing, you can type `man bas55` to see a brief explanation on how to
use the `bas55` program. More detailed documentation, including a tutorial on
Expand All @@ -82,3 +82,32 @@ Normally, after installing from source, you can find this on your system:
If you are installing bas55 using your OS distribution package system, these
folders will probably be different. Try changing `/usr/local` to `/usr`.

Enhanced editing capabilities on GNU/Linux or *BSD
--------------------------------------------------

On GNU/Linux, if you have the NetBSD Editline library (libedit, see
<http://thrysoee.dk/editline>) installed on your system, then you will have
some editing enhancements while `bas55` is in editor mode, like a history of
previous typed lines, command autocompletion, direct access to a line by its
number to edit it, etc. See the manual for details.

On FreeBSD, NetBSD or OpenBSD, this library should already be installed in the
base system.

So, to compile with libedit support, you can pass `--with-libedit` to the
configure script, and it will try to detect the library. Sometimes, the
library is already linked with its dependencies and you don't need to do
anything else, but sometimes it is not. In this case, you have to link also
with one the termcap, curses or ncurses libraries. For this, you have the
options `--with-termcap`, `--with-curses` and `--with-ncurses`. This means
that if using `--with-libedit` gives you an error but you know that libedit is
installed, try combining this option with one of the others.

This are some tests I did:

* Slackware Linux with the SlackBuild libedit 3.1 installed: `--with-libedit`
is enough.
* FreeBSD 11.1: `--with-libedit` is enough.
* NetBSD 7.1.1: `--with-libedit` is enough.
* OpenBSD 6.2: `--with-libedit --with-curses` (or `--with-termcap`) is needed.

11 changes: 5 additions & 6 deletions README.md
@@ -1,13 +1,12 @@
bas55 - ECMA-55 Minimal BASIC Interpreter
=========================================
bas55 - ECMA-55 Minimal BASIC System
====================================

`bas55` is an interpreter for the *Minimal BASIC* programming language as
described by the [ECMA standard 55][1].
`bas55` is an implementation of the *Minimal BASIC* programming language as
described by the [ECMA standard 55][1]. bas55 provides an interpreter and an
editor with line renumbering capabilities.

bas55 is free software. See the file `COPYING` for copying conditions.

Copyright (c) 2014-2017 Jorge Giner Cordero

Home page: http://jorgicor.sdfeu.org/bas55
Send bug reports to: jorge.giner@hotmail.com

Expand Down
4 changes: 4 additions & 0 deletions bootstrap
@@ -1,5 +1,9 @@
#!/bin/sh

# ===========================================================================
# bas55, an implementation of the Minimal BASIC programming language.
# ===========================================================================

# When you get the source from a version control repository, it is not
# ready for distribution. Some files have to be generated first but these
# generated files depend on the version of the tools you have on your system:
Expand Down
118 changes: 107 additions & 11 deletions configure.ac
@@ -1,8 +1,12 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([bas55 (ECMA-55 Minimal BASIC Interpreter)],
[1.12],
# ===========================================================================
# bas55, an implementation of the Minimal BASIC programming language.
# ===========================================================================

AC_INIT([bas55],
[1.13],
[jorge.giner@hotmail.com],
bas55,
[http://jorgicor.sdfeu.org/bas55])
Expand All @@ -14,8 +18,41 @@ AM_INIT_AUTOMAKE(-Wall -Werror -Wportability subdir-objects
color-tests parallel-tests)
AC_CONFIG_HEADERS([config.h])

AC_DEFINE([COPYRIGHT_YEARS], ["2018"], [Years of copyright])
AC_SUBST(COPYRIGHT_YEARS, [2018])

AC_ARG_WITH([termcap],
[AS_HELP_STRING([--with-termcap],
[use termcap with readline or libedit])],
[],
[with_termcap=no])

AC_ARG_WITH([curses],
[AS_HELP_STRING([--with-curses],
[use curses with readline or libedit])],
[],
[with_curses=no])

AC_ARG_WITH([ncurses],
[AS_HELP_STRING([--with-ncurses],
[use ncurses with readline or libedit])],
[],
[with_ncurses=no])

# AC_ARG_WITH([readline],
# [AS_HELP_STRING([--with-readline],
# [support fancy command line editing])],
# [],
# [with_readline=no])

AC_ARG_WITH([libedit],
[AS_HELP_STRING([--with-libedit],
[support fancy BSD command line editing])],
[],
[with_libedit=no])

# Checks for programs.
PKG_PROG_PKG_CONFIG
# PKG_PROG_PKG_CONFIG
AC_PROG_CC
AC_PROG_YACC
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
Expand All @@ -28,23 +65,82 @@ AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement],
AC_SUBST(WARN_CFLAGS)

# Checks for libraries.
AC_SEARCH_LIBS([pow], [m])

# AS_IF([test "x$with_readline" != xno], [check_termlib=yes])
AS_IF([test "x$with_libedit" != xno], [check_termlib=yes])

# Check that only one of --with-termcap, --with-curses, etc is used.
n_termlibs=0
AS_IF([test "x$with_termcap" != xno], [n_termlibs=$(expr "$n_termlibs" + 1)])
AS_IF([test "x$with_curses" != xno], [n_termlibs=$(expr "$n_termlibs" + 1)])
AS_IF([test "x$with_ncurses" != xno], [n_termlibs=$(expr "$n_termlibs" + 1)])
AS_IF([test "$n_termlibs" -gt 1],
[AC_MSG_ERROR([only one of --with-termcap, --with-curses, --with-ncurses can be used])])

# Check that only one of --with-readline or --with-libedit is used.

# n_editlibs=0
# AS_IF([test "x$with_readline" != xno], [n_editlibs=$(expr "$n_editlibs" + 1)])
# AS_IF([test "x$with_libedit" != xno], [n_editlibs=$(expr "$n_editlibs" + 1)])
# AS_IF([test "$n_editlibs" -gt 1],
# [AC_MSG_ERROR([only one of --with-readline or --with-libedit can be used])])

# Check that --with-termcap, --with-curses, etc are used only when
# --with-libedit is used.

AS_IF([test "x$with_termcap" != xno],
AS_IF([test "x$check_termlib" != xyes],
[AC_MSG_WARN([--with-termcap has no effect; use with --with-libedit])]))

AS_IF([test "x$with_curses" != xno],
AS_IF([test "x$check_termlib" != xyes],
[AC_MSG_WARN([--with-curses has no effect; use with --with-libedit])]))

AS_IF([test "x$with_ncurses" != xno],
AS_IF([test "x$check_termlib" != xyes],
[AC_MSG_WARN([--with-ncurses has no effect; use with --with-libedit])]))

# Check for the terminal library.

AS_IF([test "x$check_termlib" = xyes],
[AS_IF([test "x$with_termcap" != xno],
[AC_CHECK_LIB(termcap, tgetent,,
[AC_MSG_ERROR([termcap library not found])])])])

AS_IF([test "x$check_termlib" = xyes],
[AS_IF([test "x$with_curses" != xno],
[AC_CHECK_LIB(curses, tgetent,,
[AC_MSG_ERROR([curses library not found])])])])

AS_IF([test "x$check_termlib" = xyes],
[AS_IF([test "x$with_ncurses" != xno],
[AC_CHECK_LIB(ncurses, tgetent,,
[AC_MSG_ERROR([ncurses library not found])])])])

# Check for the libedit library.

# AS_IF([test "x$with_readline" != xno],
# [AC_CHECK_LIB(readline, readline,,
# [AC_MSG_ERROR([readline not found or not usable.])])])

AS_IF([test "x$with_libedit" != xno],
[AC_CHECK_LIB(edit, readline,,
[AC_MSG_ERROR([libedit not found or not usable.])])])

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_SEARCH_LIBS([pow], [m])
# AC_SEARCH_LIBS([initscr], [ncurses])
# AC_SEARCH_LIBS([el_init], [edit])
# AC_SEARCH_LIBS([readline], [readline], , ,[-lncurses])
# AC_SEARCH_LIBS([readline], [edit], , ,[-lncurses])
PKG_CHECK_MODULES([LIBEDIT], [libedit],
[ AC_DEFINE([HAVE_LIBEDIT], [1], [Use libedit]) ],
[ AC_DEFINE([HAVE_LIBEDIT], [0], [Use libedit]) ])

# PKG_CHECK_MODULES([LIBEDIT], [libedit >= 3.1],
# [ AC_DEFINE([HAVE_LIBEDIT], [1], [Use libedit]) ],
# [ ])

AC_CONFIG_FILES([Makefile
src/Makefile
doc/Makefile
doc/copyright.texi
tests/Makefile])
AC_OUTPUT
1 change: 1 addition & 0 deletions data/sieve.bas
@@ -1,3 +1,4 @@
5 REM SIEVE OF ERATOSTHENES, BY ERATOSTHENES OF CYERENE, 276 BC - 194 BC
10 PRINT "FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N: "
20 INPUT N
30 IF N<2 THEN 10
Expand Down
6 changes: 5 additions & 1 deletion doc/Makefile.am
@@ -1,6 +1,10 @@
# ===========================================================================
# bas55, an implementation of the Minimal BASIC programming language.
# ===========================================================================

AM_MAKEINFOHTMLFLAGS = --no-headers --no-split
info_TEXINFOS = bas55.texi
dist_man_MANS = bas55.1

bas55.1: $(top_srcdir)/src/ecma55.c $(top_srcdir)/configure.ac
$(HELP2MAN) --output=$@ $(top_builddir)/src/bas55$(EXEEXT)
$(HELP2MAN) --name="ECMA-55 Minimal BASIC interpreter and editor" --version-string="$(PACKAGE_STRING)" --output=$@ $(top_builddir)/src/bas55$(EXEEXT)

0 comments on commit 22b68d4

Please sign in to comment.