/* A lexical scanner generated by flex */

/* Scanner skeleton version:
 * $Header: /dsk/l1/alliance/cvsroot/alliance/src/genview/src/genview/d_lex.c,v 1.1 2002/04/11 07:14:39 fred Exp $
 */

#define FLEX_SCANNER
#define ASM_FLEX_MAJOR_VERSION 2
#define ASM_FLEX_MINOR_VERSION 5

#include <stdio.h>
#include <unistd.h>


/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif


#ifdef __cplusplus

#include <stdlib.h>

/* Use prototypes in function declarations. */
#define ASM_USE_PROTOS

/* The "const" storage-class-modifier is valid. */
#define ASM_USE_CONST

#else	/* ! __cplusplus */

#if __STDC__

#define ASM_USE_PROTOS
#define ASM_USE_CONST

#endif	/* __STDC__ */
#endif	/* ! __cplusplus */

#ifdef __TURBOC__
 #pragma warn -rch
 #pragma warn -use
#include <io.h>
#include <stdlib.h>
#define ASM_USE_CONST
#define ASM_USE_PROTOS
#endif

#ifdef ASM_USE_CONST
#define asmconst const
#else
#define asmconst
#endif


#ifdef ASM_USE_PROTOS
#define ASM_PROTO(proto) proto
#else
#define ASM_PROTO(proto) ()
#endif

/* Returned upon end-of-file. */
#define ASM_NULL 0

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
#define ASM_SC_TO_UI(c) ((unsigned int) (unsigned char) c)

/* Enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN.
 */
#define BEGIN asm_start = 1 + 2 *

/* Translate the current start state into a value that can be later handed
 * to BEGIN to return to the state.  The ASMSTATE alias is for lex
 * compatibility.
 */
#define ASM_START ((asm_start - 1) / 2)
#define ASMSTATE ASM_START

/* Action number for EOF rule of a given start state. */
#define ASM_STATE_EOF(state) (ASM_END_OF_BUFFER + state + 1)

/* Special action meaning "start processing a new file". */
#define ASM_NEW_FILE asmrestart( asmin )

#define ASM_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#define ASM_BUF_SIZE 16384

typedef struct asm_buffer_state *ASM_BUFFER_STATE;

extern int asmleng;
extern FILE *asmin, *asmout;

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

/* The funky do-while in the following #define is used to turn the definition
 * int a single C statement (which needs a semi-colon terminator).  This
 * avoids problems with code like:
 *
 * 	if ( condition_holds )
 *		asmless( 5 );
 *	else
 *		do_something_else();
 *
 * Prior to using the do-while the compiler would get upset at the
 * "else" because it interpreted the "if" statement as being all
 * done when it reached the ';' after the asmless() call.
 */

/* Return all but the first 'n' matched characters back to the input stream. */

#define asmless(n) \
	do \
		{ \
		/* Undo effects of setting up asmtext. */ \
		*asm_cp = asm_hold_char; \
		ASM_RESTORE_ASM_MORE_OFFSET \
		asm_c_buf_p = asm_cp = asm_bp + n - ASM_MORE_ADJ; \
		ASM_DO_BEFORE_ACTION; /* set up asmtext again */ \
		} \
	while ( 0 )

#define unput(c) asmunput( c, asmtext_ptr )

/* The following is because we cannot portably get our hands on size_t
 * (without autoconf's help, which isn't available because we want
 * flex-generated scanners to compile on their own).
 */
typedef unsigned int asm_size_t;


struct asm_buffer_state
	{
	FILE *asm_input_file;

	char *asm_ch_buf;		/* input buffer */
	char *asm_buf_pos;		/* current position in input buffer */

	/* Size of input buffer in bytes, not including room for EOB
	 * characters.
	 */
	asm_size_t asm_buf_size;

	/* Number of characters read into asm_ch_buf, not including EOB
	 * characters.
	 */
	int asm_n_chars;

	/* Whether we "own" the buffer - i.e., we know we created it,
	 * and can realloc() it to grow it, and should free() it to
	 * delete it.
	 */
	int asm_is_our_buffer;

	/* Whether this is an "interactive" input source; if so, and
	 * if we're using stdio for input, then we want to use getc()
	 * instead of fread(), to make sure we stop fetching input after
	 * each newline.
	 */
	int asm_is_interactive;

	/* Whether we're considered to be at the beginning of a line.
	 * If so, '^' rules will be active on the next match, otherwise
	 * not.
	 */
	int asm_at_bol;

	/* Whether to try to fill the input buffer when we reach the
	 * end of it.
	 */
	int asm_fill_buffer;

	int asm_buffer_status;
#define ASM_BUFFER_NEW 0
#define ASM_BUFFER_NORMAL 1
	/* When an EOF's been seen but there's still some text to process
	 * then we mark the buffer as ASM_EOF_PENDING, to indicate that we
	 * shouldn't try reading from the input source any more.  We might
	 * still have a bunch of tokens to match, though, because of
	 * possible backing-up.
	 *
	 * When we actually see the EOF, we change the status to "new"
	 * (via asmrestart()), so that the user can continue scanning by
	 * just pointing asmin at a new input file.
	 */
#define ASM_BUFFER_EOF_PENDING 2
	};

static ASM_BUFFER_STATE asm_current_buffer = 0;

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 */
#define ASM_CURRENT_BUFFER asm_current_buffer


/* asm_hold_char holds the character lost when asmtext is formed. */
static char asm_hold_char;

static int asm_n_chars;		/* number of characters read into asm_ch_buf */


int asmleng;

/* Points to current character in buffer. */
static char *asm_c_buf_p = (char *) 0;
static int asm_init = 1;		/* whether we need to initialize */
static int asm_start = 0;	/* start state number */

/* Flag which is used to allow asmwrap()'s to do buffer switches
 * instead of setting up a fresh asmin.  A bit of a hack ...
 */
static int asm_did_buffer_switch_on_eof;

void asmrestart ASM_PROTO(( FILE *input_file ));

void asm_switch_to_buffer ASM_PROTO(( ASM_BUFFER_STATE new_buffer ));
void asm_load_buffer_state ASM_PROTO(( void ));
ASM_BUFFER_STATE asm_create_buffer ASM_PROTO(( FILE *file, int size ));
void asm_delete_buffer ASM_PROTO(( ASM_BUFFER_STATE b ));
void asm_init_buffer ASM_PROTO(( ASM_BUFFER_STATE b, FILE *file ));
void asm_flush_buffer ASM_PROTO(( ASM_BUFFER_STATE b ));
#define ASM_FLUSH_BUFFER asm_flush_buffer( asm_current_buffer )

