Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

emcsvr.cc File Reference

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "rcs.hh"
#include "emc.hh"
#include "emcglb.h"

Include dependency graph for emcsvr.cc:

Include dependency graph

Go to the source code of this file.

Defines

#define __attribute__(x)

Functions

char __attribute__ ((unused)) ident[]="$Id
int main (int argc, char *argv[])

Variables

RCS_CMD_CHANNEL * emcCommandChannel = NULL
RCS_STAT_CHANNEL * emcStatusChannel = NULL
NML * emcErrorChannel = NULL
RCS_CMD_CHANNEL * toolCommandChannel = NULL
RCS_STAT_CHANNEL * toolStatusChannel = NULL
RCS_CMD_CHANNEL * auxCommandChannel = NULL
RCS_STAT_CHANNEL * auxStatusChannel = NULL
RCS_CMD_CHANNEL * lubeCommandChannel = NULL
RCS_STAT_CHANNEL * lubeStatusChannel = NULL
RCS_CMD_CHANNEL * spindleCommandChannel = NULL
RCS_STAT_CHANNEL * spindleStatusChannel = NULL
RCS_CMD_CHANNEL * coolantCommandChannel = NULL
RCS_STAT_CHANNEL * coolantStatusChannel = NULL


Define Documentation

#define __attribute__  
 

Definition at line 37 of file emcsvr.cc.


Function Documentation

char __attribute__ (unused)    [static]
 

Definition at line 41 of file emcsvr.cc.

00041                                                   : emcsvr.cc,v 1.7 2001/07/09 15:56:17 wshackle Exp $";
00042 
00043 static int iniLoad(const char *filename)
00044 {
00045   INIFILE inifile;
00046   const char *inistring;
00047 
00048   // open it
00049   if (-1 == inifile.open(filename)) {
00050     return -1;
00051   }
00052 
00053   if (NULL != (inistring = inifile.find("DEBUG", "EMC"))) {
00054     // copy to global
00055     if (1 != sscanf(inistring, "%i", &EMC_DEBUG)) {
00056       EMC_DEBUG = 0;
00057     }
00058   }
00059   else {
00060     // not found, use default
00061     EMC_DEBUG = 0;
00062   }
00063   if(EMC_DEBUG & EMC_DEBUG_RCS)
00064     {
00065       //set_rcs_print_flag(PRINT_EVERYTHING);
00066       max_rcs_errors_to_print=-1;
00067     }
00068 
00069 
00070   if (NULL != (inistring = inifile.find("NML_FILE", "EMC"))) {
00071     // copy to global
00072     strcpy(EMC_NMLFILE, inistring);
00073   }
00074   else {
00075     // not found, use default
00076   }
00077 
00078   // close it
00079   inifile.close();
00080 
00081   return 0;
00082 }

int main int    argc,
char *    argv[]
 

Definition at line 98 of file emcsvr.cc.

