예제 #1
0
int GetStringToken(
  char cCharacter,
  char *pcToken)
/* STRING_TOKEN             :== dquote <any> dquote                           */
{
  int       iResult;
  int       iCurrentLine;

  iCurrentLine = CurrentLine();

  cCharacter = GetChar();
  while ((cCharacter != '"') && (iCurrentLine == CurrentLine()))
  {
    *(pcToken++) = cCharacter;
    cCharacter = GetChar();
  }

  /* end of line, or " is found. Check for error and try to recover           */
  if (iCurrentLine == CurrentLine())
  {
    iResult = STRING_TOKEN;
  }
  else
  {
    iResult = UNTERMINATED_STRING_READ;
    UngetChar();
  }

  *pcToken = 0;
  return iResult;
}
예제 #2
0
void CStringParser::ProcessReadString(const TDesC8& aReadString)
	{
	LOGTEXT(_L8("[Ltsy] Starting CStringParse::ProcessReadString()"));
	LOGTEXT2(_L8("[Ltsy] Read String = %S"), &aReadString);
	for (TInt nBufferOffset = 0; nBufferOffset < aReadString.Length(); nBufferOffset++)
		{
		TText8 tChar = aReadString[nBufferOffset];
		
		// we have already found a char which is a delimiter of the Line
        // so would dismiss any of delimiter following this one already found		
		if (iInDelimiter && (tChar == '\r' || tChar == '\n'))
			{
			continue;
			}
		
		// move on lastchar
		*iLastChar++ = tChar;
		// Diacarding characters if our buffer was overflowed
		if (iLastChar >= iBufferEnd)
			{
			iLastChar = iBufferEnd;
			}
        // we anyway to find out the delimiter and notify the obser the line was found 		
		if (tChar == '\r' || tChar == '\n')
			{
			iInDelimiter = ETrue;
			TPtrC8 tLine(CurrentLine());
			LOGTEXT2(_L8("[Ltsy] Line Content = %S"), &tLine);
			TRAPD(err, iReadLineNotify->NotifyOneLineFoundL(KErrNone, tLine));
			if (err != KErrNone)
				{
				ClearCurrentLine();
				}
			}
		else
			{
			if(iInDelimiter) // the last char is a delimiter
			    {
				iInDelimiter=EFalse;
			    iLineStart=iLastChar-1;	
			    if(tChar == '>')
			    	{
			    	TPtrC8 tLine(CurrentLine());
			    	TRAPD(err, iReadLineNotify->NotifyOneLineFoundL(KErrNone, tLine));
					if (err != KErrNone)
						{
						ClearCurrentLine();
						}			    	
			    	}
				}   
			}
		}
	LOGTEXT(_L8("[Ltsy] End CStringParse::ProcessReadString()"));
	}
예제 #3
0
// ---------------------------------------------------------------------------
// CATGetRevision::ParseResponseL
// other CATGetPhoneCellInfo were commented in a header
// ---------------------------------------------------------------------------
void CATGetRevision::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if (CurrentLine().Match(KLtsyOkString) != 0)
		{
		iError = KErrGeneral;
		return ;
		}
	RArray<TPtrC8> array;
	CleanupClosePushL(array);
	iParser->ParseRespondedBuffer(array,PrecedingLine());
	iMoreInfoFlag = EFalse;
	TInt Count = array.Count();
	if (Count < 1)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrGeneral;
		return ;
		}
	for(TInt i = 0; i < Count; i++)
		{
		//lex.Assign(array[2]);
		
		if  (iMoreInfoFlag)
			{
			TBuf<RMobilePhone::KPhoneSerialNumberSize> Data;
			Data.Zero();
			TInt remainingBufferSize = RMobilePhone::KPhoneSerialNumberSize - 
			                           iPhoneId.iRevision.Length() - 1;
			if(array[i].Length() > remainingBufferSize)
				{
				Data.Copy(array[i].Mid(0,remainingBufferSize));
				}
			else
				{
				Data.Copy(array[i]);
				}
			iPhoneId.iRevision.Append(KSpaceSeparator);
			iPhoneId.iRevision.Append(Data);
			}
		else
			{
			if(array[i].Length() > RMobilePhone::KPhoneSerialNumberSize)
				{
				iPhoneId.iRevision.Copy(array[i].Mid(0,RMobilePhone::KPhoneSerialNumberSize));
				}
			else
				{
				iPhoneId.iRevision.Copy(array[i]);
				}
			iMoreInfoFlag = ETrue;
			}
		}
	iMoreInfoFlag = EFalse;
	CleanupStack::PopAndDestroy();
	iError = KErrNone;
	}
