From:	CSBVAX::MRGATE!info-vax-relay@KL.SRI.COM@SMTP 17-MAY-1988 08:43
To:	ARISIA::EVERHART
Subj:	Redistribution of CLUSTERNODES.C - with needed .H files this time!


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 16 MAY 88 04:01:54 PDT
Received: from LBL.Gov by KL.SRI.COM with TCP; Tue 19 Apr 88 08:58:43-PDT
Received: from warner.hepnet by LBL.Gov with VMSmail ;
	Tue, 19 Apr 88 08:55:45 PDT
Date:    Tue, 19 Apr 88 08:55:45 PDT
From:     nagy%warner.hepnet@LBL.Gov (Frank J. Nagy, VAX Wizard & Guru)
Message-Id: <880419085545.20800546@LBL.Gov>
Subject: Redistribution of CLUSTERNODES.C - with needed .H files this time!
To:       Info-VAX@kl.sri.com
X-ST-Vmsmail-To: INFO_VAX

Apologies to everyone, I left the .H files out of my recent mailing
with CLUSTERNODES.C.  We have a number of include files
which extend the standard VAX .H files or provide definitions the
standard files do not.  These are kept in a text library and I have
a logical set to automatically search that library when I do a CC
(thus treating our local extensions like VAXCDEF.TLB).  It always
gets me into trouble when I send packages out.

So, here is a new VMS_SHAR of Clusternodes.c and the extra .H files
it needs.   The .C file has had its #include statements modified.


= Frank J. Nagy   "VAX Guru & Wizard"
= Fermilab Research Division EED/Controls
= HEPNET: WARNER::NAGY (43198::NAGY) or FNAL::NAGY (43009::NAGY)
= BitNet: NAGY@FNAL
= USnail: Fermilab POB 500 MS/220 Batavia, IL 60510

