示例#1
0
    HRESULT EEDEnumPointer::EvaluateNext( 
        const EvalOptions& options, 
        EvalResult& result,
        std::wstring& name,
        std::wstring& fullName )
    {
        if ( mCountDone >= GetCount() )
            return E_FAIL;

        HRESULT hr = S_OK;
        RefPtr<IEEDParsedExpr>  parsedExpr;

        name.clear();
        fullName.clear();
        fullName.append( L"*(" );
        fullName.append( mParentExprText );
        fullName.append( 1, L')' );

        hr = ParseText( fullName.c_str(), mTypeEnv, mStrTable, parsedExpr.Ref() );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Bind( options, mBinder );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Evaluate( options, mBinder, result );
        if ( FAILED( hr ) )
            return hr;

        mCountDone++;

        return S_OK;
    }
示例#2
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with complete subtitles units.
 ****************************************************************************/
static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    subpicture_t *p_spu;

    if( !pp_block || *pp_block == NULL )
    {
        return NULL;
    }

    ParseText( p_dec, *pp_block );

    block_Release( *pp_block );
    *pp_block = NULL;

    /* allocate an empty subpicture to return.  the actual subpicture
     * displaying is done in the DisplayAnchor function in intf.c (called from
     * DisplayPendingAnchor, which in turn is called from the main RunIntf
     * loop). */
    p_spu = p_dec->pf_spu_buffer_new( p_dec );
    if( !p_spu )
    {
        msg_Dbg( p_dec, "couldn't allocate new subpicture" );
        return NULL;
    }

    return p_spu;
}
示例#3
0
void CFilePreviewCtrl::DoInWorkerThread()
{
    if(m_PreviewMode==PREVIEW_TEXT)
        ParseText();
    else
        LoadBitmap();
}
示例#4
0
void CCodeEditor::DealText()
{
	if (ParseText())
	{
		FormatText(this->toPlainText());
	}
}
示例#5
0
wxString TemplateParser::ParseTemplate()
{
    try
    {
        while (!m_in.Eof())
        {
            Token token = GetNextToken();
            switch (token)
            {
            case TOK_MACRO:
                ParseMacro();
                break;
            case TOK_PROPERTY:
                ParseProperty();
                break;
            case TOK_TEXT:
                ParseText();
                break;
            default:
                return wxT("");
            }
        }
    }
    catch ( wxFBException& ex )
    {
        wxLogError( ex.what() );
    }

	return m_out;
}
示例#6
0
long CScrollBufL1::AddText(char *szText, int nBytes)
{
    int nLineLen;
    int nBytesProcessed = 0;
    ETextType eTextType;

    AddDebug(szText, nBytes);

    while (nBytesProcessed < nBytes)
    {
        ParseText(szText, nBytes - nBytesProcessed, &eTextType, &nLineLen);
        if (nLineLen > 0)
        {
            FillInData(szText, eTextType, nLineLen);
            if (eTextType != LINEBUF_BROKEN_ESCAPE)
            {
                szText += (nLineLen - m_nBrokenEscLen);
                nBytesProcessed += (nLineLen - m_nBrokenEscLen);
                m_nBrokenEscLen = 0;
            }
            else
            {
                szText += nLineLen;
                nBytesProcessed += nLineLen;
            }
        }
        else
        {
            szText++;
            nBytesProcessed++;
        }
    }
    
    return UpdateSelection();
}
示例#7
0
void ChatWindow::sendLine()
{
    QColor oldColor = edtChat->color();
    QString s = edtChat->text();
    s.replace(QRegExp("<br>"), "");
    s.replace(QRegExp("</?p>"), "");
    QCString sLineSend = s.local8Bit();
    chat->chat->sendLine(sLineSend);
    QString clientString;
    QString br;
    if (bClientMode){
        int n = txtChat->paragraphs();
        clientString = txtChat->text(n-1);
        txtChat->removeParagraph(n-1);
        br = "<br>";
        int pos = clientString.find("&gt;");
        clientString = chatHeader(chat->getUin()) + clientString.mid(pos+4);
    }
    QString line = chatHeader(0) + ParseText(sLineSend) + "<br>\n";
    txtChat->insertParagraph(br + line, -1);
    if (bClientMode)
        txtChat->insertParagraph(clientString, -1);
    txtChat->scrollToBottom();
    txtChat->moveCursor(QTextEdit::MoveEnd, false);
    edtChat->setText("");
    edtChat->setBold(btnBold->isOn());
    edtChat->setItalic(btnItalic->isOn());
    edtChat->setUnderline(btnUnderline->isOn());
    if (logFile){
        QCString s = line.local8Bit();
        logFile->writeBlock(s, s.length());
        logFile->flush();
    }
    edtChat->setColor(oldColor);
}
示例#8
0
void CUILines::UpdateCursor() {
    if (uFlags.test(flComplexMode) && !m_text.empty())
    {
        ParseText();
        const int sz = (int)m_lines.size();
        int len = 0;
        for (int i = 0; i < sz; i++)
        {
            int curlen = m_lines[i].GetSize();
            if (m_iCursorPos <= len + curlen)
            {
                m_cursor_pos.y = i;
                m_cursor_pos.x = m_iCursorPos - len;
                return;
            }
            len += curlen;
        }
        R_ASSERT(false);
    }
    else
    {
        m_cursor_pos.y = 0;
        m_cursor_pos.x = m_iCursorPos;
    }
}
示例#9
0
    void Map::ParseFile(const string &fileName) 
    {
        file_name = fileName;

        int lastSlash = fileName.find_last_of("/");

        // Get the directory of the file using substring.
        if (lastSlash > 0) 
        {
            file_path = fileName.substr(0, lastSlash + 1);
        } 
        else 
        {
            file_path = "";
        }

        char* fileText;
        int fileSize;

        // Open the file for reading.
        FILE *file = fopen(fileName.c_str(), "rb");

        // Check if the file could not be opened.
        if (!file) 
        {
            has_error = true;
            error_code = TMX_COULDNT_OPEN;
            error_text = "Could not open the file.";
            return;
        }
    
        // Find out the file size.  
        fseek(file, 0, SEEK_END);
        fileSize = ftell(file);
        fseek(file, 0, SEEK_SET);
        
        // Check if the file size is valid.
        if (fileSize <= 0)
        {
            has_error = true;
            error_code = TMX_INVALID_FILE_SIZE;
            error_text = "The size of the file is invalid.";
            return;
        }

        // Allocate memory for the file and read it into the memory.
        fileText = new char[fileSize + 1];
        fileText[fileSize] = 0;
        fread(fileText, 1, fileSize, file);

        fclose(file);

        // Copy the contents into a C++ string and delete it from memory.
        std::string text(fileText, fileText+fileSize);
        delete [] fileText;

        ParseText(text);        
    }
