/* \82±\82¿\82ç\82Ì\83o\81[\83W\83\87\83\93\82à\8dX\90V\82µ\82Ä\82\82¾\82³\82¢\81B */
#define NKF_VERSIONW L"2.0.8"
/* NKF_VERSION \82Ì\83\8f\83C\83h\95¶\8e\9a */
-#define DLL_VERSION "2.0.8.0 1"
+#define DLL_VERSION "2.0.8.0 2"
/* DLL\82ª\95Ô\82· */
-#define DLL_VERSIONW L"2.0.8.0 1"
+#define DLL_VERSIONW L"2.0.8.0 2"
/* DLL\82ª\95Ô\82· DLL_VERSION \82Ì\83\8f\83C\83h\95¶\8e\9a */
/* nkf32.dll main */
#endif /*UNICODESUPPORT*/
}
+static LPSTR optStr0 = NULL;
+
int CALLBACK SetNkfOption(LPSTR optStr)
{
LPSTR p;
+ int len;
if ( *optStr == '-' ) {
- reinit();
- options(optStr);
+ len = strlen(optStr) + 1;
+ p = realloc(optStr0,len);
+ strcpy(p,optStr);
} else {
- p = malloc(strlen(optStr) + 2);
- if ( p == NULL ) return -1;
+ len = strlen(optStr) + 2;
+ p = realloc(optStr0,len);
*p = '-';
strcpy(p + 1,optStr);
- reinit();
- options(p);
- free(p);
}
+ optStr0 = p;
return 0;
}
+void options0(void)
+{
+ reinit();
+ if ( optStr0 != NULL ) {
+ options(optStr0);
+ }
+}
+
void CALLBACK NkfConvert(LPSTR outStr, LPCSTR inStr)
{
+ options0();
std_putc_mode = 2;
cout = outStr;
noutmax = -1;
BOOL WINAPI NkfConvertSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/, LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/){
if ( inStr == NULL ) return FALSE;
+ options0();
std_putc_mode = 6;
cout = outStr;
noutmax = nOutBufferLength;
p = malloc(len);
if ( p == NULL ) return;
memcpy(p,inStr,len);
- reinit();
options("-ZSs");
NkfConvert(inStr,p);
free(p);
BOOL WINAPI ToHankakuSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/)
{
- reinit();
options("-ZSs");
return NkfConvertSafe(outStr,nOutBufferLength,lpBytesReturned,inStr,nInBufferLength);
}
void CALLBACK ToZenkakuKana(LPSTR outStr, LPCSTR inStr)
{
- reinit();
options("-Ss");
NkfConvert(outStr, inStr);
}
BOOL WINAPI ToZenkakuKanaSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/)
{
- reinit();
options("-Ss");
return NkfConvertSafe(outStr,nOutBufferLength,lpBytesReturned,inStr,nInBufferLength);
}
void CALLBACK EncodeSubject(LPSTR outStr ,LPCSTR inStr){
- reinit();
options("-jM");
NkfConvert(outStr, inStr);
}
BOOL WINAPI EncodeSubjectSafe(LPSTR outStr,DWORD nOutBufferLength /*in Bytes*/,LPDWORD lpBytesReturned /*in Bytes*/,LPCSTR inStr,DWORD nInBufferLength /*in Bytes*/)
{
- reinit();
options("-jM");
return NkfConvertSafe(outStr,nOutBufferLength,lpBytesReturned,inStr,nInBufferLength);
}