/* 
  ==========================================================================
  Auxiliary general-purpose Tcl functions
  ---
   2020 - A.Buratti fecit
  ==========================================================================
*/

#ifndef __XTCL_UTIL_INCLUDED
#define __XTCL_UTIL_INCLUDED

#include <tcl.h>

#ifndef EXTERN_C
	#ifdef __cplusplus
		#define EXTERN_C extern "C"
	#else
		#define EXTERN_C extern
	#endif
#endif

typedef int TclResCode ;  // TCL_OK, TCL_RETURN, ..
#define xTcl_NewStringObj( str )  Tcl_NewStringObj( str, -1 )

EXTERN_C void xTcl_PrependObjResult( Tcl_Interp* interp, Tcl_Obj* headObj );


  // return a NEW string (must be deallocated (free()) by the caller)
EXTERN_C char* const xTcl_FSGetNormalizedPath( const char* filename );

EXTERN_C Tcl_WideInt xTcl_GetModificationTime( Tcl_Interp* interp, const char* filename );

EXTERN_C int xTcl_FillArrayOfDoubleFromObj(Tcl_Interp* interp, Tcl_Obj* listObj, double v[], int n);
EXTERN_C int xTcl_FillArrayOfFloatFromObj(Tcl_Interp* interp, Tcl_Obj* listObj, float v[], int n);

EXTERN_C TclResCode xTcl_Get_N_Floats_FromObj( Tcl_Interp* interp, Tcl_Obj* listObj, int expectedNelems, float v[]);


// This macro is a short for the standard parameter-list of the
// Tcl_ObjCmdProc conformant functions.
#define CMD_ARGS \
	ClientData clientData,\
	Tcl_Interp* interp,\
	int objc,\
	Tcl_Obj* const objv[]

#endif