#ifndef __MBASIC_H
#define __MBASIC_H

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<stdarg.h>

#define EMIT_PREFIX		'\t'

void Error(const char * fmt,...);
void Expected(const char * fmt,...);
void io_load_program(char * name);
void io_unload_program(void);
char GetProgramChar(void);
void io_init_output(void);
void io_finalize_output(char * name);
void emit(const char * fmt,...);
void _emit(const char * fmt,...);
int NewLabel(void);
void PostLabel(int L);
void InitParser(void);
void InitLabel(void);
void register_label(char * n);
void ParseAssemblyBlock(void);
void GetChar(void);
void Match(char c);
void emitch(char c);
void SkipWhite(void);
void Block(void);
void RegisterVariable(char * n);

extern char Look;
extern char current_token[];

extern int IS_FASM_SYNTAX;
extern int EQU_VARS;

#define TOK_IF		0
#define TOK_THEN	1
#define TOK_ELSE	2
#define TOK_ENDIF	3
#define TOK_FOR		4
#define TOK_TO		5
#define TOK_DOWNTO	6
#define TOK_NEXT	7
#define TOK_WHILE	8
#define TOK_WEND	9
#define TOK_END		10
#define TOK_LABEL	11
#define TOK_EXIT	12
#define TOK_ASMBEGIN	13
#define TOK_ASMEND	14
#define TOK_GOTO	15
#define TOK_GOSUB	16
#define TOK_RETURN	17
#define TOK_FUNCTION	18
#define TOK_ENDS	19
#define TOK_HALT	20
#define TOK_INCLUDE	21
#define TOK_REM		22
#define TOK_DIM		23

#define STORE_TMP(x) \
 memcpy((x),current_token,strlen(current_token)+1)

extern char * InputFilePtr,* InputFileInitPtr;

#define MAX_PARAM_PER_FUNC		(32)

void InitStrings(void);
int RegisterString(char * s);
void EmitStrings(void);

#endif