ASM_BUFFER_STATE asm_scan_buffer ASM_PROTO(( char *base, asm_size_t size ));
ASM_BUFFER_STATE asm_scan_string ASM_PROTO(( asmconst char *asm_str ));
ASM_BUFFER_STATE asm_scan_bytes ASM_PROTO(( asmconst char *bytes, int len ));

static void *asm_flex_alloc ASM_PROTO(( asm_size_t ));
static void *asm_flex_realloc ASM_PROTO(( void *, asm_size_t ));
static void asm_flex_free ASM_PROTO(( void * ));

#define asm_new_buffer asm_create_buffer

#define asm_set_interactive(is_interactive) \
	{ \
	if ( ! asm_current_buffer ) \
		asm_current_buffer = asm_create_buffer( asmin, ASM_BUF_SIZE ); \
	asm_current_buffer->asm_is_interactive = is_interactive; \
	}

#define asm_set_bol(at_bol) \
	{ \
	if ( ! asm_current_buffer ) \
		asm_current_buffer = asm_create_buffer( asmin, ASM_BUF_SIZE ); \
	asm_current_buffer->asm_at_bol = at_bol; \
	}

#define ASM_AT_BOL() (asm_current_buffer->asm_at_bol)

typedef unsigned char ASM_CHAR;
FILE *asmin = (FILE *) 0, *asmout = (FILE *) 0;
typedef int asm_state_type;
extern char *asmtext;
#define asmtext_ptr asmtext

static asm_state_type asm_get_previous_state ASM_PROTO(( void ));
static asm_state_type asm_try_NUL_trans ASM_PROTO(( asm_state_type current_state ));
static int asm_get_next_buffer ASM_PROTO(( void ));
static void asm_fatal_error ASM_PROTO(( asmconst char msg[] ));

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up asmtext.
 */
#define ASM_DO_BEFORE_ACTION \
	asmtext_ptr = asm_bp; \
	asmtext_ptr -= asm_more_len; \
	asmleng = (int) (asm_cp - asmtext_ptr); \
	asm_hold_char = *asm_cp; \
	*asm_cp = '\0'; \
	asm_c_buf_p = asm_cp;

#define ASM_NUM_RULES 40
#define ASM_END_OF_BUFFER 41
static asmconst short int asm_accept[120] =
    {   0,
        0,    0,   41,   40,   39,   20,   22,   23,   25,   26,
       28,   21,   27,   40,   31,   29,   40,   40,   32,   30,
       39,   20,   24,   35,   35,   35,   35,   35,   35,   35,
       35,   35,   35,   35,   33,   31,   32,   29,   34,   34,
       34,   34,   32,   32,   30,   37,   35,   35,   35,   35,
       35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
       35,   35,   33,    0,   38,   36,   35,   35,   35,   35,
       35,   35,   35,   35,   35,   14,   35,   35,   35,   35,
       35,   35,   35,    0,   33,   35,   35,   12,   11,    5,
       35,   18,   35,   35,   35,   35,    8,   35,   35,    4,

       35,    6,    7,   35,   15,   35,    9,   13,    2,    3,
        1,   35,   35,   16,   10,   17,   35,   19,    0
    } ;

static asmconst int asm_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    1,    4,    5,    6,    1,    1,    1,    7,
        8,    1,    9,   10,   11,   12,    1,   13,   13,   13,
       13,   13,   13,   13,   13,   13,   13,   14,   15,    1,
        1,    1,    1,    1,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
        1,    1,    1,    1,   17,    1,   18,   19,   20,   21,

       22,   23,   24,   25,   26,   16,   27,   28,   29,   30,
       31,   32,   16,   33,   34,   35,   36,   37,   16,   38,
       16,   16,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
    } ;

static asmconst int asm_meta[39] =
    {   0,
        1,    1,    2,    3,    1,    1,    1,    1,    1,    1,
        1,    4,    4,    5,    1,    6,    6,    4,    4,    4,
        4,    4,    4,    6,    6,    6,    6,    6,    6,    6,
        6,    6,    6,    6,    6,    6,    6,    6
    } ;

static asmconst short int asm_base[127] =
    {   0,
        0,    0,  212,  213,   37,    0,  213,  206,  213,  213,
      213,  213,  213,   28,   30,    0,   55,   57,   59,  197,
       71,    0,  213,   69,   57,   63,   68,   70,  181,  178,
      187,   75,  184,  183,   62,   95,  192,    0,  189,   99,
      102,  105,  107,  188,  188,  213,  174,  179,  180,  168,
      161,  159,  166,  162,  161,  156,  159,  158,  162,   91,
      149,  153,  109,  123,  213,  213,  161,  158,  150,  153,
      163,  161,  157,  160,  158,    0,  147,  142,  142,  154,
      146,  136,  129,  147,  141,  119,  119,    0,    0,    0,
      116,    0,  108,  123,  111,  104,    0,  112,  108,    0,

      111,    0,    0,  113,    0,   95,    0,    0,    0,    0,
        0,   91,   74,    0,    0,    0,   71,    0,  213,  146,
       72,  152,  155,  158,  161,  164
    } ;

static asmconst short int asm_def[127] =
    {   0,
      119,    1,  119,  119,  119,  120,  119,  119,  119,  119,
      119,  119,  119,  119,  121,  122,  123,  124,  123,   19,
      119,  120,  119,   14,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,  119,  121,  121,  122,  125,  123,
      126,  124,  125,   19,   43,  119,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,  119,  119,  119,  119,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,  119,  119,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,

       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
       24,   24,   24,   24,   24,   24,   24,   24,    0,  119,
      119,  119,  119,  119,  119,  119
    } ;

