/***************************************************************************
 *   Copyright (C) 2005 by Brian Lauber   *
 *   bml8@case.edu   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef __SHARED_C__
#define __SHARED_C__

#include "shared.h"
#include "blEnv.h"


int SetS_Group(key_t group)
{ return blSetEnv("SEM_GRP", group); }

int SetM_Group(key_t group)
{ return blSetEnv("MEM_GRP", group); }

int GetS_Group(void)
{ return blGetEnv("SEM_GRP"); }

int GetM_Group(void)
{ return blGetEnv("MEM_GRP"); }




void PrintStatus(const char *label, const struct SharedVars *s)
{
  static char *LightStatus[] = {"GREEN", "YELLOW", "RED"};
  printf("%15s: %5i %5i %5i %5i      %s\n", label, s->CarsWaiting, s->CarsCrossing,
                                                   s->TrainsComing, s->TrainsCrossing,
                                                   LightStatus[s->Light]);
}


#endif


