#include <stdio.h>
#include <stdlib.h>
#include "emc.hh"
#include "inifile.h"
#include "inispin.hh"
#include "emcglb.h"
Include dependency graph for inispin.cc:
Go to the source code of this file.
Functions | |
int | loadSpindle () |
int | iniSpindle (const char *filename) |
int | emcSpindleSetForwardIndex (int index) |
int | emcSpindleSetReverseIndex (int index) |
int | emcSpindleSetDecreaseIndex (int index) |
int | emcSpindleSetIncreaseIndex (int index) |
int | emcSpindleSetBrakeIndex (int index) |
int | emcSpindleSetEnableIndex (int index) |
int | emcSpindleSetOnIndex (int index) |
int | emcSpindleSetForwardPolarity (int polarity) |
int | emcSpindleSetReversePolarity (int polarity) |
int | emcSpindleSetDecreasePolarity (int polarity) |
int | emcSpindleSetIncreasePolarity (int polarity) |
int | emcSpindleSetBrakePolarity (int polarity) |
int | emcSpindleSetEnablePolarity (int polarity) |
int | emcSpindleSetOffWait (double wait) |
int | emcSpindleSetOnWait (double wait) |
Variables | |
INIFILE * | spindleInifile = 0 |
|
Definition at line 582 of file inispin.cc. Referenced by loadSpindle().
00583 { 00584 SPINDLE_BRAKE_INDEX = index; 00585 00586 return 0; 00587 } |
|
Definition at line 631 of file inispin.cc. Referenced by loadSpindle().
00632 { 00633 SPINDLE_BRAKE_POLARITY = polarity; 00634 00635 return 0; 00636 } |
|
Definition at line 568 of file inispin.cc. Referenced by loadSpindle().
00569 { 00570 SPINDLE_DECREASE_INDEX = index; 00571 00572 return 0; 00573 } |
|
Definition at line 617 of file inispin.cc. Referenced by loadSpindle().
00618 { 00619 SPINDLE_DECREASE_POLARITY = polarity; 00620 00621 return 0; 00622 } |
|
Definition at line 589 of file inispin.cc. Referenced by loadSpindle().
00590 { 00591 SPINDLE_ENABLE_INDEX = index; 00592 00593 return 0; 00594 } |
|
Definition at line 638 of file inispin.cc. Referenced by loadSpindle().
00639 { 00640 SPINDLE_ENABLE_POLARITY = polarity; 00641 00642 return 0; 00643 } |
|
Definition at line 554 of file inispin.cc. Referenced by loadSpindle().
00555 { 00556 SPINDLE_FORWARD_INDEX = index; 00557 00558 return 0; 00559 } |
|
Definition at line 603 of file inispin.cc. Referenced by loadSpindle().
00604 { 00605 SPINDLE_FORWARD_POLARITY = polarity; 00606 00607 return 0; 00608 } |
|
Definition at line 575 of file inispin.cc. Referenced by loadSpindle().
00576 { 00577 SPINDLE_INCREASE_INDEX = index; 00578 00579 return 0; 00580 } |
|
Definition at line 624 of file inispin.cc. Referenced by loadSpindle().
00625 { 00626 SPINDLE_INCREASE_POLARITY = polarity; 00627 00628 return 0; 00629 } |
|
Definition at line 645 of file inispin.cc. Referenced by loadSpindle().
00646 { 00647 SPINDLE_OFF_WAIT = wait; 00648 00649 return 0; 00650 } |
|
Definition at line 596 of file inispin.cc. Referenced by loadSpindle().
00597 { 00598 SPINDLE_ON_INDEX = index; 00599 00600 return 0; 00601 } |
|
Definition at line 652 of file inispin.cc. Referenced by loadSpindle().
00653 { 00654 SPINDLE_ON_WAIT = wait; 00655 00656 return 0; 00657 } |
|
Definition at line 561 of file inispin.cc. Referenced by loadSpindle().
00562 { 00563 SPINDLE_REVERSE_INDEX = index; 00564 00565 return 0; 00566 } |
|
Definition at line 610 of file inispin.cc. Referenced by loadSpindle().
00611 { 00612 SPINDLE_REVERSE_POLARITY = polarity; 00613 00614 return 0; 00615 } |
|
Definition at line 528 of file inispin.cc. 00529 { 00530 int retval = 0; 00531 00532 spindleInifile = new INIFILE; 00533 00534 if (-1 == spindleInifile->open(filename)) 00535 { 00536 return -1; 00537 } 00538 00539 // load spindle values 00540 if (0 != loadSpindle()) 00541 { 00542 retval = -1; 00543 } 00544 00545 // close the inifile 00546 spindleInifile->close(); 00547 delete spindleInifile; 00548 00549 return retval; 00550 } |
|
Definition at line 77 of file inispin.cc. Referenced by iniSpindle().
00078 { 00079 int retval = 0; 00080 const char *inistring; 00081 int i; 00082 double d; 00083 00084 if (NULL != (inistring = spindleInifile->find("SPINDLE_OFF_WAIT", "EMCIO"))) 00085 { 00086 #ifndef UNDER_CE 00087 if (1 == sscanf(inistring, "%lf", &d)) 00088 { 00089 // found, and valid 00090 if (0 != emcSpindleSetOffWait(d)) 00091 { 00092 printf("bad return value from emcSpindleSetOffWait\n"); 00093 retval = -1; 00094 } 00095 } 00096 else 00097 { 00098 // found, but invalid, so warn 00099 printf("invalid inifile value for SPINDLE_OFF_WAIT: %s\n", 00100 inistring); 00101 } 00102 #else 00103 d = RCS_CE_ATOF(inistring); 00104 if (0 != emcSpindleSetOffWait(d)) 00105 { 00106 rcs_print("bad return value from emcSpindleSetOffWait\n"); 00107 retval = -1; 00108 } 00109 #endif 00110 00111 } 00112 // else ignore omission 00113 00114 if (NULL != (inistring = spindleInifile->find("SPINDLE_ON_WAIT", "EMCIO"))) 00115 { 00116 #ifndef UNDER_CE 00117 if (1 == sscanf(inistring, "%lf", &d)) 00118 { 00119 // found, and valid 00120 if (0 != emcSpindleSetOnWait(d)) 00121 { 00122 printf("bad return value from emcSpindleSetOnWait\n"); 00123 retval = -1; 00124 } 00125 } 00126 else 00127 { 00128 // found, but invalid, so warn 00129 printf("invalid inifile value for SPINDLE_ON_WAIT: %s\n", 00130 inistring); 00131 } 00132 #else 00133 d = RCS_CE_ATOF(inistring); 00134 if (0 != emcSpindleSetOnWait(d)) 00135 { 00136 rcs_print("bad return value from emcSpindleSetOnWait\n"); 00137 retval = -1; 00138 } 00139 #endif 00140 } 00141 // else ignore omission 00142 00143 if (NULL != (inistring = spindleInifile->find("SPINDLE_FORWARD_INDEX", "EMCIO"))) 00144 { 00145 #ifndef UNDER_CE 00146 if (1 == sscanf(inistring, "%d", &i)) 00147 { 00148 // found, and valid 00149 if (0 != emcSpindleSetForwardIndex(i)) 00150 { 00151 printf("bad return value from emcSpindleSetForwardIndex\n"); 00152 retval = -1; 00153 } 00154 } 00155 else 00156 { 00157 // found, but invalid, so warn 00158 printf("invalid inifile value for SPINDLE_FORWARD_INDEX: %s\n", 00159 inistring); 00160 } 00161 #else 00162 i = atol(inistring); 00163 if (0 != emcSpindleSetForwardIndex(i)) 00164 { 00165 rcs_print("bad return value from emcSpindleSetForwardIndex\n"); 00166 retval = -1; 00167 } 00168 #endif 00169 } 00170 // else ignore omission 00171 00172 if (NULL != (inistring = spindleInifile->find("SPINDLE_REVERSE_INDEX", "EMCIO"))) 00173 { 00174 #ifndef UNDER_CE 00175 if (1 == sscanf(inistring, "%d", &i)) 00176 { 00177 // found, and valid 00178 if (0 != emcSpindleSetReverseIndex(i)) 00179 { 00180 printf("bad return value from emcSpindleSetReverseIndex\n"); 00181 retval = -1; 00182 } 00183 } 00184 else 00185 { 00186 // found, but invalid, so warn 00187 printf("invalid inifile value for SPINDLE_REVERSE_INDEX: %s\n", 00188 inistring); 00189 } 00190 #else 00191 i = atol(inistring); 00192 if (0 != emcSpindleSetReverseIndex(i)) 00193 { 00194 rcs_print("bad return value from emcSpindleSetReverseIndex\n"); 00195 retval = -1; 00196 } 00197 #endif 00198 } 00199 // else ignore omission 00200 00201 if (NULL != (inistring = spindleInifile->find("SPINDLE_DECREASE_INDEX", "EMCIO"))) 00202 { 00203 #ifndef UNDER_CE 00204 if (1 == sscanf(inistring, "%d", &i)) 00205 { 00206 // found, and valid 00207 if (0 != emcSpindleSetDecreaseIndex(i)) 00208 { 00209 printf("bad return value from emcSpindleSetDecreaseIndex\n"); 00210 retval = -1; 00211 } 00212 } 00213 else 00214 { 00215 // found, but invalid, so warn 00216 printf("invalid inifile value for SPINDLE_DECREASE_INDEX: %s\n", 00217 inistring); 00218 } 00219 #else 00220 i = atol(inistring); 00221 if (0 != emcSpindleSetDecreaseIndex(i)) 00222 { 00223 rcs_print("bad return value from emcSpindleSetDecreaseIndex\n"); 00224 retval = -1; 00225 } 00226 #endif 00227 } 00228 // else ignore omission 00229 00230 if (NULL != (inistring = spindleInifile->find("SPINDLE_INCREASE_INDEX", "EMCIO"))) 00231 { 00232 #ifndef UNDER_CE 00233 if (1 == sscanf(inistring, "%d", &i)) 00234 { 00235 // found, and valid 00236 if (0 != emcSpindleSetIncreaseIndex(i)) 00237 { 00238 printf("bad return value from emcSpindleSetIncreaseIndex\n"); 00239 retval = -1; 00240 } 00241 } 00242 else 00243 { 00244 // found, but invalid, so warn 00245 printf("invalid inifile value for SPINDLE_INCREASE_INDEX: %s\n", 00246 inistring); 00247 } 00248 #else 00249 i = atol(inistring); 00250 if (0 != emcSpindleSetIncreaseIndex(i)) 00251 { 00252 rcs_print("bad return value from emcSpindleSetIncreaseIndex\n"); 00253 retval = -1; 00254 } 00255 #endif 00256 } 00257 // else ignore omission 00258 00259 if (NULL != (inistring = spindleInifile->find("SPINDLE_BRAKE_INDEX", "EMCIO"))) 00260 { 00261 #ifndef UNDER_CE 00262 if (1 == sscanf(inistring, "%d", &i)) 00263 { 00264 // found, and valid 00265 if (0 != emcSpindleSetBrakeIndex(i)) 00266 { 00267 printf("bad return value from emcSpindleSetBrakeIndex\n"); 00268 retval = -1; 00269 } 00270 } 00271 else 00272 { 00273 // found, but invalid, so warn 00274 printf("invalid inifile value for SPINDLE_BRAKE_INDEX: %s\n", 00275 inistring); 00276 } 00277 #else 00278 i = atol(inistring); 00279 if (0 != emcSpindleSetBrakeIndex(i)) 00280 { 00281 rcs_print("bad return value from emcSpindleSetBrakeIndex\n"); 00282 retval = -1; 00283 } 00284 #endif 00285 } 00286 // else ignore omission 00287 00288 if (NULL != (inistring = spindleInifile->find("SPINDLE_ENABLE_INDEX", "EMCIO"))) 00289 { 00290 #ifndef UNDER_CE 00291 if (1 == sscanf(inistring, "%d", &i)) 00292 { 00293 // found, and valid 00294 if (0 != emcSpindleSetEnableIndex(i)) 00295 { 00296 printf("bad return value from emcSpindleSetEnableIndex\n"); 00297 retval = -1; 00298 } 00299 } 00300 else 00301 { 00302 // found, but invalid, so warn 00303 printf("invalid inifile value for SPINDLE_ENABLE_INDEX: %s\n", 00304 inistring); 00305 } 00306 #else 00307 i = atol(inistring); 00308 if (0 != emcSpindleSetEnableIndex(i)) 00309 { 00310 rcs_print("bad return value from emcSpindleSetEnableIndex\n"); 00311 retval = -1; 00312 } 00313 #endif 00314 } 00315 // else ignore omission 00316 00317 if (NULL != (inistring = spindleInifile->find("SPINDLE_ON_INDEX", "EMCIO"))) 00318 { 00319 #ifndef UNDER_CE 00320 if (1 == sscanf(inistring, "%d", &i)) 00321 { 00322 // found, and valid 00323 if (0 != emcSpindleSetOnIndex(i)) 00324 { 00325 printf("bad return value from emcSpindleSetOnIndex\n"); 00326 retval = -1; 00327 } 00328 } 00329 else 00330 { 00331 // found, but invalid, so warn 00332 printf("invalid inifile value for SPINDLE_ON_INDEX: %s\n", 00333 inistring); 00334 } 00335 #else 00336 i = atol(inistring); 00337 if (0 != emcSpindleSetOnIndex(i)) 00338 { 00339 rcs_print("bad return value from emcSpindleSetOnIndex\n"); 00340 retval = -1; 00341 } 00342 #endif 00343 } 00344 // else ignore omission 00345 00346 if (NULL != (inistring = spindleInifile->find("SPINDLE_FORWARD_POLARITY", "EMCIO"))) 00347 { 00348 #ifndef UNDER_CE 00349 if (1 == sscanf(inistring, "%d", &i)) 00350 { 00351 // found, and valid 00352 if (0 != emcSpindleSetForwardPolarity(i)) 00353 { 00354 printf("bad return value from emcSpindleSetSpindleForwardPolarity\n"); 00355 retval = -1; 00356 } 00357 } 00358 else 00359 { 00360 // found, but invalid, so warn 00361 printf("invalid inifile value for SPINDLE_FORWARD_POLARITY: %s\n", 00362 inistring); 00363 } 00364 #else 00365 i = atol(inistring); 00366 if (0 != emcSpindleSetForwardPolarity(i)) 00367 { 00368 rcs_print("bad return value from emcSpindleSetForwardPolarity\n"); 00369 retval = -1; 00370 } 00371 #endif 00372 } 00373 // else ignore omission 00374 00375 if (NULL != (inistring = spindleInifile->find("SPINDLE_REVERSE_POLARITY", "EMCIO"))) 00376 { 00377 #ifndef UNDER_CE 00378 if (1 == sscanf(inistring, "%d", &i)) 00379 { 00380 // found, and valid 00381 if (0 != emcSpindleSetReversePolarity(i)) 00382 { 00383 printf("bad return value from emcSpindleSetReversePolarity\n"); 00384 retval = -1; 00385 } 00386 } 00387 else 00388 { 00389 // found, but invalid, so warn 00390 printf("invalid inifile value for SPINDLE_REVERSE_POLARITY: %s\n", 00391 inistring); 00392 } 00393 #else 00394 i = atol(inistring); 00395 if (0 != emcSpindleSetReversePolarity(i)) 00396 { 00397 rcs_print("bad return value from emcSpindleSetReversePolarity\n"); 00398 retval = -1; 00399 } 00400 #endif 00401 } 00402 // else ignore omission 00403 00404 if (NULL != (inistring = spindleInifile->find("SPINDLE_DECREASE_POLARITY", "EMCIO"))) 00405 { 00406 #ifndef UNDER_CE 00407 if (1 == sscanf(inistring, "%d", &i)) 00408 { 00409 // found, and valid 00410 if (0 != emcSpindleSetDecreasePolarity(i)) 00411 { 00412 printf("bad return value from emcSpindleSetDecreasePolarity\n"); 00413 retval = -1; 00414 } 00415 } 00416 else 00417 { 00418 // found, but invalid, so warn 00419 printf("invalid inifile value for SPINDLE_DECREASE_POLARITY: %s\n", 00420 inistring); 00421 } 00422 #else 00423 i = atol(inistring); 00424 if (0 != emcSpindleSetDecreasePolarity(i)) 00425 { 00426 rcs_print("bad return value from emcSpindleSetDecreasePolarity\n"); 00427 retval = -1; 00428 } 00429 #endif 00430 } 00431 // else ignore omission 00432 00433 if (NULL != (inistring = spindleInifile->find("SPINDLE_INCREASE_POLARITY", "EMCIO"))) 00434 { 00435 #ifndef UNDER_CE 00436 if (1 == sscanf(inistring, "%d", &i)) 00437 { 00438 // found, and valid 00439 if (0 != emcSpindleSetIncreasePolarity(i)) 00440 { 00441 printf("bad return value from emcSpindleSetIncreasePolarity\n"); 00442 retval = -1; 00443 } 00444 } 00445 else 00446 { 00447 // found, but invalid, so warn 00448 printf("invalid inifile value for SPINDLE_INCREASE_POLARITY: %s\n", 00449 inistring); 00450 } 00451 #else 00452 i = atol(inistring); 00453 if (0 != emcSpindleSetForwardPolarity(i)) 00454 { 00455 rcs_print("bad return value from emcSpindleSetForwardPolarity\n"); 00456 retval = -1; 00457 } 00458 #endif 00459 } 00460 // else ignore omission 00461 00462 if (NULL != (inistring = spindleInifile->find("SPINDLE_BRAKE_POLARITY", "EMCIO"))) 00463 { 00464 #ifndef UNDER_CE 00465 if (1 == sscanf(inistring, "%d", &i)) 00466 { 00467 // found, and valid 00468 if (0 != emcSpindleSetBrakePolarity(i)) 00469 { 00470 printf("bad return value from emcSpindleSetBrakePolarity\n"); 00471 retval = -1; 00472 } 00473 } 00474 else 00475 { 00476 // found, but invalid, so warn 00477 printf("invalid inifile value for SPINDLE_BRAKE_POLARITY: %s\n", 00478 inistring); 00479 } 00480 #else 00481 i = atol(inistring); 00482 if (0 != emcSpindleSetBrakePolarity(i)) 00483 { 00484 rcs_print("bad return value from emcSpindleSetBrakePolarity\n"); 00485 retval = -1; 00486 } 00487 #endif 00488 } 00489 // else ignore omission 00490 00491 if (NULL != (inistring = spindleInifile->find("SPINDLE_ENABLE_POLARITY", "EMCIO"))) 00492 { 00493 #ifndef UNDER_CE 00494 if (1 == sscanf(inistring, "%d", &i)) 00495 { 00496 // found, and valid 00497 if (0 != emcSpindleSetEnablePolarity(i)) 00498 { 00499 printf("bad return value from emcSpindleSetEnablePolarity\n"); 00500 retval = -1; 00501 } 00502 } 00503 else 00504 { 00505 // found, but invalid, so warn 00506 printf("invalid inifile value for SPINDLE_ENABLE_POLARITY: %s\n", 00507 inistring); 00508 } 00509 #else 00510 i = atol(inistring); 00511 if (0 != emcSpindleSetEnablePolarity(i)) 00512 { 00513 rcs_print("bad return value from emcSpindleSetEnablePolarity\n"); 00514 retval = -1; 00515 } 00516 #endif 00517 } 00518 // else ignore omission 00519 00520 return retval; 00521 } |
|
Definition at line 30 of file inispin.cc. |