Exemple #1
0
dw_handle DWENTRY DWRefPCH(
    dw_client                   cli,
    uint_32                     ref )
{
    dw_handle                   new_hdl;

    _Validate( ref != 0 );
    _Validate( cli->dbg_pch != NULL );
    new_hdl = GetHandle( cli );
    StartDIE( cli, AB_INDIRECT_TYPE );
    CLIReloc4( DW_DEBUG_INFO, DW_W_EXT_REF, cli->dbg_pch, ref  );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #2
0
/*****************************************************************************
  Function:
	void MPFSInit(void)

  Summary:
	Initializes the MPFS module.

  Description:
	Sets all MPFS handles to closed, and initializes access to the EEPROM
	if necessary.

  Precondition:
	None

  Parameters:
	None

  Returns:
	None
	
  Remarks:
	This function is called only one during lifetime of the application.
  ***************************************************************************/
void MPFSInit(void)
{
	BYTE i;
	
	for(i = 1; i <= MAX_MPFS_HANDLES; i++)
	{
		MPFSStubs[i].addr = MPFS_INVALID;
	}
	
	#if defined(MPFS_USE_EEPROM)
    // Initialize the EEPROM access routines.
    XEEInit();
	lastRead = MPFS_INVALID;
	#endif
	
	#if defined(MPFS_USE_SPI_FLASH)
	// Initialize SPI Flash access routines.
	#if (GRAPHICS_PICTAIL_VERSION == 3)
		SST25Init();
	#else
		SST39Init();
	#endif
	#endif

	// Validate the image and load numFiles
	_Validate();

	isMPFSLocked = FALSE;

}
Exemple #3
0
/*****************************************************************************
  Function:
	void MPFSInit(void)

  Summary:
	Initializes the MPFS module.

  Description:
	Sets all MPFS handles to closed, and initializes access to the EEPROM
	if necessary.

  Precondition:
	None

  Parameters:
	None

  Returns:
	None
	
  Remarks:
	This function is called only one during lifetime of the application.
  ***************************************************************************/
void MPFSInit(void)
{
	uint8_t i;
	
	for(i = 1; i <= MAX_MPFS_HANDLES; i++)
	{
		MPFSStubs[i].addr = MPFS_INVALID;
	}
	
	#if defined(MPFS_USE_EEPROM)
    // Initialize the EEPROM access routines.
    XEEInit();
	lastRead = MPFS_INVALID;
	#endif
	
	#if defined(MPFS_USE_SPI_FLASH)
	// Initialize SPI Flash access routines.
	SPIFlashInit();
	#endif

	// Validate the image and load numFiles
	_Validate();

	isMPFSLocked = false;

}
Exemple #4
0
dw_handle DWENTRY DWModifier(
    dw_client                   cli,
    dw_handle                   hdl,
    uint                        modifiers )
{
    dw_handle                   new_hdl = 0;
    abbrev_code                 abbrev;

    _Validate( hdl != 0 );
    while( modifiers != 0 ) {
        if( modifiers & DW_MOD_CONSTANT ) {
            abbrev = AB_CONST_TYPE;
            modifiers &= ~DW_MOD_CONSTANT;
        } else if( modifiers & DW_MOD_VOLATILE ) {
            abbrev = AB_VOLATILE_TYPE;
            modifiers &= ~DW_MOD_VOLATILE;
        } else {
            abbrev = AB_ADDR_CLASS_TYPE;
        }
        new_hdl = GetHandle( cli );
        StartDIE( cli, abbrev );
        HandleWriteOffset( cli, hdl, DW_DEBUG_INFO );
        if( abbrev == AB_ADDR_CLASS_TYPE ) {
            Info8( cli, modifiers );
            modifiers = 0;
        }
        EndDIE( cli );
        hdl = new_hdl;
    }
    return( new_hdl );
}
Exemple #5
0
dw_handle DWENTRY DWAddParmToSubroutineType(
    dw_client                   cli,
    dw_handle                   parm_type,
    dw_loc_handle               loc,
    dw_loc_handle               seg,
    const char *                name )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;
//TODO: change interface
    loc = loc;
    seg = seg;
    _Validate( parm_type != 0 );
    new_hdl = LabelNewHandle( cli );
    abbrev = AB_FORMAL_PARM_TYPE;
    if( name ) abbrev |= AB_NAME;
    StartDIE( cli, abbrev );
    /* AT_name */
    if( name ) {
        InfoString( cli, name );
    }
    EmitTypeRef( cli, parm_type );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #6
0
dw_handle DWENTRY DWBeginSubroutineType(
    dw_client                   cli,
    dw_handle                   return_type,
    const char *                name,
    dw_addr_offset              start_scope,
    uint                        flags )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    start_scope = start_scope;
    _Validate( return_type != 0 );
    new_hdl = GetHandle( cli );
    abbrev = AB_SUBROUTINE_TYPE | AB_SIBLING;
    if( flags & DW_PTR_TYPE_MASK ) abbrev |= AB_ADDRESS_CLASS;
    emitCommonTypeInfo( cli, abbrev,
                        name, flags );
    if( abbrev & AB_ADDRESS_CLASS ) {
        WriteAddressClass( cli, flags );
    }
    /* AT_prototyped */
    Info8( cli, ( flags & DW_FLAG_PROTOTYPED ) != 0 );
    EmitTypeRef( cli, return_type );
    EndDIE( cli );
    StartChildren( cli );
    return( new_hdl );
}
Exemple #7
0
dw_handle DWENTRY DWBeginArray(
    dw_client                   cli,
    dw_handle                   elt_type,
    uint                        stride_size,
    const char *                name,
    dw_addr_offset              start_scope,
    uint                        access_flags )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    start_scope = start_scope;
    new_hdl = GetHandle( cli );
    _Validate( elt_type != 0 );
    abbrev = AB_SIBLING;
    if( stride_size != 0 ) {
        abbrev |= AB_ARRAY_TYPE_WITH_STRIDE;
    } else {
        abbrev |= AB_ARRAY_TYPE;
    }
    emitCommonTypeInfo( cli, abbrev, name, access_flags );
    /* AT_stride_size */
    if( stride_size ) {
        InfoULEB128( cli, stride_size );
    }
    EmitTypeRef( cli, elt_type );
    EndDIE( cli );
    StartChildren( cli );
    return( new_hdl );
}
Exemple #8
0
dw_handle DWENTRY DWAddField(
    dw_client                   cli,
    dw_handle                   field_hdl,
    dw_loc_handle               loc,
    const char *                name,
    uint                        flags )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    _Validate( field_hdl );
    _Validate( !(flags & DW_FLAG_STATIC) ); // use DWVariable dummy
    new_hdl = LabelNewHandle( cli );
    abbrev = AB_FIELD;
    if( (flags & DW_FLAG_ACCESS_MASK) != DW_FLAG_PUBLIC ){ // not the default
        abbrev |= AB_OPACCESS;
    }
    if( flags & DW_FLAG_ARTIFICIAL ){
        abbrev |= AB_ARTIFICIAL;
    }
    StartDIE( cli, abbrev );
    if( abbrev & AB_OPACCESS ){
        /* AT_accessibility */
        EmitAccessFlags( cli, flags );
    }
    /* AT_artificial */
    if( flags & DW_FLAG_ARTIFICIAL ){
        Info8( cli, 1 );
    }
    if( name == NULL ) {
        name  = "";
    }
    /* AT_name */
    InfoString( cli, name );
    /* AT_data_member_location */
    if( loc ) {
        EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), loc );
    }else{
        EmitLocExprNull( cli, DW_DEBUG_INFO, sizeof( uint_8) );
    }
    /* AT_type */
    EmitTypeRef( cli, field_hdl );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #9
0
dw_handle DWENTRY DWTypedef(
    dw_client                   cli,
    dw_handle                   base_type,
    const char *                name,
    dw_addr_offset              start_scope,
    uint                        flags )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    start_scope = start_scope;
    _Validate( name != NULL );
    _Validate( base_type != 0 );
    new_hdl = GetHandle( cli );
    abbrev = AB_TYPEDEF_TYPE | AB_START_REF;
    emitCommonTypeInfo( cli, abbrev , name, flags );
    EmitTypeRef( cli, base_type );
    EndDIE( cli );
    EndRef( cli );
    return( new_hdl );
}
Exemple #10
0
void DWENTRY DWSetFile(
    dw_client                   cli,
    const char                  *filename )
{
    uint_8                      buf[ 1 + MAX_LEB128 ];
    uint_8                      *end;

    _Validate( filename != NULL );

    buf[0] = DW_LNS_set_file;
    end = LEB128( buf + 1, GetFileNumber( cli, filename ) );
    CLIWrite( DW_DEBUG_LINE, buf, end - buf );
}
Exemple #11
0
dw_handle DWENTRY DWAddBitField(
    dw_client                   cli,
    dw_handle                   field_hdl,
    dw_loc_handle               loc,
    dw_size_t                   byte_size,
    uint                        bit_offset,
    uint                        bit_size,
    const char *                name,
    uint                        flags )
{
    abbrev_code                 abbrev;
    dw_handle                   new_hdl;

    _Validate( field_hdl );
    new_hdl = LabelNewHandle( cli );
    abbrev = AB_BITFIELD;
    if( byte_size ) abbrev |= AB_BYTE_SIZE;
    StartDIE( cli, abbrev );
    /* AT_accessibility */
    EmitAccessFlags( cli, flags );
    if( byte_size ) {
        /* AT_byte_size */
        InfoULEB128( cli, byte_size );
    }
    /* AT_bit_offset */
    InfoULEB128( cli, bit_offset );
    /* AT_bit_size  */
    InfoULEB128( cli, bit_size );
    /* AT_artificial */
    Info8( cli, (flags & DW_FLAG_ARTIFICIAL) != 0 );
    if( name == NULL ) {
        name  = "";
    }
    /* AT_name */
    InfoString( cli, name );
    /* AT_data_member_location */
    if( loc ) {
        EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), loc );
    }else{
        EmitLocExprNull( cli, DW_DEBUG_INFO, sizeof( uint_8) );
    }
    /* AT_type  */
    EmitTypeRef( cli, field_hdl );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #12