예제 #4
0
// ---------------------------------------------------------------------------
// CATDetectNetwork::ParseResponseL
// should be
// +COPS: (status,"longname","shortname",code),... ,,(list),(list)
// +COPS: [list of supported (<stat>,long alphanumeric <oper>,short alphanumeric 
// <oper>,numeric <oper>)s]
// <stat>:
// 0 unknown
// 1 available
// 2 current
// 3 forbidden
// <oper>: string type; <format> indicates if the format is alphanumeric or numeric;
// long alphanumeric format can be upto 16 characters long and short format up to 8 
// characters (refer GSM MoU SE.13 [9]); numeric format is the GSM Location Area 
// Identification number (refer GSM 04.08 [8] subclause 10.5.1.3) which consists of
// a three BCD digit country code coded as in ITU-T E.212 Annex A [10], plus a two 
// BCD digit network code, which is administration specific; returned <oper> shall 
// not be in BCD format, but in IRA characters converted from BCD; hence the number 
// has structure: (country code digit 3)(country code digit 2)(country code digit 1)
// (network code digit 2)(network code digit 1)
// other items were commented in a header
// ---------------------------------------------------------------------------
void CATDetectNetwork::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if (CurrentLine().Match(KLtsyOkString) != 0)
		{
		iError = KErrGeneral;
		return ;
		}
    if(iList)
    	{
    	delete iList;
    	iList = NULL;
    	}
	iList=CMobilePhoneNetworkListV2::NewL();
	
	RArray<TPtrC8> array;
	CleanupClosePushL(array);
	iParser->ParseRespondedBuffer(array,PrecedingLine());
	TInt Count = array.Count();
	if (Count < 1)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return ;
		}
	if( array[0].MatchF(KGetDetectNetworkRepondStr)==KErrNotFound)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return ;
		}
	TInt count = array.Count() - 1;
	for (TInt i = 1;i < count;i++)
		{
		RMobilePhone::TMobilePhoneNetworkInfoV2 info;	
		// This TSY only supports GSM mode so we can hardcode this
		info.iMode=RMobilePhone::ENetworkModeGsm;
		TInt val;
		TLex8 lex(array[i]);
		lex.Val(val);
		info.iStatus = RMobilePhone::TMobilePhoneNetworkStatus(val);
		i++;
		info.iLongName.Copy(array[i]);		
		i++;
		if(array[i].Length() > info.iShortName.MaxLength())
			info.iShortName.Copy(array[i].Mid(0,info.iShortName.MaxLength()));			
		else
			info.iShortName.Copy(array[i]);
		i++;
		User::LeaveIfError(NetworkIdL(array[i],info.iCountryCode, info.iNetworkId));  // MNC and MCC	
		
		iList->AddEntryL(info); 
		}
	CleanupStack::PopAndDestroy();
	} //ParseResponseL
예제 #5
0
// ---------------------------------------------------------------------------
// CAtSmsNack::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtSmsNack::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if (CurrentLine().Match(KLtsyOkString) == 0)
		{
		iError = KErrNone;
		}
	else
		{
		iError = KErrGeneral;
		}
	}
// ---------------------------------------------------------------------------
// CATGprsSetProfileReq::ParseResponseL()
// other items were commented in a header
// ---------------------------------------------------------------------------
void CATGprsSetProfileReq::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if (CurrentLine().Match(KLtsyOkString) == 0)
		{
		iError = KErrNone;
		}
	else
		{
		iError = KErrGeneral;
		}
	}
예제 #7
0
void ListLog::tailButtonData()
{
    if(list_audition_tail_playing) {
        list_log->auditionStop();
    }
    else {
        if(!list_audition_head_playing) {
            list_log->auditionTail(CurrentLine());
        }
    }
}
예제 #8
0
    virtual void KeyDown(const char *bytes, int32 numBytes)
    {
        int32 mods = 0;
        BMessage* msg = Window() ? Window()->CurrentMessage() : 0;
        if( msg ) {
            msg->FindInt32("modifiers",&mods);
        }

        if( *bytes == B_ESCAPE ) {
            BString tmp = mOrigText;
            mOrigText = Text();
            SetText(tmp.String());
            mHasChanged = true;
            BMessage msg(INLINE_FINALUPDATE_MSG);
            mOwner.SendMessage(&msg);
            return;
        }

        if( *bytes == '\n' || *bytes == '\r' ) {
            BMessage msg(INLINE_FINALUPDATE_MSG);
            mOwner.SendMessage(&msg);
            return;
        }

        if( Window() && Parent() ) {
            if( *bytes == B_UP_ARROW && CurrentLine() <= 0 ) {
                BMessage msg(INLINE_GOTOPREVIOUS_MSG);
                mOwner.SendMessage(&msg);
                return;
            } else if( *bytes == B_DOWN_ARROW
                       && CurrentLine() >= (CountLines()-1) ) {
                BMessage msg(INLINE_GOTONEXT_MSG);
                mOwner.SendMessage(&msg);
                return;
            }
        }
        inherited::KeyDown(bytes, numBytes);
    }
