#include <stdio.h>
#include "emc.hh"
#include "inifile.h"
#include "iniaux.hh"
#include "emcglb.h"
Include dependency graph for iniaux.cc:
Go to the source code of this file.
Functions | |
int | loadAux () |
int | iniAux (const char *filename) |
int | emcAuxEstopSetSenseIndex (int index) |
int | emcAuxEstopSetWriteIndex (int index) |
int | emcAuxEstopSetSensePolarity (int polarity) |
int | emcAuxEstopSetWritePolarity (int polarity) |
Variables | |
INIFILE * | auxInifile = 0 |
|
Definition at line 206 of file iniaux.cc. Referenced by loadAux().
00207 { 00208 ESTOP_SENSE_INDEX = index; 00209 00210 return 0; 00211 } |
|
Definition at line 220 of file iniaux.cc. Referenced by loadAux().
00221 { 00222 ESTOP_SENSE_POLARITY = polarity; 00223 00224 return 0; 00225 } |
|
Definition at line 213 of file iniaux.cc. Referenced by loadAux().
00214 { 00215 ESTOP_WRITE_INDEX = index; 00216 00217 return 0; 00218 } |
|
Definition at line 227 of file iniaux.cc. Referenced by loadAux().
00228 { 00229 ESTOP_WRITE_POLARITY = polarity; 00230 00231 return 0; 00232 } |
|
Definition at line 180 of file iniaux.cc. 00181 { 00182 int retval = 0; 00183 00184 auxInifile = new INIFILE; 00185 00186 if (-1 == auxInifile->open(filename)) 00187 { 00188 return -1; 00189 } 00190 00191 // load aux values 00192 if (0 != loadAux()) 00193 { 00194 retval = -1; 00195 } 00196 00197 // close the inifile 00198 auxInifile->close(); 00199 delete auxInifile; 00200 00201 return retval; 00202 } |
|
Definition at line 50 of file iniaux.cc. Referenced by iniAux().
00051 { 00052 int retval = 0; 00053 const char *inistring; 00054 int i; 00055 00056 if (NULL != (inistring = auxInifile->find("ESTOP_SENSE_INDEX", "EMCIO"))) 00057 { 00058 #ifndef UNDER_CE 00059 if (1 == sscanf(inistring, "%d", &i)) 00060 { 00061 // found, and valid 00062 if (0 != emcAuxEstopSetSenseIndex(i)) 00063 { 00064 printf("bad return value from emcAuxEstopSetSenseIndex\n"); 00065 retval = -1; 00066 } 00067 } 00068 else 00069 { 00070 // found, but invalid, so warn 00071 printf("invalid inifile value for ESTOP_SENSE_INDEX: %s\n", 00072 inistring); 00073 } 00074 #else 00075 i = atol(inistring); 00076 if (0 != emcAuxEstopSetSenseIndex(i)) 00077 { 00078 rcs_print_error("bad return value from emcAuxEstopSetSenseIndex\n"); 00079 retval = -1; 00080 } 00081 #endif 00082 } 00083 // else ignore omission 00084 00085 if (NULL != (inistring = auxInifile->find("ESTOP_WRITE_INDEX", "EMCIO"))) 00086 { 00087 #ifndef UNDER_CE 00088 if (1 == sscanf(inistring, "%d", &i)) 00089 { 00090 // found, and valid 00091 if (0 != emcAuxEstopSetWriteIndex(i)) 00092 { 00093 printf("bad return value from emcAuxEstopSetWriteIndex\n"); 00094 retval = -1; 00095 } 00096 } 00097 else 00098 { 00099 // found, but invalid, so warn 00100 printf("invalid inifile value for ESTOP_WRITE_INDEX: %s\n", 00101 inistring); 00102 } 00103 #else 00104 i = atol(inistring); 00105 if (0 != emcAuxEstopSetWriteIndex(i)) 00106 { 00107 rcs_print_error("bad return value from emcAuxEstopSetWriteIndex\n"); 00108 retval = -1; 00109 } 00110 #endif 00111 } 00112 // else ignore omission 00113 00114 if (NULL != (inistring = auxInifile->find("ESTOP_SENSE_POLARITY", "EMCIO"))) 00115 { 00116 #ifndef UNDER_CE 00117 if (1 == sscanf(inistring, "%d", &i)) 00118 { 00119 // found, and valid 00120 if (0 != emcAuxEstopSetSensePolarity(i)) 00121 { 00122 printf("bad return value from emcAuxEstopSetSensePolarity\n"); 00123 retval = -1; 00124 } 00125 } 00126 else 00127 { 00128 // found, but invalid, so warn 00129 printf("invalid inifile value for ESTOP_SENSE_POLARITY: %s\n", 00130 inistring); 00131 } 00132 #else 00133 i = atol(inistring); 00134 if (0 != emcAuxEstopSetSensePolarity(i)) 00135 { 00136 rcs_print_error("bad return value from emcAuxEstopSetSensePolarity\n"); 00137 retval = -1; 00138 } 00139 #endif 00140 } 00141 // else ignore omission 00142 00143 if (NULL != (inistring = auxInifile->find("ESTOP_WRITE_POLARITY", "EMCIO"))) 00144 { 00145 #ifndef UNDER_CE 00146 if (1 == sscanf(inistring, "%d", &i)) 00147 { 00148 // found, and valid 00149 if (0 != emcAuxEstopSetWritePolarity(i)) 00150 { 00151 printf("bad return value from emcAuxEstopSetWritePolarity\n"); 00152 retval = -1; 00153 } 00154 } 00155 else 00156 { 00157 // found, but invalid, so warn 00158 printf("invalid inifile value for ESTOP_WRITE_POLARITY: %s\n", 00159 inistring); 00160 } 00161 #else 00162 i = atol(inistring); 00163 if (0 != emcAuxEstopSetWritePolarity(i)) 00164 { 00165 rcs_print_error("bad return value from emcAuxEstopSetWritePolarity\n"); 00166 retval = -1; 00167 } 00168 #endif 00169 } 00170 // else ignore omission 00171 00172 return retval; 00173 } |
|
|