....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by NAGY
$! on Tuesday 19-APR-1988 10:46:45.37
$!
$! It contains the following 4 files:
$! CLUSTERNODES.C DESCRIP2.H LIBCLIDEF.H VAXTYPES.H
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="CLUSTERNODES.C"
$ Check_Sum_is=637932950
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X#module  ClusterNodes  "V1.0"
X
X/*
X **********************************************************************
X **********************************************************************
X ****`009`009`009`009`009`009`009`009   **** 
X ****`009`009`009`009`009`009`009`009   **** 
X ****`009      `009EPICURE Beamline Control System`009`009`009   **** 
X ****`009`009Copyright (c) Fermilab, 1987`009`009`009   **** 
X ****`009`009`009`009`009`009`009`009   **** 
X ****        `009Get list of VAXCluster nodes for DCL`009           **** 
X ****`009`009`009`009`009`009`009`009   **** 
X ****`009`009`009`009`009`009`009`009   **** 
X **********************************************************************
X **********************************************************************
X
X Functional Description:
X    This program supplements the DCL lexical function F$GETSYI by
X    returning a list of the node names in the VAXCluster in a DCL
X    local symbol.  
X
X Environment:
X    General purpose VMS utility.
X
X Published Information:
X    None
X
X Change Requests:
X =============================================================================
X Author: Frank J. Nagy`009`009Fermilab Research Division EED/Controls
X Modification History:
X
X V1.0`00901-May-87  FJN`009Created for MULTISUBMIT.COM to allow removal of the
X`009`009`009built-in VAXCluster node name list.
X`00919-Apr-88  FJN`009Modified for Info-VAX distribution to include local
X`009`009`009.H files as files (not from LCLCDEF.TLB)
X*/
X
X/******************
X * Include Files: *
X ******************/
X#include  "vaxtypes.h"`009`009`009/* VAX C Type extensions */
X#include  descrip`009`009`009/* VAX Descriptors */
X#include  "descrip2.h"`009`009`009/* Additional descriptor defs. */
X#include  ssdef`009`009`009`009/* System status codes */
X#include  syidef`009`009`009/* System information codes */
X#include  "libclidef.h"`009`009`009/* CLI callback definitions */
X
X/*********************************
X * Global definitions and types: *
X *********************************/
Xglobalvalue LIB$_INSVIRMEM;`009`009/* Insufficient virtual memory */
X
X/********************************
X * Local definitions and types: *
X ********************************/
Xtypedef unsigned long status;`009`009/* Condition code status type */
X
X#define`009NODENAME_LEN`00916`009`009/* Length of node name string */
X#define`009MAX_NODES`009256`009`009/* Maximum # of nodes in VAXCluster */
X
X/***********************
X * Global Own Storage: *
X ***********************/
X
X/*****************************
X * Module Local Own Storage: *
X *****************************/
Xstatic char nodes[MAX_NODES][NODENAME_LEN]; /* Storage for node names */
Xstatic int number_of_nodes;`009`009/* Number of nodes in VAXCluster */
X
Xstatic long csid = -1;`009`009`009/* Cluster system id, wildcard */
Xstatic unsigned short returned;`009`009/* Length of returned string */
Xstatic $DESCRIPTOR0( d_proto);`009`009/* Descriptor for node string */
X
Xstatic readonly $DESCRIPTOR( d_symbol, "CLUSTER_NODES");
Xstatic readonly $DESCRIPTOR( d_null, "");
X
Xstatic struct {`009`009`009`009/* Item list for $GETSYI */
X    unsigned short buflen;`009`009/* Buffer length */
X    unsigned short itemcode;`009`009/* Item code */
X    char *buffer;`009`009`009/* Pointer to return buffer */
X    unsigned short *retlen;`009`009/* Pointer to return length */
X    int listterm;`009`009`009/* List terminator */
X    } items = { NODENAME_LEN, SYI$_NODENAME, NULL, &returned, 0 };
Xstatic status iosb[2];`009`009`009/* $GETSYI I/O status block */
X
X/**********************************************
X * Global Procedure and Function definitions: *
X **********************************************/
Xextern status lib$getsyi();`009`009/* Get system information */
Xextern status sys$getsyiw();`009`009/* .. ditto .. */
Xextern void lib$signal();`009`009/* Signal error */
X
Xextern void exit();`009`009`009/* Program exit */
Xextern int strlen();`009`009`009/* Length of NUL-terminated string */
Xextern void strcat();`009`009`009/* String concatenation routine */
Xextern char *malloc();`009`009`009/* Memory allocator */
X
X`012
X/* Main Program
X This program is executed by a RUN command.  It uses a wildcard $GETSYI
X to gather the node names of the current members of the VAXCluster.  These
X are then returned in the local DCL symbol CLUSTER_NODES as a list of
X names separated by commas.
X
X If the current system is not a VAXCluster member, CLUSTER_NODES is set
X to the null string.
X*/
X
Xmain( )
X{
Xregister status sts;
Xregister int nnn;`009`009`009/* Node name number */
X
X/*
X First, a quick check that we are part of a VAXCluster.
X*/
Xsts = lib$getsyi( &SYI$_CLUSTER_MEMBER, &csid);
XSIGNAL_FAILURE( sts);
X
Xif ($VMS_FAILURE( csid))
X    {
X    /*
X     Not part of a VAXCluster, set symbol CLUSTER_NODES to null string and
X     exit prematurely.
X    */
X    sts = lib$set_symbol( &d_symbol, &d_null, &LIB$K_CLI_LOCAL_SYM);
X    SIGNAL_FAILURE( sts);
X
X    exit();
X    }
X
X/*
X Now get the number of nodes in the VAXCluster (used later).
X*/
Xsts = lib$getsyi( &SYI$_CLUSTER_NODES, &number_of_nodes);
XSIGNAL_FAILURE( sts);
X
X/*
X Now do wildcard node name look up with $GETSYI and build table of node
X names.
X*/
X
Xitems.buffer = nodes[0];`009`009    /* Initialize buffer pointer */
X
Xfor (csid = -1, nnn = 0;;)`009`009    /* Wildcard node scan */
X    {
X    sts = sys$getsyiw( 1, &csid, 0, &items, &iosb, 0, 0);
X    if ($VMS_SUCCESS( sts))
X`009sts = iosb[0];`009`009`009    /* Use IOSB status */
X    if ($VMS_SUCCESS( sts))
X`009{
X`009nodes[nnn][returned] = '\0';`009    /* Add NUL terminator */
X`009items.buffer = nodes[++nnn];
X`009}
X    else if (sts == SS$_NOMORENODE)
X`009break;
X    else
X`009lib$signal( sts);
X    }
X
X/*
X Get some memory to build the list of node names (separated by commas)
X for the DCL symbol value.
X*/
Xif ((d_proto.dsc$a_pointer = malloc( number_of_nodes*NODENAME_LEN)) == NULL)
X    lib$signal( LIB$_INSVIRMEM);
X*d_proto.dsc$a_pointer = '\0';`009`009/* Init to empty string */
X
Xfor (nnn = 0; nnn < number_of_nodes; nnn++)
X    {
X    if (nnn > 0)
X`009strcat( d_proto.dsc$a_pointer, ",");`009/* Add "," to previous... */
X
X    strcat( d_proto.dsc$a_pointer, nodes[nnn]);
X    }
X
Xd_proto.dsc$w_length = strlen( d_proto.dsc$a_pointer);
X
X/*
X Set the DCL symbol and exit out end...
X*/
Xsts = lib$set_symbol( &d_symbol, &d_proto, &LIB$K_CLI_LOCAL_SYM);
XSIGNAL_FAILURE( sts);
X
X}
$ GoSub Convert_File
$ File_is="DESCRIP2.H"
$ Check_Sum_is=2031178614
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X/*+ DESCRIP2
X Module (DESCRIP2) of SYS$LIBRARY:LCLCDEF.TLB and file DESCRIP2.H.
X
X This module defines some additions to the standard VAX-11 C include
X module (DESCRIP) found in SYS$LIBRARY:CSYSDEF.TLB.
X
X The following macros are defined:
X
X  $DESCRIPTOR0(name)             empty string descriptor (length and
X                                 pointer fields initialzed to 0).
X
X  $DESCRIPTOR1(name,string)      string descriptor for 1 character
X                                 or a whole structure.
X
X  $DESCRIPTORM(name,string)      string descriptor for structure
X                                 member or non-NUL terminated strings.
X
X  $DESCRIPTORA(name,array,type)  array descriptor.
X
X  $LENGTH(descriptor)            length field of descriptor.
X  $POINTER(descriptor)           pointer field of descriptor.
X-*/
X/*
X  V1.0`00916-May-83`009FJN`009Created
X*/
X
X/*`009DESCRIP2 - Extended VMS Descriptor Definitions `009*/
X
X/* Invoke standard descriptor definitions if not already done so */
X
X#ifndef $DESCRIPTOR
X#include descrip
X#endif
X
X/* `009simple macro to construct an empty string descriptor `009*/
X
X#define $DESCRIPTOR0(name) \
X`009struct dsc$descriptor_s name = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 }
X
X/* `009simple macro to construct string descriptor for single
X`009characters or for complete structures:`009`009`009*/
X
X#define $DESCRIPTOR1(name,string) \
V`009struct dsc$descriptor_s name = { sizeof(string), DSC$K_DTYPE_T, DSC$K_CLASS
X_S, &string }
X
X/* `009macro to construct string descriptor for structure
X`009members or non-NUL terminated strings:`009`009`009*/
X
X#define $DESCRIPTORM(name,string) \
V`009struct dsc$descriptor_s name = { sizeof(string), DSC$K_DTYPE_T, DSC$K_CLASS
X_S, string }
X
X/* `009macro to construct array desciptors:`009`009`009*/
X
X#define $DESCRIPTORA(name,array,type) \
V`009struct dsc$descriptor_a name = { sizeof(type), DSC$K_DTYPE_L, DSC$K_CLASS_A
X, array, 0, 0, \
X`009`009`009`009`009{ 0, 0, 0, 0, 0 }, 1, sizeof(array) }
X
X/*`009macros to reference the length or pointer fields of
X`009descriptors`009`009`009`009`009`009*/
X
X#define $LENGTH(descriptor) descriptor.dsc$w_length
X#define $POINTER(descriptor) descriptor.dsc$a_pointer
X
X/*
X End of DESCRIP2 module
X*/
$ GoSub Convert_File
$ File_is="LIBCLIDEF.H"
$ Check_Sum_is=1165506887
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X/*+ LIBCLIDEF
X Definitions for LIB$ CLI callback procedures
X*/
X/* Extracted from V4.4 SYS$LIBRARY:STARLET.REQ on  10-Jun-1986 */
X/* Added SPAWN definitions from V4.4 SYS$LIBRARY:STARLET.REQ on  05-Jan-1987 */
X#define LIB$K_CLI_LOCAL_SYM`0091
X#define LIB$K_CLI_GLOBAL_SYM`0092
X#define LIB$M_CLI_CTRLT`009`0090X100000
X#define LIB$M_CLI_CTRLY`009`0090X02000000
X/*
X Define the constants used for LIB$SPAWN 
X*/
X#define CLI$M_NOWAIT`009`0090X1
X#define CLI$M_NOCLISYM`009`0090X2
X#define CLI$M_NOLOGNAM`009`0090X4
X#define CLI$M_NOKEYPAD`009`0090X8
X#define CLI$M_NOTIFY`009`0090X10
X#define CLI$M_NOCONTROL`009`0090X20
$ GoSub Convert_File
$ File_is="VAXTYPES.H"
$ Check_Sum_is=1611877955
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X/*+ VAXTYPES
X  Module (VAXTYPES) of FERMI$LIB:LCLCDEF.TLB and file VAXTYPES.H.
X
X This module defines some data types, constants and macros for use
X with VAX C under VAX/VMS.  Note that using these definitions
X renders the program "non-portable".  The "vaxtypes" symbol is
X defined by this module and can be used to eliminate additional
X calls in other #include modules by:
X
X        #ifndef   vaxtypes
X        #include  vaxtypes
X        #endif
X
X2 Constants
X Defined constants for general VAX C usage:
X
X  TRUE       conditional true value (1)
X  FALSE      conditional false value (0)
X  EOF        End-of-file flag (for standard I/O)
X  NULL       Undefined pointer value (0)
X
X  MAX_...    Maximum value for several data types:
X                  int,ulong,short,uword,char,ubyte
X  MIN_...    Minimum value for several data types which
X             may take on negative values:
X                  int,short,char
X
X2 Types
X Additional types (or structures) for use with VAX C
X
X  byte / ubyte    signed / unsigned 8-bit byte
X  word / uword    signed / unsigned 16-bit word
X  long / ulong    signed / unsigned 32-bit longword
X  quad / uquad    signed / unsigned 64-bit quadword
X  octa / uocta    signed / unsigned 128-bit octaword
X
X  address    general address (pointer to byte or char)
X  queue      structure defining a queue header or the queue links
X             (fields flink and blink).
X  vmstime    VMS-returned system time type (long array of [2]).
X
X For simplicity, [u]quad, [u]octa and vmstime are defined as
X arrays of long's (or unsigned long's).  See also $bit, $[u]field
X under the "Macros" subtopic.
X2 Macros
X Macros defined for use with VAX C under VMS
X
X $VMS_SUCCESS(code)     TRUE if the status code has a severity code of
X                        success or informational (success indication).
X $VMS_FAILURE(code)     TRUE if the status code has a severity code of
X                        warning, error or severe (error indication).
X SIGNAL_FAILURE(code)   if code has an error indication severity, then
X                        call LIB$SIGNAL to signal the error.
X ABORT_ON_FAILURE(code) if code has an error indication severity, then
X                        call LIB$STOP to signal the error and abort.
X RETURN_ON_FAILURE(code) if code has an error indication severity, then
X                        exit the routine returning the status code (use
X                        only in routines which return VMS status).
X
X  $bit(name)            defines a single bit in a struct (unsigned)
X  $field(name,size)     defines a bit field of "size" bits in a struct
X  $ufield(name,size)    same as $field but for an unsigned field
X  $align`009`009align to next byte field in struct
X  $unused(size)         unused field of "size" bits
X-*/
X/*
X  V1.0`00908-Feb-83  FJN`009Created
X  V2.0`00909-Feb-83  FJN`009Corrected and expanded
X  V3.0`00922-Feb-83  FJN`009Changed names to be similar to VAX PASCAL V2
X  V3.1`00917-Apr-83  FJN`009Added $VMS... macros
X  V3.2`00922-Jul-83  FJN`009Dropped $ from byte/ubyte, etc. types
X  V3.3`00919-Sep-83  FJN`009Added macros $unused, SIGNAL_FAILURE, and
X`009`009`009ABORT_ON_FAILURE
X  V3.4`00901-Aug-85  FJN`009Added RETURN_ON_FAILURE
X  V3.5`00919-Jan-87  FJN`009Converted to lowercase lib$signal and lib$stop
X*/
X
X#ifndef`009vaxtypes
X#define`009vaxtypes 1`009/* To invoke this procedure only once! */
X
Xtypedef`009char`009`009*address;`009/* General address */
X
Xtypedef char`009byte;`009`009`009/* 8-bit signed byte */
Xtypedef short`009word;`009`009`009/* 16-bit signed word */
X/* typedef long`009long; */`009`009/* 32-bit signed longword (already
X`009`009`009`009`009   defined by VAX C */
Xtypedef long`009quad[2];`009`009/* 64-bit signed quadword */
Xtypedef long`009octa[4];`009`009/* 128-bit signed octaword */
X
Xtypedef`009unsigned char`009ubyte;`009`009/* 8-bit unsigned byte */
Xtypedef`009unsigned short`009uword;`009`009/* 16-bit unsigned word */
Xtypedef`009unsigned long`009ulong;`009`009/* 32-bit unsigned longword */
Xtypedef`009unsigned long`009uquad[2];`009/* 64-bit unsigned quadword */
Xtypedef unsigned long`009uocta[4];`009/* 128-bit unsigned octaword */
X
Xtypedef`009long int vmstime[2];`009`009/* Quadword with VMS time */
X
Xstruct  queue  {`009`009`009/* Queue header/links */
X`009unsigned int *flink;`009`009/* Forward link pointer */
X`009unsigned int *blink;`009`009/* Backward link pointer */
X`009};
X
X/*
X  Define shorthands for struct bit fields:
X*/
X#define $bit(name)  unsigned name : 1`009`009/* Single bit */
X#define $field(name,size)  int name : size`009/* Field of "size" bits */
X#define $ufield(name,size) unsigned name : size`009/* Field of "size" bits */
X#define $align  unsigned : 0`009`009`009/* Re-align on byte */
X#define $unused(size)  unsigned : size`009`009/* Unused "size" bit field */
X
X#endif
X
X/* Some (re-)definitions from STDIO module (used when STDIO is not called) */
X#ifndef`009EOF
X#define`009TRUE`0091
X#define`009FALSE`0090
X#define`009EOF`009(-1)
X#define`009NULL`0090
X#endif
X
X/* Define constants giving minimum and maximum values for various types */
X#ifndef`009MAX_INT
X#define`009MAX_INT`009`0092147483647`009/* Maximum value in signed longword */
X#define`009MAX_ULONG`0094294967295`009/* Maximum value in unsigned long */
X#define`009MAX_SHORT`00932767`009`009/* Maximum value in signed word */
X#define`009MAX_UWORD`00965535`009`009/* Maximum value in unsigned word */
X#define`009MAX_CHAR`009127`009`009/* Maximum value in signed byte */
X#define`009MAX_UBYTE`009255`009`009/* Maximum value in unsigned byte */
X#define`009MIN_INT`009`009-2147483648`009/* Minimum value in signed longword */
X#define`009MIN_SHORT`009-32768`009`009/* Minimum value in signed word */
X#define`009MIN_CHAR`009-128`009`009/* Minimum value in signed byte */
X#endif
X
X/*
X Define macros used to provide quick test of VMS completion codes
X and macros to signal or abort (signal and stop) on failure codes.
X*/
X#ifndef $VMS_SUCCESS
X#define $VMS_SUCCESS(code)  ((code) & 1)`009  /* for success */
X#define $VMS_FAILURE(code)  (!$VMS_SUCCESS(code)) /* for failure */
X`009`009`009`009`009/* Signal failure completion code */
X#define SIGNAL_FAILURE(code) if ($VMS_FAILURE(code)) lib$signal(code)
X`009`009`009`009`009/* Abort on failure completion code */
X#define ABORT_ON_FAILURE(code) if ($VMS_FAILURE(code)) lib$stop(code)
X`009`009`009`009`009/* Return failure completion code */
X#define RETURN_ON_FAILURE(code) if ($VMS_FAILURE(code)) return(code)
X#define`009LIB$SIGNAL`009lib$signal
X#define`009LIB$STOP`009lib$stop
X#endif
X
X/*
X End of VAXTYPES module
X*/
$ GoSub Convert_File
$ Exit
-------

