Skip to content

Commit

Permalink
Added support for viewing the Gambit manual (REPL ,h command and help…
Browse files Browse the repository at this point in the history
… procedure).
  • Loading branch information
feeley committed Feb 12, 2009
1 parent e8b1b8c commit c6c7081
Show file tree
Hide file tree
Showing 14 changed files with 583 additions and 136 deletions.
5 changes: 4 additions & 1 deletion INSTALL.txt
@@ -1,7 +1,7 @@
Installation instructions for Gambit-C
======================================

[Time-stamp: <2008-12-23 09:06:13 feeley>]
[Time-stamp: <2009-02-11 11:12:55 feeley>]


This directory contains a release of the Gambit-C Scheme programming
Expand Down Expand Up @@ -140,6 +140,9 @@ The configure options which are specific to the Gambit-C system are:
--enable-absolute-shared-libs
shared libraries should be linked to using an
absolute path
--enable-help-browser=BROWSER
use the specified browser to view documentation
requested through the help procedure or REPL

The option --enable-cplusplus should be used when applications
developped with the Gambit-C compiler are to be linked with code or
Expand Down
73 changes: 73 additions & 0 deletions bin/gambc-doc.bat.unix.in
@@ -0,0 +1,73 @@
#! /bin/sh

# Script parameters are passed in the following environment variables:
# GAMBC_DOC_GAMBCDIR_BIN
# GAMBC_DOC_GAMBCDIR_DOC
# GAMBC_DOC_ARG1
# GAMBC_DOC_ARG2
# GAMBC_DOC_ARG3
# GAMBC_DOC_ARG4
# ...

# echo GAMBC_DOC_GAMBCDIR_BIN = "${GAMBC_DOC_GAMBCDIR_BIN}"
# echo GAMBC_DOC_GAMBCDIR_DOC = "${GAMBC_DOC_GAMBCDIR_DOC}"
# echo GAMBC_DOC_ARG1 = "${GAMBC_DOC_ARG1}"
# echo GAMBC_DOC_ARG2 = "${GAMBC_DOC_ARG2}"
# echo GAMBC_DOC_ARG3 = "${GAMBC_DOC_ARG3}"
# echo GAMBC_DOC_ARG4 = "${GAMBC_DOC_ARG4}"

find_in_path() # exe-name, sets `$exe'
{
save_IFS="${IFS}"; IFS=":"
for dir in $PATH; do
if test -x "$dir/$1" -a ! -d "$dir/$1"; then
exe="$dir/$1"; IFS="$save_IFS"; return 0
fi
done
exe=""; IFS="$save_IFS"; return 1
}

find_browser() # sets `$exe'
{
if [ "@HELP_BROWSER@" != "" ]; then
browser_list="@HELP_BROWSER@"
else
browser_list="lynx firefox mozilla netscape osascript"
fi

browser_list="${GAMBC_DOC_ARG3} $browser_list"

for b in $browser_list; do
if find_in_path $b; then
browser=$b
return 0
fi
done
return 1
}

operation_help() # sets `$exe'
{
if find_browser; then
url="file://${GAMBC_DOC_GAMBCDIR_DOC}/gambit-c.html#${GAMBC_DOC_ARG4}"
case "$browser" in
osascript ) $exe <<EOF ;;
tell application "Safari"
open location "$url"
end tell
EOF
* ) $exe $url ;;
esac
else
echo "*** WARNING -- none of these browsers can be found to view the documentation:"
echo "*** $browser_list"
exit 1
fi
}

if [ "${GAMBC_DOC_ARG1}" == "help" ]; then
operation_help
else
echo "*** WARNING -- unsupported operation: ${GAMBC_DOC_ARG1}"
exit 1
fi
49 changes: 49 additions & 0 deletions bin/gambc-doc.bat.windows.in
@@ -0,0 +1,49 @@
@echo off

rem Script parameters are passed in the following environment variables:
rem GAMBC_DOC_GAMBCDIR_BIN
rem GAMBC_DOC_GAMBCDIR_DOC
rem GAMBC_DOC_ARG1
rem GAMBC_DOC_ARG2
rem GAMBC_DOC_ARG3
rem GAMBC_DOC_ARG4
rem ...

