Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for viewing the Gambit manual (REPL ,h command and help…
… procedure).
- Loading branch information
Showing
14 changed files
with
583 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.