sj4/include/sj4lib/sj4lib.h

44 lines
778 B
C
Raw Permalink Normal View History

2026-06-21 20:32:04 +09:00
#ifndef __SJ4LIB_H__
#define __SJ4LIB_H__
2026-06-29 20:11:20 +09:00
#include <sj4charset.h>
2026-06-21 20:32:04 +09:00
#include <wchar.h>
/* increase this as needed... */
2026-06-22 00:17:07 +09:00
#define SJ4BUFSZ (4 * 1024)
2026-06-21 20:32:04 +09:00
2026-06-22 05:10:51 +09:00
#ifdef __cplusplus
extern "C" {
#endif
2026-06-21 20:32:04 +09:00
typedef union sj4kouhobuffer {
2026-06-21 23:53:20 +09:00
char sjis[SJ4BUFSZ];
char eucjp[SJ4BUFSZ];
char utf8[SJ4BUFSZ];
wchar_t utf16[SJ4BUFSZ / sizeof(wchar_t)];
2026-06-21 20:32:04 +09:00
unsigned char raw[SJ4BUFSZ];
2026-06-21 23:53:20 +09:00
wchar_t wraw[SJ4BUFSZ / sizeof(wchar_t)];
2026-06-21 20:32:04 +09:00
} Sj4KouhoBuffer;
typedef struct sj4kouho {
Sj4KouhoBuffer buffer;
2026-07-02 15:09:22 +09:00
2026-07-05 04:25:55 +09:00
int take;
2026-07-02 15:09:22 +09:00
unsigned char intbuf[SJ4BUFSZ];
2026-06-21 20:32:04 +09:00
} Sj4Kouho;
typedef struct sj4lib Sj4Lib;
Sj4Lib* sj4_open(int, const char*);
int sj4_getkan(Sj4Lib*, const void*, int len, Sj4Kouho*);
2026-06-22 00:17:07 +09:00
int sj4_nextkan(Sj4Lib*);
2026-07-05 04:25:55 +09:00
int sj4_prevkan(Sj4Lib*);
2026-06-21 20:32:04 +09:00
void sj4_close(Sj4Lib*);
2026-06-22 05:10:51 +09:00
#ifdef __cplusplus
}
#endif
2026-06-21 20:32:04 +09:00
#endif