~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/infosoft/wordbreaker.c

Version: ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  *    Word splitter Implementation
  3  *
  4  * Copyright 2006 Mike McCormack
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #define COBJMACROS
 22 
 23 #include "config.h"
 24 
 25 #include <stdarg.h>
 26 
 27 #include "windef.h"
 28 #include "winbase.h"
 29 #include "winuser.h"
 30 #include "ole2.h"
 31 #include "indexsrv.h"
 32 #include "wine/unicode.h"
 33 #include "wine/debug.h"
 34 
 35 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
 36 
 37 typedef struct tag_wordbreaker_impl
 38 {
 39     const IWordBreakerVtbl *lpVtbl;
 40     LONG ref;
 41 } wordbreaker_impl;
 42 
 43 static HRESULT WINAPI wb_QueryInterface( IWordBreaker *iface,
 44         REFIID riid, LPVOID *ppvObj)
 45 {
 46     wordbreaker_impl *This = (wordbreaker_impl *)iface;
 47 
 48     TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
 49 
 50     *ppvObj = NULL;
 51 
 52     if (IsEqualIID(riid, &IID_IUnknown) ||
 53         IsEqualIID(riid, &IID_IWordBreaker))
 54     {
 55         *ppvObj = This;
 56         return S_OK;
 57     }
 58 
 59     TRACE("-- E_NOINTERFACE\n");
 60     return E_NOINTERFACE;
 61 }
 62 
 63 static ULONG WINAPI wb_AddRef( IWordBreaker *iface )
 64 {
 65     wordbreaker_impl *This = (wordbreaker_impl *)iface;
 66     return InterlockedIncrement(&This->ref);
 67 }
 68 
 69 static ULONG WINAPI wb_Release(IWordBreaker *iface)
 70 {
 71     wordbreaker_impl *This = (wordbreaker_impl *)iface;
 72     LONG refcount;
 73 
 74     refcount = InterlockedDecrement(&This->ref);
 75     if (!refcount)
 76         HeapFree(GetProcessHeap(), 0, This);
 77 
 78     return refcount;
 79 }
 80 
 81 static HRESULT WINAPI wb_Init( IWordBreaker *iface,
 82         BOOL fQuery, ULONG ulMaxTokenSize, BOOL *pfLicense )
 83 {
 84     TRACE("%d %u\n", fQuery, ulMaxTokenSize);
 85     *pfLicense = FALSE;
 86     return S_OK;
 87 }
 88 
 89 static HRESULT call_sink( IWordSink *pWordSink, TEXT_SOURCE *ts, UINT len )
 90 {
 91     HRESULT r;
 92 
 93     if (!len)
 94         return S_OK;
 95 
 96     TRACE("%d %s\n", len, debugstr_w(&ts->awcBuffer[ts->iCur]));
 97 
 98     r = IWordSink_PutWord( pWordSink, len, &ts->awcBuffer[ts->iCur], len, ts->iCur );
 99     ts->iCur += len;
100 
101     return r;
102 }
103 
104 static HRESULT WINAPI wb_BreakText( IWordBreaker *iface,
105          TEXT_SOURCE *ts, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
106 {
107     UINT len, state = 0;
108     WCHAR ch;
109 
110     TRACE("%p %p %p\n", ts, pWordSink, pPhraseSink);
111 
112     if (pPhraseSink)
113         FIXME("IPhraseSink won't be called\n");
114 
115     do
116     {
117         len = 0;
118         while ((ts->iCur + len) < ts->iEnd)
119         {
120             ch = ts->awcBuffer[ts->iCur + len];
121 
122             switch (state)
123             {
124             case 0: /* skip spaces and punctuation */
125 
126                 if (!ch || ispunctW(ch) || isspaceW(ch))
127                     ts->iCur ++;
128                 else
129                     state = 1;
130                 break;
131 
132             case 1: /* find the end of the word */
133 
134                 if (ch && !ispunctW(ch) && !isspaceW(ch))
135                     len++;
136                 else
137                 {
138                     call_sink( pWordSink, ts, len );
139                     len = 0;
140                     state = 0;
141                 }
142                 break;
143 
144             }
145         }
146         call_sink( pWordSink, ts, len );
147 
148     } while (S_OK == ts->pfnFillTextBuffer( ts ));
149 
150     return S_OK;
151 }
152 
153 static HRESULT WINAPI wb_ComposePhrase( IWordBreaker *iface,
154          const WCHAR *pwcNoun, ULONG cwcNoun,
155          const WCHAR *pwcModifier, ULONG cwcModifier,
156          ULONG ulAttachmentType, WCHAR *pwcPhrase, ULONG *pcwcPhrase)
157 {
158     FIXME("%p %u %p %u %u %p %p\n", pwcNoun, cwcNoun,
159           pwcModifier, cwcModifier, ulAttachmentType, pwcPhrase, pcwcPhrase);
160     return S_OK;
161 }
162 
163 static HRESULT WINAPI wb_GetLicenseToUse( IWordBreaker *iface, const WCHAR **ppwcsLicense )
164 {
165     FIXME("%p\n", ppwcsLicense);
166     *ppwcsLicense = NULL;
167     return S_OK;
168 }
169 
170 static const IWordBreakerVtbl wordbreaker_vtbl =
171 {
172     wb_QueryInterface,
173     wb_AddRef,
174     wb_Release,
175     wb_Init,
176     wb_BreakText,
177     wb_ComposePhrase,
178     wb_GetLicenseToUse,
179 };
180 
181 HRESULT WINAPI wb_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObject)
182 {
183     wordbreaker_impl *This;
184     IWordBreaker *wb;
185 
186     TRACE("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject);
187 
188     This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
189     if (!This)
190         return E_OUTOFMEMORY;
191 
192     This->ref = 1;
193     This->lpVtbl = &wordbreaker_vtbl;
194 
195     wb = (IWordBreaker*) This;
196 
197     return IWordBreaker_QueryInterface(wb, riid, ppvObject);
198 }
199 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.