0
dw_handle DWENTRY DWSimpleArray(
    dw_client                   cli,
    dw_handle                   elt_type,
    int                         elt_count )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    new_hdl = GetHandle( cli );
    _Validate( elt_type != 0 );
    abbrev = AB_SIMPLE_ARRAY_TYPE;
    StartDIE( cli, abbrev );
    InfoULEB128( cli, elt_count );
    EmitTypeRef( cli, elt_type );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #13
0
dw_handle DWENTRY DWPointer(
    dw_client                   cli,
    dw_handle                   base_type,
    uint                        flags )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    _Validate( base_type != 0 );
    new_hdl = GetHandle( cli );
    abbrev = AB_POINTER_TYPE;
    if( flags & DW_FLAG_REFERENCE ) abbrev = AB_REFERENCE_TYPE;
    flags &= ~DW_FLAG_REFERENCE;
    if( flags ) abbrev |= AB_ADDRESS_CLASS;
    StartDIE( cli, abbrev );
    WriteAddressClass( cli, flags );
    HandleWriteOffset( cli, base_type, DW_DEBUG_INFO );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #14
0
dw_handle DWENTRY DWFundamental(
    dw_client                   cli,
    char const                 *name,
    unsigned                    fund_idx,
    unsigned                    size )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    _Validate( fund_idx >= DW_FT_MIN && fund_idx < DW_FT_MAX );
    new_hdl = GetHandle( cli );
    abbrev = AB_BASE_TYPE;
    if( name ) abbrev |= AB_NAME;
    StartDIE( cli, abbrev );
    if( name ) {
        InfoString( cli, name );
    }
    Info8( cli, fund_idx );
    Info8( cli, size );
    EndDIE( cli );
    return( new_hdl );
}
Exemple #15
0
dw_handle DWENTRY DWBasedPointer(
    dw_client                   cli,
    dw_handle                   base_type,
    dw_loc_handle               seg,
    uint                        flags )
{
    dw_handle                   new_hdl;
    abbrev_code                 abbrev;

    _Validate( base_type != 0 );
    new_hdl = GetHandle( cli );
    abbrev = AB_POINTER_TYPE;
    if( seg ) abbrev |= AB_SEGMENT;
    if( flags ) abbrev |= AB_ADDRESS_CLASS;
    StartDIE( cli, abbrev );
    if( seg ) {
        EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), seg );
    }
    WriteAddressClass( cli, flags );
    HandleWriteOffset( cli, base_type, DW_DEBUG_INFO );
    EndDIE( cli );
    return( new_hdl );
}
   void
   IMAPSimpleCommandParser::Parse(shared_ptr<IMAPCommandArgument> pArgument)
   {
      if (!_Validate(pArgument->Command()))
         return;

      int iCurWordStartPos = 0;

      const String sCommand = pArgument->Command();

      int iCurrentLiteralPos = 0;

      while (1)
      {
         
         bool bCurWordIsQuoted = false;
         bool bCurWordIsParanthezed = false;
         bool bCurWordIsClammerized = false;

         if (iCurWordStartPos >= sCommand.GetLength())
            break;

         if (sCommand.GetAt(iCurWordStartPos) == '\"')
         {
            // Move to the first character in the quoted string.
            iCurWordStartPos ++;
            bCurWordIsQuoted = true;
         }
         else if (sCommand.GetAt(iCurWordStartPos) == '(')
         {
            iCurWordStartPos ++;
            bCurWordIsParanthezed = true;
         }
         else if (sCommand.GetAt(iCurWordStartPos) == '{')
         {
            iCurWordStartPos ++;
            bCurWordIsClammerized = true;
         }

         int iCurWordEndPos = 0;

         if (bCurWordIsQuoted)
         {

            iCurWordEndPos = _FindEndOfQuotedString(sCommand, iCurWordStartPos);

            if (iCurWordEndPos < 0)
               return;
         }
         else if (bCurWordIsParanthezed)
         {
            // Find the end parentheses.
            bool bInString = false;
            int nestDeep = 1;
            for (int i = iCurWordStartPos; i < sCommand.GetLength(); i++)
            {
               wchar_t sCurPos = sCommand.GetAt(i);

               if (sCurPos == '"')
               {
                  bInString = !bInString;
                  continue;
               }

               if (bInString)
                  continue;

               if (sCurPos == '(')
                  nestDeep++;

               if (sCurPos == ')')
               {
                  nestDeep--;
                  
                  if (nestDeep == 0)
                  {
                     iCurWordEndPos = i;
                     break;
                  }
               }
            }

            if (iCurWordEndPos <= 0)
               iCurWordEndPos = sCommand.GetLength();
         }
         else if (bCurWordIsClammerized)
         {
            iCurWordEndPos = sCommand.Find(_T("}"), iCurWordStartPos);

            if (iCurWordEndPos < 0)
               return;
         }
         else
         {
            iCurWordEndPos = sCommand.Find(_T(" "), iCurWordStartPos);

            if (iCurWordEndPos == -1)
            {
               // Found end of string.
               iCurWordEndPos = sCommand.GetLength();
            }
         }

         

         int iCurWordLength = iCurWordEndPos - iCurWordStartPos;
         
         String sCurWord = sCommand.Mid(iCurWordStartPos, iCurWordLength);

         if (bCurWordIsQuoted)
         {
            // The characters " and \ are escaped so we need to unescape them.
            IMAPFolder::UnescapeFolderString(sCurWord);
         }

         shared_ptr<IMAPSimpleWord> pWord = shared_ptr<IMAPSimpleWord>(new IMAPSimpleWord);
         pWord->Value(sCurWord);
         pWord->Quoted(bCurWordIsQuoted);
         pWord->Paranthezied(bCurWordIsParanthezed);
         pWord->Clammerized(bCurWordIsClammerized);

         if (bCurWordIsClammerized)
         {
            pWord->LiteralData(pArgument->Literal(iCurrentLiteralPos));
            iCurrentLiteralPos++;
         }

         m_vecParsedWords.push_back(pWord);
         
         if (bCurWordIsQuoted || bCurWordIsParanthezed || bCurWordIsClammerized)
            iCurWordStartPos = iCurWordEndPos + 2;
         else
            iCurWordStartPos = iCurWordEndPos + 1;
      }



   }