示例#10
0
void CUILines::Draw(float x, float y) {
    static string256 passText;

    if (m_text.empty())
        return;

    R_ASSERT(m_pFont);
    m_pFont->SetColor(m_dwTextColor);

    if (!uFlags.is(flComplexMode))
    {
        Fvector2 text_pos;
        text_pos.set(0,0);

        text_pos.x = x + GetIndentByAlign();
        text_pos.y = y + GetVIndentByAlign();
        UI()->ClientToScreenScaled(text_pos);

        if (uFlags.test(flPasswordMode))
        {
            int sz = (int)m_text.size();
            for (int i = 0; i < sz; i++)
                passText[i] = '*';
            passText[sz] = 0;
            m_pFont->SetAligment((CGameFont::EAligment)m_eTextAlign);
            m_pFont->Out(text_pos.x, text_pos.y, "%s", passText);
        }
        else {
            m_pFont->SetAligment((CGameFont::EAligment)m_eTextAlign);
            m_pFont->Out(text_pos.x, text_pos.y, "%s", m_text.c_str());
        }
    }
    else
    {
        //if (uFlags.test(flNeedReparse))
        ParseText();

        Fvector2 pos;
        // get vertical indent
        pos.y			= y + GetVIndentByAlign();
        float height	= m_pFont->CurrentHeight_();
        UI()->ClientToScreenScaledHeight(height);

        u32 size		= m_lines.size();

        m_pFont->SetAligment((CGameFont::EAligment)m_eTextAlign);
        for (int i=0; i<(int)size; i++)
        {
            pos.x = x + GetIndentByAlign();
            m_lines[i].Draw(m_pFont, pos.x, pos.y);
            pos.y+= height + m_interval;
        }

    }

    m_pFont->OnRender();
}
示例#11
0
void CTextBox::OnBackSpaceWord()
{
    if ( IsFoucus() )
    {
        m_fCurXoffset -= m_fScaleSize;
        DeleteAChar();
        ParseText();
        UpdateCur();
    }
}
示例#12
0
void CGUITextLayout::UpdateCommon(const std::wstring &text, float maxWidth, bool forceLTRReadingOrder)
{
  // parse the text for style information
  vecText parsedText;
  vecColors colors;
  ParseText(text, m_font ? m_font->GetStyle() : 0, m_textColor, colors, parsedText);

  // and update
  UpdateStyled(parsedText, colors, maxWidth, forceLTRReadingOrder);
}
示例#13
0
	CTString AdjustAlias()
	{
		int iNameSize  = this->strName.GetLength();
		
		if(iNameSize <= 6)//少于或等于3个
		{
			this->strBaseAls = this->strName;
		}
		else if((iNameSize > 6) && (this->count == 1))//多于或等于4个,且个数不到100(iNameSize <= 8) &&
		{
			int iCnt = iNameSize <= 10 ? iNameSize:10;
			iCnt = ParseText(strName,iCnt);
			this->strBaseAls = this->strName.Left(iCnt);//10
		}
		else if((iNameSize > 6) && (this->count < 100))//多于或等于4个,且个数不到100(iNameSize <= 8) &&
		{
			int iCnt = iNameSize <= 8 ? iNameSize:8;
			iCnt = ParseText(strName,iCnt);
			this->strBaseAls = this->strName.Left(iCnt);
		}
		else if((iNameSize > 6) && (this->count <= 9999))//多于或等于4个,且个数超过99,最多支持1000个表也可扩展
		{
			int iCnt = iNameSize <= 6 ? iNameSize:6;
			iCnt = ParseText(strName,iCnt);
			this->strBaseAls = this->strName.Left(6);
		}
		else if((iNameSize > 6) && (this->count <= 999999))
		{
			int iCnt = iNameSize <= 4 ? iNameSize:4;
			iCnt = ParseText(strName,iCnt);
			this->strBaseAls = this->strName.Left(iCnt);
		}
		else if((iNameSize > 6) && (this->count > 999999))
		{
			int iCnt = iNameSize <= 4 ? iNameSize:4;
			iCnt = ParseText(strName,iCnt);
			this->strBaseAls = this->strName.Left(iCnt);
		//	//===temp AfxMessageBox("您打开的数据表数目多于1000000个");
		}
		return this->strBaseAls;
	}
示例#14
0
void CGUITextLayout::Filter(std::string &text)
{
  std::wstring utf16;
  g_charsetConverter.utf8ToW(text, utf16, false);
  vecColors colors;
  vecText parsedText;
  ParseText(utf16, 0, 0xffffffff, colors, parsedText);
  utf16.clear();
  for (unsigned int i = 0; i < parsedText.size(); i++)
    utf16 += (wchar_t)(0xffff & parsedText[i]);
  g_charsetConverter.wToUTF8(utf16, text);
}
示例#15
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with complete subtitles units.
 ****************************************************************************/
static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    subpicture_t *p_spu = NULL;

    if( !pp_block || *pp_block == NULL ) return NULL;

    p_spu = ParseText( p_dec, *pp_block );

    block_Release( *pp_block );
    *pp_block = NULL;

    return p_spu;
}
示例#16
0
文件: stl.c 项目: Janak-Nirmal/vlc
static subpicture_t *Decode(decoder_t *dec, block_t **block)
{
    if (block == NULL || *block == NULL)
        return NULL;

    subpicture_t *sub = NULL;

    block_t *b = *block; *block = NULL;
    if (b->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
        goto exit;
    if (b->i_buffer < 128)
        goto exit;

    int     payload_size = (b->i_buffer / 128) * 112;
    uint8_t *payload = malloc(payload_size);
    if (!payload)
        goto exit;
    for (unsigned i = 0; i < b->i_buffer / 128; i++)
        memcpy(&payload[112 * i], &b->p_buffer[128 * i + 16], 112);

    sub = decoder_NewSubpicture(dec, NULL);
    if (!sub) {
        free(payload);
        goto exit;
    }
    sub->i_start    = b->i_pts;
    sub->i_stop     = b->i_pts + b->i_length;
    sub->b_ephemer  = b->i_length == 0;
    sub->b_absolute = false;
    //sub->i_original_picture_width  = 0;
    //sub->i_original_picture_height = 0;

    video_format_t fmt;
    video_format_Init(&fmt, VLC_CODEC_TEXT);
    sub->p_region = subpicture_region_New(&fmt);
    video_format_Clean(&fmt);

    if (sub->p_region) {
        sub->p_region->psz_text = ParseText(payload,
                                            payload_size,
                                            cct_nums[dec->p_sys->cct - CCT_BEGIN].str);
        sub->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM;
        sub->p_region->psz_html = NULL;
    }

    free(payload);

exit:
    block_Release(b);
    return sub;
}
示例#17
0
文件: subsusf.c 项目: mstorsjo/vlc
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with complete subtitles units.
 ****************************************************************************/
static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
    subpicture_t *p_spu;

    if( p_block == NULL ) /* No Drain */
        return VLCDEC_SUCCESS;

    p_spu = ParseText( p_dec, p_block );

    block_Release( p_block );
    if( p_spu != NULL )
        decoder_QueueSub( p_dec, p_spu );
    return VLCDEC_SUCCESS;
}
示例#18
0
float CUILines::GetVisibleHeight()
{
    float _curr_h = m_pFont->CurrentHeight_();
    UI()->ClientToScreenScaledHeight(_curr_h);

    if (uFlags.test(flComplexMode))
    {
        if(uFlags.test(flNeedReparse))
            ParseText	();
        return (_curr_h + m_interval)*m_lines.size() - m_interval;
    }
    else
        return _curr_h;
}
nsresult
RDFContentSinkImpl::FlushText()
{
    nsresult rv = NS_OK;
    if (0 != mTextLength) {
        if (rdf_IsDataInBuffer(mText, mTextLength)) {
            // XXX if there's anything but whitespace, then we'll
            // create a text node.

            switch (mState) {
            case eRDFContentSinkState_InMemberElement: {
                nsCOMPtr<nsIRDFNode> node;
                ParseText(getter_AddRefs(node));

                nsCOMPtr<nsIRDFContainer> container;
                NS_NewRDFContainer(getter_AddRefs(container));
                container->Init(mDataSource, GetContextElement(1));

                container->AppendElement(node);
            } break;

            case eRDFContentSinkState_InPropertyElement: {
                nsCOMPtr<nsIRDFNode> node;
                ParseText(getter_AddRefs(node));

                mDataSource->Assert(GetContextElement(1), GetContextElement(0), node, PR_TRUE);
            } break;

            default:
                // just ignore it
                break;
            }
        }
        mTextLength = 0;
    }
    return rv;
}
示例#20
0
bool CSkinParser::LoadVariation( const wchar_t *fname )
{
	m_VarText.swap(m_Text);
	bool res=LoadText(fname);
	if (res)
	{
		std::vector<const wchar_t*> lines;
		lines.swap(m_Lines);
		lines.push_back(L"[TRUE]");
		ParseText();
		m_Lines.insert(m_Lines.begin(),lines.begin(),lines.end());
	}
	m_VarText.swap(m_Text);
	return res;
}
示例#21
0
bool CSkinParser::LoadVariation( HMODULE hMod, HRSRC hResInfo )
{
	m_VarText.swap(m_Text);
	bool res=LoadText(hMod,hResInfo);
	if (res)
	{
		std::vector<const wchar_t*> lines;
		lines.swap(m_Lines);
		lines.push_back(L"[TRUE]");
		ParseText();
		m_Lines.insert(m_Lines.begin(),lines.begin(),lines.end());
	}
	m_VarText.swap(m_Text);
	return res;
}
示例#22
0
	void Map::ParseFile(const string &fileName) 
	{
		file_name = fileName;

		int lastSlash = fileName.find_last_of("/");

		// Get the directory of the file using substring.
		if (lastSlash > 0) 
		{
			file_path = fileName.substr(0, lastSlash + 1);
		} 
		else 
		{
			file_path = "";
		}

		has_error = true;
		error_code = TMX_COULDNT_OPEN;
		error_text = "Could not open the file.";
		yam2d::Ref<yam2d::Stream> s = new yam2d::FileStream(fileName.c_str(), yam2d::FileStream::READ_ONLY );
	
		// Check if the file size is valid.
		if (s->available() <= 0)
		{
			has_error = true;
			error_code = TMX_INVALID_FILE_SIZE;
			error_text = "The size of the file is invalid.";
			return;
		}
		
		has_error = false;
		error_code = 0;
		error_text = "";

		// Allocate memory for the file and read it into the memory.
		std::vector<char> fileText;
		fileText.resize( s->available() );
		s->read( &fileText[0], fileText.size() );

		// Copy the contents into a C++ string and delete it from memory.
		std::string text(&fileText[0], &fileText[0]+fileText.size());
		
		ParseText(text);


	}
示例#23
0
    HRESULT EEDEnumStruct::EvaluateNext( 
        const EvalOptions& options, 
        EvalResult& result,
        std::wstring& name,
        std::wstring& fullName )
    {
        if ( mCountDone >= GetCount() )
            return E_FAIL;

        HRESULT hr = S_OK;
        RefPtr<Declaration>     decl;
        RefPtr<IEEDParsedExpr>  parsedExpr;

        if ( !mMembers->Next( decl.Ref() ) )
            return E_FAIL;

        mCountDone++;

        name.clear();
        fullName.clear();

        if ( decl->IsBaseClass() )
        {
            if ( !NameBaseClass( decl, name, fullName ) )
                return E_FAIL;
        }
        else
        {
            if ( !NameRegularMember( decl, name, fullName ) )
                return E_FAIL;
        }

        hr = ParseText( fullName.c_str(), mTypeEnv, mStrTable, parsedExpr.Ref() );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Bind( options, mBinder );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Evaluate( options, mBinder, result );
        if ( FAILED( hr ) )
            return hr;

        return S_OK;
    }
示例#24
0
    HRESULT EEDEnumSArray::EvaluateNext( 
        const EvalOptions& options, 
        EvalResult& result,
        std::wstring& name,
        std::wstring& fullName )
    {
        if ( mCountDone >= GetCount() )
            return E_FAIL;

        // 4294967295
        const int   MaxIntStrLen = 10;
        // "[indexInt]", and add some padding
        const int   MaxIndexStrLen = MaxIntStrLen + 2 + 10;

        HRESULT hr = S_OK;
        RefPtr<IEEDParsedExpr>  parsedExpr;
        wchar_t indexStr[ MaxIndexStrLen + 1 ] = L"";

        swprintf_s( indexStr, L"[%d]", mCountDone );

        name.clear();
        name.append( indexStr );

        fullName.clear();
        fullName.append( L"(" );
        fullName.append( mParentExprText );
        fullName.append( L")" );
        fullName.append( name );

        hr = ParseText( fullName.c_str(), mTypeEnv, mStrTable, parsedExpr.Ref() );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Bind( options, mBinder );
        if ( FAILED( hr ) )
            return hr;

        hr = parsedExpr->Evaluate( options, mBinder, result );
        if ( FAILED( hr ) )
            return hr;

        mCountDone++;

        return S_OK;
    }