00099 {
00100   double start_time;
00101 
00102   // don't print the RCS library version
00103   rcs_version_printed = 1;
00104 
00105   // process command line args
00106   if (0 != emcGetArgs(argc, argv)) {
00107     rcs_print_error("Error in argument list\n");
00108     exit(1);
00109   }
00110 
00111   // get configuration information
00112   iniLoad(EMC_INIFILE);
00113 
00114   set_rcs_print_destination(RCS_PRINT_TO_NULL);
00115 
00116   start_time = etime();
00117 
00118   while(fabs(etime() - start_time) < 10.0 &&
00119         ( emcCommandChannel == NULL || emcStatusChannel == NULL || toolCommandChannel == NULL ||
00120           toolStatusChannel == NULL || emcErrorChannel == NULL)
00121         )
00122     {
00123       if(NULL == emcCommandChannel)
00124         {
00125           emcCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "emcCommand", "emcsvr", EMC_NMLFILE);
00126         }
00127       if(NULL == emcStatusChannel)
00128         {
00129           emcStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "emcStatus", "emcsvr", EMC_NMLFILE);
00130         }
00131       if(NULL == emcErrorChannel)
00132         {
00133           emcErrorChannel = new NML(nmlErrorFormat, "emcError", "emcsvr", EMC_NMLFILE);
00134         }
00135       if(NULL == toolCommandChannel)
00136         {
00137           toolCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "toolCmd", "emcsvr", EMC_NMLFILE);
00138         }
00139       if(NULL == toolStatusChannel)
00140         {
00141           toolStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "toolSts", "emcsvr", EMC_NMLFILE);
00142         }
00143       if(NULL == spindleCommandChannel)
00144         {
00145           spindleCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "spindleCmd", "emcsvr", EMC_NMLFILE);
00146         }
00147       if(NULL == spindleStatusChannel)
00148         {
00149           spindleStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "spindleSts", "emcsvr", EMC_NMLFILE);
00150         }
00151       if(NULL == auxCommandChannel)
00152         {
00153           auxCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "auxCmd", "emcsvr", EMC_NMLFILE);
00154         }
00155       if(NULL == auxStatusChannel)
00156         {
00157           auxStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "auxSts", "emcsvr", EMC_NMLFILE);
00158         }
00159       if(NULL == coolantCommandChannel)
00160         {
00161           coolantCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "coolantCmd", "emcsvr", EMC_NMLFILE);
00162         }
00163       if(NULL == coolantStatusChannel)
00164         {
00165           coolantStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "coolantSts", "emcsvr", EMC_NMLFILE);
00166         }
00167       if(NULL == lubeCommandChannel)
00168         {
00169           lubeCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "lubeCmd", "emcsvr", EMC_NMLFILE);
00170         }
00171       if(NULL == lubeStatusChannel)
00172         {
00173           lubeStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "lubeSts", "emcsvr", EMC_NMLFILE);
00174         }
00175 
00176       if(!emcCommandChannel->valid())
00177         {
00178           delete emcCommandChannel;
00179           emcCommandChannel = NULL;
00180         }
00181       if(!emcStatusChannel->valid())
00182         {
00183           delete emcStatusChannel;
00184           emcStatusChannel = NULL;
00185         }
00186       if(!emcErrorChannel->valid())
00187         {
00188           delete emcErrorChannel;
00189           emcErrorChannel = NULL;
00190         }
00191       if(!toolCommandChannel->valid())
00192         {
00193           delete toolCommandChannel;
00194           toolCommandChannel = NULL;
00195         }
00196       if(!toolStatusChannel->valid())
00197         {
00198           delete toolStatusChannel;
00199           toolStatusChannel = NULL;
00200         }
00201       if(!auxCommandChannel->valid())
00202         {
00203           delete auxCommandChannel;
00204           auxCommandChannel = NULL;
00205         }
00206       if(!auxStatusChannel->valid())
00207         {
00208           delete auxStatusChannel;
00209           auxStatusChannel = NULL;
00210         }
00211       if(!coolantCommandChannel->valid())
00212         {
00213           delete coolantCommandChannel;
00214           coolantCommandChannel = NULL;
00215         }
00216       if(!coolantStatusChannel->valid())
00217         {
00218           delete coolantStatusChannel;
00219           coolantStatusChannel = NULL;
00220         }
00221       if(!lubeCommandChannel->valid())
00222         {
00223           delete lubeCommandChannel;
00224           lubeCommandChannel = NULL;
00225         }
00226       if(!lubeStatusChannel->valid())
00227         {
00228           delete lubeStatusChannel;
00229           lubeStatusChannel = NULL;
00230         }
00231       if(!spindleCommandChannel->valid())
00232         {
00233           delete spindleCommandChannel;
00234           spindleCommandChannel = NULL;
00235         }
00236       if(!spindleStatusChannel->valid())
00237         {
00238           delete spindleStatusChannel;
00239           spindleStatusChannel = NULL;
00240         }
00241       esleep(0.200);
00242     }
00243 
00244   set_rcs_print_destination(RCS_PRINT_TO_STDERR);
00245 
00246   if(NULL == emcCommandChannel)
00247     {
00248       emcCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "emcCommand", "emcsvr", EMC_NMLFILE);
00249     }
00250   if(NULL == emcStatusChannel)
00251     {
00252       emcStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "emcStatus", "emcsvr", EMC_NMLFILE);
00253     }
00254   if(NULL == emcErrorChannel)
00255     {
00256       emcErrorChannel = new NML(nmlErrorFormat, "emcError", "emcsvr", EMC_NMLFILE);
00257     }
00258   if(NULL == toolCommandChannel)
00259     {
00260       toolCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "toolCmd", "emcsvr", EMC_NMLFILE);
00261     }
00262   if(NULL == toolStatusChannel)
00263     {
00264       toolStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "toolSts", "emcsvr", EMC_NMLFILE);
00265     }
00266 
00267   if(NULL == spindleCommandChannel)
00268     {
00269       spindleCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "spindleCmd", "emcsvr", EMC_NMLFILE);
00270     }
00271   if(NULL == spindleStatusChannel)
00272     {
00273       spindleStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "spindleSts", "emcsvr", EMC_NMLFILE);
00274     }
00275   if(NULL == auxCommandChannel)
00276     {
00277       auxCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "auxCmd", "emcsvr", EMC_NMLFILE);
00278     }
00279   if(NULL == auxStatusChannel)
00280     {
00281       auxStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "auxSts", "emcsvr", EMC_NMLFILE);
00282     }
00283   if(NULL == coolantCommandChannel)
00284     {
00285       coolantCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "coolantCmd", "emcsvr", EMC_NMLFILE);
00286     }
00287   if(NULL == coolantStatusChannel)
00288     {
00289       coolantStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "coolantSts", "emcsvr", EMC_NMLFILE);
00290     }
00291   if(NULL == lubeCommandChannel)
00292     {
00293       lubeCommandChannel = new RCS_CMD_CHANNEL(emcFormat, "lubeCmd", "emcsvr", EMC_NMLFILE);
00294     }
00295   if(NULL == lubeStatusChannel)
00296     {
00297       lubeStatusChannel = new RCS_STAT_CHANNEL(emcFormat, "lubeSts", "emcsvr", EMC_NMLFILE);
00298     }
00299 
00300 
00301   run_nml_servers();
00302 
00303   return 0;
00304 }