static asmconst short int asm_nxt[252] =
    {   0,
        4,    5,    5,    6,    7,    8,    9,   10,   11,   12,
       13,   14,   15,    4,   16,   17,   18,   19,   19,   19,
       20,   19,   19,   17,   17,   17,   17,   17,   17,   17,
       17,   17,   17,   17,   17,   17,   17,   17,   21,   21,
       24,   35,   36,   24,   24,   25,   24,   26,   27,   24,
       28,   29,   24,   30,   24,   31,   24,   24,   24,   24,
       24,   32,   33,   24,   34,   24,   39,   39,   39,   41,
       39,   43,   21,   21,   63,   37,   44,   44,   44,   44,
       44,   44,   46,   64,   47,   51,   24,   49,   24,   24,
       48,   24,   24,   50,   24,   53,   24,   54,   52,   58,

      118,   59,   24,   24,  117,   24,   35,   36,   80,   60,
       39,   39,   65,   39,  116,   66,   39,   41,   66,   43,
       65,   63,  115,   81,   43,   43,   43,   43,   43,   43,
       64,   84,  109,   84,  114,   85,  113,  112,  108,  107,
      106,  110,  105,  104,  103,  111,   22,   22,  102,   22,
       22,   22,   38,   85,   38,   38,   38,   38,   40,   85,
       40,   42,  101,   42,   39,   39,   39,   41,   41,   41,
      100,   99,   98,   97,   96,   95,   94,   93,   92,   91,
       90,   89,   88,   87,   86,   83,   82,   79,   78,   77,
       76,   75,   74,   73,   72,   71,   70,   69,   68,   67,

       45,   65,   65,  119,   62,   61,   57,   56,   55,   45,
       23,  119,    3,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119
    } ;

static asmconst short int asm_chk[252] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    5,    5,
       14,   15,   15,   14,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
       14,   14,   14,   14,   14,   14,   17,   17,   18,   18,
       19,   19,   21,   21,   35,  121,   19,   19,   19,   19,
       19,   19,   24,   35,   25,   27,   24,   26,   24,   24,
       25,   24,   24,   26,   24,   28,   24,   28,   27,   32,

      117,   32,   24,   24,  113,   24,   36,   36,   60,   32,
       40,   40,   40,   41,  112,   41,   42,   42,   42,   43,
       43,   63,  106,   60,   43,   43,   43,   43,   43,   43,
       63,   64,   98,   64,  104,   64,  101,   99,   96,   95,
       94,   98,   93,   91,   87,   98,  120,  120,   86,  120,
      120,  120,  122,   85,  122,  122,  122,  122,  123,   84,
      123,  124,   83,  124,  125,  125,  125,  126,  126,  126,
       82,   81,   80,   79,   78,   77,   75,   74,   73,   72,
       71,   70,   69,   68,   67,   62,   61,   59,   58,   57,
       56,   55,   54,   53,   52,   51,   50,   49,   48,   47,

       45,   44,   39,   37,   34,   33,   31,   30,   29,   20,
        8,    3,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
      119
    } ;

static asm_state_type asm_last_accepting_state;
static char *asm_last_accepting_cpos;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
static int asm_more_flag = 0;
static int asm_more_len = 0;
#define asmmore() (asm_more_flag = 1)
#define ASM_MORE_ADJ asm_more_len
#define ASM_RESTORE_ASM_MORE_OFFSET
char *asmtext;
#line 1 "d_asm.lex"
#define INITIAL 0
#line 2 "d_asm.lex"
#include "y.tab.h"
#line 463 "lex.asm.c"

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef ASM_SKIP_ASMWRAP
#ifdef __cplusplus
extern "C" int asmwrap ASM_PROTO(( void ));
#else
extern int asmwrap ASM_PROTO(( void ));
#endif
#endif

#ifndef ASM_NO_UNPUT
static void asmunput ASM_PROTO(( int c, char *buf_ptr ));
#endif

#ifndef asmtext_ptr
static void asm_flex_strncpy ASM_PROTO(( char *, asmconst char *, int ));
#endif

#ifdef ASM_NEED_STRLEN
static int asm_flex_strlen ASM_PROTO(( asmconst char * ));
#endif

#ifndef ASM_NO_INPUT
#ifdef __cplusplus
static int asminput ASM_PROTO(( void ));
#else
static int input ASM_PROTO(( void ));
#endif
#endif

#if ASM_STACK_USED
static int asm_start_stack_ptr = 0;
static int asm_start_stack_depth = 0;
static int *asm_start_stack = 0;
#ifndef ASM_NO_PUSH_STATE
static void asm_push_state ASM_PROTO(( int new_state ));
#endif
#ifndef ASM_NO_POP_STATE
static void asm_pop_state ASM_PROTO(( void ));
#endif
#ifndef ASM_NO_TOP_STATE
static int asm_top_state ASM_PROTO(( void ));
#endif

#else
#define ASM_NO_PUSH_STATE 1
#define ASM_NO_POP_STATE 1
#define ASM_NO_TOP_STATE 1
#endif

#ifdef ASM_MALLOC_DECL
ASM_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines.  This will fail
 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
 * or sizeof(void*) != sizeof(int).
 */
#endif
#endif

/* Amount of stuff to slurp up with each read. */
#ifndef ASM_READ_BUF_SIZE
#define ASM_READ_BUF_SIZE 8192
#endif

/* Copy whatever the last rule matched to the standard output. */

#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( asmtext, asmleng, 1, asmout )
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or ASM_NULL,
 * is returned in "result".
 */
