Commit c4c35d33 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

infosoft: Use the pfnFillTextBuffer function to refresh the buffer.

parent 510fc118
...@@ -87,35 +87,67 @@ static HRESULT WINAPI wb_Init( IWordBreaker *iface, ...@@ -87,35 +87,67 @@ static HRESULT WINAPI wb_Init( IWordBreaker *iface,
return S_OK; return S_OK;
} }
static HRESULT WINAPI wb_BreakText( IWordBreaker *iface, static HRESULT call_sink( IWordSink *pWordSink, TEXT_SOURCE *ts, UINT len )
TEXT_SOURCE *pTextSource, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
{ {
LPCWSTR p, q; HRESULT r;
DWORD len;
FIXME("%p %p %p\n", pTextSource, pWordSink, pPhraseSink); if (!len)
return S_OK;
p = pTextSource->awcBuffer; TRACE("%d %s\n", len, debugstr_w(&ts->awcBuffer[ts->iCur]));
while (*p) r = IWordSink_PutWord( pWordSink, len, &ts->awcBuffer[ts->iCur], len, ts->iCur );
{ ts->iCur += len;
/* skip spaces and punctuation */
while(ispunctW(*p) || isspaceW(*p)) return r;
p++; }
/* find the end of the word */ static HRESULT WINAPI wb_BreakText( IWordBreaker *iface,
q = p; TEXT_SOURCE *ts, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
while(*q && !ispunctW(*q) && !isspaceW(*q)) {
q++; UINT len, state = 0;
WCHAR ch;
len = q - p; TRACE("%p %p %p\n", ts, pWordSink, pPhraseSink);
if (!len)
break;
IWordSink_PutWord( pWordSink, len, p, len, p - pTextSource->awcBuffer ); if (pPhraseSink)
FIXME("IPhraseSink won't be called\n");
do
{
len = 0;
while ((ts->iCur + len) < ts->iEnd)
{
ch = ts->awcBuffer[ts->iCur + len];
switch (state)
{
case 0: /* skip spaces and punctuation */
if (!ch || ispunctW(ch) || isspaceW(ch))
ts->iCur ++;
else
state = 1;
break;
case 1: /* find the end of the word */
if (ch && !ispunctW(ch) && !isspaceW(ch))
len++;
else
{
call_sink( pWordSink, ts, len );
len = 0;
state = 0;
}
break;
}
}
call_sink( pWordSink, ts, len );
} while (S_OK == ts->pfnFillTextBuffer( ts ));
p = q;
}
return S_OK; return S_OK;
} }
...@@ -152,7 +184,7 @@ HRESULT WINAPI wb_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObjec ...@@ -152,7 +184,7 @@ HRESULT WINAPI wb_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObjec
wordbreaker_impl *This; wordbreaker_impl *This;
IWordBreaker *wb; IWordBreaker *wb;
FIXME("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject); TRACE("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject);
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This); This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
if (!This) if (!This)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment