infosoft: Add a word breaker for English.
This commit is contained in:
parent
7a15278504
commit
4d3877b649
|
@ -1625,10 +1625,11 @@ dlls/hlink/Makefile
|
|||
dlls/iccvid/Makefile
|
||||
dlls/icmp/Makefile
|
||||
dlls/ifsmgr.vxd/Makefile
|
||||
dlls/inseng/Makefile
|
||||
dlls/imaadp32.acm/Makefile
|
||||
dlls/imagehlp/Makefile
|
||||
dlls/imm32/Makefile
|
||||
dlls/infosoft/Makefile
|
||||
dlls/inseng/Makefile
|
||||
dlls/iphlpapi/Makefile
|
||||
dlls/iphlpapi/tests/Makefile
|
||||
dlls/itss/Makefile
|
||||
|
|
|
@ -75,6 +75,7 @@ BASEDIRS = \
|
|||
imaadp32.acm \
|
||||
imagehlp \
|
||||
imm32 \
|
||||
infosoft \
|
||||
inseng \
|
||||
iphlpapi \
|
||||
itss \
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
TOPSRCDIR = @top_srcdir@
|
||||
TOPOBJDIR = ../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = infosoft.dll
|
||||
IMPORTS = ole32 advapi32 kernel32 ntdll
|
||||
EXTRALIBS = -luuid $(LIBUNICODE)
|
||||
EXTRADEFS = -DCOM_NO_WINDOWS_H
|
||||
|
||||
C_SRCS = \
|
||||
infosoft_main.c \
|
||||
wordbreaker.c
|
||||
|
||||
@MAKE_DLL_RULES@
|
||||
|
||||
### Dependencies:
|
|
@ -0,0 +1,4 @@
|
|||
@ stdcall -private DllCanUnloadNow()
|
||||
@ stdcall -private DllGetClassObject(ptr ptr ptr)
|
||||
@ stdcall -private DllRegisterServer()
|
||||
# @ stdcall -private DllUnregisterServer()
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* Word splitter Implementation
|
||||
*
|
||||
* Copyright 2006 Mike McCormack
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "ole2.h"
|
||||
#include "indexsvr.h"
|
||||
#include "initguid.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
|
||||
|
||||
DEFINE_GUID(CLSID_wb_en_us,
|
||||
0x59e09780,0x8099,0x101b,0x8d,0xf3,0x00,0x00,0x0b,0x65,0xc3,0xb5);
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||
{
|
||||
switch(fdwReason)
|
||||
{
|
||||
case DLL_WINE_PREATTACH:
|
||||
return FALSE; /* prefer native version */
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hInstDLL);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern HRESULT WINAPI wb_en_us_Constructor(IUnknown*, REFIID, LPVOID *);
|
||||
|
||||
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const IClassFactoryVtbl *lpVtbl;
|
||||
LPFNCREATEINSTANCE lpfnCI;
|
||||
} CFImpl;
|
||||
|
||||
static HRESULT WINAPI infosoftcf_fnQueryInterface ( LPCLASSFACTORY iface,
|
||||
REFIID riid, LPVOID *ppvObj)
|
||||
{
|
||||
CFImpl *This = (CFImpl *)iface;
|
||||
|
||||
TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
|
||||
|
||||
*ppvObj = NULL;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppvObj = This;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
TRACE("-- E_NOINTERFACE\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI infosoftcf_fnAddRef (LPCLASSFACTORY iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI infosoftcf_fnRelease(LPCLASSFACTORY iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI infosoftcf_fnCreateInstance( LPCLASSFACTORY iface,
|
||||
LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
|
||||
{
|
||||
CFImpl *This = (CFImpl *)iface;
|
||||
|
||||
TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
|
||||
|
||||
*ppvObject = NULL;
|
||||
|
||||
return This->lpfnCI(pUnkOuter, riid, ppvObject);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI infosoftcf_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
|
||||
{
|
||||
FIXME("%p %d\n", iface, fLock);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IClassFactoryVtbl infosoft_cfvt =
|
||||
{
|
||||
infosoftcf_fnQueryInterface,
|
||||
infosoftcf_fnAddRef,
|
||||
infosoftcf_fnRelease,
|
||||
infosoftcf_fnCreateInstance,
|
||||
infosoftcf_fnLockServer
|
||||
};
|
||||
|
||||
static CFImpl wb_en_us_cf = { &infosoft_cfvt, &wb_en_us_Constructor };
|
||||
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
|
||||
{
|
||||
IClassFactory *pcf = NULL;
|
||||
|
||||
TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
|
||||
|
||||
if (!ppv)
|
||||
return E_INVALIDARG;
|
||||
*ppv = NULL;
|
||||
|
||||
if (IsEqualIID(rclsid, &CLSID_wb_en_us))
|
||||
pcf = (IClassFactory*) &wb_en_us_cf;
|
||||
else
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
|
||||
return IClassFactory_QueryInterface(pcf, iid, ppv);
|
||||
}
|
||||
|
||||
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
FIXME("\n");
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
FIXME("\n");
|
||||
return S_OK;
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* Word splitter Implementation
|
||||
*
|
||||
* Copyright 2006 Mike McCormack
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "ole2.h"
|
||||
#include "indexsvr.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
|
||||
|
||||
typedef struct tag_wordbreaker_impl
|
||||
{
|
||||
const IWordBreakerVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
} wordbreaker_impl;
|
||||
|
||||
static HRESULT WINAPI wb_QueryInterface( IWordBreaker *iface,
|
||||
REFIID riid, LPVOID *ppvObj)
|
||||
{
|
||||
wordbreaker_impl *This = (wordbreaker_impl *)iface;
|
||||
|
||||
TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
|
||||
|
||||
*ppvObj = NULL;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IWordBreaker))
|
||||
{
|
||||
*ppvObj = This;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
TRACE("-- E_NOINTERFACE\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI wb_AddRef( IWordBreaker *iface )
|
||||
{
|
||||
wordbreaker_impl *This = (wordbreaker_impl *)iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI wb_Release(IWordBreaker *iface)
|
||||
{
|
||||
wordbreaker_impl *This = (wordbreaker_impl *)iface;
|
||||
LONG refcount;
|
||||
|
||||
refcount = InterlockedDecrement(&This->ref);
|
||||
if (!refcount)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI wb_Init( IWordBreaker *iface,
|
||||
BOOL fQuery, ULONG ulMaxTokenSize, BOOL *pfLicense )
|
||||
{
|
||||
TRACE("%d %lu\n", fQuery, ulMaxTokenSize);
|
||||
*pfLicense = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI wb_BreakText( IWordBreaker *iface,
|
||||
TEXT_SOURCE *pTextSource, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
|
||||
{
|
||||
LPCWSTR p, q;
|
||||
DWORD len;
|
||||
|
||||
FIXME("%p %p %p\n", pTextSource, pWordSink, pPhraseSink);
|
||||
|
||||
p = pTextSource->awcBuffer;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
/* skip spaces and punctuation */
|
||||
while(ispunctW(*p) || isspaceW(*p))
|
||||
p++;
|
||||
|
||||
/* find the end of the word */
|
||||
q = p;
|
||||
while(*q && !ispunctW(*q) && !isspaceW(*q))
|
||||
q++;
|
||||
|
||||
len = q - p;
|
||||
if (!len)
|
||||
break;
|
||||
|
||||
IWordSink_PutWord( pWordSink, len, p, len, p - pTextSource->awcBuffer );
|
||||
|
||||
p = q;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI wb_ComposePhrase( IWordBreaker *iface,
|
||||
const WCHAR *pwcNoun, ULONG cwcNoun,
|
||||
const WCHAR *pwcModifier, ULONG cwcModifier,
|
||||
ULONG ulAttachmentType, WCHAR *pwcPhrase, ULONG *pcwcPhrase)
|
||||
{
|
||||
FIXME("%p %lu %p %lu %lu %p %p\n", pwcNoun, cwcNoun,
|
||||
pwcModifier, cwcModifier, ulAttachmentType, pwcPhrase, pcwcPhrase);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI wb_GetLicenseToUse( IWordBreaker *iface, const WCHAR **ppwcsLicense )
|
||||
{
|
||||
FIXME("%p\n", ppwcsLicense);
|
||||
*ppwcsLicense = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IWordBreakerVtbl wordbreaker_vtbl =
|
||||
{
|
||||
wb_QueryInterface,
|
||||
wb_AddRef,
|
||||
wb_Release,
|
||||
wb_Init,
|
||||
wb_BreakText,
|
||||
wb_ComposePhrase,
|
||||
wb_GetLicenseToUse,
|
||||
};
|
||||
|
||||
HRESULT WINAPI wb_en_us_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObject)
|
||||
{
|
||||
wordbreaker_impl *This;
|
||||
IWordBreaker *wb;
|
||||
|
||||
FIXME("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject);
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
This->ref = 1;
|
||||
This->lpVtbl = &wordbreaker_vtbl;
|
||||
|
||||
wb = (IWordBreaker*) This;
|
||||
|
||||
return IWordBreaker_QueryInterface(wb, riid, ppvObject);
|
||||
}
|
Loading…
Reference in New Issue