rem echo GAMBC_DOC_GAMBCDIR_BIN = %GAMBC_DOC_GAMBCDIR_BIN%
rem echo GAMBC_DOC_GAMBCDIR_DOC = %GAMBC_DOC_GAMBCDIR_DOC%
rem echo GAMBC_DOC_ARG1 = %GAMBC_DOC_ARG1%
rem echo GAMBC_DOC_ARG2 = %GAMBC_DOC_ARG2%
rem echo GAMBC_DOC_ARG3 = %GAMBC_DOC_ARG3%
rem echo GAMBC_DOC_ARG3 = %GAMBC_DOC_ARG4%

if "%GAMBC_DOC_ARG1%" == "help" goto operation_help

echo *** WARNING -- unsupported operation: %GAMBC_DOC_ARG1%
exit 1

:operation_help

set browser_list=explorer.exe netscape.exe mozilla.exe firefox.exe lynx.exe

rem if "@HELP_BROWSER@" != "" set browser_list=@HELP_BROWSER@

set browser_list=%browser_list% %GAMBC_DOC_ARG3%

set url="file://%GAMBC_DOC_GAMBCDIR_DOC%\gambit-c.html#%GAMBC_DOC_ARG4%"

set browser=

for %%f in (%browser_list%) do if not "%%~$PATH:f" == "" set browser=%%f

if not "%browser%" == "" goto start_browser

echo *** WARNING -- none of these browsers can be found to view the documentation:
echo *** %browser_list%

exit 1

:start_browser

%browser% %url%

exit 0
19 changes: 15 additions & 4 deletions bin/makefile.in
@@ -1,6 +1,6 @@
# makefile for Gambit-C bin directory.

# Copyright (c) 1994-2008 by Marc Feeley, All Rights Reserved.
# Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.

herefromroot = bin
rootfromhere = ..
Expand Down Expand Up @@ -64,13 +64,14 @@ mandir = @mandir@

.SUFFIXES:

RCFILES = makefile.in
RCFILES = makefile.in \
gambc-doc.bat.unix.in gambc-doc.bat.windows.in

GENDISTFILES =

DISTFILES = $(RCFILES) $(GENDISTFILES)

INSTFILES_BIN_PROG = gsc-cc-o.bat
INSTFILES_BIN_PROG = gsc-cc-o.bat gambc-doc.bat
INSTFILES_BIN_LINK_GSI = six@exe@ gsi-script@bat@ six-script@bat@ \
scheme-srfi-0@bat@ scheme-r5rs@bat@ scheme-r4rs@bat@ scheme-ieee-1178-1990@bat@
INSTFILES_BIN_LINK_GSC = gsc-script@bat@
Expand All @@ -81,7 +82,7 @@ all: all-pre all-recursive all-post

all-pre:

all-post: gsc-cc-o.bat six@exe@ gsi-script@bat@ gsc-script@bat@ six-script@bat@ scheme-srfi-0@bat@ scheme-r5rs@bat@ scheme-r4rs@bat@ scheme-ieee-1178-1990@bat@
all-post: gsc-cc-o.bat gambc-doc.bat six@exe@ gsi-script@bat@ gsc-script@bat@ six-script@bat@ scheme-srfi-0@bat@ scheme-r5rs@bat@ scheme-r4rs@bat@ scheme-ieee-1178-1990@bat@

gsc-cc-o.bat: makefile
rm -f gsc-cc-o.bat
Expand Down Expand Up @@ -166,6 +167,15 @@ gsc-cc-o.bat: makefile
echo "exit" >> gsc-cc-o.bat; \
fi

gambc-doc.bat: makefile
rm -f gambc-doc.bat
if test "@bat@" = ""; then \
cp gambc-doc.bat.unix gambc-doc.bat; \
chmod +x gambc-doc.bat; \
else \
cp gambc-doc.bat.windows gambc-doc.bat; \
fi