Variable Documentation

RCS_CMD_CHANNEL* auxCommandChannel = NULL [static]
 

Definition at line 89 of file emcsvr.cc.

RCS_STAT_CHANNEL* auxStatusChannel = NULL [static]
 

Definition at line 90 of file emcsvr.cc.

RCS_CMD_CHANNEL* coolantCommandChannel = NULL [static]
 

Definition at line 95 of file emcsvr.cc.

RCS_STAT_CHANNEL* coolantStatusChannel = NULL [static]
 

Definition at line 96 of file emcsvr.cc.

RCS_CMD_CHANNEL* emcCommandChannel = NULL [static]
 

Definition at line 84 of file emcsvr.cc.

NML* emcErrorChannel = NULL [static]
 

Definition at line 86 of file emcsvr.cc.

RCS_STAT_CHANNEL* emcStatusChannel = NULL [static]
 

Definition at line 85 of file emcsvr.cc.

RCS_CMD_CHANNEL* lubeCommandChannel = NULL [static]
 

Definition at line 91 of file emcsvr.cc.

RCS_STAT_CHANNEL* lubeStatusChannel = NULL [static]
 

Definition at line 92 of file emcsvr.cc.

RCS_CMD_CHANNEL* spindleCommandChannel = NULL [static]
 

Definition at line 93 of file emcsvr.cc.

RCS_STAT_CHANNEL* spindleStatusChannel = NULL [static]
 

Definition at line 94 of file emcsvr.cc.

RCS_CMD_CHANNEL* toolCommandChannel = NULL [static]
 

Definition at line 87 of file emcsvr.cc.

RCS_STAT_CHANNEL* toolStatusChannel = NULL [static]
 

Definition at line 88 of file emcsvr.cc.


Generated on Sun Dec 2 15:28:02 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001