

#ifdef MACVERSION 
#include <standard.h>
#endif

#ifdef WIN95VERSION 
#include "standard.h"
#include <stdio.h>
#endif

#include "kb.h"
#include "mouse.h"
#include "strings.h"
#include "shell.h"
#include "langinternal.h"




/*
static boolean fllangtrace = false; 
*/


#ifdef fldebug
	#define fllangtrace 0
#else
	#define fllangtrace 0
#endif

extern bigstring bstoken; /*text of last token, see langscan.c*/

/*
#if fllangtrace
	#ifdef MACVERSION
		#define messageset(bs) shellfrontwindowmessage (bs)
	#endif

	#ifdef WIN95VERSION
		static FILE * tracefile = NULL;
		#define messageset(bs)	\
				do {if (tracefile == NULL) \
					tracefile = fopen ("langtrace.txt", "w+"); \
					fprintf (tracefile, "%s\n", bs);} while (0)
	#endif
#endif
*/


#if fllangtrace
	

	#define STR_lineterminator "\r\n"


	static FILE * tracefile = NULL;


	void langstarttrace (void) {

		if (tracefile == NULL)
			tracefile = fopen ("frontier_langtrace.txt", "a+"); /* append */

		fprintf (tracefile, STR_lineterminator);
		} /*langstarttrace*/
		
		
	void langendtrace (void) {

		if (tracefile)
			fclose (tracefile);
		
		tracefile = NULL;
		} /*langendtrace*/


	void langtrace (bigstring bs) {
		
		nullterminate (bstoken);

		nullterminate (bs);

		fprintf (tracefile, ("'%s' ==> %s" STR_lineterminator), &bstoken[1], &bs[1]);
		
		if (shiftkeydown ())
			waitmouseclick ();
		} /*langtrace*/


#else


	void langstarttrace (void) { }
		
	void langendtrace (void) { }

	void langtrace (bigstring bs) { }


#endif

/*
void langsyntaxtrace (boolean fl) {
	
	#ifdef fldebug
	
	fllangtrace = fl; /*set global that turns the syntax trace on or off%/
	
	if (fl) 
		langstarttrace ();
	
	#endif
	} /*langsyntaxtrace*/
	

