//	Zinc Application Framework - Z_STDARG.HPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#if !defined(Z_STDARG_HPP)
#define Z_STDARG_HPP

#include <z_stdcom.hpp>
/* START BLOCK COMMENT
**	const int ZAF_MAXPARAMLEN = 512;
**	
**	typedef void (*objectFormat)(va_list *argList, ZafIChar **ptrBuffer, ZafIChar fmtch, int flags, int width, int prec);
**	typedef int (*objectParse)(va_list *argList, ZafIChar **ptrBuffer, ZafIChar fmtch, int flags, int width, const ZafIChar **fmt);
**	
**	const int ZAF_ALT			= 0x0001;	// alternate form
**	const int ZAF_HEXPREFIX		= 0x0002;	// add 0x or 0X prefix
**	const int ZAF_LADJUST		= 0x0004;	// left adjustment
**	const int ZAF_LONGDBL		= 0x0008;	// long double; unimplemented
**	const int ZAF_LONGINT		= 0x0010;	// long integer
**	const int ZAF_QUADINT		= 0x0020;	// quad integer; unimplemented
**	const int ZAF_SHORTINT		= 0x0040;	// short integer
**	const int ZAF_ZEROPAD		= 0x0080;	// zero (as opposed to blank) pad
**	const int ZAF_ALT_DIGITS		= 0x0100;	// Use alternate digits
**	const int ZAF_CURRENCYx		= 0x0200;	// use currency
**	const int ZAF_CREDIT		= 0x0400;	// use credits (xxx)
**	const int ZAF_COMMAS		= 0x0800;	// use commas
**	const int ZAF_SPACEx		= 0x1000;	// had space flag (not used?)
**	const int ZAF_PLUS			= 0x2000;	// had plus flag
**	const int ZAF_OBJ		= 0x4000;	// pointer to a ZAF_DATA_OBJECT
**	
**	const int ZAF_LONGVAL		= 0x001; // l: long or double
**	const int ZAF_SHORTVAL		= 0x002; // h: short
**	const int ZAF_SUPPRESS		= 0x004; // suppress assignment
**	//const int ZAF_LONGDBL		= 0x008; // L: long double; unimplemented
**	const int ZAF_POINTER		= 0x010; // weird %p pointer (`fake hex')
**	const int ZAF_NOSKIP		= 0x020; // do not skip blanks
**	// The following are used in numeric conversions only:
**	// ZAF_SIGNOK, ZAF_NDIGITS, ZAF_DPTOK, and ZAF_EXPOK are for floating point;
**	// ZAF_SIGNOK, ZAF_NDIGITS, ZAF_PFXOK, and ZAF_NZDIGITS are for integral.
**	const int ZAF_SIGNOK		= 0x040; // +/- is (still) legal
**	const int ZAF_NDIGITS		= 0x080; // no digits detected
**	const int ZAF_DPTOK			= 0x100; // (float) decimal point is still legal
**	const int ZAF_EXPOK			= 0x200; // (float) exponent (e+3, etc) still legal
**	const int ZAF_PFXOK			= 0x100; // 0x prefix is (still) legal
**	const int ZAF_NZDIGITS		= 0x200; // no zero digits detected
**	//const int ZAF_OBJ		= 0x4000;	// pointer to a ZAF_DATA_OBJECT
END BLOCK COMMENT */

class ZAF_EXPORT ZafStandardArg
{
public:
	static int vsprintf(ZafIChar *buffer, const ZafIChar *format, va_list *argList);
	static int vsscanf(const ZafIChar *buffer, const ZafIChar *format, va_list *argList);
	static void RearrangeArgs(bool isScanf, void *newBuffer,
		const ZafIChar *format, const va_list ap, ZafIChar *newFormat,
		va_list *toRet);
	static int _vsprintf(ZafIChar *fp, const ZafIChar *fmt, va_list *ap);
	static int _vsscanf(const ZafIChar *fp, const ZafIChar *fmt, va_list *ap);
	static void SetSprintf(ZafIChar fmtCH, objectFormat format);
	static void SetSscanf(ZafIChar fmtCH, objectParse parse);
};

#endif