six@exe@: makefile
rm -f six@exe@ six@exe@.lnk
if test "@bat@" = ""; then \
Expand Down Expand Up @@ -297,6 +307,7 @@ mostlyclean-pre:

mostlyclean-post:
rm -f gsc-cc-o.bat \
gambc-doc.bat \
six@exe@ six@exe@.lnk \
gsi-script@bat@ \
gsi-script@bat@.lnk \
Expand Down
25 changes: 22 additions & 3 deletions configure
Expand Up @@ -9,7 +9,7 @@
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
#
# Copyright (c) 1994-2008 by Marc Feeley, All Rights Reserved.
# Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
Expand Down Expand Up @@ -800,6 +800,7 @@ ENABLE_SHARED
ENABLE_ABSOLUTE_SHARED_LIBS
ENABLE_VERSIONNED_LIBS
emacsdir
HELP_BROWSER
SET_MAKE
LIBOBJS
LTLIBOBJS'
Expand All @@ -821,6 +822,7 @@ enable_ansi_c
enable_symlinks
enable_multiple_versions
enable_absolute_shared_libs
enable_help_browser
with_x
'
ac_precious_vars='build_alias
Expand Down Expand Up @@ -1493,6 +1495,8 @@ Optional Features:
--enable-absolute-shared-libs
shared libraries should be linked to using an
absolute path (default is YES)
--enable-help-browser=BROWSER
Browser to use for help (default is to search)

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Expand Down Expand Up @@ -1587,7 +1591,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.

Copyright (c) 1994-2008 by Marc Feeley, All Rights Reserved.
Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.
_ACEOF
exit
fi
Expand Down Expand Up @@ -5434,6 +5438,18 @@ if test "$ENABLE_SHARED" != "yes"; then
ENABLE_ABSOLUTE_SHARED_LIBS=no
fi

###############################################################################
#
# Determine which browser to use for help.

# Check whether --enable-help-browser was given.
if test "${enable_help_browser+set}" = set; then
enableval=$enable_help_browser; HELP_BROWSER=$enableval
else
HELP_BROWSER=""
fi


###############################################################################
#
# Check for C compiler.
Expand Down Expand Up @@ -24790,6 +24806,7 @@ INSTALL_PROGRAM='$(rootfromhere)/install-sh -c -m 755'






{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
Expand Down Expand Up @@ -24824,7 +24841,7 @@ $as_echo "no" >&6; }
fi


ac_config_files="$ac_config_files makefile include/makefile include/gambit.h lib/makefile lib/guide/guidepro lib/guide/makefile lib/guide/images/makefile gsi/makefile gsc/makefile bin/makefile misc/makefile doc/makefile tests/makefile examples/makefile examples/distr-comp/makefile examples/pi/makefile examples/ring/makefile examples/web-repl/makefile examples/web-server/makefile examples/tcltk/makefile examples/Xlib-simple/makefile examples/pthread/makefile examples/misc/makefile prebuilt/makefile prebuilt/macosx/makefile prebuilt/macosx/build-phase2 prebuilt/windows/makefile prebuilt/windows/build-phase2"
ac_config_files="$ac_config_files makefile include/makefile include/gambit.h lib/makefile lib/guide/guidepro lib/guide/makefile lib/guide/images/makefile gsi/makefile gsc/makefile bin/makefile bin/gambc-doc.bat.unix bin/gambc-doc.bat.windows misc/makefile doc/makefile tests/makefile examples/makefile examples/distr-comp/makefile examples/pi/makefile examples/ring/makefile examples/web-repl/makefile examples/web-server/makefile examples/tcltk/makefile examples/Xlib-simple/makefile examples/pthread/makefile examples/misc/makefile prebuilt/makefile prebuilt/macosx/makefile prebuilt/macosx/build-phase2 prebuilt/windows/makefile prebuilt/windows/build-phase2"

cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
Expand Down Expand Up @@ -25420,6 +25437,8 @@ do
"gsi/makefile") CONFIG_FILES="$CONFIG_FILES gsi/makefile" ;;
"gsc/makefile") CONFIG_FILES="$CONFIG_FILES gsc/makefile" ;;
"bin/makefile") CONFIG_FILES="$CONFIG_FILES bin/makefile" ;;
"bin/gambc-doc.bat.unix") CONFIG_FILES="$CONFIG_FILES bin/gambc-doc.bat.unix" ;;
"bin/gambc-doc.bat.windows") CONFIG_FILES="$CONFIG_FILES bin/gambc-doc.bat.windows" ;;
"misc/makefile") CONFIG_FILES="$CONFIG_FILES misc/makefile" ;;
"doc/makefile") CONFIG_FILES="$CONFIG_FILES doc/makefile" ;;
"tests/makefile") CONFIG_FILES="$CONFIG_FILES tests/makefile" ;;
Expand Down
17 changes: 14 additions & 3 deletions configure.ac
@@ -1,6 +1,6 @@
# Configure template for Gambit-C system.

# Copyright (c) 1994-2008 by Marc Feeley, All Rights Reserved.
# Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.

# Process this file with autoconf to produce a configure script.

Expand All @@ -17,7 +17,7 @@ AC_SUBST(PACKAGE_STRING)
AC_SUBST(PACKAGE_BUGREPORT)
AC_SUBST(PACKAGE_TARNAME)

AC_COPYRIGHT([[Copyright (c) 1994-2008 by Marc Feeley, All Rights Reserved.]])
AC_COPYRIGHT([[Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.]])

AC_CONFIG_SRCDIR(include/gambit.h.in)

Expand Down Expand Up @@ -381,6 +381,16 @@ if test "$ENABLE_SHARED" != "yes"; then
ENABLE_ABSOLUTE_SHARED_LIBS=no
fi

###############################################################################
#
# Determine which browser to use for help.

AC_ARG_ENABLE(help-browser,
AC_HELP_STRING([--enable-help-browser=BROWSER],
[Browser to use for help (default is to search)]),
HELP_BROWSER=$enableval,
HELP_BROWSER="")

###############################################################################
#
# Check for C compiler.
Expand Down Expand Up @@ -1532,10 +1542,11 @@ AC_SUBST(ENABLE_SHARED)
AC_SUBST(ENABLE_ABSOLUTE_SHARED_LIBS)
AC_SUBST(ENABLE_VERSIONNED_LIBS)
AC_SUBST(emacsdir)
AC_SUBST(HELP_BROWSER)

AC_PROG_MAKE_SET

AC_OUTPUT(makefile include/makefile include/gambit.h lib/makefile lib/guide/guidepro lib/guide/makefile lib/guide/images/makefile gsi/makefile gsc/makefile bin/makefile misc/makefile doc/makefile tests/makefile examples/makefile examples/distr-comp/makefile examples/pi/makefile examples/ring/makefile examples/web-repl/makefile examples/web-server/makefile examples/tcltk/makefile examples/Xlib-simple/makefile examples/pthread/makefile examples/misc/makefile prebuilt/makefile prebuilt/macosx/makefile prebuilt/macosx/build-phase2 prebuilt/windows/makefile prebuilt/windows/build-phase2)
AC_OUTPUT(makefile include/makefile include/gambit.h lib/makefile lib/guide/guidepro lib/guide/makefile lib/guide/images/makefile gsi/makefile gsc/makefile bin/makefile bin/gambc-doc.bat.unix bin/gambc-doc.bat.windows misc/makefile doc/makefile tests/makefile examples/makefile examples/distr-comp/makefile examples/pi/makefile examples/ring/makefile examples/web-repl/makefile examples/web-server/makefile examples/tcltk/makefile examples/Xlib-simple/makefile examples/pthread/makefile examples/misc/makefile prebuilt/makefile prebuilt/macosx/makefile prebuilt/macosx/build-phase2 prebuilt/windows/makefile prebuilt/windows/build-phase2)

if test "$ENABLE_SINGLE_HOST" != yes; then
AC_MSG_NOTICE([
Expand Down

0 comments on commit c6c7081

Please sign in to comment.