void test_queue() { //test queue myQueue <int> q = new myQueue <int>(); q.push(1); int tmp = q.pop(); q.push(2); q.push(3); tmp = q.pop(); tmp = q.pop(); return; }
public void start() { var fs = new myReader(); fs.Open(uri); progress_total = fs.size; fs.Seek(0, SeekOrigin.Begin); int nRead; nRead = fs.Read(block, block_prefix, page_size); for (; nRead > 0; nRead = fs.Read(block, block_prefix, page_size)) { #if bg_parse m_block.push(new myBlock(nRead, block)); m_nBlock++; block = new byte[page_size + block_prefix]; #else parseBlock(nRead, block); #endif } //save last record if (type != myTkType.t_eol) { type = myTkType.t_eol; executeRule(); } fs.Close(); fs.Dispose(); }
void executeRule() { cur = nState; nState = tbl[(int)cur, (int)type]; cbid id = cbidTbl[(int)cur, (int)type]; switch (id) { case cbid.o1: //do nonthing break; case cbid.ss: res.count++; res.arr.Add(""); res.curObj.iStart = ++res.curObj.iCur; break; case cbid.sa: res.curObj.iStart = ++res.curObj.iCur; break; case cbid.aa: res.curObj.iCur++; break; case cbid.bs: res.count++; res.arr.Add(res.gerCurObj()); res.curObj.iCur += 2; break; case cbid.es: res.count++; res.arr.Add(res.gerCurObj()); res.curObj.iCur++; break; case cbid.ba: res.curObj.iCur += 2; res.curObj.dblQt = true; break; case cbid.sz: res.curObj.iStart = res.curObj.iCur; goto case cbid.en; case cbid.en: res.arr.Add(res.gerCurObj()); //save rec & reset #if use_res_queue m_resQueue.push(res.arr); #else m_res.Add(res.arr); #endif m_recCount++; res.reset(); break; case cbid.se: res.curObj.iStart = res.curObj.iCur++; break; case cbid.zz: res.curObj.iCur++; break; default: throw new Exception(); } }