示例#25
0
void CTextBox::OnInsertText( const TCHAR* data, int num )
{
    if ( IsFoucus() )
    {
        TString insertString( data, nNum );
        m_strText += insertString;
        auto glyphs = m_pFontFace->GetGlyphs( m_strText );
        m_fCurXoffset = 0;
        CRenderTarget* pCurTarget = CRenderManager::GetInstance()->GetCurrentRenderTarget();
        BEATS_ASSERT(pCurTarget != NULL);
        for ( auto glyph : glyphs )
        {
            m_fCurXoffset +=  glyph->GetWidth() * pCurTarget->GetScaleFactor();
        }
        ParseText();
        UpdateCur();
    }
}
示例#26
0
文件: subsdec.c 项目: etix/vlc
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with complete subtitles units.
 ****************************************************************************/
static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
    subpicture_t *p_spu;

    if( p_block == NULL ) /* No Drain */
        return VLCDEC_SUCCESS;

    if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
    {
        block_Release( p_block );
        return VLCDEC_SUCCESS;
    }

    p_spu = ParseText( p_dec, p_block );

    block_Release( p_block );
    if( p_spu != NULL )
        decoder_QueueSub( p_dec, p_spu );
    return VLCDEC_SUCCESS;
}
示例#27
0
// Main recursive parsing function
bool wxSimpleHtmlParser::ParseHtml(wxSimpleHtmlTag* parent)
{
    while (!Eof())
    {
        EatWhitespace();
        if (IsComment())
        {
            ParseComment();
        }
        else if (IsDirective())
        {
            wxSimpleHtmlTag* tag = ParseDirective();
            if (tag)
                parent->AppendTag(tag);
        }
        else if (IsTagClose())
        {
            wxSimpleHtmlTag* tag = ParseTagClose();
            if (tag)
                parent->AppendTag(tag);
        }
        else if (IsTagStartBracket(GetChar(m_pos)))
        {
            wxSimpleHtmlTag* tag = ParseTagHeader();
            if (tag)
                parent->AppendTag(tag);
        }
        else
        {
            // Just a text string
            wxString text;
            ParseText(text);

            wxSimpleHtmlTag* tag = new wxSimpleHtmlTag(wxT("TEXT"), wxSimpleHtmlTag_Text);
            tag->SetText(text);
            parent->AppendTag(tag);
        }
    }
    return TRUE;
}
示例#28
0
bool CTextBox::OnPropertyChange( void* pVariableAddr, CSerializer* pSerializer )
{
    bool bRet = super::OnPropertyChange( pVariableAddr, pSerializer );
    if ( !bRet )
    {
        if ( &m_strFontName == pVariableAddr )
        {
            TString fontName;
            DeserializeVariable( fontName, pSerializer );
            if ( fontName != m_strFontName )
            {
                m_strFontName = fontName;
                m_pFontFace = CFontManager::GetInstance()->GetFace( m_strFontName );
                BEATS_ASSERT( m_pFontFace, _T("can't get the font face named %s"), m_strFontName.c_str() );
                ParseText();
            }
            bRet = true;
        }
        else if ( &m_fXBorderWidth == pVariableAddr )
        {
            DeserializeVariable( m_fXBorderWidth, pSerializer );
            UpdateQuadP();
            bRet = true;
        }
        else if ( &m_fYBorderWidth == pVariableAddr )
        {
            DeserializeVariable( m_fYBorderWidth, pSerializer );
            UpdateQuadP();
            bRet = true;
        }
        else if ( &m_uTextSize == pVariableAddr )
        {
            DeserializeVariable( m_uTextSize, pSerializer );
            UpdateQuadP();
            bRet = true;
        }
    }
    return bRet;
}
示例#29
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with complete subtitles units.
 ****************************************************************************/
