#
# 	@(#)cshrc	23.11 94/02/11
#
set history = 100
set prompt = "$USER \!> "

set path = (. ~/bin /usr/bsd /usr/ucb /bin /usr/bin /usr/sbin /usr/bin/X11)

#setenv COPYRIGHT "(C) Copyright 19`date +%y`, fill_in_your_name"

alias startdemo 'startgig -d'
alias ls        ls -CF
alias l		ls -lF
alias cp	cp -i
alias mv	mv -i
alias rm 	rm -i
alias h		'history 25'
alias v		vi
alias m		more
unset ignoreeof
unset noglob
set filec


if (-e $HOME/.localgig) then
  source $HOME/.localgig
endif

# root directory of ElectroGig tree
if (! $?GIG_D_ROOT) then
  setenv GIG_D_ROOT $HOME
endif

# root of directories that can be local to each user
setenv LOCAL $HOME

#file for gig password
if (-e /usr/local/gig/.gigid) then
  setenv GID /usr/local/gig/.gigid
  setenv GIG_F_ID $GID
else
  setenv GID $LOCAL/.gigid
  setenv GIG_F_ID $LOCAL/.gigid
endif

#time-file for time-limited gig
setenv TF $LOCAL/.time
setenv GIG_F_TIME $LOCAL/.time

#directory holding all projects
if (! $?GIG_D_PROJECTS) then
  setenv GIG_D_PROJECTS $GIG_D_ROOT/projects
endif

#file holding the current project name
if (! $?GIG_F_CURPROJ) then
  setenv GIG_F_CURPROJ $GIG_D_PROJECTS/curproject
endif

#bin directory for gig executable
setenv BD $GIG_D_ROOT/bin
setenv GIG_D_BIN $GIG_D_ROOT/bin
setenv GIG_D_TOOLBIN $GIG_D_ROOT/bin
setenv GIG_D_TOOLUTILS $GIG_D_ROOT/utils
set path = ($path   $GIG_D_ROOT/utils $GIG_D_BIN)

# directory for help files
setenv HD $GIG_D_ROOT/lib/help
setenv GIG_D_HELP  $GIG_D_ROOT/lib/help

# directory for error message file
setenv EF $GIG_D_ROOT/lib/intlib/interr.dat
setenv GIG_F_ERRORS $GIG_D_ROOT/lib/intlib/interr.dat

# directory for colour compensation files
setenv CD $GIG_D_ROOT/lib/intcmp
setenv GIG_D_COLOR  $GIG_D_ROOT/lib/intcmp


#compatibility for old cshrc vars DD,TD,RC,MD,ED,LD
if (-e $GIG_F_CURPROJ) then
  set PROJECT = `cat $GIG_F_CURPROJ`
  set PROJECT = ${PROJECT}_prj
else
  set PROJECT = demo_prj
endif

# directory for intercol files
setenv LD $GIG_D_PROJECTS/$PROJECT/intlib
setenv GIG_D_INTERCOL $GIG_D_ROOT/lib/intlib

# directory for saved pictures
setenv DD $GIG_D_PROJECTS/$PROJECT/intdump
setenv GIG_D_IMAGES $GIG_D_ROOT/lib/intdump

# directory for saved solids,totals etc
setenv ED $GIG_D_PROJECTS/$PROJECT/intenv
setenv GIG_D_MODELS $GIG_D_ROOT/lib/intenv

# directory for map files
setenv MD $GIG_D_PROJECTS/$PROJECT/intmap
setenv GIG_D_MAPS $GIG_D_ROOT/lib/intmap

# directory for record files
setenv RC $GIG_D_PROJECTS/$PROJECT/rcrd

# directory for rendered images
setenv TD $GIG_D_PROJECTS/$PROJECT/production

# directory for pixmap files
setenv PD $GIG_D_PROJECTS/$PROJECT/intpixmap
setenv GIG_D_PIXMAPS $GIG_D_ROOT/lib/intpixmap

