/* * Function name: main() * Function prototype: int main ( int argc, char *argv[] ); * Description: C main driver which calls C and SPARC assembly routines to print two * squares within each other made of two different characters * Parameters: * arg 1: int argc -- integer count for the number of arguments in argv * arg 2: char *argv[] -- array of string inputs * Side Effects: Outputs two squares within each other made of different chars. * Error Conditions: None * Return Value: 0 */ int main (int argc, char *argv[]) { if(argc != 5) { (void) printf("Usage: pa1 outer_sq_sz inner_sq_sz outer_sq_ch inner_sq_ch\n"); (void) printf(" outer_sq_sz (must be within the range of [%d - %d]\n" , OUTER_SQUARE_MIN, OUTER_SQUARE_MAX ); (void) printf(" inner_sq_sz (must be within the range of [%d - %d]\n" , INNER_SQUARE_MIN, INNER_SQUARE_MIN ); (void) printf(" (must be smaller than outer_sq_sz)\n" ); (void) printf(" (must be odd if outer_sq_sz is odd)\n" ); (void) printf(" (must be even if outer_sq_sz is even)\n" ); (void) printf(" outer_sq_ch (must be an ASCII value within the range [%d - %d]\n" , ASCII_MIN, ASCII_MAX ); (void) printf(" inner_sq_ch (must be an ASCII value within the range [%d - %d]\n" , ASCII_MIN, ASCII_MAX ); (void) printf(" (must be different than outer_sq_ch)\n" ); }/*END IF to check if user knows how to use or not */ else { int noError = 0; /* Holds if all data is correct values and in the ranges allowed. */ long num1 = strToLong(argv[1], BASE); /*Holds the outer square size*/ if(checkRange(num1, OUTER_SQUARE_MIN, OUTER_SQUARE_MAX) != 1 && errno == 0) { (void) printf("\n outer_sq_sz(%ld) must be within the range of [%d - %d]\n", num1, OUTER_SQUARE_MIN, OUTER_SQUARE_MAX ); noError = 1; }/*END IF to check that integer is within the range*/ long num2 = strToLong(argv[2], BASE); /*Holds the inner square size*/ if(checkRange(num2, INNER_SQUARE_MIN, INNER_SQUARE_MAX) != 1 && errno == 0) { (void) printf("\n inner_sq_sz(%ld) must be within the range of [%d - %d]\n", num2, INNER_SQUARE_MIN, INNER_SQUARE_MAX ); noError = 1; }/*END IF to check that integer is within the range*/ if( num2 >= num1 && (num1 != -1 && num2 != -1)) { (void) printf("\n inner_sq_sz(%ld) must be less than outer_sq_sz(%ld)\n", num2, num1); noError = 1; }/*end if to check that the second integer passed in is less than the first integer*/ if(isOdd(num2) != isOdd(num1) && (num1 != -1 && num2 != -1)) { (void) printf("\n both outer_sq_sz(%ld) and inner_sq_sz(%ld) must be either odd or even\n", num1, num2); noError = 1; }/*end if to check that both integers are either odd or even*/ long num3 = strToLong(argv[3], BASE); /*Holds the outer square character*/ if(checkRange(num3, ASCII_MIN, ASCII_MAX) != 1 && errno == 0) { (void) printf("\n outer_sq_ch(%ld) must be an ASCII code in the range [%d - %d]\n", num3, ASCII_MIN, ASCII_MAX ); noError = 1; }/*END IF to check that ASCII code is in the range*/ long num4 = strToLong(argv[4], BASE); /*Holds the inner square character*/ if(checkRange(num4, ASCII_MIN, ASCII_MAX) != 1 && errno == 0) { (void) printf("\n inner_sq_ch(%ld) must be an ASCII code in the range [%d - %d]\n", num4, ASCII_MIN, ASCII_MAX ); noError = 1; }/*END IF to check that ASCII code is in the range*/ if(num4 == num3) { (void) printf("\n outer_sq_ch(%ld) and inner_sq_ch(%ld) must be different\n", num3, num4); noError = 1; }/*END IF to check that ASCII code is different*/ if(noError == 0) { displaySquare(num1, num2, num3, num4); }/*END IF to check if data is correct to be printed*/ }/*END ELSE to check that 5 arguments have been sent in from command line */ return 0; }/*END main*/
int main( int argc, char *argv[] ) { FILE *infile = stdin; //Used to hold pointer to file char *filename; //Used to hold file name char oBaseCopy[50]; //Used to hold a copy of the bases given char *oBase; //Used to hold the bases int outBase = 10; //Used to hold the outBase, default of 10 char *iBase; //Used to hold the iBases int inBase; //Used to hold the inBase, default of 10 char* pEnd; //Used to check if strtol checked all the way to the end or not char* token; //Used to check that all bases have been converted to or not char errorString[50]; //Used to hold a error string if error has been detected unsigned int mode = 0; //Used to hold the mode which tracks which flags are wanted int flag; //Used to track which flag is wanted int englishFlag = 0; //Used to track if english has been printed already or not int stopFlag = 0; //Used to track if error was detected in which case dont check char fileLines[50]; //Used to hold the numbers grabbed from file char* fileToken; //Used to track that all numbers grabbed have been processed char* savePoint; //Used to hold the savePoint of strtok_r if(argc == 1) { mode = mode | H_FLAG; }//END IF to check if no arguments were given errno = 0; while( (flag = getopt(argc, argv, ":ebhi:f:o:")) != -1 ) { switch(flag) { case 'e': mode = mode | E_FLAG; break; case 'b': mode = mode | B_FLAG; break; case 'h': mode = mode | H_FLAG; break; case 'i': mode = mode | I_FLAG; iBase = optarg; break; case 'o': mode = mode | O_FLAG; oBase = optarg; break; case 'f': mode = mode | F_FLAG; filename = optarg; break; case ':': mode = mode | H_FLAG; (void) printf("option requires an argument -- %c", optarg); break; default: mode = mode | H_FLAG; break; }//END SWITCH to set mode to all flags triggered }//END WHILE to check all flags triggered and sets mode to them if(mode & H_FLAG) { (void) printf("\nUsage: ./pa3test [-ebh] [-i input_base] "); (void) printf("[-o output_base(s)] -f input_file | numbers\n"); (void) printf("\t-e -- print number in english\n"); (void) printf("\t-b -- print floating point number (if floating "); (void) printf("point) in binary\n"); (void) printf("\t-h -- this help/usage message\n"); return 0; }//END IF to check if H_FLAG has been triggered or not if(mode & I_FLAG) { inBase = (int) strtol(iBase, &pEnd, 10); if(errno != 0) { (void) snprintf(errorString, 50, "\n\t Converting %s", iBase); (void) perror(errorString); }//END IF to check if ibase converted correctly or not else if(*pEnd != '\0') { (void) fprintf(stderr, "\n\t%s (input base) is not an integer.\n", iBase); errno = 0; return 0; }//END ELSE IF to check if ibase is a integer or not }//END IF To check if I_FLAG has been triggered or not else { inBase = 10; }//END ELSE to see if input base has been given or not if(optind == argc) { if(mode & O_FLAG) { token = strtok(oBase, ","); while(token != NULL) { stopFlag = 0; outBase = (int) strtol(token, &pEnd, 10); if(errno != 0) { (void) snprintf(errorString, 50, "\n\t Converting %s", token); (void) perror(errorString); }//END IF to check if strtol conversion was succesful or not else if(*pEnd != '\0') { (void) fprintf(stderr, "\n\t%s (output base) is not an integer\n", token); errno = 0; stopFlag = 1; }//END ELSE IF to check if base is a integer or not if(stopFlag == 0 &&(checkRange(outBase, MIN_BASE, MAX_BASE) != 1 )) { (void) fprintf(stderr, "\t%d - invalid output base; valid input", outBase); (void) fprintf(stderr, " base range [2 - 36]\n"); }//END IF to check if bases given are in range or not token = strtok(NULL, ","); }//END WHILE to check all the bases given }//END IF to check if O_FLAG has been triggered or not }//END IF to check if no numbers have been given or not if(mode & E_FLAG) { englishFlag = 1; }//END IF to check if english has been selected or not if(mode & F_FLAG) { infile = fopen(filename, "r"); if(infile == NULL) { (void) fprintf(stderr, "\t%s: No such file or directory\n", filename); return 0; }//END IF to check if input file given is found or not while(fgets(fileLines, 50,infile) != NULL) { fileLines[strlen(fileLines) - 1] = '\0'; fileToken = strtok_r(fileLines, " ", &savePoint); while(fileToken != NULL) { if(englishFlag == 1) { mode = mode | E_FLAG; }//END IF to check if english has been printed or not yet if( strchr(fileToken,'.') != NULL) { (void) printf("%s\n", fileToken); processFPToken(fileToken, mode); (void) printf("\n"); }//END IF to check if number is a float or not else { (void) printf("%s\n", fileToken); if(mode & O_FLAG) { (void) strcpy(oBaseCopy, oBase); token = strtok(oBaseCopy, ","); while(token != NULL) { stopFlag = 0; outBase = (int) strtol(token, &pEnd, 10); if(errno != 0) { (void) snprintf(errorString, 50, "\n\tConverting %s", token); (void) perror(errorString); }//END IF to check if strtol converted correctly else if(*pEnd != '\0') { (void) fprintf(stderr, "\n\t%s (output base) is not an integer\n", token); errno = 0; stopFlag = 1; }//END ELSE IF to check if output is a integer or not if(stopFlag == 0) { processIntToken(fileToken, inBase, outBase, mode); }//END IF to see if current number is a integer or not if(englishFlag == 1) { mode = mode & (~E_FLAG); }//END IF to check if english has already been printed or not token = strtok(NULL, ","); }//END WHILE loop to check if all bases have been printed or not }//END IF to check if 0_FLAG has been triggered or not else { processIntToken(fileToken, inBase, outBase, mode); mode = mode ^ E_FLAG; }//END ELSE to see if output base has been given or not in which case 10 is used }//END ELSE to check if number is a floating number or not (void) printf("\n"); fileToken = strtok_r(NULL, " ", &savePoint); }//END WHILE to check if all grabbed numbers have been printed or not }//END WHILE loop to check if all the numbers in file been printed or not return 0; }//END IF to check if F_Flag has been triggered or not while(optind < argc) { if(englishFlag == 1) { mode = mode | E_FLAG; }//END IF to check if it has been printed in english already or not if( strchr(argv[optind],'.') != NULL) { (void) printf("%s\n", argv[optind]); processFPToken(argv[optind], mode); (void) printf("\n"); }//END IF to check if its a floating point number or not else { (void) printf("%s\n", argv[optind]); if(mode & O_FLAG) { strcpy(oBaseCopy, oBase); token = strtok(oBaseCopy, ","); while(token != NULL) { stopFlag = 0; outBase = (int) strtol(token, &pEnd, 10); if(errno != 0) { (void) snprintf(errorString, 50, "\n\tConverting %s", token); (void) perror(errorString); }//END IF to check if conversion was succesful or not else if(*pEnd != '\0') { (void) fprintf(stderr, "\n\t%s (output base) is not an integer\n", token); errno = 0; stopFlag = 1; }//END ELSE IF to check if output base is a integer or not if(stopFlag == 0) { processIntToken(argv[optind], inBase, outBase, mode); }//END IF to check if error was detected or not, to not process it if(englishFlag == 1) { mode = mode & (~E_FLAG); }//END IF to check if english has been printed already or not token = strtok(NULL, ","); }//END WHILE loop to print in all outbases given }//END IF to check if O_FLAG has been triggered or not else { processIntToken(argv[optind], inBase, outBase, mode); mode = mode ^ E_FLAG; }//END ELSE to print with outbase 10 if not given by user }//END ELSE to check if its a floating point number or not (void) printf("\n"); optind++; }//END WHILE loop to check each number argument passed in return 0; }//END main
//==================================== void runMode(int stop) //==================================== { int ch,x,step,tmp,res=0,a=0,b=0,ir,ok=0,n=0; char tempName[80],syscom[120],temp[80]; char command[40][40]; strcpy(tempName,"help.txt"); s_mode = S_RUN; if(stop > 1) { if(stop > g_steps)stop = g_steps; //if(stop > currentStep) runAll(stop); return; } putMsg(3,"Run Mode. Press h for help."); while(1) { anyErrors(); if(g_silent==S_NO )mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode); if(g_silent==S_YES)mvwprintw(uno,board_h-2,1,"R%1d<",confWinMode); unoInfo(); if(g_debug == 1) readFile(confSketchFile,g_lineSketch[currentStep]); ch = getchar(); if (ch=='q') { return; } if (ch=='h') { readMsg(fileInfoRun); } else if (ch=='c') { readMsg(currentConf); } else if (ch=='d') { readMsg(fileServTime); } else if(ch=='y' ) // scenario { readMsg(fileServScen); } else if (ch=='x') { readMsg(fileServScenario); } else if (ch=='G') { runAll(g_steps); } else if (ch=='l') { showLoops(); } else if (ch=='s') { g_debug++; if(g_debug > 1)g_debug = 0; } else if (ch=='w') { confWinMode++; if(confWinMode > WIN_MODES)confWinMode = 0; init(confWinMode); mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode); unoInfo(); } else if (ch=='a') { goStep(1); } else if (ch=='r') { goStep(loopStep[currentLoop+1]); } else if (ch=='o') { goStep(loopStep[currentLoop]); } else if (ch=='p') { goStep(loopStep[currentLoop-1]); } else if (ch=='z') { goStep(g_steps); } else if (ch=='k') { resetSim(); init(confWinMode); unoInfo(); mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode); show(uno); } else if (ch=='f')// Up Arrow { goStep(currentStep+1); } else if (ch=='b')// Down Arrow { goStep(currentStep-1); } else if (ch=='R') // Right Arrow { runLoop(S_FORWARD); } else if (ch=='P') // Left Arrow { runLoop(S_BACKWARD); } else if (ch=='t') { runNextRead(); } else if (ch=='j') { runPrevRead(); } else if (ch=='i') { step = currentStep; sprintf(temp,"(Step:%d) Enter: d/a pin value (q - cancel)",step); putMsg(2,temp); wgetstr(uno,temp); n = tokCommand(command,temp); if(strstr(command[0],"q") == NULL && n == 3) { g_pinNo = atoi(command[1]); x = atoi(command[2]); printf("%s %d %d",command[0],g_pinNo,x); if(strstr(command[0],"a")) { ok = ok + checkRange(S_OK,"anapin",g_pinNo); ok = ok + checkRange(S_OK,"anaval",x); g_pinType = ANA; } if(strstr(command[0],"d")) { ok = ok + checkRange(S_OK,"digpin",g_pinNo); ok = ok + checkRange(S_OK,"digval",x); g_pinType = DIG; } if(ok == S_OK) { g_scenSource = 1; // steps, source, pintype, pinno, pinvalue, pinstep sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,x,currentStep,S_ADD); tmp=system(syscom); initSim(); readSketchInfo(); readSimulation(); goStep(currentStep); readMsg(fileServScen); } } else putMsg(2,"Cancelled!"); } else if (ch=='v') { step = currentStep ; sprintf(temp," Enter value to be read at step %d (q - cancel)",step); putMsg(2,temp); res = analyzeEvent(simulation[step]); if(res > 0) { wgetstr(uno,temp); if(strstr(temp,"q") == NULL) { x = atoi(temp); ok = S_OK; if(res == ANA)ok = ok + checkRange(S_OK,"anaval",x); if(res == DIG)ok = ok + checkRange(S_OK,"digval",x); if(ok == S_OK) { g_scenSource = 1; // steps, source, pintype, pinno, pinvalue, pinstep sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,x,currentStep,S_ADD); tmp=system(syscom); initSim(); readSketchInfo(); readSimulation(); goStep(currentStep); readMsg(fileServScen); } } else putMsg(2,"Cancelled!"); } else putMsg(2,"Next step is not a Read event"); } else { sprintf(temp,"Unknown command: %c",ch); putMsg(msg_h-2,temp); } } return; }
Range::Range() :myLow( Pitch( NoteName( Step::a, 0 ), -2 ) ) ,myHigh( Pitch( NoteName( Step::c, 0 ), 9 ) ) { checkRange( myLow, myHigh ); }
bool checkMagnitude(const Eigen::MatrixBase<DerivedA>& mm, typename DerivedA::Scalar magnitude = 1e10) { return checkRange(mm, -1 * std::abs(magnitude), std::abs(magnitude)); }
inline ElemType &Vector<ElemType>::operator[](int index) { checkRange(index, "access"); return elements[index]; }
/* * constructor: note that the ra and dec args are both in degrees */ WorldCoords::WorldCoords(double ra, double dec, double equinox) : ra_(ra/15), dec_(dec) { dec_.show_sign(1); status_ = checkRange() || convertEquinox(equinox); }
void RPG::generatePassword() { // QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); setVariables(); if(checkRange()) return; char specialCharacters[31]={'!','@','#','$','%','^','&','*','(',')','-','_','+','=','{','}', '[',']','|','\\',':',';','\'','"',',','.','<','>','?','/'}; time_t t; srand(time(&t)); int i; int total=0; char *upperCaseCharacters=0; char *lowerCaseCharacters=0; char *numbers=0; char *special_Characters=0; char *password; QList<char*> processedCharacters; QList<int> autoGenList; if(numOfLowerCaseLetters != -1) { if(numOfLowerCaseLetters) { lowerCaseCharacters = new char[numOfLowerCaseLetters+1]; for(i=0;i<numOfLowerCaseLetters;++i) { lowerCaseCharacters[i] = rand()%26 + 97; } lowerCaseCharacters[i]='\0'; total += numOfLowerCaseLetters; processedCharacters << lowerCaseCharacters; } } else { autoGenList << autoGenLowerCaseCharacters; } if(numOfUpperCaseLetters !=-1) { if(numOfUpperCaseLetters) { upperCaseCharacters = new char[numOfUpperCaseLetters+1]; for(i=0;i<numOfUpperCaseLetters;++i) { upperCaseCharacters[i] = rand()%26 + 65; } upperCaseCharacters[i]='\0'; total += numOfUpperCaseLetters; processedCharacters << upperCaseCharacters; } } else { autoGenList << autoGenUpperCaseCharacters; } if(numOfDigits != -1) { if(numOfDigits) { numbers = new char[numOfDigits+1]; for(i=0;i<numOfDigits;++i) { numbers[i] = rand()%10 + 48; } numbers[i]='\0'; total += numOfDigits; processedCharacters << numbers; } } else { autoGenList << autoGenNumbers; } if(numOfSpecialCharacters != -1) { if(numOfSpecialCharacters) { special_Characters = new char[numOfSpecialCharacters+1]; for(i=0;i<numOfSpecialCharacters;++i) { special_Characters[i] = specialCharacters[rand()%30]; } special_Characters[i]='\0'; total += numOfSpecialCharacters; processedCharacters << special_Characters; } } else { autoGenList << autoGenSpecialCharacters; } if(total >= passwordLength || (total<passwordLength && autoGenList.isEmpty())) { ui->lengthSpinBox->setValue(total); for(i=0;i<autoGenList.size();i++) { switch(autoGenList[i]) { case autoGenLowerCaseCharacters : emit ui->lowerCheckBox->setChecked(false); ui->lowerSpinBoxEnabler->setEnabled(false); break; case autoGenUpperCaseCharacters: ui->upperCheckBox->setChecked(false); ui->upperSpinBoxEnabler->setEnabled(false); break; case autoGenNumbers: ui->numberCheckBox->setChecked(false); ui->numberSpinBoxEnabler->setEnabled(false); break; case autoGenSpecialCharacters: ui->specialCheckBox->setChecked(false); ui->specialSpinBoxEnabler->setEnabled(false); } } } else { int remaining = passwordLength -total; int totalRatio=0; QList<int> numOfCharcters; numOfCharcters << 0 << 0 << 0 << 0; for(i=0;i<autoGenList.size() && remaining;i++) { switch(autoGenList[i]) { case autoGenLowerCaseCharacters : numOfCharcters[0] = 1; totalRatio +=6; break; case autoGenUpperCaseCharacters: numOfCharcters[1] = 1; totalRatio +=6; break; case autoGenNumbers: numOfCharcters[2] = 1; totalRatio +=3; break; case autoGenSpecialCharacters: numOfCharcters[3] = 1; totalRatio +=1; } remaining--; } if(remaining) { int x = remaining / totalRatio; int add; if(x) { for(i=0;i<autoGenList.size();++i) { switch(autoGenList[i]) { case autoGenLowerCaseCharacters : add = x * 6; numOfCharcters[0] += add ; break; case autoGenUpperCaseCharacters: add = x * 6; numOfCharcters[1] += add; break; case autoGenNumbers: add = x * 3; numOfCharcters[2] += add; break; case autoGenSpecialCharacters: add = x * 1; numOfCharcters[3] += add; } remaining = remaining - add; } } while(remaining) { for(i=0;i<autoGenList.size()&&remaining;++i) { switch(autoGenList[i]) { case autoGenLowerCaseCharacters : numOfCharcters[0]++; break; case autoGenUpperCaseCharacters: numOfCharcters[1]++; break; case autoGenNumbers: numOfCharcters[2]++; break; case autoGenSpecialCharacters: numOfCharcters[3]++; } remaining--; } } } int k; for(i=0;i<autoGenList.size();++i) { switch(autoGenList[i]) { case autoGenLowerCaseCharacters: if(numOfCharcters[0]) { lowerCaseCharacters = new char[numOfCharcters[0] + 1]; for(k=0;k<numOfCharcters[0];k++) { lowerCaseCharacters[k] = rand()%26 + 97; } lowerCaseCharacters[k] = '\0'; processedCharacters << lowerCaseCharacters; total += numOfCharcters[0]; } else { ui->lowerCheckBox->setChecked(false); ui->lowerSpinBoxEnabler->setEnabled(false); } break; case autoGenUpperCaseCharacters: if(numOfCharcters[1]) { upperCaseCharacters = new char[numOfCharcters[1] + 1]; for(k=0;k<numOfCharcters[1];k++) { upperCaseCharacters[k] = rand()%26 + 65; } upperCaseCharacters[k] = '\0'; processedCharacters << upperCaseCharacters; total += numOfCharcters[1]; } else { ui->upperCheckBox->setChecked(false); ui->upperSpinBoxEnabler->setEnabled(false); } break; case autoGenNumbers: if(numOfCharcters[2]) { numbers = new char[numOfCharcters[2] + 1]; for(k=0;k<numOfCharcters[2];k++) { numbers[k] = rand()%10 + 48; } numbers[k] = '\0'; processedCharacters << numbers; total += numOfCharcters[2]; } else { ui->numberCheckBox->setChecked(false); ui->numberSpinBoxEnabler->setEnabled(false); } break; case autoGenSpecialCharacters: if(numOfCharcters[3]) { special_Characters = new char[numOfCharcters[3] + 1]; for(k=0;k<numOfCharcters[3];k++) { special_Characters[k] = specialCharacters[rand()%30]; } special_Characters[k] = '\0'; processedCharacters << special_Characters; total += numOfCharcters[3]; } else { ui->specialCheckBox->setChecked(false); ui->specialSpinBoxEnabler->setEnabled(false); } break; } } Q_ASSERT(total == passwordLength); } int numOfTypes = processedCharacters.size(); QList<int> sizeOfType; for(i=0;i<numOfTypes;++i) sizeOfType << strlen(processedCharacters[i]); password = new char[total+1]; QList<int> l; l << 0 << 0 << 0 << 0; int j; int *order; order = new int[total]; if(total<=1000) { for(i=0;i<total;i++) order[i]=-1; int flag; i=0; int p; while(i<total) { j=rand()%total; flag=1; for(p=0;p<=i;p++) { if(order[p]==j) { flag=0; break; } } if(flag) { order[i]=j; i++; } } } else { for(i=0;i<total;i++) order[i]=i; } for(i=0;i<total;) { j=rand()%numOfTypes; if(l[j] < sizeOfType[j]) { password[order[i]] = processedCharacters[j][l[j]]; l[j]++; i++; } else { processedCharacters.removeAt(j); l.removeAt(j); sizeOfType.removeAt(j); numOfTypes--; } } password[total]='\0'; ui->passwordLineEdit->setText(password); // QApplication::restoreOverrideCursor(); delete lowerCaseCharacters; delete upperCaseCharacters; delete numbers; delete special_Characters; delete password; delete order; }
coVR1DTransInteractor::coVR1DTransInteractor(pfVec3 o, pfVec3 d, float min, float max, float val, float size, int showConstr, char *name) { pfMatrix wm, tm, sm; pfVec3 zaxis(0,0,1); origin = o; dir = d; dir.normalize(); minVal = min; maxVal = max; currVal = val; interSize = size; interactorName= new char[strlen(name)+1]; strcpy(interactorName, name); if ((showConstr == SHOW_CONSTRAINTS_ALWAYS) || (showConstr == SHOW_CONSTRAINTS_ONTOUCH) || (showConstr == SHOW_CONSTRAINTS_ONSELECT)) showConstraints = showConstr; else { fprintf(stderr,"\nERROR in coVR1DTransInteractor::coVR1DTransInteractor\n"); fprintf(stderr,"\tillegal value [%d] for showConstraints\n", showConstr); showConstraints = SHOW_CONSTRAINTS_ALWAYS; } float interScale = size/cover->getScale(); fprintf(stderr,"interactor size=%f cover scale = %f\n", interSize, cover->getScale()); // initialize flags interactionOngoing = false; isI = false; isS = false; isE = false; justHit = true; // get debug level const char *line = CoviseConfig::getEntry("COVERConfig.DEBUG_LEVEL"); if (line) sscanf(line,"%d", &debugLevel); else debugLevel = 0; // debugprint if (debugLevel>0) { fprintf(stderr,"\ncoVR1DTransInteractor:coVR1DTransInteractor [%s]\n", interactorName); fprintf(stderr,"\tshowConstraints=[%d]\n", showConstraints); fprintf(stderr,"\torigin=[%f %f %f]\n", origin[0], origin[1], origin[2]); fprintf(stderr,"\tdir=[%f %f %f]\n", dir[0], dir[1], dir[2]); fprintf(stderr,"\tminVal=[%f] maxVal=[%f] currVal=[%f]\n", minVal, maxVal, currVal); } // check and adjust the ranges checkRange(); // load geostates only once geostate = loadDefaultGeostate(); unlightedGeostate = loadUnlightedGeostate(); // objectsRoot // | // worldDCS // | // interactorRoot // | | // lineGeode sphereTransDCS // | // sphereScaleDCS // | // sphereGeode if(debugLevel>1) fprintf(stderr,"\tcreating the scenegraph\n"); objectsRoot = cover->getObjectsRoot(); worldDCS = new pfDCS(); wm.makeVecRotVec(zaxis, dir); wm[3][0] = origin[0]; wm[3][1] = origin[1]; wm[3][2] = origin[2]; worldDCS->setMat(wm); interactorRoot = new pfGroup(); sphereTransDCS = new pfDCS(); tm.makeTrans(0, 0, currVal); sphereTransDCS->setMat(tm); sphereScaleDCS = new pfDCS(); sm.makeScale(interScale, interScale, interScale); sphereScaleDCS->setMat(sm); sphereGeode = createSphere(); lineGeode = createLine(); objectsRoot->addChild(worldDCS); worldDCS->addChild(interactorRoot); interactorRoot->addChild(lineGeode); interactorRoot->addChild(sphereTransDCS); sphereTransDCS->addChild(sphereScaleDCS); sphereScaleDCS->addChild(sphereGeode); if (showConstraints == SHOW_CONSTRAINTS_ALWAYS) showLine(); else hideLine(); if(debugLevel>1) fprintf(stderr,"\tcreating the highlights\n"); // highlights isectedHl = new pfHighlight(); isectedHl->setMode(PFHL_FILL); isectedHl->setColor(PFHL_FGCOLOR, 0.6, 0.6, 0.0); isectedHl->setLineWidth(3.0); selectedHl = new pfHighlight(); selectedHl->setMode(PFHL_FILL); selectedHl->setColor(PFHL_FGCOLOR, 0.0, 0.6, 0.0); selectedHl->setLineWidth(3.0); }
Rate ZeroInflationTermStructure::zeroRate(Time t, bool extrapolate) const { checkRange(t, extrapolate); return zeroRateImpl(t); }
Rate YoYInflationTermStructure::yoyRate(Time t, bool extrapolate) const { checkRange(t, extrapolate); return yoyRateImpl(t); }
bool mod_base::checkRange(std::string range, int &val, int *flag) { double dval = double(val); return checkRange(range, dval, flag); };
int main (void) { // Assign default values to variables base and exponent // (I picked 5 and 2 as defaults because I felt like it) int base = 5, exponent = 2; // Create an exit condition for when the user tries to exit int exiting = 0; // Create an input buffer for deciding whether or not to // use inputted values int input = 0; while (!exiting) { printf("Power Menu:\n"); printf("\t1. Change base\n"); printf("\t2. Change exponent\n"); printf("\t3. Display base raised to exponent\n"); printf("\t4. Exit Program\n"); printf("\n"); printf("Option? "); input = getNum(); if (checkRange(input, 1, 4)) { switch (input) { case 1: // Get the base from the user printf("Please enter a base: "); input = getNum(); // Check if it is between our preset range if (checkRange(input, 1, 25)) { // If it is, make it our base base = input; } else { // If it isn't, ignore it and use default values printf("The value %d is out of range. Defaulting to %d\r\n", input, base); } break; case 2: // Get the base from the user printf("Please enter an exponent: "); input = getNum(); // Check if it is between our preset range if (checkRange(input, 1, 5)) { // If it is, make it our base exponent = input; } else { // If it isn't, ignore it and use default values printf("The value %d is out of range. Defaulting to %d\r\n", input, exponent); } break; case 3: // Print the calculated power printf("%d to the power of %d is %d\r\n\r\n", base, exponent, feelThePower(base, exponent)); break; case 4: printf("Exiting..."); exiting = 1; break; } } else { printf("Invalid input.\n"); } printf("\n"); } }
int& MapMatrix::at(const int x, const int y) { assert(checkRange(x, y)); return m_data[toIndex(x, y)]; }
ElemType Vector<ElemType>::getAt(int index) { checkRange(index, "getAt"); return elements[index]; }
PrintDialog::PrintDialog( QWidget *parent, const char *name, int maxPages, bool marked ) : QDialog( parent, name, TRUE ) { setFocusPolicy(QWidget::StrongFocus); pgMode = All; /* printerName.sprintf( "" ); // default printer will be chosen. spoolerCommand.sprintf( "lpr" ); printerVariable.sprintf( "PRINTER" ); */ KConfig *config = KApplication::getKApplication()->getConfig(); /* Read in the default options. */ config->setGroup( "Print" ); printerName=config->readEntry ("Name",""); spoolerCommand=config->readEntry ("Spool","lpr"); printerVariable=config->readEntry ("Variable","PRINTER"); pgMax = maxPages; pgStart=0; pgEnd=0; int border = 10; QBoxLayout *topLayout = new QVBoxLayout( this, border ); cbFile = new QCheckBox( i18n("Print to file"), this ); cbFile->setFixedHeight( cbFile->sizeHint().height() ); topLayout->addWidget( cbFile ); QGroupBox *group = new QGroupBox( i18n( "Pages" ), this ); topLayout->addWidget( group, 10 ); QGridLayout *grid = new QGridLayout( group, 5, 7, 5 ); grid->setRowStretch( 0, 10 ); grid->setRowStretch( 1, 100 ); grid->setRowStretch( 2, 0 ); grid->setRowStretch( 3, 100 ); grid->setRowStretch( 4, 10 ); grid->setColStretch( 0, 0 ); grid->setColStretch( 1, 100 ); grid->setColStretch( 2, 100 ); grid->setColStretch( 3, 100 ); grid->setColStretch( 4, 0 ); grid->setColStretch( 5, 100 ); grid->setColStretch( 6, 0 ); pgGroup = new QButtonGroup( group ); pgGroup->hide(); pgGroup->setExclusive( true ); connect( pgGroup, SIGNAL( clicked( int ) ), SLOT( slotPageMode( int ) ) ); int widest = 0; QRadioButton *arb = new QRadioButton( i18n("&All"), group ); arb->setFixedHeight( arb->sizeHint().height()+6 ); arb->setChecked( true ); pgGroup->insert( arb, All ); grid->addWidget( arb, 1, 1 ); if ( arb->sizeHint().width() > widest ) widest = arb->sizeHint().width(); QRadioButton *rb = new QRadioButton( i18n("&Current"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); pgGroup->insert( rb, Current ); grid->addWidget( rb, 1, 2 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); rb = new QRadioButton( i18n("&Marked"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); if ( !marked ) rb->setEnabled( false ); else { arb->setChecked ( false ); rb->setChecked ( true ); } pgGroup->insert( rb, Marked ); grid->addWidget( rb, 3, 1 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); rb = new QRadioButton( i18n("&Range"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); pgGroup->insert( rb, Range ); grid->addWidget( rb, 3, 2 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); leStart = new QLineEdit( group ); leStart->setFixedHeight( rb->sizeHint().height()+6 ); grid->addWidget( leStart, 3, 3 ); lTo = new QLabel( group ); lTo->setText( i18n("to") ); lTo->setAlignment( AlignCenter ); lTo->setMinimumSize( lTo->sizeHint() ); grid->addWidget( lTo, 3, 4 ); leEnd = new QLineEdit( group ); leEnd->setFixedHeight( rb->sizeHint().height()+6 ); grid->addWidget( leEnd, 3, 5 ); group->setMinimumSize( QSize( 4*widest+25, 4*(rb->sizeHint().height()+6) ) ); cbOrder = new QCheckBox( i18n("Print document in re&verse order"), this ); cbOrder->setFixedHeight( cbOrder->sizeHint().height() ); topLayout->addWidget( cbOrder ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); // CREATE BUTTONS KButtonBox *bbox = new KButtonBox( this ); QPushButton* setup = bbox->addButton( i18n("&Setup ...") ); connect( setup, SIGNAL(clicked()), SLOT( setup()) ); bbox->addStretch( 10 ); QPushButton* ok = bbox->addButton( i18n("&OK") ); connect( ok, SIGNAL(clicked()), SLOT( checkRange() ) ); QPushButton* cancel = bbox->addButton( i18n("&Cancel") ); connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); if ( marked ) slotPageMode( Marked ); else slotPageMode( All ); resize( 250, 0 ); }
void Vector<ElemType>::setAt(int index, ElemType elem) { checkRange(index, "setAt"); elements[index] = elem; }
int& MapMatrix::operator[](int index) { assert(checkRange(index)); return m_data[index]; }
/* * constructor: note that the ra arg is H:M:S, while dec is D:M:S */ WorldCoords::WorldCoords(const HMS& ra, const HMS& dec, double equinox) : ra_(ra), dec_(dec) { dec_.show_sign(1); status_ = checkRange() || convertEquinox(equinox); }
int MapMatrix::at(int index) const { assert(checkRange(index)); return m_data[index]; }
Range::Range( const Pitch& low, const Pitch& high ) :myLow( low ) ,myHigh( high ) { checkRange( myLow, myHigh ); }
int MapMatrix::at(int x, int y) const { assert(checkRange(x, y)); return m_data[toIndex(x, y)]; }
int main(int argc, char* argv[]) { long parsed_arg[4]; /* [0] diamond_size [1] diamond_char [2] bg_char [3] border_char */ long valid_range[4][2] = { {3, 77}, {32, 126}, {32, 126}, {32, 126} }; if (argc != 5) { fprintf(stderr, "%s: Wrong number of arguments\n", argv[0]); fprintf(stderr, "Usage: %s X_size X_char bg_char border_char\n", argv[0]); fprintf(stderr, "diamond_size (odd number within the range of [3 - 77])\n" "diamond_char (ASCII value within the range [32 - 126])\n" "bg_char (ASCII value within the range [32 - 126])\n" " (must be different than X_char)\n" "border_char (ASCII value within the range [32 - 126])\n" " (must be different than X_char)\n" ); return 1; } int parsed_i; int parsed_max = argc-1; int anyerror = 0; for (parsed_i = 0; parsed_i < parsed_max; parsed_i++) { int argi = parsed_i + 1; /* index in argv is offset by 1 from parsed */ errno = 0; parsed_arg[parsed_i] = strtol(argv[argi], NULL, 0); if (errno) { fprintf(stderr, "\"%s\": ", argv[argi]); perror("strtol"); anyerror = 1; } } /* opportunity to bail out here because all the validation below depends on having parsed actual integers out of the cmd line args */ if (anyerror) { return 1; } for (parsed_i = 0; parsed_i < parsed_max; parsed_i++) { if (!checkRange(valid_range[parsed_i][0], valid_range[parsed_i][1], parsed_arg[parsed_i])) { fprintf(stderr, "%ld needs to be within the range [%ld - %ld]\n", parsed_arg[parsed_i], valid_range[parsed_i][0], valid_range[parsed_i][1]); anyerror = 1; } } /* certain argument values must be different from each other */ if (parsed_arg[1] == parsed_arg[2]) { fprintf(stderr, "diamond_char must be different from bg_char\n"); anyerror = 1; } if (parsed_arg[1] == parsed_arg[3]) { fprintf(stderr, "diamond_char must be different from border_char\n"); anyerror = 1; } /* diamond size must be odd */ if (!isOdd(parsed_arg[0])) { fprintf(stderr, "diamond_char literally can't even\n"); anyerror = 1; } if (anyerror) { return 1; } displayDiamond(parsed_arg[0], parsed_arg[1], parsed_arg[2], parsed_arg[3]); return 0; }
void MapMatrix::set(int index, int val) { assert(checkRange(index)); m_data[index] = val; }
bool checkMagnitude(const Eigen::Quaternion<DerivedA>& qq, double magnitude = 1e10) { return checkRange(qq, -1 * std::abs(magnitude), std::abs(magnitude)); }
void MapMatrix::set(int x, int y, int val) { assert(checkRange(x, y)); m_data[toIndex(x, y)] = val; }
//==================================== void openCommand() //==================================== { struct stat st; int ch,nsteps=1000,x,i,n,stop=0,loop,projNo = 0,ok=0,tmp; char *p,str[120],sstr[20],fileName[120],temp[120],syscom[120]; char command[40][40]; s_mode = S_ADMIN; g_silent = 0; readMsg(gplFile); while(strstr(str,"ex") == NULL) { anyErrors(); unoInfo(); wmove(uno,board_h-2,1); wprintw(uno," "); if(g_silent==S_NO )mvwprintw(uno,board_h-2,1,"A%1d>",confWinMode); if(g_silent==S_YES)mvwprintw(uno,board_h-2,1,"A%1d<",confWinMode); strcpy(command[0],""); wgetstr(uno,str); n = tokCommand(command,str); strcpy(sstr,command[0]); p = str; projNo = atoi(sstr); if(strstr(sstr,"gpl")) { readMsg(gplFile); } else if(strstr(sstr,"err")) { readMsg(fileTemp); } else if(strstr(sstr,"run")) { stop = 1; if(n == 2)stop = atoi(command[1]); stop = checkRange(HEAL,"step",stop); runMode(stop); if(stop==0)putMsg(2,"Back in Admin Mode!"); } else if(strstr(sstr,"res")) // reset simulation { resetSim(); init(confWinMode); unoInfo(); readMsg(currentConf); } else if(strstr(sstr,"help")) // { strcpy(fileName,fileInfoAdmin); readMsg(fileName); } else if(strstr(sstr,"rem")) // { if(n == 4) { if(strstr(command[1],"a"))g_pinType = ANA; if(strstr(command[1],"d"))g_pinType = DIG; g_pinNo = atoi(command[2]); g_pinStep = atoi(command[3]); if(g_pinType == ANA) ok = checkRange(S_OK,"anapin",g_pinNo); if(g_pinType == DIG) ok = checkRange(S_OK,"digpin",g_pinNo); if(ok == S_OK) { g_scenSource = 1; sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,0,g_pinStep,S_DELETE); //putMsg(2,syscom); tmp=system(syscom); initSim(); readSketchInfo(); readSimulation(); runStep(S_FORWARD); readMsg(fileServScen); } else putMsg(2,"Wrong pin number or pin type!"); } else putMsg(2,"Syntax: rem <a or d> <pin> <step>"); } else if(strstr(sstr,"add")) // { if(n == 5) { if(strstr(command[1],"a"))g_pinType = ANA; if(strstr(command[1],"d"))g_pinType = DIG; g_pinNo = atoi(command[2]); g_pinStep = atoi(command[3]); g_pinValue = atoi(command[4]); ok = S_OK; if(g_pinType == ANA) ok = checkRange(S_OK,"anapin",g_pinNo); if(g_pinType == DIG) ok = checkRange(S_OK,"digpin",g_pinNo); ok = ok + checkRange(S_OK,"step",g_pinStep); if(ok == S_OK) { g_scenSource = 1; sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,g_pinValue,g_pinStep,S_ADD); tmp=system(syscom); initSim(); readSketchInfo(); readSimulation(); runStep(S_FORWARD); readMsg(fileServScen); } } else putMsg(2,"Syntax: add <a or d> <pin> <step> <value>"); } else if(strstr(sstr,"info")) { if(n == 2) { if(strstr(command[1],"conf")) { readMsg(fileDefault); } else if(strstr(command[1],"err")) { readMsg(fileServError); } else if(strstr(command[1],"g++")) { readMsg(fileServComp); } else if(strstr(command[1],"help")) { readMsg(fileInfoAdmin); } else if(strstr(command[1],"loop")) { showLoops(); } else if(strstr(command[1],"scen")) // scenario { readMsg(fileServScen); } } else { readMsg(fileInfoAdmin); } } else if(strstr(sstr,"proj")) { if(n == 2) { strcpy(currentConf,command[1]); strcat(currentConf,".conf"); readConfig(currentConf); g_warning = S_YES; unoInfo(); } readMsg(currentConf); } else if(strstr(sstr,"list")) { readMsg(fileProjList); } else if(strstr(sstr,"sketch")) { if(n == 2) { if(strstr(command[1],"conf")) { readMsg(confSketchFile); } else if(strstr(command[1],"work")) { readMsg(fileServSketch); } } else readMsg(fileServSketch); } else if(strstr(sstr,"conf")) { if(n == 3) { if(strstr(command[1],"sim")) { confSteps = atoi(command[2]); } else if(strstr(command[1],"win")) { confWinMode = atoi(command[2]); if(confWinMode > WIN_MODES)confWinMode = 0; init(confWinMode); unoInfo(); } else if(strstr(command[1],"sketch")) { strcpy(temp,command[2]); if(stat(temp,&st) == 0) { strcpy(confSketchFile,command[2]); } else { sprintf(temp,"Sketch not found: %s",command[2]);// Issue 16 putMsg(msg_h-2,temp); } } saveConfig(currentConf); } readMsg(currentConf); } else if(strstr(sstr,"sav")) //save config { if(n == 2) { strcpy(currentConf,command[1]); strcat(currentConf,".conf"); } saveConfig(currentConf); readMsg(currentConf); sprintf(syscom,"ls *.conf > %s;",fileProjList); x=system(syscom); } else if(strstr(sstr,"del")) //delete config { if(n == 2) { strcpy(currentConf,command[1]); strcat(currentConf,".conf"); } if(strstr(currentConf,"default") == NULL) { sprintf(syscom,"rm %s;",currentConf); x=system(syscom); sprintf(syscom,"ls *.conf > %s;",fileProjList); x=system(syscom); readMsg(fileProjList); strcpy(currentConf,fileDefault); } } else if(strstr(sstr,"win")) //windows layout { if(n == 2) { confWinMode = atoi(command[1]); if(confWinMode > WIN_MODES)confWinMode = 0; init(confWinMode); unoInfo(); } } else if(strstr(sstr,"loop")) { if(n == 2)loop = atoi(command[1]); loop = checkRange(HEAL,"loop",loop); runLoops(loop); } else if(strstr(sstr,"clear")) { sprintf(syscom,"rm servuino/sketch.ino;rm servuino/data.su;rm servuino/data.scen;"); x=system(syscom); } else if(strstr(sstr,"load")) { if(n == 2) { confSteps = atoi(command[1]); } g_scenSource = 0; loadCurrentProj(); } else if(projNo > 0 && projNo < 10) { selectProj(projNo,currentConf); readConfig(currentConf); g_warning = S_YES; unoInfo(); readMsg(currentConf); } else if(strstr(sstr,"data")) { if(n == 2) { if(strstr(command[1],"ard")) { readMsg(fileServArduino); } else if(strstr(command[1],"cus")) { readMsg(fileServCustom); } else if(strstr(command[1],"cod")) { readMsg(fileServCode); } else if(strstr(command[1],"err")) { readMsg(fileServError); } else if(strstr(command[1],"sce")) { readMsg(fileServScen); } } else readMsg(fileServArduino); } else { putMsg(msg_h-2,"Unknown Admin command"); } } }
inline boost::shared_ptr<SmileSection> OptionletVolatilityStructure::smileSection(Time optionTime, bool extrapolate) const { checkRange(optionTime, extrapolate); return smileSectionImpl(optionTime); }
void testcheckRange() { printf( "Testing checkRange()\n" ); /* Test around 0 with range of size 0. */ TEST( checkRange( -1, 0, 0 ) == 0 ); TEST( checkRange( 0, 0, 0 ) == 1 ); TEST( checkRange( 1, 0, 0 ) == 0 ); /* Test around a negative range of size > 1. */ TEST( checkRange( -100, -99, -90 ) == 0 ); TEST( checkRange( -99, -99, -90 ) == 1 ); TEST( checkRange( -90, -99, -90 ) == 1 ); TEST( checkRange( -89, -99, -90 ) == 0 ); /* Test around a positive range of size 1. */ TEST( checkRange( 99, 100, 101 ) == 0 ); TEST( checkRange( 100, 100, 101 ) == 1 ); TEST( checkRange( 101, 100, 101 ) == 1 ); TEST( checkRange( 102, 100, 101 ) == 0 ); /* Test MIN and MAX int values with range of size 0. */ TEST( checkRange( LONG_MIN, LONG_MIN, LONG_MIN ) == 1 ); TEST( checkRange( LONG_MAX, LONG_MAX, LONG_MAX ) == 1 ); /* Test a random value in the the full range of MIN and MAX int. */ TEST( checkRange( rand(), LONG_MIN, LONG_MAX ) == 1 ); printf( "Finished running tests on checkRange()\n" ); }
IDE_RC idpBase::updateForce(SChar *aIn, UInt aNum, void *aArg) { void *sValue = NULL; void *sOldValue = NULL; UInt sUpdateValue = 0; idBool sLocked = ID_FALSE; IDE_ASSERT( idlOS::thread_mutex_lock(&mMutex) == 0); sLocked = ID_TRUE; // 카운트 검사 IDE_TEST_RAISE(aNum >= mMemVal.mCount, no_exist_error); /* 변경 불가능한 경우를 검사하지 않는다. IDE_TEST_RAISE( (mAttr & IDP_ATTR_RD_MASK) == IDP_ATTR_RD_READONLY, cant_modify_error); */ if ( ( mAttr & IDP_ATTR_SK_MASK ) != IDP_ATTR_SK_MULTI_BYTE ) { IDE_TEST(convertFromString(aIn, &sValue) != IDE_SUCCESS); } else { sValue = iduMemMgr::mallocRaw(idlOS::strlen((SChar *)aIn) + 1, IDU_MEM_FORCE); IDE_ASSERT(sValue != NULL); idlOS::strncpy((SChar *)sValue, (SChar *)aIn, idlOS::strlen((SChar *)aIn) + 1); } sOldValue = mMemVal.mVal[aNum]; /* Value Range Validation */ IDE_TEST(checkRange(sValue) != IDE_SUCCESS); IDE_TEST( mUpdateBefore(NULL, getName(), sOldValue, sValue, aArg) != IDE_SUCCESS); /* 기존 메모리 해제 & Set */ mMemVal.mVal[aNum] = sValue; /* 프로퍼티 값을 바꾸었다고 표시하고 에러발생시 원래값으로 원복한다. */ sUpdateValue = 1; IDE_TEST( mUpdateAfter(NULL, getName(), sOldValue, sValue, aArg) != IDE_SUCCESS); iduMemMgr::freeRaw(sOldValue); sLocked = ID_FALSE; IDE_ASSERT( idlOS::thread_mutex_unlock(&mMutex) == 0); return IDE_SUCCESS; /* 변경 불가능한 경우를 검사하지 않는다. IDE_EXCEPTION(cant_modify_error); { IDE_SET(ideSetErrorCode(idERR_ABORT_idp_ReadOnlyEntry, getName())); } */ IDE_EXCEPTION(no_exist_error); { IDE_SET(ideSetErrorCode(idERR_ABORT_idp_NameNotFound, getName())); } IDE_EXCEPTION_END; /* BUG-17763: idpBase::update()에서 FMR을 유발시키고 있습니다. * * 이전에 원래값을 에러발생시 Free시켜서 문제가 되었습니다. * Free시키고 않고 * 에러발생시 프로퍼티 값을 원래 값으로 원복해야 합니다. */ if( sUpdateValue == 1 ) { mMemVal.mVal[aNum] = sOldValue; } if (sValue != NULL) { iduMemMgr::freeRaw(sValue); } if ( sLocked == ID_TRUE ) { IDE_ASSERT( idlOS::thread_mutex_unlock(&mMutex) == 0); } return IDE_FAILURE; }