#!/bin/sh
#
# Use this script inside the $GAPROOT directory (the top directory
# containing 'bin', 'lib', 'pkg' and so on as subdirectories) to 
# generate a workspace file:
#     bin/wsgap4
# $Id: CreateWorkspace.sh,v 1.2 2006/11/23 13:17:05 gap Exp $   Frank Lübeck

echo Creating new workspace file ... 

# the -N option is to really load the code, not completion files
bin/gap.sh -N -r <<EOF

# load here all packages you want to include in the standard workspace
LoadPackage("EDIM");

# load help book infos with a dummy help query
??blablfdfhskhks

# a small trick to make everything sensible available to the TAB completion
function() local a; for a in NamesGVars() do if ISB_GVAR(a) then
VAL_GVAR(a); fi;od;end;
last();

# save the workspace
SaveWorkspace("bin/wsgap4");

quit;
EOF

echo 
echo -------------------------------------------------------------------
echo You can use the just produced workspace when starting GAP with the 
echo -L option.
echo
echo Do not forget to regenerate the workspace after applying bugfixes or
echo package updates!
echo 
echo The following script starts GAP with this workspace and reads a users
echo .gaprc file if it exists:
echo
echo '#!/bin/sh'
echo 'if test -e $HOME/.gaprc; then G="$HOME/.gaprc"; else G=""; fi'
echo 'gap -L '`pwd`'/bin/wsgap4   $* $G'
echo