예제 #9
0
void ListLog::trackButtonData()
{
  int line=CurrentLine();
  QString logname=list_log->logName().left(list_log->logName().length()-4);

  if((line>=0)&&(!logname.isEmpty())) {
    RDMacro *rml=new RDMacro();
    rml->setRole(RDMacro::Cmd);
    rml->setEchoRequested(false);
    rml->setCommand(RDMacro::VT);
    rml->setAddress(QHostAddress("127.0.0.1"));
    rml->setArgQuantity(2);
    rml->setArg(0,logname);
    rml->setArg(1,line);
    rdripc->sendRml(rml);
    delete rml;
  }
}
예제 #10
0
void ListLog::playButtonData()
{
    int line=CurrentLine();
    if(line<0) {
        return;
    }

    switch(list_playbutton_mode) {
    case ListLog::ButtonPlay:
        switch(CurrentStatus()) {
        case RDLogLine::Scheduled:
        case RDLogLine::Paused:
            if(line<0) {
                return;
            }
            list_log->play(line,RDLogLine::StartManual);
            ClearSelection();
            break;

        default:
            break;
        }
        break;

    case ListLog::ButtonStop:
        if(list_pause_allowed) {
            list_log->pause(line);
        }
        else {
            list_log->stop(line);
        }
        ClearSelection();
        break;

    case ListLog::ButtonDisabled:
        break;
    }
}
// ---------------------------------------------------------------------------
// CAtPhbkGetPhoneStoreInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkGetPhoneStoreInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState == ESetPhoneStoreComplete )
		{
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
		}
	else if( iState == EGetPhoneStoreInfoComplete )
		{
		/**
		* Here is an Example 
		* +CPBS: "SM",6,250  
        * ADN phonebook is selected,6 locations are used and 
        * total 250 locations are available
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		//remove AT+CPBS
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG			
		for( TInt i=0;i<count;i++ )
			{
		    LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tarray[%d]=%S"),
		    		      i,&array[i]);     
			}
#endif			
		if (count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPBSResponseString) == KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
				
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iUsedEntries = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret = lex1.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iTotalEntries = val;
		iPhoneStoreInfo.iType = RMobilePhoneStore::EPhoneBookStore;
	    LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
	    		                                iPhoneStoreInfo.iUsedEntries,iPhoneStoreInfo.iTotalEntries);
		CleanupStack::PopAndDestroy(&array);
		}
	else 
		{
		/**
		* Parse result of AT+CPMS? 
		* Response:+CPMS:<mem1>,<used1>,<total1>,<mem2>,<used2>,<total2>
		* Here only the first mem is used. mem1 is SM
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt Count = array.Count();
		if (Count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPMSResponseString) == KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		//parse name 
		TPtrC8 name(array[1]);
		
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iUsedEntries = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret = lex1.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iTotalEntries = val;
		iPhoneStoreInfo.iType = RMobilePhoneStore::EShortMessageStore;
		LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
			    		                        iPhoneStoreInfo.iUsedEntries,iPhoneStoreInfo.iTotalEntries);
		CleanupStack::PopAndDestroy(&array);
		}
	}
예제 #12
0
// ---------------------------------------------------------------------------
// CAtPhbkEnGetInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkEnGetInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState==ESetEnStoreComplete )
		{
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
		}
	else if( iState==EGetEnStoreInfoComplete )
		{
		/**
		* Here is an Example 
		* +CPBS: "EN",2,16 
        * phonebooken is selected,2 locations are used and 
        * total 16 locations are available
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		//remove AT+CPBS
		if(array[0].MatchF(KAnyATCommand)!=KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG			
		for( TInt i=0;i<count;i++ )
			{
		    LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tarray[%d]=%S"),
		    		      i,&array[i]);     
			}
#endif			
		if (count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPBSResponseString)==KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
				
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret=lex.Val(val,EDecimal);
		if(ret!=KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iUsed = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret=lex1.Val(val,EDecimal);
		if(ret!=KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iTotal = val;
	    LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
	    		                                iUsed,iTotal);
		CleanupStack::PopAndDestroy(&array);
		}
	}
예제 #13
0
/// SingleComponentLSScan::ParseMCU
// Parse a single MCU in this scan. Return true if there are more
// MCUs in this row.
bool SingleComponentLSScan::ParseMCU(void)
{ 
#if ACCUSOFT_CODE
  int lines             = m_ulRemaining[0]; // total number of MCU lines processed.
  UBYTE preshift        = m_ucLowBit + FractionalColorBitsOf();
  struct Line *line     = CurrentLine(0);
  
  //
  // If a DNL marker is present, the number of remaining lines is zero. Fix it.
  if (m_pFrame->HeightOf() == 0) {
    assert(lines == 0);
    lines = 8;
  }

  assert(m_ucCount == 1);

  //
  // A "MCU" in respect to the code organization is eight lines.
  if (lines > 8) {
    lines = 8;
  }
  if (m_pFrame->HeightOf() > 0)
    m_ulRemaining[0] -= lines;
  
  assert(lines > 0);

  // Loop over lines and columns
  do {
    LONG length = m_ulWidth[0];
    LONG *lp    = line->m_pData;

#ifdef DEBUG_LS
    int xpos    = 0;
    static int linenumber = 0;
    printf("\n%4d : ",++linenumber);
#endif
     
    StartLine(0);
    if (BeginReadMCU(m_Stream.ByteStreamOf())) { // No error handling strategy. No RST in scans. Bummer!
      do {
        LONG a,b,c,d;   // neighbouring values.
        LONG d1,d2,d3;  // local gradients.
      
        GetContext(0,a,b,c,d);
        d1  = d - b;    // compute local gradients
        d2  = b - c;
        d3  = c - a;
        
        if (isRunMode(d1,d2,d3)) {
          LONG run = DecodeRun(length,m_lRunIndex[0]);
          //
          // Now fill the data.
          while(run) {
            // Update so that the next process gets the correct value.
            UpdateContext(0,a);
            // And insert the value into the target line as well.
            *lp++ = a << preshift;
#ifdef DEBUG_LS
            printf("%4d:<%2x> ",xpos++,a);
#endif
            run--,length--;
            // As long as there are pixels on the line.
          }
          //
          // More data on the line? I.e. the run did not cover the full m_lJ samples?
          // Now decode the run interruption sample.
          if (length) {
            bool negative; // the sign variable
            bool rtype;    // run interruption type
            LONG errval;   // the prediction error
            LONG merr;     // the mapped error (symbol)
            LONG rx;       // the reconstructed value
            UBYTE k;       // golomb parameter
            // Get the neighbourhood.
            GetContext(0,a,b,c,d);
            // Get the prediction mode.
            rtype  = InterruptedPredictionMode(negative,a,b);
            // Get the golomb parameter for run interruption coding.
            k      = GolombParameter(rtype);
            // Golomb-decode the error symbol.
            merr   = GolombDecode(k,m_lLimit - m_lJ[m_lRunIndex[0]] - 1);
            // Inverse the error mapping procedure.
            errval = InverseErrorMapping(merr + rtype,ErrorMappingOffset(rtype,rtype || merr,k));
            // Compute the reconstructed value.
            rx     = Reconstruct(negative,rtype?a:b,errval);
            // Update so that the next process gets the correct value.
            UpdateContext(0,rx);
            // Fill in the value into the line
            *lp    = rx << preshift;
#ifdef DEBUG_LS
            printf("%4d:<%2x> ",xpos++,*lp);
#endif
            // Update the variables of the run mode.
            UpdateState(rtype,errval);
            // Update the run index now. This is not part of
            // EncodeRun because the non-reduced run-index is
            // required for the golomb coder length limit. 
            if (m_lRunIndex[0] > 0)
              m_lRunIndex[0]--;
          } else break; // end of line.
        } else {
          UWORD ctxt;
          bool  negative; // the sign variable.
          LONG  px;       // the predicted variable.
          LONG  rx;       // the reconstructed value.
          LONG  errval;   // the error value.
          LONG  merr;     // the mapped error value.
          UBYTE k;        // the Golomb parameter.
          // Quantize the gradients.
          d1     = QuantizedGradient(d1);
          d2     = QuantizedGradient(d2);
          d3     = QuantizedGradient(d3);
          // Compute the context.
          ctxt   = Context(negative,d1,d2,d3); 
          // Compute the predicted value.
          px     = Predict(a,b,c);
          // Correct the prediction.
          px     = CorrectPrediction(ctxt,negative,px);
          // Compute the golomb parameter k from the context.
          k      = GolombParameter(ctxt);
          // Decode the error symbol.
          merr   = GolombDecode(k,m_lLimit);
          // Inverse the error symbol into an error value.
          errval = InverseErrorMapping(merr,ErrorMappingOffset(ctxt,k));
          // Update the variables.
          UpdateState(ctxt,errval);
          // Compute the reconstructed value.
          rx     = Reconstruct(negative,px,errval);
          // Update so that the next process gets the correct value.
          UpdateContext(0,rx);
          // And insert the value into the target line as well.
          *lp    = rx << preshift;
#ifdef DEBUG_LS
          printf("%4d:<%2x> ",xpos++,*lp);
#endif
        }
      } while(++lp,--length);
    } // No error handling here.
    EndLine(0);
    line = line->m_pNext;
  } while(--lines); 
  //
  // If this is the last line, gobble up all the
  // bits from bitstuffing the last byte may have left.
  // As SkipStuffing is idempotent, we can also do that
  // all the time.
  m_Stream.SkipStuffing();
#endif  
  return false;
}
예제 #14
0
// ---------------------------------------------------------------------------
// CAtPhbkStoreRead::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkStoreRead::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState == ESetStoreNameComplete )
	    {
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
	    }
	else if( iState == EReadEntryComplete )
		{
		/**
		* +CPBR = <index>,<number>,<129/145>,<text> 
		* OK    
		*/
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		// remove the string of AT+CPBR=..
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG		
		for( TInt i=0;i<count;i++ )
			{
			LOGTEXT3(_L8("CAtPhbkStoreRead::ParseResponseL\tarray[%d]=%S"),i,&array[i]); 
			}
#endif		
		if((array[1].Match(KLtsyOkString) == KErrNone))
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNone;
			iEndFlag = ETrue;
			return; 
			}
		else if((array[1].Match(KLtsyErrorString) == KErrNone))
			{
			CleanupStack::PopAndDestroy();
			iError = KErrGeneral;
			iEndFlag = ETrue;
			return; 
			}
	  
		iError = KErrNone;
		//remove number line if it has 
		if( array[0].MatchF(KCPBRSResponseString) == KErrNotFound )
			{
			array.Remove(0);
			}
		if( array[0].MatchF(KCPBRSResponseString) == KErrNotFound )
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		//parse index
		TLex8 lex(array[1]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		//Index  
		iReadEntry.iIndex = val;             
		iReadEntry.iNumber.Copy(array[2]);   
		//Parse TON/NPI
		TLex8 lex1(array[3]);
		TUint16 val1;
		ret = lex1.Val(val1,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		 //TON/NPI
		iReadEntry.iTon = (TUint8)val1;  
		iReadEntry.iText.Copy(array[4]);
		CleanupStack::PopAndDestroy();
		} 
  	}
