#include "clipstd.h"	/* 標準ヘッダ取り込み */
#include "clipmisc.h"	/* その他いろいろ */
#include "clipscan.h"	/* コールバックを用いたscanfの実装 */
/****************************************************************************
 *	Boehm GC
 ****************************************************************************/
//#include "gc.h"
#include "leak_detector.h"
/****************************************************************************
 *	clipio.c
 ****************************************************************************/
//#define truncate(path,length)	???
#define ftruncate(fd,length)	_chsize((fd),(length))
/****************************************************************************
 *	cliplibc.c
 ****************************************************************************/
//#define MAX_PATH  _MAX_PATH	//_MAX_PATH ⇒STDLIB.H,MAX_PATH⇒WINDEF.H
#define MAX_DRIVE _MAX_DRIVE	//_MAX_DRIVE⇒STDLIB.H
#define MAX_DIR   _MAX_DIR	//_MAX_DIR  ⇒STDLIB.H
#define MAX_FNAME _MAX_FNAME	//_MAX_FNAME⇒STDLIB.H
#define MAX_EXT   _MAX_EXT	//_MAX_EXT  ⇒STDLIB.H
/*--------------------------------------------------------------------------*/
char* strcasestr(const char* s1, const char* s2);
size_t strnlen(const char* string, size_t n);
#ifndef GC_LEAK_DETECTOR_H	//Boehm GCのleak_detector.hをインクルードしている場合は、定義が重複するのでここでは定義しない。
char* strndup(const char* string, size_t n);
#endif//GC_LEAK_DETECTOR_H	//Boehm GCのleak_detector.hをインクルードしている場合は、定義が重複するのでここでは定義しない。
int strcasecmp(const char* s1, const char* s2);
int strncasecmp(const char* s1, const char* s2, size_t n);
char* strsep(char** stringp, const char* delim);
size_t strlcpy(char* dst, const char* src, size_t size);
size_t strlcat(char* dst, const char* src, size_t size);
void* memccpy(void* dest, const void* src, int c, size_t n);
void* mempcpy(void* dest, const void* src, size_t n);
char* stpncpy(char* dest, const char* src, size_t n);
char* stpcpy(char* dest, const char* src);
int ismbblead(int c);
int ismbbtrail(int c);
int isblank(int c);
size_t malloc_usable_size(void* ptr);
/****************************************************************************
 *	clipprnt.c
 ****************************************************************************/
int scprintf(const char* fmt, ...);
int vscprintf(const char* fmt, va_list ap);
int asprintf(char** strp, const char* fmt, ...);
int vasprintf(char** strp, const char* fmt, va_list ap);
/****************************************************************************
 *	clipscan.c
 ****************************************************************************/
int vscanf(const char* fmt, va_list ap);
int vsscanf(const char* str, const char* fmt, va_list ap);
int vfscanf(FILE* stream, const char* fmt, va_list ap);
/****************************************************************************
 *	getline.c
 ****************************************************************************/
/*ssize_t*/int getline(char** lineptr, size_t* n, FILE* stream);
/*ssize_t*/int getdelim(char** lineptr, size_t* n, int delim, FILE* stream);
/****************************************************************************
 *	rand48.c
 ****************************************************************************/
struct drand48_data {
	unsigned short	x[3];		//+ 0,6 Current state.					//┐
	unsigned short	a[3];		//+ 6,6 Factor in congruential formula.			//├lcong48()の引数param[7]の並びに一致
	unsigned short	c[1];		//+12,2 Additive constant in congruential formula.	//┘
	unsigned short	old_x[3];	//+14,6 Old state.
};					//=20
//Return non-negative, double-precision floating-point value in [0.0,1.0).
double drand48();
int    drand48_r(                         struct drand48_data* buffer, double* result);		//GNU extension
double erand48(  unsigned short xsubi[3]);
int    erand48_r(unsigned short xsubi[3], struct drand48_data* buffer, double* result);		//GNU extension
//Return non-negative, long integer in [0,2^31).
long lrand48();
int  lrand48_r(                         struct drand48_data* buffer, long* result);		//GNU extension
long nrand48(  unsigned short xsubi[3]);
int  nrand48_r(unsigned short xsubi[3], struct drand48_data* buffer, long* result);		//GNU extension
//Return signed, long integers in [-2^31,2^31).
long mrand48();
int  mrand48_r(                         struct drand48_data* buffer, long* result);		//GNU extension
long jrand48(  unsigned short xsubi[3]);
int  jrand48_r(unsigned short xsubi[3], struct drand48_data* buffer, long* result);		//GNU extension
//Seed random number generator.
void srand48(  long seedval);
int  srand48_r(long seedval,                        struct drand48_data* buffer);		//GNU extension
unsigned short* seed48(  unsigned short seed16v[3]);
int             seed48_r(unsigned short seed16v[3], struct drand48_data* buffer);		//GNU extension
void lcong48(  unsigned short param[7]);
int  lcong48_r(unsigned short param[7],             struct drand48_data* buffer);		//GNU extension
