void addToPath(string t) { path[plength] = StringGetChar(t, 0); path[plength+1] = StringGetChar(t, 1); path[plength+2] = StringGetChar(t, 2); path[plength+3] = StringGetChar(t, 3); plength +=4; }
wStep* wSequence_parseWStep(const string & strStep) { bool isBadInstruction = false; if ( StringFind(strStep, "LS")>=0 ) { _oneStctStep.type = WsTEP_TYPE_LS; // extract the n value of LS char charN = StringGetChar(strStep, 2); int n = charN - '0'; if (n >=1 && n <= 4) { _oneStctStep.value = n; } else { // bad instruction isBadInstruction = true; } // is inverse? charN = StringGetChar(strStep, 3); if ( charN == 'i' ) { _oneStctStep.isInverse = true; } else { _oneStctStep.isInverse = false; } } else if ( StringFind(strStep, "RT")>=0 ) { _oneStctStep.type = WsTEP_TYPE_RT; // is inverse? char charN = StringGetChar(strStep, 2); if ( charN == 'i' ) { _oneStctStep.isInverse = true; } else { _oneStctStep.isInverse = false; } } else { _oneStctStep.type = WsTEP_TYPE_UNKNOWN; } // TODO: maybe we will have a better implementation here // - dealing with bad situation. if (isBadInstruction) { _oneStctStep.type = WsTEP_TYPE_UNKNOWN; } _oneStctStep.action = strStep; return &_oneStctStep; }
bool wSequence_pushOne(const string & oneStep) { if ( _nowWriteIndex + 1 >= _capcity) {return false;} ++_nowWriteIndex; // string -> char arr int len = strlen(oneStep); for (int i=0; i<len ; i++) { _wStepStrArr[_nowWriteIndex][i] = StringGetChar(oneStep, i); } return true; }