예제 #15
0
// ---------------------------------------------------------------------------
// CATNetworkInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CATNetworkInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if (CurrentLine().Match(KLtsyOkString) != 0)
		{
		iError = KErrGeneral;
		return ;
		}
	RArray<TPtrC8> array;
	CleanupClosePushL(array);
	iParser->ParseRespondedBuffer(array,PrecedingLine());
	TInt Count = array.Count();
	if (Count < 1)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return ;
		}
	
	if( array[0].MatchF(KGetCurrentNetworkInfoResponse)==KErrNotFound)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return ;
		}
	TInt val = 0;
	TLex8 lex(array[1]);
	lex.Val(val);
	iPhoneGlobals.iPhoneStatus.iLocalNetworkSel.iMethod = RMobilePhone::TMobilePhoneSelectionMethod(val);
	if(Count > 2)
		{
		TLex8 lex1(array[2]);
		lex1.Val(iNameFormat);
		switch (iNameFormat)
			{
			case 0:
				if(array[3].Length() > iNetworkInfo.iLongName.MaxLength())
					iNetworkInfo.iLongName.Copy(array[3].Mid(0,iNetworkInfo.iLongName.MaxLength()));			
				else
					iNetworkInfo.iLongName.Copy(array[3]);
				break;
			case 1:
				if(array[2].Length() > iNetworkInfo.iShortName.MaxLength())
					iNetworkInfo.iShortName.Copy(array[3].Mid(0,iNetworkInfo.iShortName.MaxLength()));			
				else 
					iNetworkInfo.iShortName.Copy(array[3]);	
				break;
			case 2:
				/*if(array[2].Length() > iNetworkInfo.iShortName.MaxLength())
					iNetworkInfo.iShortName.Copy(array[3].Mid(0,iNetworkInfo.iShortName.MaxLength()));			
				else 
					iNetworkInfo.iShortName.Copy(array[3]);*/	
				User::LeaveIfError(NetworkIdL(array[3],iNetworkInfo.iCountryCode, iNetworkInfo.iNetworkId));
				break;
			default:
				User::Leave(KErrGeneral);
				break;
				}
		}
	else
		{
		iError = KErrGeneral;
		}
	iNetworkInfo.iStatus=RMobilePhone::ENetworkStatusCurrent;
	CleanupStack::PopAndDestroy();
	iError = KErrNone;
	}
