#include <stdio.h>#include <stdlib.h>#include "emc.hh"#include "inifile.h"#include "inilube.hh"#include "emcglb.h"Include dependency graph for inilube.cc:

Go to the source code of this file.
Functions | |
| int | loadLube () |
| int | iniLube (const char *filename) |
| int | emcLubeSetSenseIndex (int index) |
| int | emcLubeSetSensePolarity (int polarity) |
| int | emcLubeSetWriteIndex (int index) |
| int | emcLubeSetWritePolarity (int polarity) |
Variables | |
| INIFILE * | lubeInifile = 0 |
|
|
Definition at line 201 of file inilube.cc. Referenced by loadLube().
00202 {
00203 LUBE_SENSE_INDEX = index;
00204
00205 return 0;
00206 }
|
|
|
Definition at line 208 of file inilube.cc. Referenced by loadLube().
00209 {
00210 LUBE_SENSE_POLARITY = polarity;
00211
00212 return 0;
00213 }
|
|
|
Definition at line 215 of file inilube.cc. Referenced by loadLube().
00216 {
00217 LUBE_WRITE_INDEX = index;
00218
00219 return 0;
00220 }
|
|
|
Definition at line 222 of file inilube.cc. Referenced by loadLube().
00223 {
00224 LUBE_WRITE_POLARITY = polarity;
00225
00226 return 0;
00227 }
|
|
|
Definition at line 175 of file inilube.cc. 00176 {
00177 int retval = 0;
00178
00179 lubeInifile = new INIFILE;
00180
00181 if (-1 == lubeInifile->open(filename))
00182 {
00183 return -1;
00184 }
00185
00186 // load lube values
00187 if (0 != loadLube())
00188 {
00189 retval = -1;
00190 }
00191
00192 // close the inifile
00193 lubeInifile->close();
00194 delete lubeInifile;
00195
00196 return retval;
00197 }
|
|
|
Definition at line 46 of file inilube.cc. Referenced by iniLube().
00047 {
00048 int retval = 0;
00049 const char *inistring;
00050 int i;
00051
00052 if (NULL != (inistring = lubeInifile->find("LUBE_SENSE_INDEX", "EMCIO")))
00053 {
00054 #ifndef UNDER_CE
00055 if (1 == sscanf(inistring, "%d", &i))
00056 {
00057 // found, and valid
00058 if (0 != emcLubeSetSenseIndex(i))
00059 {
00060 printf("bad return value from emcLubeSetSenseIndex\n");
00061 retval = -1;
00062 }
00063 }
00064 else
00065 {
00066 // found, but invalid, so warn
00067 printf("invalid inifile value for LUBE_SENSE_INDEX: %s\n",
00068 inistring);
00069 }
00070 #else
00071 i = atol(inistring);
00072 if (0 != emcLubeSetSenseIndex(i))
00073 {
00074 rcs_print("bad return value from emcLubeSetSenseIndex\n");
00075 retval = -1;
00076 }
00077 #endif
00078 }
00079
00080 if (NULL != (inistring = lubeInifile->find("LUBE_SENSE_POLARITY", "EMCIO")))
00081 {
00082 #ifndef UNDER_CE
00083 if (1 == sscanf(inistring, "%d", &i))
00084 {
00085 // found, and valid
00086 if (0 != emcLubeSetSensePolarity(i))
00087 {
00088 printf("bad return value from emcLubeSetSensePolarity\n");
00089 retval = -1;
00090 }
00091 }
00092 else
00093 {
00094 // found, but invalid, so warn
00095 printf("invalid inifile value for LUBE_SENSE_POLARITY: %s\n",
00096 inistring);
00097 }
00098 #else
00099 i = atol(inistring);
00100 if (0 != emcLubeSetSensePolarity(i))
00101 {
00102 rcs_print("bad return value from emcLubeSetSensePolarity\n");
00103 retval = -1;
00104 }
00105 #endif
00106 }
00107
00108 if (NULL != (inistring = lubeInifile->find("LUBE_WRITE_INDEX", "EMCIO")))
00109 {
00110 #ifndef UNDER_CE
00111 if (1 == sscanf(inistring, "%d", &i))
00112 {
00113 // found, and valid
00114 if (0 != emcLubeSetWriteIndex(i))
00115 {
00116 printf("bad return value from emcLubeSetWriteIndex\n");
00117 retval = -1;
00118 }
00119 }
00120 else
00121 {
00122 // found, but invalid, so warn
00123 printf("invalid inifile value for LUBE_WRITE_INDEX: %s\n",
00124 inistring);
00125 }
00126 #else
00127 i = atol(inistring);
00128 if (0 != emcLubeSetWriteIndex(i))
00129 {
00130 rcs_print("bad return value from emcLubeSetWriteIndex\n");
00131 retval = -1;
00132 }
00133 #endif
00134 }
00135 // else ignore omission
00136
00137 if (NULL != (inistring = lubeInifile->find("LUBE_WRITE_POLARITY", "EMCIO")))
00138 {
00139 #ifndef UNDER_CE
00140 if (1 == sscanf(inistring, "%d", &i))
00141 {
00142 // found, and valid
00143 if (0 != emcLubeSetWritePolarity(i))
00144 {
00145 printf("bad return value from emcLubeSetWritePolarity\n");
00146 retval = -1;
00147 }
00148 }
00149 else
00150 {
00151 // found, but invalid, so warn
00152 printf("invalid inifile value for LUBE_WRITE_POLARITY: %s\n",
00153 inistring);
00154 }
00155 #else
00156 i = atol(inistring);
00157 if (0 != emcLubeSetWritePolarity(i))
00158 {
00159 rcs_print("bad return value from emcLubeSetWritePolarity\n");
00160 retval = -1;
00161 }
00162 #endif
00163 }
00164
00165 // else ignore omission
00166
00167 return retval;
00168 }
|
|
|
Definition at line 26 of file inilube.cc. |
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001