# directory for brush definition files
setenv GIG_D_BRUSHES $GIG_D_ROOT/lib/brushes

set MACHINE = `uname -m`
switch ($MACHINE)
   case 'MIPS':
   case 'RISC':
      # directory for font files
      setenv GIG_D_FONTS /usr/lib/DPS/outline.9/decwin
      setenv FD $GIG_D_FONTS

      setenv DISPLAY :0.0
      setenv PHIGSconid $DISPLAY
      if ($?USER && $?prompt) then
# 
#        Detection of PEX server by looking at the display server that
#        is present.  According to Digital, display server Xtm implies
#        a PEX server while display servers Xtm2d, Xcfb, Xcmb and Xmfb
#        imply no PEX server.
#
         unset pex
         set ps=(`ps -ax`)
         foreach p ($ps)
           if ("$p" == "(Xtm)") then
             set pex
             break
           endif
         end
         if ($?pex) then
           setenv PHIGSwstype 221
	   #  set environment for PEX server
	   #  use 8 planes 'pseudo color 'model
	   #
	   #  For configuring your workstation to use 8 bit-planes
	   #  refer to DEC manual. However, GiG was designed to work
	   #  with 24 bit-planes.  
	   #
	   setenv PHIGSnum_pseudo_colors	64
	   setenv PHIGSnum_fixed_colors		4	#to minimum
	   setenv PHIGSnum_red_for_true		4	#to minimum
	   setenv PHIGSnum_green_for_true	4	#to minimum
	   setenv PHIGSnum_blue_for_true	4	#to minimum
         else
	   setenv PHIGSwstype 211                 
         endif
      endif
      breaksw

  case 'sun':
  case 'sun4':
  case 'sun4[a-z0-9]':
      set path = ( $path /usr/openwin/bin )
      setenv LD_LIBRARY_PATH "/usr/openwin/lib:/usr/lib"
      # directory for font files
      set SUNOSVERSION = `uname -r`
      if ( $SUNOSVERSION == '5.3' ) then
        setenv GIG_D_FONTS /usr/openwin/lib/X11/fonts/Type1/outline
      else
        setenv GIG_D_FONTS /usr/openwin/lib/fonts
      endif
      setenv FD $GIG_D_FONTS
    breaksw;

   case IP[0-9]:
   case IP[0-9][0-9]:
   case IP[0-9][0-9][0-9]:
      # directory for font files
      setenv GIG_D_FONTS /usr/lib/DPS/outline/base
      setenv FD $GIG_D_FONTS
      breaksw
   default:
      echo "unknown machine $MACHINE"
      sleep 5
endsw

#catch signals, save model in 'gigtmp' files
setenv SIGNALS

# font convertor comment this line out if you want to
# use `normal' fonts. (see encodings on p. 598-599 of Postscript
# Language Reference Manual, 2nd edition, Addison Wesley)
setenv ISOLATIN

#INPUT DEVICES
#sgi dialbox
#setenv SGI_DIAL

#GTCO dialbox port
#setenv NOMAD_DIALTTY /dev/ttyd1

#TDS ZEDPEN settings: RS232 port, baudrate, and 1/2 stopbits
#setenv ZEDTTY /dev/ttyd1
#setenv ZEDIOCTL B9600  #ioctl settings Bbaud and/or CSTOPB

#TK ENVIRONMENT VARIABLES:
#---
setenv TK_LIBRARY       "$GIG_D_ROOT/lib/t_tkgen"
setenv TCL_LIBRARY      "$GIG_D_ROOT/lib/t_tclgen"

# Kinetic effects environment vars adjust KFX_ROOT 
setenv KFX_ROOT		$HOME/kfx
setenv KFX_SKELETONS	$KFX_ROOT/data
setenv KFX_DANCES	$KFX_ROOT/dances

if (-e $HOME/.localcshrc) then
  source $HOME/.localcshrc
endif