예제 #16
0
/// SingleComponentLSScan::WriteMCU
// Write a single MCU in this scan.
bool SingleComponentLSScan::WriteMCU(void)
{
#if ACCUSOFT_CODE
  int lines             = m_ulRemaining[0]; // total number of MCU lines processed.
  UBYTE preshift        = m_ucLowBit + FractionalColorBitsOf();
  struct Line *line     = CurrentLine(0);
  
  assert(m_ucCount == 1);

  //
  // A "MCU" in respect to the code organization is eight lines.
  if (lines > 8) {
    lines = 8;
  }
  m_ulRemaining[0] -= lines;
  assert(lines > 0);

  // Loop over lines and columns
  do {
    LONG length = m_ulWidth[0];
    LONG *lp    = line->m_pData;

    BeginWriteMCU(m_Stream.ByteStreamOf()); // MCU is a single line.
    StartLine(0);
    do {
      LONG a,b,c,d,x; // neighbouring values.
      LONG d1,d2,d3;  // local gradients.
      
      GetContext(0,a,b,c,d);
      x   = *lp >> preshift;
      
      d1  = d - b;    // compute local gradients
      d2  = b - c;
      d3  = c - a;

      if (isRunMode(d1,d2,d3)) {
        LONG runval = a;
        LONG runcnt = 0;
        do {
          x  = *lp >> preshift;
          if (x - runval < -m_lNear || x - runval > m_lNear)
            break;
          // Update so that the next process gets the correct value.
          // Also updates the line pointers.
          UpdateContext(0,runval);
        } while(lp++,runcnt++,--length);
        // Encode the run. Depends on whether the run was interrupted
        // by the end of the line.
        EncodeRun(runcnt,length == 0,m_lRunIndex[0]);
        // Continue the encoding of the end of the run if there are more
        // samples to encode.
        if (length) {
          bool negative; // the sign variable
          bool rtype;    // run interruption type
          LONG errval;   // the prediction error
          LONG merr;     // the mapped error (symbol)
          LONG rx;       // the reconstructed value
          UBYTE k;       // golomb parameter
          // Get the neighbourhood.
          GetContext(0,a,b,c,d);
          // Get the prediction mode.
          rtype  = InterruptedPredictionMode(negative,a,b);
          // Compute the error value.
          errval = x - ((rtype)?(a):(b));
          if (negative)
            errval = -errval;
          // Quantize the error.
          errval = QuantizePredictionError(errval);
          // Compute the reconstructed value.
          rx     = Reconstruct(negative,rtype?a:b,errval);
          // Update so that the next process gets the correct value.
          UpdateContext(0,rx);
          // Get the golomb parameter for run interruption coding.
          k      = GolombParameter(rtype);
          // Map the error into a symbol.
          merr   = ErrorMapping(errval,ErrorMappingOffset(rtype,errval != 0,k)) - rtype;
          // Golomb-coding of the error.
          GolombCode(k,merr,m_lLimit - m_lJ[m_lRunIndex[0]] - 1);
          // Update the variables of the run mode.
          UpdateState(rtype,errval);
          // Update the run index now. This is not part of
          // EncodeRun because the non-reduced run-index is
          // required for the golomb coder length limit.
          if (m_lRunIndex[0] > 0)
            m_lRunIndex[0]--;
        } else break; // Line ended, abort the loop over the line.
      } else { 
        UWORD ctxt;
        bool  negative; // the sign variable.
        LONG  px;       // the predicted variable.
        LONG  rx;       // the reconstructed value.
        LONG  errval;   // the error value.
        LONG  merr;     // the mapped error value.
        UBYTE k;        // the Golomb parameter.
        // Quantize the gradients.
        d1     = QuantizedGradient(d1);
        d2     = QuantizedGradient(d2);
        d3     = QuantizedGradient(d3);
        // Compute the context.
        ctxt   = Context(negative,d1,d2,d3); 
        // Compute the predicted value.
        px     = Predict(a,b,c);
        // Correct the prediction.
        px     = CorrectPrediction(ctxt,negative,px);
        // Compute the error value.
        errval = x - px;
        if (negative)
          errval = -errval;
        // Quantize the prediction error if NEAR > 0
        errval = QuantizePredictionError(errval);
        // Compute the reconstructed value.
        rx     = Reconstruct(negative,px,errval);
        // Update so that the next process gets the correct value.
        UpdateContext(0,rx);
        // Compute the golomb parameter k from the context.
        k      = GolombParameter(ctxt);
        // Map the error into a symbol
        merr   = ErrorMapping(errval,ErrorMappingOffset(ctxt,k));
        // Golomb-coding of the error.
        GolombCode(k,merr,m_lLimit);
        // Update the variables.
        UpdateState(ctxt,errval);
      }
    } while(++lp,--length);
    EndLine(0);
    line = line->m_pNext;
  } while(--lines);
예제 #17
0
// ---------------------------------------------------------------------------
// CAtSmsReceive::CMTResponseSecondLineL
// other items were commented in a header
// ---------------------------------------------------------------------------
void  CAtSmsReceive::CMTResponseSecondLineL() 
	{
	LOGTEXT(_L8("CAtSmsReceive::CMTResponseSecondLineL Enter funciton"));
	iError = KErrNone;
	iAttr.iFlags=0;
	TPtrC8 secondLineBuf;
	secondLineBuf.Set(CurrentLine());
	
#ifdef _DEBUG
	TInt totalLen = secondLineBuf.Length();
	if(totalLen <= KLogMaxCharNumPerLine)
		{
		LOGTEXT2(_L8("CAtSmsReceiveMessage::CMTResponseSecondLineL\tSecondLine=%S"),&secondLineBuf);
		}
	else
		{
		TInt lines = (totalLen/KLogMaxCharNumPerLine);
		TInt remainingStrNum = (totalLen%KLogMaxCharNumPerLine);
		for(TInt i = 0; i < lines; i++)
			{
			TPtrC8 line(secondLineBuf.Mid(i*KLogMaxCharNumPerLine,KLogMaxCharNumPerLine));
			LOGTEXT2(_L8("CAtSmsReceiveMessage::CMTResponseSecondLineL \tSecondLine line=%S"),&line);
			}
		
		TPtrC8 remaining(secondLineBuf.Right(remainingStrNum));
		
		LOGTEXT2(_L8("CAtSmsReceiveMessage::CMTResponseSecondLineL \tSecondLine line=%S"),&remaining);
		}
#endif  
	// Buffer size calculated as follows;
	//   (max pdu size + max prefixed SCA size) * number of ASCII chars used to code an octet
	TBuf8<(RMobileSmsMessaging::KGsmTpduSize+12)*2> localPdu;	
	localPdu.Copy(secondLineBuf);
	//  The CMT frame sometimes contains odd number of nibbles which
	// causes panic in ConvertAsciiToBinary() method. This type of
	// frames will simply be discarded.
	if(localPdu.Length() < (iPduLen*2))
		{
		iError = KErrUnderflow;
		User::Leave(KErrUnderflow);
		}
		
	//
	// Check if we have a prefixed SCA on our pdu.
	// If we do then remove it.
	
	if(localPdu.Length() > (iPduLen*2))
		{
		TInt ret = SmsAtUtil::ReadAndRemoveAddressFromAscii(localPdu,iAttr.iGsmServiceCentre);
		if(ret !=KErrNone)
			{
			LOGTEXT(_L8("CAtSmsReceiveMessage::CMTResponseSecondLineL Failed to read and remove SCA from PDU"));
			iError = ret;
			return;
			}
		else
			{
			iMsgReceive.iServiceCentre = iAttr.iGsmServiceCentre.iTelNumber;    //for iServiceCentre
			iMsgReceive.iMobileScNPI = iAttr.iGsmServiceCentre.iNumberPlan;
			iMsgReceive.iMobileScTON = iAttr.iGsmServiceCentre.iTypeOfNumber;
			iAttr.iFlags|= RMobileSmsMessaging::KGsmServiceCentre;
			}
		}
	//
	// Convert received pdu from ASCII into binary
	TInt ret = SmsAtUtil::ConvertAsciiToBinary(localPdu,iPdu);
	if (ret!=KErrNone)
		{
		LOGTEXT(_L8("CAtSmsReceiveMessage::CMTResponseSecondLineL Failed to code PDU into binary"));
		iError = ret;
		return;
		}
	else
		{
		iAttr.iDataFormat=RMobileSmsMessaging::EFormatGsmTpdu;
		iAttr.iFlags|=RMobileSmsMessaging::KSmsDataFormat;
		iAttr.iStatus = RMobileSmsMessaging::EMtMessageUnstoredClientAck;
		iAttr.iFlags|=RMobileSmsMessaging::KIncomingStatus;
		}

	LOGTEXT2(_L8("Received PDU String is %S"),&iPdu);
	iMsgReceive.iSmsMsg = iPdu;
	}
예제 #18
0
// ------------------------------------------------------------------------------- RHTML_text_view - KeyDown -
void RHTMLtextview::KeyDown(const char *bytes, int32 numBytes)
{
	pushmenu = false;
	int32 c,d;
	GetSelection(&c, &d);
	BString *oldtext = new BString(Text());
	BString *newtext = 0;
	switch(bytes[0])
	{
		case B_ESCAPE:			// - ESC
		{
		}
		break;
		case B_ENTER:				// - ENTER
		{
			fTarget->SetModify(true);
			BString tmp = "";
			if (d - OffsetAt(CurrentLine()) > 0)
			{
				for (int i = OffsetAt(CurrentLine()); i < d; i++)
				{
					if (Text()[i] == B_SPACE || Text()[i] == B_TAB)
					{
						tmp << Text()[i];
					} else
						break;
				}
			}
			BTextView::KeyDown(bytes, numBytes);
			Insert(tmp.String());

			fFileTypes->SetFontAndColor(oldtext, newtext = new BString(Text()), 0, c);
   
			if (fUpdateTimer->IsActive())
				fUpdateTimer->ResetTimer();
			else
				fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
   
			if (PointAt(TextLength() - 1).y + 50 > fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right, PointAt(TextLength() - 1).y + 50);
		}
		break;
		case '>':					// - >
		{
			fTagMenu->Stop();
   fTarget->SetModify(true);
   BTextView::KeyDown(bytes,numBytes);
   fFileTypes->SetFontAndColor(oldtext, newtext = new BString(Text()),0,c);

   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);

   if (PointAt(TextLength()-1).y+50>fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right,PointAt(TextLength()-1).y+50);
  }
  break;
  case '<':					// - <
  {
   BTextView::KeyDown(bytes,numBytes);
   fTarget->SetModify(true);
   pushmenu=true;
   ScrollToSelection();
   fFileTypes->SetFontAndColor(oldtext, newtext = new BString(Text()),0,c);

   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);

   if (PointAt(TextLength()-1).y+50>fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right,PointAt(TextLength()-1).y+50);
   mode=1;
   fTimer->StartTimer(fOptions->ReakcioIdoTM);
  }
  break;
  case B_SPACE:				// - SPACE
  {
   fTarget->SetModify(true);
   BTextView::KeyDown(bytes,numBytes);
   fFileTypes->SetFontAndColor(oldtext, newtext = new BString(Text()),0,c);

   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);

   if (PointAt(TextLength()-1).y+50>fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right,PointAt(TextLength()-1).y+50);
   buf1 = "";
   int32 o;
   
   for (int i=c;i>=0;i--)
   {
    if (Text()[i]=='>') break;
    if (Text()[i]=='<')
    {
     for (o=i+1;o<=c+1;o++)
     {
      if (Text()[o]=='>') break;
      if (Text()[o]=='<') break;

      if (Text()[o]==' ')
      {
       pushmenu=true;
       mode=2;
       fTimer->StartTimer(fOptions->ReakcioIdoTM);
       break;
       i=-1;
      }
      buf1 << Text()[o];
     }
    }
   }
   
   BString str(Text());
   int32 a,b;
   tags.clear();

   a=str.FindLast('<',c);

   if (a>str.FindLast('>',c))
   {
    b=str.FindFirst('>',c);
    int32 e=str.FindFirst('<',c);
    if (b>=0 && ((b<e && e>=0) || (e<0)))
    {
     while (str[a]!=' ')
      a++;
     a++;
     int32 i=a;
     while (i<b)
     {
      if (str[i]==' ')
      {
       BString tmp;
       str.CopyInto(tmp,a,i-a);
       tmp.ToLower();
       if (tmp!=" " && tmp!="")
        tags.push_back(tmp);
       a=i+1;
      }

      if (str[i]=='=')
      {
       BString tmp;
       str.CopyInto(tmp,a,i-a);
       tmp.ToLower();
       tags.push_back(tmp);
       if (str[i+1]=='"')
       {
        a=str.FindFirst('"',i+2)+1;
        i=a-1;
       }
       else
        a=i=str.FindFirst(' ',i+1);
      }

      i++;
     }
    }   
   }
  }
  break;
  case B_UP_ARROW:			// - UP
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_DOWN_ARROW:		// - DOWN
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_LEFT_ARROW:		// - LEFT
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_RIGHT_ARROW:		// - RIGHT
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_PAGE_UP:			// - PUP
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_PAGE_DOWN:			// - PDOWN
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_HOME:				// - HOME
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_END:				// - END
  {
   BTextView::KeyDown(bytes,numBytes);
   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
  }
  break;
  case B_BACKSPACE:			// - BackSpace
  {
   fTarget->SetModify(true);
   BTextView::KeyDown(bytes,numBytes);
   fFileTypes->SetFontAndColor(oldtext, newtext = new BString(Text()),0,c-1);

   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);

   if (PointAt(TextLength()-1).y+50>fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right,PointAt(TextLength()-1).y+50);
  }
  break;
  default:
  {
   fTarget->SetModify(true);
   BTextView::KeyDown(bytes,numBytes);
   fFileTypes->SetFontAndColor(oldtext, newtext = new BString(Text()),0,c);

   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);

   if (PointAt(TextLength()-1).y+50>fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right,PointAt(TextLength()-1).y+50);

   if (fUpdateTimer->IsActive())
    fUpdateTimer->ResetTimer();
   else
    fUpdateTimer->StartTimer(fOptions->ReakcioIdo);

   if (PointAt(TextLength()-1).y+50>fTarget->fNumView->Bounds().bottom) fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right,PointAt(TextLength()-1).y+50);
  }
 }
	if (oldtext)
 		delete oldtext;
	if (newtext)
 		delete newtext;