#ifndef ASM_INPUT
#define ASM_INPUT(buf,result,max_size) \
	if ( asm_current_buffer->asm_is_interactive ) \
		{ \
		int c = '*', n; \
		for ( n = 0; n < max_size && \
			     (c = getc( asmin )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( asmin ) ) \
			ASM_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else if ( ((result = fread( buf, 1, max_size, asmin )) == 0) \
		  && ferror( asmin ) ) \
		ASM_FATAL_ERROR( "input in flex scanner failed" );
#endif

/* No semi-colon after return; correct usage is to write "asmterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef asmterminate
#define asmterminate() return ASM_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef ASM_START_STACK_INCR
#define ASM_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef ASM_FATAL_ERROR
#define ASM_FATAL_ERROR(msg) asm_fatal_error( msg )
#endif

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef ASM_DECL
#define ASM_DECL int asmlex ASM_PROTO(( void ))
#endif

/* Code executed at the beginning of each rule, after asmtext and asmleng
 * have been set up.
 */
#ifndef ASM_USER_ACTION
#define ASM_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef ASM_BREAK
#define ASM_BREAK break;
#endif

#define ASM_RULE_SETUP \
	ASM_USER_ACTION

ASM_DECL
	{
	register asm_state_type asm_current_state;
	register char *asm_cp = NULL, *asm_bp = NULL;
	register int asm_act;

#line 10 "d_asm.lex"


#line 617 "lex.asm.c"

	if ( asm_init )
		{
		asm_init = 0;

#ifdef ASM_USER_INIT
		ASM_USER_INIT;
#endif

		if ( ! asm_start )
			asm_start = 1;	/* first start state */

		if ( ! asmin )
			asmin = stdin;

		if ( ! asmout )
			asmout = stdout;

		if ( ! asm_current_buffer )
			asm_current_buffer =
				asm_create_buffer( asmin, ASM_BUF_SIZE );

		asm_load_buffer_state();
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
		asm_more_len = 0;
		if ( asm_more_flag )
			{
			asm_more_len = asm_c_buf_p - asmtext_ptr;
			asm_more_flag = 0;
			}
		asm_cp = asm_c_buf_p;

		/* Support of asmtext. */
		*asm_cp = asm_hold_char;

		/* asm_bp points to the position in asm_ch_buf of the start of
		 * the current run.
		 */
		asm_bp = asm_cp;

		asm_current_state = asm_start;
asm_match:
		do
			{
			register ASM_CHAR asm_c = asm_ec[ASM_SC_TO_UI(*asm_cp)];
			if ( asm_accept[asm_current_state] )
				{
				asm_last_accepting_state = asm_current_state;
				asm_last_accepting_cpos = asm_cp;
				}
			while ( asm_chk[asm_base[asm_current_state] + asm_c] != asm_current_state )
				{
				asm_current_state = (int) asm_def[asm_current_state];
				if ( asm_current_state >= 120 )
					asm_c = asm_meta[(unsigned int) asm_c];
				}
			asm_current_state = asm_nxt[asm_base[asm_current_state] + (unsigned int) asm_c];
			++asm_cp;
			}
		while ( asm_base[asm_current_state] != 213 );

asm_find_action:
		asm_act = asm_accept[asm_current_state];
		if ( asm_act == 0 )
			{ /* have to back up */
			asm_cp = asm_last_accepting_cpos;
			asm_current_state = asm_last_accepting_state;
			asm_act = asm_accept[asm_current_state];
			}

		ASM_DO_BEFORE_ACTION;


do_action:	/* This label is used only to access EOF actions. */


		switch ( asm_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of ASM_DO_BEFORE_ACTION */
			*asm_cp = asm_hold_char;
			asm_cp = asm_last_accepting_cpos;
			asm_current_state = asm_last_accepting_state;
			goto asm_find_action;

case 1:
ASM_RULE_SETUP
#line 12 "d_asm.lex"
{	return SYMBL;}
	ASM_BREAK
case 2:
ASM_RULE_SETUP
#line 13 "d_asm.lex"
{	return LIGNE_DIR;}
	ASM_BREAK
case 3:
ASM_RULE_SETUP
#line 14 "d_asm.lex"
{	return BLOC;}
	ASM_BREAK
case 4:
ASM_RULE_SETUP
#line 16 "d_asm.lex"
{	return TEXT;}
	ASM_BREAK
case 5:
ASM_RULE_SETUP
#line 17 "d_asm.lex"
{	return DATA;}
	ASM_BREAK
case 6:
ASM_RULE_SETUP
#line 19 "d_asm.lex"
{	return ALIGN;}
	ASM_BREAK
case 7:
ASM_RULE_SETUP
#line 20 "d_asm.lex"
{	return ASCII;}
	ASM_BREAK
case 8:
ASM_RULE_SETUP
#line 21 "d_asm.lex"
{	return SKIP;}
	ASM_BREAK
case 9:
ASM_RULE_SETUP
#line 23 "d_asm.lex"
{	return STATIC;}
	ASM_BREAK
case 10:
ASM_RULE_SETUP
#line 24 "d_asm.lex"
{	return GLOBL;}
	ASM_BREAK
case 11:
ASM_RULE_SETUP
#line 25 "d_asm.lex"
{	return COMM;}
	ASM_BREAK
case 12:
ASM_RULE_SETUP
#line 27 "d_asm.lex"
{	return CHAR;}
	ASM_BREAK
case 13:
ASM_RULE_SETUP
#line 28 "d_asm.lex"
{	return SHORT;}
	ASM_BREAK
case 14:
ASM_RULE_SETUP
#line 29 "d_asm.lex"
{	return INT_DIR;}
	ASM_BREAK
case 15:
ASM_RULE_SETUP
#line 30 "d_asm.lex"
{	return FLOAT;}
	ASM_BREAK
case 16:
ASM_RULE_SETUP
#line 31 "d_asm.lex"
{	return DOUBLE;}
	ASM_BREAK
case 17:
ASM_RULE_SETUP
#line 32 "d_asm.lex"
{	return STRING_DIR;}
	ASM_BREAK
case 18:
ASM_RULE_SETUP
#line 34 "d_asm.lex"
{	return FILE_DIR;}
	ASM_BREAK
case 19:
ASM_RULE_SETUP
#line 35 "d_asm.lex"
{	return VERSION;}
	ASM_BREAK
case 20:
ASM_RULE_SETUP
#line 37 "d_asm.lex"
{	if (asmtext[asmleng -1]=='\\' && asmtext[asmleng-2]!='\\')
#ifdef FLEX_SCANNER
						asmmore();   /* not semi-colon, know that! */
#else
						asmmore();
#endif
					else {
						asmlval.str = (char *)mbkalloc(asmleng);
						strncpy(asmlval.str, &(asmtext[1]), asmleng-1);
						asmlval.str[asmleng-1] = '\0';
						input();
						return STRING; 
					}
				}
	ASM_BREAK
case 21:
ASM_RULE_SETUP
#line 52 "d_asm.lex"
{	return VIRGULE;}
	ASM_BREAK
case 22:
ASM_RULE_SETUP
#line 53 "d_asm.lex"
{	return IMMEDIAT;}
	ASM_BREAK
case 23:
ASM_RULE_SETUP
#line 54 "d_asm.lex"
{	return DIRECT;}
	ASM_BREAK
case 24:
ASM_RULE_SETUP
#line 55 "d_asm.lex"
{	return DIRECT;}
	ASM_BREAK
case 25:
ASM_RULE_SETUP
#line 56 "d_asm.lex"
{	return IND_DEB;}
	ASM_BREAK
case 26:
ASM_RULE_SETUP
#line 57 "d_asm.lex"
{	return IND_FIN;}
	ASM_BREAK
case 27:
ASM_RULE_SETUP
#line 58 "d_asm.lex"
{	asmlval.val = '-'; return SIGN;}
	ASM_BREAK
case 28:
ASM_RULE_SETUP
#line 59 "d_asm.lex"
{	asmlval.val = '+'; return SIGN;}
	ASM_BREAK
case 29:
ASM_RULE_SETUP
#line 60 "d_asm.lex"
;
	ASM_BREAK
case 30:
ASM_RULE_SETUP
#line 62 "d_asm.lex"
{	asmlval.val = atoi(&(asmtext[1])); return REGISTRE;}
	ASM_BREAK
case 31:
ASM_RULE_SETUP
#line 64 "d_asm.lex"
{	asmlval.val = atoi(asmtext); return NOMBRE;}
	ASM_BREAK
case 32:
ASM_RULE_SETUP
#line 66 "d_asm.lex"
{	asmlval.fl = atof(asmtext); return FLOTTANT;}
	ASM_BREAK
case 33:
ASM_RULE_SETUP
#line 68 "d_asm.lex"
{	sscanf(asmtext,"%lf",&asmlval.fl); return FLOTTANT;};
	ASM_BREAK
case 34:
ASM_RULE_SETUP
#line 70 "d_asm.lex"
{	if (asmlval.val = RechCodeInst(asmtext))
										return CODE_OP;
									else {
										asmlval.str = (char *)mbkalloc(asmleng+1);
										strcpy(asmlval.str, asmtext);
										return NAME;
									 }
								 }
	ASM_BREAK
case 35:
ASM_RULE_SETUP
#line 79 "d_asm.lex"
{	asmlval.str = (char *)mbkalloc(asmleng+1);
							strcpy(asmlval.str, asmtext);
							return NAME;}
	ASM_BREAK
case 36:
ASM_RULE_SETUP
#line 83 "d_asm.lex"
{	asmlval.str = (char *)mbkalloc(asmleng);
							strncpy(asmlval.str, asmtext, asmleng-1);
							asmlval.str[asmleng-1] = '\0';
							return ETIQ;}
	ASM_BREAK
case 37:
ASM_RULE_SETUP
#line 88 "d_asm.lex"
{	asmlval.str = (char *)mbkalloc(asmleng);
								strncpy(asmlval.str, asmtext, asmleng-1);
								asmlval.str[asmleng-1] = '\0';
								return ETIQ;}
	ASM_BREAK
case 38:
ASM_RULE_SETUP
#line 93 "d_asm.lex"
{	asmlval.str = (char *)mbkalloc(asmleng);
										strncpy(asmlval.str, asmtext, asmleng-1);
										asmlval.str[asmleng-1] = '\0';
										return ETIQ;}
	ASM_BREAK
case 39:
ASM_RULE_SETUP
#line 99 "d_asm.lex"
;
	ASM_BREAK
case 40:
ASM_RULE_SETUP
#line 101 "d_asm.lex"
ECHO;
	ASM_BREAK
#line 937 "lex.asm.c"
case ASM_STATE_EOF(INITIAL):
	asmterminate();

	case ASM_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int asm_amount_of_matched_text = (int) (asm_cp - asmtext_ptr) - 1;

		/* Undo the effects of ASM_DO_BEFORE_ACTION. */
		*asm_cp = asm_hold_char;
		ASM_RESTORE_ASM_MORE_OFFSET

		if ( asm_current_buffer->asm_buffer_status == ASM_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed asmin at a new source and called
			 * asmlex().  If so, then we have to assure
			 * consistency between asm_current_buffer and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			asm_n_chars = asm_current_buffer->asm_n_chars;
			asm_current_buffer->asm_input_file = asmin;
			asm_current_buffer->asm_buffer_status = ASM_BUFFER_NORMAL;
			}

		/* Note that here we test for asm_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since asm_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the
		 * end-of-buffer state).  Contrast this with the test
		 * in input().
		 */
		if ( asm_c_buf_p <= &asm_current_buffer->asm_ch_buf[asm_n_chars] )
			{ /* This was really a NUL. */
			asm_state_type asm_next_state;

			asm_c_buf_p = asmtext_ptr + asm_amount_of_matched_text;

			asm_current_state = asm_get_previous_state();

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * asm_get_previous_state() go ahead and do it
			 * for us because it doesn't know how to deal
			 * with the possibility of jamming (and we don't
			 * want to build jamming into it because then it
			 * will run more slowly).
			 */

			asm_next_state = asm_try_NUL_trans( asm_current_state );

			asm_bp = asmtext_ptr + ASM_MORE_ADJ;

			if ( asm_next_state )
				{
				/* Consume the NUL. */
				asm_cp = ++asm_c_buf_p;
				asm_current_state = asm_next_state;
				goto asm_match;
				}

			else
				{
				asm_cp = asm_c_buf_p;
				goto asm_find_action;
				}
			}

		else switch ( asm_get_next_buffer() )
			{
			case EOB_ACT_END_OF_FILE:
				{
				asm_did_buffer_switch_on_eof = 0;

				if ( asmwrap() )
					{
					/* Note: because we've taken care in
					 * asm_get_next_buffer() to have set up
					 * asmtext, we can now set up
					 * asm_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * ASM_NULL, it'll still work - another
					 * ASM_NULL will get returned.
					 */
					asm_c_buf_p = asmtext_ptr + ASM_MORE_ADJ;

					asm_act = ASM_STATE_EOF(ASM_START);
					goto do_action;
					}

				else
					{
					if ( ! asm_did_buffer_switch_on_eof )
						ASM_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				asm_c_buf_p =
					asmtext_ptr + asm_amount_of_matched_text;

				asm_current_state = asm_get_previous_state();

				asm_cp = asm_c_buf_p;
				asm_bp = asmtext_ptr + ASM_MORE_ADJ;
				goto asm_match;

			case EOB_ACT_LAST_MATCH:
				asm_c_buf_p =
				&asm_current_buffer->asm_ch_buf[asm_n_chars];

				asm_current_state = asm_get_previous_state();

				asm_cp = asm_c_buf_p;
				asm_bp = asmtext_ptr + ASM_MORE_ADJ;
				goto asm_find_action;
			}
		break;
		}

	default:
		ASM_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
	} /* end of asmlex */


/* asm_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
 */

static int asm_get_next_buffer()
	{
	register char *dest = asm_current_buffer->asm_ch_buf;
	register char *source = asmtext_ptr;
	register int number_to_move, i;
	int ret_val;

	if ( asm_c_buf_p > &asm_current_buffer->asm_ch_buf[asm_n_chars + 1] )
		ASM_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( asm_current_buffer->asm_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( asm_c_buf_p - asmtext_ptr - ASM_MORE_ADJ == 1 )
			{
			/* We matched a single character, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{
			/* We matched some text prior to the EOB, first
			 * process it.
			 */
			return EOB_ACT_LAST_MATCH;
			}
		}

	/* Try to read more data. */

	/* First move last chars to start of buffer. */
	number_to_move = (int) (asm_c_buf_p - asmtext_ptr) - 1;

	for ( i = 0; i < number_to_move; ++i )
		*(dest++) = *(source++);

	if ( asm_current_buffer->asm_buffer_status == ASM_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		asm_current_buffer->asm_n_chars = asm_n_chars = 0;

	else
		{
		int num_to_read =
			asm_current_buffer->asm_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */
#ifdef ASM_USES_REJECT
			ASM_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else

			/* just a shorter name for the current buffer */
			ASM_BUFFER_STATE b = asm_current_buffer;

			int asm_c_buf_p_offset =
				(int) (asm_c_buf_p - b->asm_ch_buf);

			if ( b->asm_is_our_buffer )
				{
				int new_size = b->asm_buf_size * 2;

				if ( new_size <= 0 )
					b->asm_buf_size += b->asm_buf_size / 8;
				else
					b->asm_buf_size *= 2;

				b->asm_ch_buf = (char *)
					/* Include room in for 2 EOB chars. */
					asm_flex_realloc( (void *) b->asm_ch_buf,
							 b->asm_buf_size + 2 );
				}
			else
				/* Can't grow it, we don't own it. */
				b->asm_ch_buf = 0;

			if ( ! b->asm_ch_buf )
				ASM_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			asm_c_buf_p = &b->asm_ch_buf[asm_c_buf_p_offset];

			num_to_read = asm_current_buffer->asm_buf_size -
						number_to_move - 1;
#endif
			}

		if ( num_to_read > ASM_READ_BUF_SIZE )
			num_to_read = ASM_READ_BUF_SIZE;

		/* Read in more data. */
		ASM_INPUT( (&asm_current_buffer->asm_ch_buf[number_to_move]),
			asm_n_chars, num_to_read );

		asm_current_buffer->asm_n_chars = asm_n_chars;
		}

	if ( asm_n_chars == 0 )
		{
		if ( number_to_move == ASM_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			asmrestart( asmin );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			asm_current_buffer->asm_buffer_status =
				ASM_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	asm_n_chars += number_to_move;
	asm_current_buffer->asm_ch_buf[asm_n_chars] = ASM_END_OF_BUFFER_CHAR;
	asm_current_buffer->asm_ch_buf[asm_n_chars + 1] = ASM_END_OF_BUFFER_CHAR;

	asmtext_ptr = &asm_current_buffer->asm_ch_buf[0];

	return ret_val;
	}


/* asm_get_previous_state - get the state just before the EOB char was reached */

static asm_state_type asm_get_previous_state()
	{
	register asm_state_type asm_current_state;
	register char *asm_cp;

	asm_current_state = asm_start;

	for ( asm_cp = asmtext_ptr + ASM_MORE_ADJ; asm_cp < asm_c_buf_p; ++asm_cp )
		{
		register ASM_CHAR asm_c = (*asm_cp ? asm_ec[ASM_SC_TO_UI(*asm_cp)] : 1);
		if ( asm_accept[asm_current_state] )
			{
			asm_last_accepting_state = asm_current_state;
			asm_last_accepting_cpos = asm_cp;
			}
		while ( asm_chk[asm_base[asm_current_state] + asm_c] != asm_current_state )
			{
			asm_current_state = (int) asm_def[asm_current_state];
			if ( asm_current_state >= 120 )
				asm_c = asm_meta[(unsigned int) asm_c];
			}
		asm_current_state = asm_nxt[asm_base[asm_current_state] + (unsigned int) asm_c];
		}

	return asm_current_state;
	}


/* asm_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = asm_try_NUL_trans( current_state );
 */

#ifdef ASM_USE_PROTOS
static asm_state_type asm_try_NUL_trans( asm_state_type asm_current_state )
#else
static asm_state_type asm_try_NUL_trans( asm_current_state )
asm_state_type asm_current_state;
#endif
	{
	register int asm_is_jam;
	register char *asm_cp = asm_c_buf_p;

	register ASM_CHAR asm_c = 1;
	if ( asm_accept[asm_current_state] )
		{
		asm_last_accepting_state = asm_current_state;
		asm_last_accepting_cpos = asm_cp;
		}
	while ( asm_chk[asm_base[asm_current_state] + asm_c] != asm_current_state )
		{
		asm_current_state = (int) asm_def[asm_current_state];
		if ( asm_current_state >= 120 )
			asm_c = asm_meta[(unsigned int) asm_c];
		}
	asm_current_state = asm_nxt[asm_base[asm_current_state] + (unsigned int) asm_c];
	asm_is_jam = (asm_current_state == 119);

	return asm_is_jam ? 0 : asm_current_state;
	}


#ifndef ASM_NO_UNPUT
#ifdef ASM_USE_PROTOS
static void asmunput( int c, register char *asm_bp )
#else
static void asmunput( c, asm_bp )
int c;
register char *asm_bp;
#endif
	{
	register char *asm_cp = asm_c_buf_p;

	/* undo effects of setting up asmtext */
	*asm_cp = asm_hold_char;

	if ( asm_cp < asm_current_buffer->asm_ch_buf + 2 )
		{ /* need to shift things up to make room */
		/* +2 for EOB chars. */
		register int number_to_move = asm_n_chars + 2;
		register char *dest = &asm_current_buffer->asm_ch_buf[
					asm_current_buffer->asm_buf_size + 2];
		register char *source =
				&asm_current_buffer->asm_ch_buf[number_to_move];

		while ( source > asm_current_buffer->asm_ch_buf )
			*--dest = *--source;

		asm_cp += (int) (dest - source);
		asm_bp += (int) (dest - source);
		asm_current_buffer->asm_n_chars =
			asm_n_chars = asm_current_buffer->asm_buf_size;

		if ( asm_cp < asm_current_buffer->asm_ch_buf + 2 )
			ASM_FATAL_ERROR( "flex scanner push-back overflow" );
		}

	*--asm_cp = (char) c;


	asmtext_ptr = asm_bp;
	asm_hold_char = *asm_cp;
	asm_c_buf_p = asm_cp;
	}
#endif	/* ifndef ASM_NO_UNPUT */


#ifdef __cplusplus
static int asminput()
#else
static int input()
#endif
	{
	int c;

	*asm_c_buf_p = asm_hold_char;

	if ( *asm_c_buf_p == ASM_END_OF_BUFFER_CHAR )
		{
		/* asm_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( asm_c_buf_p < &asm_current_buffer->asm_ch_buf[asm_n_chars] )
			/* This was really a NUL. */
			*asm_c_buf_p = '\0';

		else
			{ /* need more input */
			int offset = asm_c_buf_p - asmtext_ptr;
			++asm_c_buf_p;

			switch ( asm_get_next_buffer() )
				{
				case EOB_ACT_LAST_MATCH:
					/* This happens because asm_g_n_b()
					 * sees that we've accumulated a
					 * token and flags that we need to
					 * try matching the token before
					 * proceeding.  But for input(),
					 * there's no matching to consider.
					 * So convert the EOB_ACT_LAST_MATCH
					 * to EOB_ACT_END_OF_FILE.
					 */

					/* Reset buffer status. */
					asmrestart( asmin );

					/* fall through */

				case EOB_ACT_END_OF_FILE:
					{
					if ( asmwrap() )
						return EOF;

					if ( ! asm_did_buffer_switch_on_eof )
						ASM_NEW_FILE;
#ifdef __cplusplus
					return asminput();
#else
					return input();
#endif
					}

				case EOB_ACT_CONTINUE_SCAN:
					asm_c_buf_p = asmtext_ptr + offset;
					break;
				}
			}
		}

	c = *(unsigned char *) asm_c_buf_p;	/* cast for 8-bit char's */
	*asm_c_buf_p = '\0';	/* preserve asmtext */
	asm_hold_char = *++asm_c_buf_p;


	return c;
	}


#ifdef ASM_USE_PROTOS
void asmrestart( FILE *input_file )
#else
void asmrestart( input_file )
FILE *input_file;
#endif
	{
	if ( ! asm_current_buffer )
		asm_current_buffer = asm_create_buffer( asmin, ASM_BUF_SIZE );

	asm_init_buffer( asm_current_buffer, input_file );
	asm_load_buffer_state();
	}


#ifdef ASM_USE_PROTOS
void asm_switch_to_buffer( ASM_BUFFER_STATE new_buffer )
#else
void asm_switch_to_buffer( new_buffer )
ASM_BUFFER_STATE new_buffer;
#endif
	{
	if ( asm_current_buffer == new_buffer )
		return;

	if ( asm_current_buffer )
		{
		/* Flush out information for old buffer. */
		*asm_c_buf_p = asm_hold_char;
		asm_current_buffer->asm_buf_pos = asm_c_buf_p;
		asm_current_buffer->asm_n_chars = asm_n_chars;
		}

	asm_current_buffer = new_buffer;
	asm_load_buffer_state();

	/* We don't actually know whether we did this switch during
	 * EOF (asmwrap()) processing, but the only time this flag
	 * is looked at is after asmwrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	asm_did_buffer_switch_on_eof = 1;
	}


#ifdef ASM_USE_PROTOS
void asm_load_buffer_state( void )
#else
void asm_load_buffer_state()
#endif
	{
	asm_n_chars = asm_current_buffer->asm_n_chars;
	asmtext_ptr = asm_c_buf_p = asm_current_buffer->asm_buf_pos;
	asmin = asm_current_buffer->asm_input_file;
	asm_hold_char = *asm_c_buf_p;
	}


#ifdef ASM_USE_PROTOS
ASM_BUFFER_STATE asm_create_buffer( FILE *file, int size )
#else
ASM_BUFFER_STATE asm_create_buffer( file, size )
FILE *file;
int size;
#endif
	{
	ASM_BUFFER_STATE b;

	b = (ASM_BUFFER_STATE) asm_flex_alloc( sizeof( struct asm_buffer_state ) );
	if ( ! b )
		ASM_FATAL_ERROR( "out of dynamic memory in asm_create_buffer()" );

	b->asm_buf_size = size;

	/* asm_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->asm_ch_buf = (char *) asm_flex_alloc( b->asm_buf_size + 2 );
	if ( ! b->asm_ch_buf )
		ASM_FATAL_ERROR( "out of dynamic memory in asm_create_buffer()" );

	b->asm_is_our_buffer = 1;

	asm_init_buffer( b, file );

	return b;
	}


#ifdef ASM_USE_PROTOS
void asm_delete_buffer( ASM_BUFFER_STATE b )
#else
void asm_delete_buffer( b )
ASM_BUFFER_STATE b;
#endif
	{
	if ( ! b )
		return;

	if ( b == asm_current_buffer )
		asm_current_buffer = (ASM_BUFFER_STATE) 0;

	if ( b->asm_is_our_buffer )
		asm_flex_free( (void *) b->asm_ch_buf );

	asm_flex_free( (void *) b );
	}



#ifdef ASM_USE_PROTOS
void asm_init_buffer( ASM_BUFFER_STATE b, FILE *file )
#else
void asm_init_buffer( b, file )
ASM_BUFFER_STATE b;
FILE *file;
#endif


	{
	asm_flush_buffer( b );

	b->asm_input_file = file;
	b->asm_fill_buffer = 1;

#if ASM_ALWAYS_INTERACTIVE
	b->asm_is_interactive = 1;
#else
#if ASM_NEVER_INTERACTIVE
	b->asm_is_interactive = 0;
#else
	b->asm_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
	}


#ifdef ASM_USE_PROTOS
void asm_flush_buffer( ASM_BUFFER_STATE b )
#else
void asm_flush_buffer( b )
ASM_BUFFER_STATE b;
#endif

	{
	if ( ! b )
		return;

	b->asm_n_chars = 0;

	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->asm_ch_buf[0] = ASM_END_OF_BUFFER_CHAR;
	b->asm_ch_buf[1] = ASM_END_OF_BUFFER_CHAR;

	b->asm_buf_pos = &b->asm_ch_buf[0];

	b->asm_at_bol = 1;
	b->asm_buffer_status = ASM_BUFFER_NEW;

	if ( b == asm_current_buffer )
		asm_load_buffer_state();
	}


#ifndef ASM_NO_SCAN_BUFFER
#ifdef ASM_USE_PROTOS
ASM_BUFFER_STATE asm_scan_buffer( char *base, asm_size_t size )
#else
ASM_BUFFER_STATE asm_scan_buffer( base, size )
char *base;
asm_size_t size;
#endif
	{
	ASM_BUFFER_STATE b;

	if ( size < 2 ||
	     base[size-2] != ASM_END_OF_BUFFER_CHAR ||
	     base[size-1] != ASM_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return 0;

	b = (ASM_BUFFER_STATE) asm_flex_alloc( sizeof( struct asm_buffer_state ) );
	if ( ! b )
		ASM_FATAL_ERROR( "out of dynamic memory in asm_scan_buffer()" );

	b->asm_buf_size = size - 2;	/* "- 2" to take care of EOB's */
	b->asm_buf_pos = b->asm_ch_buf = base;
	b->asm_is_our_buffer = 0;
	b->asm_input_file = 0;
	b->asm_n_chars = b->asm_buf_size;
	b->asm_is_interactive = 0;
	b->asm_at_bol = 1;
	b->asm_fill_buffer = 0;
	b->asm_buffer_status = ASM_BUFFER_NEW;

	asm_switch_to_buffer( b );

	return b;
	}
#endif


#ifndef ASM_NO_SCAN_STRING
#ifdef ASM_USE_PROTOS
ASM_BUFFER_STATE asm_scan_string( asmconst char *asm_str )
#else
ASM_BUFFER_STATE asm_scan_string( asm_str )
asmconst char *asm_str;
#endif
	{
	int len;
	for ( len = 0; asm_str[len]; ++len )
		;

	return asm_scan_bytes( asm_str, len );
	}
#endif


#ifndef ASM_NO_SCAN_BYTES
#ifdef ASM_USE_PROTOS
ASM_BUFFER_STATE asm_scan_bytes( asmconst char *bytes, int len )
#else
ASM_BUFFER_STATE asm_scan_bytes( bytes, len )
asmconst char *bytes;
int len;
#endif
	{
	ASM_BUFFER_STATE b;
	char *buf;
	asm_size_t n;
	int i;

	/* Get memory for full buffer, including space for trailing EOB's. */
	n = len + 2;
	buf = (char *) asm_flex_alloc( n );
	if ( ! buf )
		ASM_FATAL_ERROR( "out of dynamic memory in asm_scan_bytes()" );

	for ( i = 0; i < len; ++i )
		buf[i] = bytes[i];

	buf[len] = buf[len+1] = ASM_END_OF_BUFFER_CHAR;

	b = asm_scan_buffer( buf, n );
	if ( ! b )
		ASM_FATAL_ERROR( "bad buffer in asm_scan_bytes()" );

	/* It's okay to grow etc. this buffer, and we should throw it
	 * away when we're done.
	 */
	b->asm_is_our_buffer = 1;

	return b;
	}
#endif


#ifndef ASM_NO_PUSH_STATE
#ifdef ASM_USE_PROTOS
static void asm_push_state( int new_state )
#else
static void asm_push_state( new_state )
int new_state;
#endif
	{
	if ( asm_start_stack_ptr >= asm_start_stack_depth )
		{
		asm_size_t new_size;

		asm_start_stack_depth += ASM_START_STACK_INCR;
		new_size = asm_start_stack_depth * sizeof( int );

		if ( ! asm_start_stack )
			asm_start_stack = (int *) asm_flex_alloc( new_size );

		else
			asm_start_stack = (int *) asm_flex_realloc(
					(void *) asm_start_stack, new_size );

		if ( ! asm_start_stack )
			ASM_FATAL_ERROR(
			"out of memory expanding start-condition stack" );
		}

	asm_start_stack[asm_start_stack_ptr++] = ASM_START;

	BEGIN(new_state);
	}
#endif


#ifndef ASM_NO_POP_STATE
static void asm_pop_state()
	{
	if ( --asm_start_stack_ptr < 0 )
		ASM_FATAL_ERROR( "start-condition stack underflow" );

	BEGIN(asm_start_stack[asm_start_stack_ptr]);
	}
#endif


#ifndef ASM_NO_TOP_STATE
static int asm_top_state()
	{
	return asm_start_stack[asm_start_stack_ptr - 1];
	}
#endif

#ifndef ASM_EXIT_FAILURE
#define ASM_EXIT_FAILURE 2
#endif

#ifdef ASM_USE_PROTOS
static void asm_fatal_error( asmconst char msg[] )
#else
static void asm_fatal_error( msg )
char msg[];
#endif
	{
	(void) fprintf( stderr, "%s\n", msg );
	exit( ASM_EXIT_FAILURE );
	}



/* Redefine asmless() so it works in section 3 code. */

#undef asmless
#define asmless(n) \
	do \
		{ \
		/* Undo effects of setting up asmtext. */ \
		asmtext[asmleng] = asm_hold_char; \
		asm_c_buf_p = asmtext + n; \
		asm_hold_char = *asm_c_buf_p; \
		*asm_c_buf_p = '\0'; \
		asmleng = n; \
		} \
	while ( 0 )


/* Internal utility routines. */

#ifndef asmtext_ptr
#ifdef ASM_USE_PROTOS
static void asm_flex_strncpy( char *s1, asmconst char *s2, int n )
#else
static void asm_flex_strncpy( s1, s2, n )
char *s1;
asmconst char *s2;
int n;
#endif
	{
	register int i;
	for ( i = 0; i < n; ++i )
		s1[i] = s2[i];
	}
#endif

#ifdef ASM_NEED_STRLEN
#ifdef ASM_USE_PROTOS
static int asm_flex_strlen( asmconst char *s )
#else
static int asm_flex_strlen( s )
asmconst char *s;
#endif
	{
	register int n;
	for ( n = 0; s[n]; ++n )
		;

	return n;
	}
#endif


#ifdef ASM_USE_PROTOS
static void *asm_flex_alloc( asm_size_t size )
#else
static void *asm_flex_alloc( size )
asm_size_t size;
#endif
	{
	return (void *) malloc( size );
	}

#ifdef ASM_USE_PROTOS
static void *asm_flex_realloc( void *ptr, asm_size_t size )
#else
static void *asm_flex_realloc( ptr, size )
void *ptr;
asm_size_t size;
#endif
	{
	/* The cast to (char *) in the following accommodates both
	 * implementations that use char* generic pointers, and those
	 * that use void* generic pointers.  It works with the latter
	 * because both ANSI C and C++ allow castless assignment from
	 * any pointer type to void*, and deal with argument conversions
	 * as though doing an assignment.
	 */
	return (void *) realloc( (char *) ptr, size );
	}

#ifdef ASM_USE_PROTOS
static void asm_flex_free( void *ptr )
#else
static void asm_flex_free( ptr )
void *ptr;
#endif
	{
	free( ptr );
	}

#if ASM_MAIN
int main()
	{
	asmlex();
	return 0;
	}
#endif
#line 101 "d_asm.lex"


asmwrap()
{
	return 1;
}

asmerror(str)
char *str;
{
	printf("%s on %s\n",str,asmtext);
	exit(-1);
}
