/****************************************************************************** * * PROJECT: Carnegie Mellon Planetary Rover Project * Task Control Architecture * * MODULE: burying globals under a rock! * * FILE: global.c * * ABSTRACT: define module global. * * Copyright (c) 2008, Carnegie Mellon University * This software is distributed under the terms of the * Simplified BSD License (see ipc/LICENSE.TXT) * * REVISION HISTORY * * $Log: globalM.c,v $ * Revision 2.3 2009/01/12 15:54:56 reids * Added BSD Open Source license info * * Revision 2.2 2000/07/03 17:03:23 hersh * Removed all instances of "tca" in symbols and messages, plus changed * the names of all other symbols which conflicted with TCA. This new * version of IPC should be able to interoperate TCA fully. Client * programs can now link to both tca and ipc. * * Revision 2.1.1.1 1999/11/23 19:07:35 reids * Putting IPC Version 2.9.0 under local (CMU) CVS control. * * Revision 1.1 1996/05/09 01:01:24 reids * Moved all the X_IPC files over to the IPC directory. * Fixed problem with sending NULL data. * Added function IPC_setCapacity. * VxWorks m68k version released. * * Revision 1.1 1996/03/03 04:31:26 reids * First release of IPC files. X_IPC code (8.5), modified to support NM-DS1 IPC. * * Revision 1.16 1995/04/07 05:03:06 rich * Fixed GNUmakefiles to find the release directory. * Cleaned up libc.h file for sgi and vxworks. Moved all system includes * into libc.h * Got direct queries to work. * Fixed problem in allocating/initializing generic mats. * The direct flag (-c) now mostly works. Connect message has been extended to * indicate when direct connections are the default. * Problem with failures on sunOS machines. * Fixed problem where x_ipcError would not print out its message if logging had * not been initialized. * Fixed another memory problem in modVar.c. * Fixed problems found in by sgi cc compiler. Many type problems. * * Revision 1.15 1994/05/25 04:57:20 rich * Defined macros for registering simple messages and handlers at once. * Added function to ignore logging for all messages associated with a * global variable. * Moved module global variable routines to a new file so they are not * included in the .sa library file. Gets better code sharing and lets you * debug these routines. * Added code to force the module variables to be re-initialized after the * server goes down. * x_ipcClose now will not crash if the server is down and frees some module * memory. * The command line flag "-u" turns off the simple user interface. * Added routines to free hash tables and id tables. * * Revision 1.14 1994/05/24 13:48:44 reids * Fixed so that messages are not sent until a x_ipcWaitUntilReady is received * (and the expected number of modules have all connected) * * Revision 1.13 1994/05/11 01:57:28 rich * Now set an invalid x_ipcServerGlobal (a socket fd) to -1 rather than 0 * which is stdout. * Added checks to make sure x_ipcServerGlobal is a valid socket before * sending messages or waiting for messages. * * Revision 1.12 1994/04/28 16:16:07 reids * Changes in X_IPC Version 7.6: * 1) New functions: x_ipcIgnoreLogging and x_ipcResumeLogging * 2) Code for MacIntosh (MPW) version of X_IPC * * Revision 1.11 1994/04/26 16:23:28 rich * Now you can register an exit handler before anything else and it will * get called if connecting to central fails. * Also added code to handle pipe breaks during writes. * * Revision 1.10 1994/04/16 19:42:14 rich * First release of X_IPC for the DEC alpha. * Changes were needed because longs are 64 bits. * Fixed alignment assumption in the data message format. * Fixed the way offsets are calculated for variable length arrays. This * was a problem even without 64 bit longs and pointers. * * Added the commit date to the version information printed out with the -v * option. * * Now uses standard defines for byte order * (BYTE_ORDER = BIG_ENDIAN, LITTLE_ENDIAN or PDP_ENDIAN) * * Defined alignment types: ALIGN_INT ALINE_LONGEST and ALIGN_WORD. * * *** WARNING *** * sending longs between alphas and non-alpha machines will probably not work. * *** WARNING *** * * Revision 1.9 1994/04/15 17:09:53 reids * Changes to support vxWorks version of X_IPC 7.5 * * Revision 1.8 1993/12/14 17:33:40 rich * Changed getMGlobal to GET_M_GLOBAL and changed getSGlobal to * GET_S_GLOBAL to conform to Chris' software standards. * * Patched problem with connecting between machines with different byte * orders. The real fix requires changing the way formats are stored. * Searching for structural similar formats does not guarantee that you * find the right format. * * Revision 1.7 1993/11/21 20:17:54 rich * Added shared library for sun4c_411 sunos machines. * Added install to the makefile. * Fixed problems with global variables. * * Revision 1.6 1993/10/20 19:00:33 rich * Fixed bug with self registed messages in the lisp version. * Added new routine : x_ipcGetServerGlobal to get the server socket. * Fixed some bad global references for the lisp version. * Updated some prototypes. * * Revision 1.5 1993/08/30 21:53:31 fedor * V7+V6+VXWORKS Everything compiles but there are initialization problems. * * Revision 1.4 1993/08/27 08:38:37 fedor * Pass 2 aat a V7+V6+VxWorks merge. Many many problems with pointless casting. * * Revision 1.3 1993/08/27 07:14:56 fedor * First Pass at V7 and V6+VXWORKS merge * * Revision 1.2 1993/06/13 23:28:09 rich * Made changes for lisp needed for vx works style global variables. * Fixed some random compiler warnings. * Moved test routines to test directory. * * Revision 1.1.1.1 1993/05/20 05:45:23 rich * Importing x_ipc version 8 * * Revision 8.1 1993/05/20 00:29:57 rich * RTG - initial checkin of Chris Fedor's version 8 of x_ipc * * Revision 1.2 1993/05/19 17:23:50 fedor * Added Logging. * * $Revision: 2.3 $ * $Date: 2009/01/12 15:54:56 $ * $Author: reids $ * *****************************************************************************/ #include "globalM.h" #if defined(VXWORKS) /* VX works needs to access the globals through a pointer. */ GM_PTR x_ipc_gM = NULL; #else /* In general, the globals can just be statically allocated. */ GM_PTR x_ipc_gM_ptr = NULL; GM_TYPE x_ipc_gM; #endif