// ScrollToSelection();
}
예제 #19
0
int GetNewToken(
  char *pcToken)
/******************************************************************************/
/* get a new token from the input file. Don't check for a put back token      */
/* characters are classified as:                                              */
/* cr        :== carriage return character                                    */
/* lf        :== line feed character                                          */
/* tab       :== the tab character                                            */
/* dquote    :== the " character                                              */
/* digit     :== 0123456789                                                   */
/* bindigit  :== 01                                                           */
/* hexdigit  :== 0123456789ABCDEF                                             */
/* alpha     :== _abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ        */
/* any       :== all prtble chars except cr, lf and dqoute                    */
/* tab       :== the tab character                                            */
/* alphanum  :== alpha | digit                                                */
/*                                                                            */
/* <x>       :== zero or more x                                               */
/* [x]       :== one or more x                                                */
/*  x        :== exactly one x                                                */
/*                                                                            */
/* recognized tokens are :                                                    */
/*                                                                            */
/* FLOAT_TOKEN              :== <digit> '.' [digit]                           */
/* DEC_NUMBER_TOKEN         :== [digit]                                       */
/* HEX_NUMBER_TOKEN         :== '0' 'x' [hexdigit]                            */
/* BIN_NUMBER_TOKEN         :== '0' 'b' [bindigit]                            */
/* IDENTIFIER_TOKEN         :== alpha <alphanum>                              */
/* STRING_TOKEN             :== dquote <any> dquote                           */
/* OPERATOR_TOKEN           :== '='                                           */
/*                          :== '=' '='                                       */
/*                          :== '<'                                           */
/*                          :== '>'                                           */
/*                          :== '<' '='                                       */
/*                          :== '>' '='                                       */
/*                          :== '<' '>'                                       */
/*                          :== '+'                                           */
/*                          :== '-'                                           */
/*                          :== '*'                                           */
/*                          :== '/'                                           */
/*                          :== '<' '<'                                       */
/*                          :== '>' '>'                                       */
/*                          :== '&'                                           */
/*                          :== '|'                                           */
/*                          :== '[' ']'                                       */
/*                          :== '['                                           */
/*                          :== ']'                                           */
/* DOT_TOKEN                :== '.'                                           */
/* DOTDOT_TOKEN             :== '.' '.'                                       */
/* COMMA_TOKEN              :== ','                                           */
/* SEMICOLON_TOKEN          :== ';'                                           */
/* COLON_TOKEN              :== ':'                                           */
/* LEFT_ARROW_TOKEN         :== '<' '-'                                       */
/* RIGHT_ARROW_TOKEN        :== '-' '>'                                       */
/* OPEN_PARENTHESE_TOKEN    :== '('                                           */
/* CLOSE_PARENTHESE_TOKEN   :== ')'                                           */
/* PRECOMPILER_TOKEN        :== '#' [alpha]                                   */
/* DELIMITER_TOKEN          :== ' '                                           */
/*                          :== tab                                           */
/*                          :== cr                                            */
/*                          :== lf                                            */
/******************************************************************************/
{
  char      cCharacter;
  int       iResult;
  int       iCurrentLine;
  boolean   bEoLn;

  char     *pcTokenWalker;

  pcTokenWalker = pcToken;

  cCharacter = GetChar();
  /* first skip all delimiter chars */
  while (chrpos((char) cCharacter, DELIMITER_CHARS) != NULL)
  {
    cCharacter = GetChar();
  }

  if (isDigit(cCharacter))
  {
    /*    read a DEC_NUMBER_TOKEN */
    /* or read a HEX_NUMBER_TOKEN */
    /* or read a BIN_NUMBER_TOKEN */
    iResult = GetNumberToken(cCharacter, pcToken);
  }
  else if (isAlpha(cCharacter))
  {
    /* read an IDENTIFIER_TOKEN */
    iResult = GetIdentifierToken(cCharacter, pcToken);
  }
  else if (cCharacter == '"')
  {
    /* read a STRING_TOKEN */
    iResult = GetStringToken(cCharacter, pcToken);
  }
  else if (chrpos(cCharacter, "=<>+-*/&|[].") != NULL)
  {
    /* read an OPERATOR_TOKEN */
    iResult = GetOperatorToken(cCharacter, pcToken);
    if (strcmp((char *) pcToken, "->") == 0)
      iResult = RIGHT_ARROW_TOKEN;
    else if (strcmp((char *) pcToken, "<-") == 0)
      iResult = LEFT_ARROW_TOKEN;
    else if (strcmp((char *) pcToken, "..") == 0)
      iResult = DOTDOT_TOKEN;
    else if (strcmp((char *) pcToken, "//") == 0)
    {
      iCurrentLine = CurrentLine();

      /* bEoLn (EndOfLine) will be set to true if end of line is reached    */
      /* undetected because of end of file. (This will also happen in the   */
      /* unlikely situation that an inputfile contains something like:      */
      /* #define COMMENT //this is comment                                  */
      /* because while parsing a preprocessor macro, the scanner refuses to */
      /* go to the next line.                                               */

      bEoLn = FALSE;
      while ((iCurrentLine == CurrentLine()) && (!bEoLn))
      {
        cCharacter = GetChar();
        if ((cCharacter != ILLEGAL_CHAR) && (cCharacter != '\0'))
        {
          *(pcToken++) = cCharacter;
        }
        else
        {
          bEoLn = TRUE;
        }
      }
      iResult = COMMENT_TOKEN;

      if (!bEoLn)
      {
        /* End of comment detected by reading a Cr/Lf character. This       */
        /* read character is added to pcToken.                              */
        /* Put cr/lf back, only to adjust the line counter...               */
        /* (only needed if not in the middle of a macro.)                   */
        UngetChar();

        /* Delete cr or lf character from pcToken by overwriting it with    */
        /* the zero character (for terminating pcToken)                     */
        *(--pcToken) = 0;

      }
      else
      {
        /* Terminate pcToken by adding a zero character                     */
        *(pcToken) = 0;
      }

    }

  }
  else if (cCharacter == '#')
  {
    /* read a PRECOMPILER_TOKEN */
    iResult = GetPrecompilerToken(cCharacter, pcToken);
  }
  else if (cCharacter == '{')
  {
    iResult = OPEN_BRACKETS_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == '}')
  {
    iResult = CLOSE_BRACKETS_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == '(')
  {
    iResult = OPEN_PARENTHESES_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == ')')
  {
    iResult = CLOSE_PARENTHESES_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == '.')
  {
    iResult = DOT_TOKEN;
    (*pcTokenWalker++) = cCharacter;

    cCharacter = GetChar();

    while (isDigit(cCharacter))
    {
      iResult = FLOAT_TOKEN;
      (*pcTokenWalker++) = cCharacter;
      cCharacter = GetChar();
    }
    UngetChar();
    *pcTokenWalker = 0;
  }
  else if (cCharacter == ',')
  {
    iResult = COMMA_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == ';')
  {
    iResult = SEMICOLON_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == ':')
  {
    iResult = COLON_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == '~')
  {
    iResult = TILDE_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == '\\')
  {
    iResult = BACKSLASH_TOKEN;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  else if (cCharacter == 0)
  {
    /* End of file reached. */
    iResult = END_OF_FILE;
    (*pcTokenWalker++) = cCharacter;
  }
  else
  {
    /* unexpected character read */
    iResult = UNEXPECTED_CHAR_READ;
    (*pcTokenWalker++) = cCharacter;
    *pcTokenWalker = 0;
  }
  return iResult;
}
// -----------------------------------------------------------------------------
// CTestSDKDialogsControl::CTestSDKDialogsCurrentLine 
// -----------------------------------------------------------------------------
CEikCaptionedControl* CTestSDKDialogsControl::CTestSDKDialogsCurrentLine()
    {
    return CurrentLine();
    }
예제 #21
0
 virtual uint32_t Current() const           { return CurrentLine(); };