// ＡＩＧライブラリ　基本関数：データ変換関数
//	Copyright (C) 1989-1995,98,2001,2002 by AIG-SOFT

#ifndef	__AIG_CDATA__
#define	__AIG_CDATA__	1	/* ヘッダー読み込みシンボル */

#include "deftype.h"

#ifdef	__cplusplus
// 95/11 : G++対応
extern	"C" {
#endif

#ifdef	__PROTO_TYPE
	/* プロトタイプ宣言 */
	int	atoi2(unchar *);
	long	atol2(unchar *);
	int	atoi3(unchar *,int *,int);
	int	atol3(unchar *,int *,int);
	int	atoi3s(unchar *(*),int *,int );
	int	atol3s(unchar *(*),int *,int );
	int	atoi3b(unchar *,int *,int,int,unchar *(*));
	int	atol3b(unchar *,long *,int,int,unchar *(*));
	int	atoi4(unchar *,int *,int);
	int	atol4(unchar *,int *,int);
	int	hval(int);
	int	hex(unchar *);
	int	dval(int);
	int	deci2(unchar *);
	int	deci4(unchar *);
	int	akcnvs(unchar *,unchar *,int);
	int	kacnvs(unchar *,unchar *,int);
	int	ahcnvs(unchar *,unchar *,int);
	unchar	*handaku(unchar *,unchar *);
	unchar	*dakuhan(unchar *,unchar *);
	long	ctol(unchar *);
	unchar	*ltoc(long,unchar *);
	int	ctos(unchar *);
	unchar	*stoc(int,unchar *);
	int	ctos80(unchar *);
	long	ctol80(unchar *);
	unchar	*stoc80(int,unchar *);
	unchar	*ltoc80(long,unchar *);
	int	month_asc(unchar *);
	int	week_asc(unchar *);
	int	akcnv(unint,int);
	int	kacnv(unint,int);
	unsint	kacnvA(unsint);
	int	ahcnv(unint,int);
	unint	dakcnv(unint,int);
	int	jistosjis(unint);
	int	sjistojis(unint);
	unint	zhirakata(unint);
	unint	zkatahira(unint);
	int	code98(int ,unchar *,int);
	int	make_dec(int,unchar *);
	int	make_base(int,unchar *,int );
#if __GNUC__
	// long longを使うのでGCC専用
	int	make_base64(long long,unchar *,int );
#endif
	void	make_hex2(int ,unchar* ,int );
	void	make_hex4(int ,unchar* ,int );
	int	hexstr(const unchar *,unchar *,int);
	int	time_read(unchar *,int *,int );
	int	lshift(unchar *,int,int);
	int	week(int,int,int);
	int	KeikaDays(int ,int ,int );
	int	month_end(int ,int );
	int	kyou(int *,int *);
	int	NowTime(int *,int *);
	unsint	hash(unchar *);
	unsint	hashi(unchar *);
#else	/* フォーワード宣言 */
	int	atoi2();
	long	atol2();
	int	atoi3();
	int	atol3();
	int	atoi3s();
	int	atol3s();
	int	atoi3b();
	int	atol3b();
	int	atoi4();
	int	atol4();
	int	hval();
	int	hex();
	int	dval();
	int	deci2();
	int	deci4();
	int	akcnvs();
	int	kacnvs();
	int	ahcnvs();
	unchar	*handaku();
	unchar	*dakuhan();
	long	ctol();
	unchar	*ltoc();
	int	ctos();
	unchar	*stoc();
	int	ctos80();
	long	ctol80();
	unchar	*stoc80();
	unchar	*ltoc80();
	int	month_asc();
	int	week_asc();
	int	akcnv();
	int	kacnv();
	unsint	kacnvA();
	int	ahcnv();
	unint	dakcnv();
	int	jistosjis();
	int	sjistojis();
	unint	zhirakata();
	unint	zkatahira();
	int	code98();
	int	make_dec();
	int	make_base();
	int	make_base64();
	void	make_hex2();
	void	make_hex4();
	int	hexstr();
	int	time_read();
	int	lshift();
	int	week();
	int	KeikaDays();
	int	month_end();
	int	kyou();
	int	NowTime();
	unsint	hash();
	unsint	hashi();
#endif
#ifdef	__cplusplus
}
#endif

// マクロ関数
#define	atol2(str)			((long)atoi2(str))
#define	atol3(str,num,mode)		atoi3(str,(int*)num,mode)
#define	atol3s(str,num,mode)		atoi3s(str,(int*)num,mode)
#define	atol4(str,num,mode)		atoi4(str,(int*)num,mode)
#define	atol3b(str,num,base,mode,after)	atoi3b(str,(int*)num,base,mode,after)

#define	stoc2(ad,c)	stoc(c,ad)	/* 引数逆順関数 */
#define	ctos2(ad)	ctos(ad)	/* stoc2()に名前を合わせただけ */

#endif