static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    subpicture_t *p_spu;
    block_t *p_block;

    if( !pp_block || *pp_block == NULL )
        return NULL;

    p_block = *pp_block;
    if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
    {
        block_Release( p_block );
        return NULL;
    }

    p_spu = ParseText( p_dec, p_block );

    block_Release( p_block );
    *pp_block = NULL;

    return p_spu;
}
void ParseScript()
{
	char str[512];
	
	while(!feof(infile))
	{	
		memset(str,'\0',512);
		fgets(str,512,infile);
		
		switch(GetType(str))
		{
			case 1:
			{
				int opcode = GetID(str);
				
				if(opcode!=-1)
				{
					Push(&bytestack,opcode,1);
					PushArgs(&bytestack,str,opcode,4);
				}
			}
			break;
			
			case 2:
			{
				char *name = GetFuncName(str);
				int opcode = GetOpcode(name);
				
				Push(&bytestack,opcode,1);
				PushArgs(&bytestack,str,opcode,strlen(name));
				
				free(name);
			}
			break;
			
			case 3:
			{
				int id = GetID(str);
				
				if(id!=-1)
				{
					PushInt(&labelstack,bytestack.size,id);
					scrhead.labels.size++;
				}
				else
				{
					printf("Problem parsing label: %s",str);
					exit(1);
				}
			}
			break;
				
			case 4:
			{
				int id = GetID(str);
				
				if(id!=-1)
				{
					//Push(&markerstack,id,4);
					markerstack[id] = bytestack.size;
					scrhead.markers.size = 100;
				}
				else
				{
					printf("Problem parsing marker: %s",str);
					exit(1);
				}
			}
			break;
				
			case 5:
			{
				FILE *textfile = NULL;
				
				while(str[strlen(str)-1]=='\r' || str[strlen(str)-1]=='\n')
					str[strlen(str)-1] = '\0';
					
				textfile = fopen(str+9,"rb");
				
				if(!textfile)
				{
					printf("Could not open %s\n",str+9);
					exit(1);
				}
				
				ParseText(textfile);
				fclose(textfile);
			}
			break;
			
			case 6:
			{
				int t = 0;
				sscanf(str+1,"%x",&t);
				
				if(scrhead.unk12.size==0)
					unk12stack = (int*)calloc(1,sizeof(int));
				else
					unk12stack = (int*)realloc(unk12stack,(scrhead.unk12.size+1)*sizeof(int));
				
				unk12stack[scrhead.unk12.size++] = t;
			}
			break;
			
			case 7:
			{
				int t = 0;
				sscanf(str+1,"%x",&t);
				
				if(scrhead.unk13.size==0)
					unk13stack = (int*)calloc(1,sizeof(int));
				else
					unk13stack = (int*)realloc(unk13stack,(scrhead.unk13.size+1)*sizeof(int));
					
				unk13stack[scrhead.unk13.size++] = t;
			}
			break;
		
			default:
				break;
		}
	}
}