#line 2 "common/gw_template_parser.c"

#line 4 "common/gw_template_parser.c"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define yy_create_buffer jtp__create_buffer
#define yy_delete_buffer jtp__delete_buffer
#define yy_flex_debug jtp__flex_debug
#define yy_init_buffer jtp__init_buffer
#define yy_flush_buffer jtp__flush_buffer
#define yy_load_buffer_state jtp__load_buffer_state
#define yy_switch_to_buffer jtp__switch_to_buffer
#define yyin jtp_in
#define yyleng jtp_leng
#define yylex jtp_lex
#define yylineno jtp_lineno
#define yyout jtp_out
#define yyrestart jtp_restart
#define yytext jtp_text
#define yywrap jtp_wrap
#define yyalloc jtp_alloc
#define yyrealloc jtp_realloc
#define yyfree jtp_free

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif

/* First, we deal with  platform-specific or compiler-specific issues. */

/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */

#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L

/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
 * if you want the limit (max/min) macros for int types. 
 */
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif

#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; 
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;

/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN               (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN              (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN              (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX               (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX              (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX              (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX              (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX             (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX             (4294967295U)
#endif

#endif /* ! C99 */

#endif /* ! FLEXINT_H */

#ifdef __cplusplus

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

#else	/* ! __cplusplus */

/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)

#define YY_USE_CONST

#endif	/* defined (__STDC__) */
#endif	/* ! __cplusplus */

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif

/* Returned upon end-of-file. */
#define YY_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 YY_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 (yy_start) = 1 + 2 *

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

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

/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE jtp_restart(jtp_in  )

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
 * Ditto for the __ia64__ case accordingly.
 */
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif

/* The state buf must be large enough to hold one state per character in the main buffer.
 */
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))

#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif

extern int jtp_leng;

extern FILE *jtp_in, *jtp_out;

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

    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
     *       access to the local variable yy_act. Since yyless() is a macro, it would break
     *       existing scanners that call yyless() from OUTSIDE jtp_lex. 
     *       One obvious solution it to make yy_act a global. I tried that, and saw
     *       a 5% performance hit in a non-jtp_lineno scanner, because yy_act is
     *       normally declared as a register variable-- so it is not worth it.
     */
    #define  YY_LESS_LINENO(n) \
            do { \
                int yyl;\
                for ( yyl = n; yyl < jtp_leng; ++yyl )\
                    if ( jtp_text[yyl] == '\n' )\
                        --jtp_lineno;\
            }while(0)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up jtp_text. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		*yy_cp = (yy_hold_char); \
		YY_RESTORE_YY_MORE_OFFSET \
		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up jtp_text again */ \
		} \
	while ( 0 )

#define unput(c) yyunput( c, (yytext_ptr)  )

#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif

#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
	{
	FILE *yy_input_file;

	char *yy_ch_buf;		/* input buffer */
	char *yy_buf_pos;		/* current position in input buffer */

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

	/* Number of characters read into yy_ch_buf, not including EOB
	 * characters.
	 */
	int yy_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 yy_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 yy_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 yy_at_bol;

    int yy_bs_lineno; /**< The line count. */
    int yy_bs_column; /**< The column count. */
    
	/* Whether to try to fill the input buffer when we reach the
	 * end of it.
	 */
	int yy_fill_buffer;

	int yy_buffer_status;

#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
	/* When an EOF's been seen but there's still some text to process
	 * then we mark the buffer as YY_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 jtp_restart()), so that the user can continue scanning by
	 * just pointing jtp_in at a new input file.
	 */
#define YY_BUFFER_EOF_PENDING 2

	};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */

/* 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".
 *
 * Returns the top of the stack, or NULL.
 */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)

/* Same as previous macro, but useful when we know that the buffer stack is not
 * NULL or when we need an lvalue. For internal use only.
 */
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]

/* yy_hold_char holds the character lost when jtp_text is formed. */
static char yy_hold_char;
static int yy_n_chars;		/* number of characters read into yy_ch_buf */
int jtp_leng;

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 0;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */

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

void jtp_restart (FILE *input_file  );
void jtp__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE jtp__create_buffer (FILE *file,int size  );
void jtp__delete_buffer (YY_BUFFER_STATE b  );
void jtp__flush_buffer (YY_BUFFER_STATE b  );
void jtp_push_buffer_state (YY_BUFFER_STATE new_buffer  );
void jtp_pop_buffer_state (void );

static void jtp_ensure_buffer_stack (void );
static void jtp__load_buffer_state (void );
static void jtp__init_buffer (YY_BUFFER_STATE b,FILE *file  );

#define YY_FLUSH_BUFFER jtp__flush_buffer(YY_CURRENT_BUFFER )

YY_BUFFER_STATE jtp__scan_buffer (char *base,yy_size_t size  );
YY_BUFFER_STATE jtp__scan_string (yyconst char *yy_str  );
YY_BUFFER_STATE jtp__scan_bytes (yyconst char *bytes,int len  );

void *jtp_alloc (yy_size_t  );
void *jtp_realloc (void *,yy_size_t  );
void jtp_free (void *  );

#define yy_new_buffer jtp__create_buffer

#define yy_set_interactive(is_interactive) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){ \
        jtp_ensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            jtp__create_buffer(jtp_in,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
	}

#define yy_set_bol(at_bol) \
	{ \
	if ( ! YY_CURRENT_BUFFER ){\
        jtp_ensure_buffer_stack (); \
		YY_CURRENT_BUFFER_LVALUE =    \
            jtp__create_buffer(jtp_in,YY_BUF_SIZE ); \
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
	}

#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

/* Begin user sect3 */

typedef unsigned char YY_CHAR;

FILE *jtp_in = (FILE *) 0, *jtp_out = (FILE *) 0;

typedef int yy_state_type;

extern int jtp_lineno;

int jtp_lineno = 1;

extern char *jtp_text;
#define yytext_ptr jtp_text

static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
static int yy_get_next_buffer (void );
static void yy_fatal_error (yyconst char msg[]  );

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up jtp_text.
 */
#define YY_DO_BEFORE_ACTION \
	(yytext_ptr) = yy_bp; \
	jtp_leng = (size_t) (yy_cp - yy_bp); \
	(yy_hold_char) = *yy_cp; \
	*yy_cp = '\0'; \
	(yy_c_buf_p) = yy_cp;

#define YY_NUM_RULES 63
#define YY_END_OF_BUFFER 64
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
	{
	flex_int32_t yy_verify;
	flex_int32_t yy_nxt;
	};
static yyconst flex_int16_t yy_accept[456] =
    {   0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,   44,   44,
       47,   47,   51,   51,   54,   54,    0,    0,   64,   62,
       61,   63,   63,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   63,   30,   63,
       31,   63,   32,   63,   33,   63,   34,   63,   35,   63,
       36,   63,   37,   41,   41,   38,   41,   41,   41,   41,
       41,   44,   44,   42,   44,   44,   48,   47,   45,   47,
       48,   46,   51,   51,   49,   52,   51,   52,   50,   54,
       54,   56,   57,   54,   54,   55,   63,   58,   63,   60,

       63,   62,   61,    0,    1,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   27,   62,   62,   62,   62,
       62,   62,   62,   62,   62,    0,   30,   30,    0,   31,
       31,    0,   32,   32,    0,   33,   33,    0,   34,   34,
        0,   35,   35,    0,   36,    0,    0,   37,    0,   38,
        0,    0,   40,    0,    0,    0,   44,   44,   42,   44,
       44,    0,   43,   44,   48,   47,   45,   47,   48,   46,
        0,   48,    0,   46,   51,   51,   49,    0,   51,   50,
        0,   51,    0,   50,   54,   54,   56,    0,   54,   55,
        0,   54,    0,   53,   54,    0,   55,    0,   58,    0,

        0,   60,   59,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   39,   43,   53,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   29,   62,   62,   62,   13,
       62,   62,   62,   62,   62,   62,   62,   26,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   16,   62,   62,

       62,   62,   62,   62,   62,   62,   62,   62,   15,   62,
       62,   62,   28,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,    3,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,    2,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,    9,   62,
       62,   62,   62,    4,    5,   62,   62,   62,   11,   62,
       62,   62,   62,    8,   10,   62,   62,   62,   62,   62,
       62,    6,   62,   14,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,    7,   62,   62,   24,

       62,   62,   62,   62,   62,   62,   62,   62,   62,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   25,
       62,   62,   62,   62,   62,   62,   62,   18,   19,   62,
       62,   62,   62,   62,   62,   62,   62,   62,   62,   22,
       23,   62,   62,   62,   62,   62,   62,   62,   62,   12,
       17,   20,   62,   21,    0
    } ;

static yyconst flex_int32_t yy_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,    4,    1,    5,    6,    1,    1,    1,    1,    1,
        1,    1,    1,    7,    1,    1,    1,    8,    8,    8,
        8,    8,    8,    8,    8,    8,    8,    9,    1,    1,
       10,    1,    1,    1,   11,   12,   13,   14,   15,   16,
       17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
       27,   28,   29,   30,   31,   32,   33,   34,   35,    1,
        1,    1,    1,    1,   36,    1,    1,    1,    1,    1,

       37,    1,    1,    1,    1,    1,    1,    1,    1,   38,
       39,    1,    1,    1,   40,    1,    1,    1,    1,    1,
       41,    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,    1
    } ;

static yyconst flex_int32_t yy_meta[42] =
    {   0,
        1,    2,    3,    4,    1,    2,    5,    1,    1,    6,
        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 yyconst flex_int16_t yy_base[482] =
    {   0,
        0,    0,   40,   41,   44,   45,   54,   55,   58,   59,
       68,   69,   72,   73,   82,   89,   96,  136,  101,  106,
      111,  119,  126,  141,  150,  159,  176,  184,  836,    0,
      165,  832,  837,  806,   63,  818,  125,  808,  806,  805,
      165,  798,  800,  135,   22,  792,  798,  171,   92,  193,
      168,  196,  197,  200,  203,  207,  210,  211,  214,  220,
      837,  822,  816,  837,  225,  837,  820,   41,  104,  783,
      784,    0,  230,  837,  232,  817,    0,  236,  837,  242,
      247,  251,    0,  254,  837,  259,  263,  837,  270,    0,
      273,  837,  279,  284,  289,  293,  296,  837,  816,  810,

      809,    0,  301,  813,  837,  798,  799,  782,  801,  779,
      795,  783,  796,  783,  783,    0,  782,  774,  788,  778,
      279,  787,  771,  773,  787,  305,  308,  309,  312,  315,
      316,  319,  322,  323,  326,  329,  330,  333,  336,  337,
      340,  343,  344,  349,  837,  794,  793,  787,  354,  837,
      791,  790,  837,  763,  751,  750,    0,  359,  837,  786,
      361,  783,    0,  784,    0,  365,  837,  371,  376,  380,
      783,  382,  782,  386,    0,  389,  837,  394,  398,  405,
      781,  407,  780,  411,    0,  416,  837,  422,  427,  431,
      779,  433,  776,    0,  438,  777,  442,  445,  837,  776,

      775,  769,  768,  744,  761,  751,  758,  752,  757,  738,
      732,  748,  751,  753,  738,  727,  741,  730,  195,  435,
      734,  744,  732,  837,  837,  837,  734,  735,  730,  732,
      725,  721,  721,  736,  719,    0,  733,  716,  713,    0,
      726,  726,  732,  714,  717,  709,  724,    0,  712,  722,
      710,  724,  715,  708,  702,  695,  715,  704,  700,  697,
      698,  697,  709,  695,  694,  685,  690,  695,  703,  693,
      691,  701,  690,  689,  701,  695,  684,  681,  672,  671,
      695,  690,  690,  673,  666,  685,  664,  670,  670,  667,
      677,  659,  679,  670,  680,  672,  675,    0,  664,  672,

      661,  663,  654,  648,  667,  663,  665,  661,    0,  650,
      654,  647,    0,  661,  653,  652,  649,  656,  652,  644,
      654,  646,  651,  647,  643,  645,  638,    0,  632,  643,
      636,  644,  643,  643,  620,  633,  639,  629,  275,  633,
      629,  635,  627,  624,  611,  618,  615,    0,  615,  628,
      614,  626,  612,  609,  602,  613,  614,  620,    0,  619,
      597,  228,  617,    0,    0,  607,  615,  600,  592,  598,
      601,  608,  609,    0,    0,  593,  598,  593,  591,  606,
      588,    0,  606,    0,  592,  579,  585,  594,  582,  540,
      543,  541,  514,  513,  504,   97,    0,  499,  485,    0,

      474,  483,  440,  441,  441,  432,  437,  438,  424,  421,
      410,  417,  396,  410,  386,  384,  381,  371,  380,    0,
      358,  358,  357,  355,  344,  323,  338,    0,    0,  286,
      262,  250,  242,  238,  230,  217,  199,  188,  201,    0,
        0,  164,  161,  172,  133,  106,  109,   79,   65,    0,
        0,    0,   53,    0,  837,  460,  466,  472,  478,  484,
      490,  496,  501,  507,  513,  519,  525,  531,  537,  543,
      549,  551,  557,  563,  569,  575,  581,  587,  593,  599,
      605
    } ;

static yyconst flex_int16_t yy_def[482] =
    {   0,
      455,    1,  456,  456,  456,  456,  456,  456,  456,  456,
      456,  456,  456,  456,  456,  456,  457,  457,  458,  458,
      459,  459,  460,  460,  461,  461,  456,  456,  455,  462,
      455,  463,  455,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  464,  455,  455,  455,  455,  465,  455,  455,  455,
      455,  466,  466,  455,  467,  468,  469,  469,  455,  455,
      470,  455,  471,  471,  455,  455,  472,  455,  455,  473,
      473,  455,  455,  474,  475,  455,  455,  455,  476,  455,

      455,  462,  455,  463,  455,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  464,  464,  455,  455,  455,
      465,  465,  455,  455,  455,  455,  466,  466,  455,  468,
      467,  477,  466,  468,  469,  469,  455,  455,  470,  455,
      478,  470,  478,  455,  471,  471,  455,  455,  472,  455,
      479,  472,  479,  455,  473,  473,  455,  455,  475,  455,
      480,  474,  481,  473,  475,  480,  455,  455,  455,  476,

      476,  455,  455,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  455,  455,  455,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,

      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,

      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
      462,  462,  462,  462,    0,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455
    } ;

static yyconst flex_int16_t yy_nxt[879] =
    {   0,
       30,   31,   31,   31,   30,   32,   30,   30,   30,   33,
       34,   30,   35,   36,   37,   30,   30,   30,   38,   39,
       30,   30,   40,   41,   42,   43,   30,   44,   45,   46,
       30,   30,   47,   30,   30,   30,   30,   30,   30,   30,
       30,   48,   48,   48,   48,   50,   50,   50,   50,   49,
       49,  122,  123,   51,   51,   52,   52,   52,   52,   54,
       54,   54,   54,   53,   53,  153,  454,   55,   55,   56,
       56,   56,   56,   58,   58,   58,   58,   57,   57,  153,
      107,   59,   59,   60,   61,   60,  453,   62,  108,   63,
       60,   61,   60,  128,   62,  128,   63,   65,   66,   65,

      452,   67,   73,   74,   73,   75,   76,   73,   74,   73,
       75,   76,   78,   79,   80,  406,   81,   82,  154,   68,
       78,   79,   80,  451,   81,   82,  407,   84,   85,   86,
       69,   87,   88,   70,  450,   89,   71,   65,   66,   65,
      155,   67,   84,   85,   86,  120,   87,   88,  110,  121,
       89,   91,   92,   93,   94,   95,   96,  449,  111,   68,
       91,   92,   93,   94,   95,   96,  103,  103,  103,  131,
       69,  131,  126,   70,  126,  115,   71,   97,   98,   97,
      127,   99,  448,  100,  101,   97,   98,   97,  447,   99,
      116,  100,  101,  446,  129,  117,  129,  132,  134,  132,

      134,  135,  130,  135,  137,  133,  137,  242,  138,  136,
      138,  140,  141,  140,  141,  143,  139,  143,  445,  444,
      142,  144,  145,  144,  243,  146,  149,  150,  149,  443,
      151,  158,  159,  158,  162,  160,  163,  166,  167,  168,
      442,  169,  170,  168,  167,  168,  377,  171,  170,  167,
      173,  441,  174,  173,  174,  176,  177,  178,  378,  179,
      178,  177,  178,  180,  181,  177,  183,  440,  180,  183,
      439,  184,  183,  184,  186,  187,  188,  438,  189,  190,
      188,  187,  188,  437,  191,  190,  193,  193,  194,  355,
      193,  187,  196,  356,  197,  196,  197,  198,  199,  198,

      436,  200,  103,  103,  103,  218,  126,  219,  126,  128,
      128,  128,  128,  129,  127,  129,  131,  131,  131,  131,
      132,  130,  132,  134,  134,  134,  134,  135,  133,  135,
      137,  137,  137,  137,  138,  136,  138,  140,  140,  140,
      140,  141,  139,  141,  143,  143,  143,  143,  435,  142,
      144,  145,  144,  434,  146,  149,  150,  149,  433,  151,
      158,  159,  158,  162,  160,  163,  166,  167,  168,  432,
      169,  170,  168,  167,  168,  431,  171,  170,  167,  173,
      430,  174,  173,  174,  167,  173,  429,  174,  173,  174,
      176,  177,  178,  428,  179,  178,  177,  178,  180,  181,

      177,  183,  427,  180,  183,  426,  184,  183,  184,  177,
      183,  425,  184,  183,  184,  424,  183,  186,  187,  188,
      423,  189,  190,  188,  187,  188,  422,  191,  190,  187,
      196,  421,  197,  196,  197,  193,  193,  194,  420,  193,
      187,  196,  419,  197,  196,  197,  198,  199,  198,  244,
      200,  418,  417,  245,  416,  415,  414,  413,  412,  246,
       33,   33,   33,   33,   33,   33,   64,   64,   64,   64,
       64,   64,   72,   72,   72,   72,   72,   72,   77,   77,
       77,   77,   77,   77,   83,   83,   83,   83,   83,   83,
       90,   90,   90,   90,   90,   90,  102,  411,  410,  409,

      102,  104,  104,  104,  104,  104,  104,  147,  147,  147,
      147,  147,  147,  152,  152,  152,  152,  152,  152,  157,
      157,  408,  157,  157,  157,  161,  161,  161,  161,  161,
      161,  164,  164,  164,  164,  164,  164,  165,  165,  405,
      404,  403,  165,  172,  172,  172,  172,  172,  172,  175,
      175,  182,  182,  182,  182,  182,  182,  185,  185,  402,
      401,  400,  185,  192,  192,  192,  192,  192,  192,  195,
      195,  195,  195,  195,  195,  201,  201,  201,  201,  201,
      201,  162,  162,  162,  162,  162,  162,  173,  173,  173,
      173,  173,  173,  183,  183,  183,  183,  183,  183,  196,

      196,  196,  196,  196,  196,  193,  193,  193,  193,  193,
      193,  399,  398,  397,  396,  395,  394,  393,  392,  391,
      390,  389,  388,  387,  386,  385,  384,  383,  382,  381,
      380,  379,  376,  375,  374,  373,  372,  371,  370,  369,
      368,  367,  366,  365,  364,  363,  362,  361,  360,  359,
      358,  357,  354,  353,  352,  351,  350,  349,  348,  347,
      346,  345,  344,  343,  342,  341,  340,  339,  338,  337,
      336,  335,  334,  333,  332,  331,  330,  329,  328,  327,
      326,  325,  324,  323,  322,  321,  320,  319,  318,  317,
      316,  315,  314,  313,  312,  311,  310,  309,  308,  307,

      306,  305,  304,  303,  302,  301,  300,  299,  298,  297,
      296,  295,  294,  293,  292,  291,  290,  289,  288,  287,
      286,  285,  284,  283,  282,  281,  280,  279,  278,  277,
      276,  275,  274,  273,  272,  271,  270,  269,  268,  267,
      266,  265,  264,  263,  262,  261,  260,  259,  258,  257,
      256,  255,  254,  253,  252,  251,  250,  249,  248,  247,
      241,  240,  239,  238,  237,  236,  235,  234,  233,  232,
      231,  230,  229,  228,  227,  203,  202,  199,  199,  187,
      226,  187,  177,  177,  167,  167,  159,  225,  159,  224,
      224,  224,  150,  150,  148,  145,  145,  223,  222,  221,

      220,  217,  216,  215,  214,  213,  212,  211,  210,  209,
      208,  207,  206,  205,  204,  105,  203,  202,  199,  159,
      156,  153,  150,  148,  145,  125,  124,  119,  118,  114,
      113,  112,  109,  106,  105,  455,   29,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455
    } ;

static yyconst flex_int16_t yy_chk[879] =
    {   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,    1,    1,
        1,    3,    4,    3,    4,    5,    6,    5,    6,    3,
        4,   45,   45,    5,    6,    7,    8,    7,    8,    9,
       10,    9,   10,    7,    8,   68,  453,    9,   10,   11,
       12,   11,   12,   13,   14,   13,   14,   11,   12,   68,
       35,   13,   14,   15,   15,   15,  449,   15,   35,   15,
       16,   16,   16,   49,   16,   49,   16,   17,   17,   17,

      448,   17,   19,   19,   19,   19,   19,   20,   20,   20,
       20,   20,   21,   21,   21,  396,   21,   21,   69,   17,
       22,   22,   22,  447,   22,   22,  396,   23,   23,   23,
       17,   23,   23,   17,  446,   23,   17,   18,   18,   18,
       69,   18,   24,   24,   24,   44,   24,   24,   37,   44,
       24,   25,   25,   25,   25,   25,   25,  445,   37,   18,
       26,   26,   26,   26,   26,   26,   31,   31,   31,   51,
       18,   51,   48,   18,   48,   41,   18,   27,   27,   27,
       48,   27,  444,   27,   27,   28,   28,   28,  443,   28,
       41,   28,   28,  442,   50,   41,   50,   52,   53,   52,

       53,   54,   50,   54,   55,   52,   55,  219,   56,   54,
       56,   57,   58,   57,   58,   59,   56,   59,  439,  438,
       58,   60,   60,   60,  219,   60,   65,   65,   65,  437,
       65,   73,   73,   73,   75,   73,   75,   78,   78,   78,
      436,   78,   78,   80,   80,   80,  362,   80,   80,   81,
       81,  435,   82,   81,   82,   84,   84,   84,  362,   84,
       86,   86,   86,   84,   86,   87,   87,  434,   86,   87,
      433,   89,   87,   89,   91,   91,   91,  432,   91,   91,
       93,   93,   93,  431,   93,   93,   94,   94,   94,  339,
       94,   95,   95,  339,   96,   95,   96,   97,   97,   97,

      430,   97,  103,  103,  103,  121,  126,  121,  126,  127,
      128,  127,  128,  129,  126,  129,  130,  131,  130,  131,
      132,  129,  132,  133,  134,  133,  134,  135,  132,  135,
      136,  137,  136,  137,  138,  135,  138,  139,  140,  139,
      140,  141,  138,  141,  142,  143,  142,  143,  427,  141,
      144,  144,  144,  426,  144,  149,  149,  149,  425,  149,
      158,  158,  158,  161,  158,  161,  166,  166,  166,  424,
      166,  166,  168,  168,  168,  423,  168,  168,  169,  169,
      422,  170,  169,  170,  172,  172,  421,  174,  172,  174,
      176,  176,  176,  419,  176,  178,  178,  178,  176,  178,

      179,  179,  418,  178,  179,  417,  180,  179,  180,  182,
      182,  416,  184,  182,  184,  415,  182,  186,  186,  186,
      414,  186,  186,  188,  188,  188,  413,  188,  188,  189,
      189,  412,  190,  189,  190,  192,  192,  192,  411,  192,
      195,  195,  410,  197,  195,  197,  198,  198,  198,  220,
      198,  409,  408,  220,  407,  406,  405,  404,  403,  220,
      456,  456,  456,  456,  456,  456,  457,  457,  457,  457,
      457,  457,  458,  458,  458,  458,  458,  458,  459,  459,
      459,  459,  459,  459,  460,  460,  460,  460,  460,  460,
      461,  461,  461,  461,  461,  461,  462,  402,  401,  399,

      462,  463,  463,  463,  463,  463,  463,  464,  464,  464,
      464,  464,  464,  465,  465,  465,  465,  465,  465,  466,
      466,  398,  466,  466,  466,  467,  467,  467,  467,  467,
      467,  468,  468,  468,  468,  468,  468,  469,  469,  395,
      394,  393,  469,  470,  470,  470,  470,  470,  470,  471,
      471,  472,  472,  472,  472,  472,  472,  473,  473,  392,
      391,  390,  473,  474,  474,  474,  474,  474,  474,  475,
      475,  475,  475,  475,  475,  476,  476,  476,  476,  476,
      476,  477,  477,  477,  477,  477,  477,  478,  478,  478,
      478,  478,  478,  479,  479,  479,  479,  479,  479,  480,

      480,  480,  480,  480,  480,  481,  481,  481,  481,  481,
      481,  389,  388,  387,  386,  385,  383,  381,  380,  379,
      378,  377,  376,  373,  372,  371,  370,  369,  368,  367,
      366,  363,  361,  360,  358,  357,  356,  355,  354,  353,
      352,  351,  350,  349,  347,  346,  345,  344,  343,  342,
      341,  340,  338,  337,  336,  335,  334,  333,  332,  331,
      330,  329,  327,  326,  325,  324,  323,  322,  321,  320,
      319,  318,  317,  316,  315,  314,  312,  311,  310,  308,
      307,  306,  305,  304,  303,  302,  301,  300,  299,  297,
      296,  295,  294,  293,  292,  291,  290,  289,  288,  287,

      286,  285,  284,  283,  282,  281,  280,  279,  278,  277,
      276,  275,  274,  273,  272,  271,  270,  269,  268,  267,
      266,  265,  264,  263,  262,  261,  260,  259,  258,  257,
      256,  255,  254,  253,  252,  251,  250,  249,  247,  246,
      245,  244,  243,  242,  241,  239,  238,  237,  235,  234,
      233,  232,  231,  230,  229,  228,  227,  223,  222,  221,
      218,  217,  216,  215,  214,  213,  212,  211,  210,  209,
      208,  207,  206,  205,  204,  203,  202,  201,  200,  196,
      193,  191,  183,  181,  173,  171,  164,  162,  160,  156,
      155,  154,  152,  151,  148,  147,  146,  125,  124,  123,

      122,  120,  119,  118,  117,  115,  114,  113,  112,  111,
      110,  109,  108,  107,  106,  104,  101,  100,   99,   76,
       71,   70,   67,   63,   62,   47,   46,   43,   42,   40,
       39,   38,   36,   34,   32,   29,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
      455,  455,  455,  455,  455,  455,  455,  455
    } ;

/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[64] =
    {   0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 
    0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 
    0, 1, 0, 0,     };

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

extern int jtp__flex_debug;
int jtp__flex_debug = 0;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *jtp_text;
#line 1 "gw_template_parser.l"
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, GridWay Project Leads (GridWay.org)                   */
/*                                                                            */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
/* not use this file except in compliance with the License. You may obtain    */
/* a copy of the License at                                                   */
/*                                                                            */
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
/*                                                                            */
/* Unless required by applicable law or agreed to in writing, software        */
/* distributed under the License is distributed on an "AS IS" BASIS,          */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
/* See the License for the specific language governing permissions and        */
/* limitations under the License.                                             */
/* -------------------------------------------------------------------------- */
#line 18 "gw_template_parser.l"
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <limits.h>

#include "gw_template.h"

#define YY_DECL static int yylex_jt(gw_template_t *jt)

void gw_template_set_value_str (gw_template_t *jt,
        gw_template_var_t var, 
        const char *val);

void gw_template_set_value_int (gw_template_t *jt,
        gw_template_var_t var,
        int val);
        
static void jtp_error(gw_template_t *jt, const char *str);

gw_template_var_t jtp_var;

char *jtp_val_str = NULL;
int jtp_val_int;
gw_boolean_t jtp_val_yn;
char *jtp_val_files = NULL;
char *jtp_val_env = NULL;

pthread_mutex_t jtp_mutex = PTHREAD_MUTEX_INITIALIZER;

int file;
int find;
char *GW_LOCATION;

int dl_comp;
int dl[3];














#line 911 "common/gw_template_parser.c"

#define INITIAL 0
#define var_int 1
#define var_yn 2
#define var_str 3
#define var_files 4
#define var_env 5
#define var_dl 6
#define val_int 7
#define val_yn 8
#define val_str 9
#define val_files 10
#define val_env 11
#define val_env_val 12
#define val_dl 13

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
#include <unistd.h>
#endif

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

static int yy_init_globals (void );

/* Accessor methods to globals.
   These are made visible to non-reentrant scanners for convenience. */

int jtp_lex_destroy (void );

int jtp_get_debug (void );

void jtp_set_debug (int debug_flag  );

YY_EXTRA_TYPE jtp_get_extra (void );

void jtp_set_extra (YY_EXTRA_TYPE user_defined  );

FILE *jtp_get_in (void );

void jtp_set_in  (FILE * in_str  );

FILE *jtp_get_out (void );

void jtp_set_out  (FILE * out_str  );

int jtp_get_leng (void );

char *jtp_get_text (void );

int jtp_get_lineno (void );

void jtp_set_lineno (int line_number  );

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

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int jtp_wrap (void );
#else
extern int jtp_wrap (void );
#endif
#endif

#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif

#ifndef YY_NO_INPUT

#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#endif

#endif

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#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 do { if (fwrite( jtp_text, jtp_leng, 1, jtp_out )) {} } while (0)
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
		{ \
		int c = '*'; \
		size_t n; \
		for ( n = 0; n < max_size && \
			     (c = getc( jtp_in )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( jtp_in ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else \
		{ \
		errno=0; \
		while ( (result = fread(buf, 1, max_size, jtp_in))==0 && ferror(jtp_in)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(jtp_in); \
			} \
		}\
\

#endif

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

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

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif

/* end tables serialization structures and prototypes */

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1

extern int jtp_lex (void);

#define YY_DECL int jtp_lex (void)
#endif /* !YY_DECL */

/* Code executed at the beginning of each rule, after jtp_text and jtp_leng
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

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

#define YY_RULE_SETUP \
	YY_USER_ACTION

/** The main scanner function which does all the work.
 */
YY_DECL
{
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;
    
#line 74 "gw_template_parser.l"


    /* --------------------------------------------------------------------- */
    /*    Parse comments                                                     */
    /* --------------------------------------------------------------------- */
    
#line 1116 "common/gw_template_parser.c"

	if ( !(yy_init) )
		{
		(yy_init) = 1;

#ifdef YY_USER_INIT
		YY_USER_INIT;
#endif

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

		if ( ! jtp_in )
			jtp_in = stdin;

		if ( ! jtp_out )
			jtp_out = stdout;

		if ( ! YY_CURRENT_BUFFER ) {
			jtp_ensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				jtp__create_buffer(jtp_in,YY_BUF_SIZE );
		}

		jtp__load_buffer_state( );
		}

	while ( 1 )		/* loops until end-of-file is reached */
		{
		yy_cp = (yy_c_buf_p);

		/* Support of jtp_text. */
		*yy_cp = (yy_hold_char);

		/* yy_bp points to the position in yy_ch_buf of the start of
		 * the current run.
		 */
		yy_bp = yy_cp;

		yy_current_state = (yy_start);
yy_match:
		do
			{
			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
			if ( yy_accept[yy_current_state] )
				{
				(yy_last_accepting_state) = yy_current_state;
				(yy_last_accepting_cpos) = yy_cp;
				}
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
				{
				yy_current_state = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 456 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 837 );

yy_find_action:
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;

		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
			{
			int yyl;
			for ( yyl = 0; yyl < jtp_leng; ++yyl )
				if ( jtp_text[yyl] == '\n' )
					   
    jtp_lineno++;
;
			}

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

		switch ( yy_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of YY_DO_BEFORE_ACTION */
			*yy_cp = (yy_hold_char);
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			goto yy_find_action;

case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
#line 80 "gw_template_parser.l"
;
	YY_BREAK
/* --------------------------------------------------------------------- */
/*    Variable Parsing                                                   */
/* --------------------------------------------------------------------- */
case 2:
YY_RULE_SETUP
#line 86 "gw_template_parser.l"
{ jtp_var = EXECUTABLE;             BEGIN var_str;}
	YY_BREAK
case 3:
YY_RULE_SETUP
#line 87 "gw_template_parser.l"
{ jtp_var = ARGUMENTS;              BEGIN var_str;}
	YY_BREAK
case 4:
YY_RULE_SETUP
#line 88 "gw_template_parser.l"
{ jtp_var = ENVIRONMENT;   jt->num_env=0; BEGIN var_env;}
	YY_BREAK
case 5:
YY_RULE_SETUP
#line 89 "gw_template_parser.l"
{ jtp_var = INPUT_FILES;   file= 0; find = 0; BEGIN var_files;}
	YY_BREAK
case 6:
YY_RULE_SETUP
#line 90 "gw_template_parser.l"
{ jtp_var = OUTPUT_FILES;  file= 0; find = 1; BEGIN var_files;}
	YY_BREAK
case 7:
YY_RULE_SETUP
#line 91 "gw_template_parser.l"
{ jtp_var = RESTART_FILES; file= 0; find = 2; BEGIN var_files;}
	YY_BREAK
case 8:
YY_RULE_SETUP
#line 92 "gw_template_parser.l"
{ jtp_var = STDERR_FILE;            BEGIN var_str;}
	YY_BREAK
case 9:
YY_RULE_SETUP
#line 93 "gw_template_parser.l"
{ jtp_var = STDIN_FILE;             BEGIN var_str;}
	YY_BREAK
case 10:
YY_RULE_SETUP
#line 94 "gw_template_parser.l"
{ jtp_var = STDOUT_FILE;            BEGIN var_str;}
	YY_BREAK
case 11:
YY_RULE_SETUP
#line 95 "gw_template_parser.l"
{ jtp_var = PRE_WRAPPER;            BEGIN var_str;}
	YY_BREAK
case 12:
YY_RULE_SETUP
#line 96 "gw_template_parser.l"
{ jtp_var = PRE_WRAPPER_ARGUMENTS;  BEGIN var_str;}
	YY_BREAK
case 13:
YY_RULE_SETUP
#line 97 "gw_template_parser.l"
{ jtp_var = RANK;                   BEGIN var_str;}
	YY_BREAK
case 14:
YY_RULE_SETUP
#line 98 "gw_template_parser.l"
{ jtp_var = REQUIREMENTS;           BEGIN var_str;}
	YY_BREAK
case 15:
YY_RULE_SETUP
#line 99 "gw_template_parser.l"
{ jtp_var = WRAPPER;                BEGIN var_str;}
	YY_BREAK
case 16:
YY_RULE_SETUP
#line 100 "gw_template_parser.l"
{ jtp_var = MONITOR;                BEGIN var_str;}
	YY_BREAK
case 17:
YY_RULE_SETUP
#line 101 "gw_template_parser.l"
{ jtp_var = RESCHEDULE_ON_FAILURE;  BEGIN var_yn;}
	YY_BREAK
case 18:
YY_RULE_SETUP
#line 102 "gw_template_parser.l"
{ jtp_var = CPULOAD_THRESHOLD;      BEGIN var_int;}
	YY_BREAK
case 19:
YY_RULE_SETUP
#line 103 "gw_template_parser.l"
{ jtp_var = NUMBER_OF_RETRIES;      BEGIN var_int;}
	YY_BREAK
case 20:
YY_RULE_SETUP
#line 104 "gw_template_parser.l"
{ jtp_var = RESCHEDULING_INTERVAL;  BEGIN var_int;}
	YY_BREAK
case 21:
YY_RULE_SETUP
#line 105 "gw_template_parser.l"
{ jtp_var = RESCHEDULING_THRESHOLD; BEGIN var_int;}
	YY_BREAK
case 22:
YY_RULE_SETUP
#line 106 "gw_template_parser.l"
{ jtp_var = SUSPENSION_TIMEOUT;     BEGIN var_int;}
	YY_BREAK
case 23:
YY_RULE_SETUP
#line 107 "gw_template_parser.l"
{ jtp_var = CHECKPOINT_INTERVAL;    BEGIN var_int;}
	YY_BREAK
case 24:
YY_RULE_SETUP
#line 108 "gw_template_parser.l"
{ jtp_var = CHECKPOINT_URL;         BEGIN var_str;}
	YY_BREAK
case 25:
YY_RULE_SETUP
#line 109 "gw_template_parser.l"
{ jtp_var = JOB_DEPENDENCIES;       BEGIN var_str;}
	YY_BREAK
case 26:
YY_RULE_SETUP
#line 110 "gw_template_parser.l"
{ jtp_var = TYPE;                   BEGIN var_str;}
	YY_BREAK
case 27:
YY_RULE_SETUP
#line 111 "gw_template_parser.l"
{ jtp_var = NP;                     BEGIN var_int;}
	YY_BREAK
case 28:
YY_RULE_SETUP
#line 112 "gw_template_parser.l"
{ jtp_var = DEADLINE;               BEGIN var_dl;}
	YY_BREAK
case 29:
YY_RULE_SETUP
#line 113 "gw_template_parser.l"
{ jtp_var = NAME;                   BEGIN var_str;}
	YY_BREAK
/* --------------------------------------------------------------------- */
/*    Assignment Parsing                                                 */
/* --------------------------------------------------------------------- */
case 30:
YY_RULE_SETUP
#line 119 "gw_template_parser.l"
{ BEGIN val_int;}
	YY_BREAK
case 31:
YY_RULE_SETUP
#line 120 "gw_template_parser.l"
{ BEGIN val_yn;}
	YY_BREAK
case 32:
YY_RULE_SETUP
#line 121 "gw_template_parser.l"
{ BEGIN val_str;}
	YY_BREAK
case 33:
YY_RULE_SETUP
#line 122 "gw_template_parser.l"
{ BEGIN val_files;}
	YY_BREAK
case 34:
YY_RULE_SETUP
#line 123 "gw_template_parser.l"
{ BEGIN val_env;}
	YY_BREAK
case 35:
YY_RULE_SETUP
#line 124 "gw_template_parser.l"
{ BEGIN val_dl;}
	YY_BREAK
/* --------------------------------------------------------------------- */
/*    Value Parsing                                                      */
/* --------------------------------------------------------------------- */
case 36:
/* rule 36 can match eol */
YY_RULE_SETUP
#line 130 "gw_template_parser.l"
{ BEGIN INITIAL;}
	YY_BREAK
case 37:
YY_RULE_SETUP
#line 131 "gw_template_parser.l"
{ gw_template_set_value_int(jt, jtp_var, atoi(jtp_text));}
	YY_BREAK
case 38:
/* rule 38 can match eol */
YY_RULE_SETUP
#line 133 "gw_template_parser.l"
{ BEGIN INITIAL;}
	YY_BREAK
case 39:
YY_RULE_SETUP
#line 134 "gw_template_parser.l"
{ gw_template_set_value_int(jt, jtp_var, GW_TRUE);}
	YY_BREAK
case 40:
YY_RULE_SETUP
#line 135 "gw_template_parser.l"
{ gw_template_set_value_int(jt, jtp_var, GW_FALSE);}
	YY_BREAK
case 41:
YY_RULE_SETUP
#line 136 "gw_template_parser.l"
{ fprintf(stderr,"Parse error at line %i: expected \"yes\" or \"no\"\n",
                          jtp_lineno);
                          return -1;}
	YY_BREAK
case 42:
/* rule 42 can match eol */
YY_RULE_SETUP
#line 140 "gw_template_parser.l"
{ BEGIN INITIAL;} 
	YY_BREAK
case 43:
/* rule 43 can match eol */
YY_RULE_SETUP
#line 141 "gw_template_parser.l"
{ jtp_text[strlen(jtp_text)-1]= '\0';
                          gw_template_set_value_str(jt, jtp_var, jtp_text+1);}
	YY_BREAK
case 44:
YY_RULE_SETUP
#line 143 "gw_template_parser.l"
{ gw_template_set_value_str(jt, jtp_var, jtp_text);}
	YY_BREAK
case 45:
/* rule 45 can match eol */
YY_RULE_SETUP
#line 145 "gw_template_parser.l"
{ BEGIN INITIAL;}
	YY_BREAK
case 46:
YY_RULE_SETUP
#line 146 "gw_template_parser.l"
{ file = 0;}
	YY_BREAK
case 47:
YY_RULE_SETUP
#line 147 "gw_template_parser.l"
{ file++;}
	YY_BREAK
case 48:
YY_RULE_SETUP
#line 148 "gw_template_parser.l"
{ switch (file)
                              {
                                  case 0:
                                      switch(find)
                                      {
                                      case 0:
                                          jt->num_input_files++;
                                          
                                          if (jt->num_input_files==GW_JT_FILES)
                                          {
                                              fprintf(stderr,"Max number of input files reached at line %i\n",jtp_lineno);
                                              return -1;
                                          }
                                          else
                                              strncpy(jt->input_files[jt->num_input_files-1][0],jtp_text,GW_JT_STR);
                                          break;
                                        case 1:
                                          jt->num_output_files++;
                                          if (jt->num_output_files==GW_JT_FILES)
                                          {
                                              fprintf(stderr,"Max number of output files reached at line %i\n",jtp_lineno);
                                              return -1;
                                          }                                          
                                          else                                          
                                              strncpy(jt->output_files[jt->num_output_files-1][0],jtp_text,GW_JT_STR);
                                          break;
                                        case 2:
                                          jt->num_restart_files++;
                                          if (jt->num_restart_files==GW_JT_FILES)
                                          {
                                              fprintf(stderr,"Max number of restart files reached at line %i\n",jtp_lineno);
                                              return -1;
                                          }                                              
                                          else                                          
                                              strncpy(jt->restart_files[jt->num_restart_files-1],jtp_text,GW_JT_STR);
                                          break;
                                      }                                      
                                    break;
                            
                                  case 1:
                                      switch(find)
                                      {
                                      case 0:
                                          strncpy(jt->input_files[jt->num_input_files-1][1],jtp_text,GW_JT_STR);
                                          break;
                                        case 1:
                                          strncpy(jt->output_files[jt->num_output_files-1][1],jtp_text,GW_JT_STR);
                                          break;
                                        case 2:
                                          fprintf(stderr,"Parse error at line %i\n", jtp_lineno);
                                          return -1;
                                      }                                  
                                    break;
                                      
                                  default:
                                     fprintf(stderr,"Parse error at line %i\n", jtp_lineno);
                                     return -1;
                               }
                             }
	YY_BREAK
case 49:
/* rule 49 can match eol */
YY_RULE_SETUP
#line 208 "gw_template_parser.l"
{ BEGIN INITIAL;}
	YY_BREAK
case 50:
YY_RULE_SETUP
#line 210 "gw_template_parser.l"
{ BEGIN val_env_val;}
	YY_BREAK
case 51:
YY_RULE_SETUP
#line 211 "gw_template_parser.l"
{ jt->num_env++;
                          strncpy(jt->environment[jt->num_env-1][0],jtp_text,GW_JT_STR);
                        }
	YY_BREAK
case 52:
YY_RULE_SETUP
#line 214 "gw_template_parser.l"
{jtp_error(jt, "ENVIRONMENT attribute (var)"); return -1;}
	YY_BREAK
case 53:
/* rule 53 can match eol */
YY_RULE_SETUP
#line 216 "gw_template_parser.l"
{ jtp_text[strlen(jtp_text)-1]= '\0';
                          strncpy(jt->environment[jt->num_env-1][1],jtp_text+1,GW_JT_STR);}
	YY_BREAK
case 54:
YY_RULE_SETUP
#line 218 "gw_template_parser.l"
{ strncpy(jt->environment[jt->num_env-1][1],jtp_text,GW_JT_STR);}
	YY_BREAK
case 55:
YY_RULE_SETUP
#line 219 "gw_template_parser.l"
BEGIN val_env;
	YY_BREAK
case 56:
/* rule 56 can match eol */
YY_RULE_SETUP
#line 220 "gw_template_parser.l"
{ BEGIN INITIAL;}
	YY_BREAK
case 57:
YY_RULE_SETUP
#line 221 "gw_template_parser.l"
{jtp_error(jt, "ENVIRONMENT attribute (value)"); return -1;}
	YY_BREAK
case 58:
/* rule 58 can match eol */
YY_RULE_SETUP
#line 224 "gw_template_parser.l"
{ switch (dl_comp)
                          {
                              case 1:
                                  jt->deadline = dl[0]*60;
                                  break;
                              case 2:
                                  jt->deadline = dl[0]*60*60 + dl[1]*60;
                                  break;
                              case 3:
                                  jt->deadline = dl[0]*24*60*60 + dl[1]*60*60 + dl[2]*60;
                                  break;
                              default:
                                 jtp_error(jt, "Bad deadline format"); return -1;
                          }
                          BEGIN INITIAL;}
	YY_BREAK
case 59:
YY_RULE_SETUP
#line 239 "gw_template_parser.l"
{ if (dl_comp >= 3 )
                        {
                             jtp_error(jt, "Bad deadline format");
                             return -1;
                        }
                        dl[dl_comp++] = atoi(jtp_text+1);}
	YY_BREAK
case 60:
YY_RULE_SETUP
#line 245 "gw_template_parser.l"
{ dl[0] = atoi(jtp_text); dl_comp = 1; }
	YY_BREAK
/* --------------------------------------------------------------------- */
/*    Default Parsing                                                    */
/* --------------------------------------------------------------------- */
case 61:
/* rule 61 can match eol */
YY_RULE_SETUP
#line 251 "gw_template_parser.l"
;
	YY_BREAK
case 62:
YY_RULE_SETUP
#line 252 "gw_template_parser.l"
{ fprintf(stderr,"Undefined variable (%s) at line %i\n",
                        jtp_text, jtp_lineno);
                  return -1;}
	YY_BREAK
case 63:
YY_RULE_SETUP
#line 255 "gw_template_parser.l"
ECHO;
	YY_BREAK
#line 1632 "common/gw_template_parser.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(var_int):
case YY_STATE_EOF(var_yn):
case YY_STATE_EOF(var_str):
case YY_STATE_EOF(var_files):
case YY_STATE_EOF(var_env):
case YY_STATE_EOF(var_dl):
case YY_STATE_EOF(val_int):
case YY_STATE_EOF(val_yn):
case YY_STATE_EOF(val_str):
case YY_STATE_EOF(val_files):
case YY_STATE_EOF(val_env):
case YY_STATE_EOF(val_env_val):
case YY_STATE_EOF(val_dl):
	yyterminate();

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = (yy_hold_char);
		YY_RESTORE_YY_MORE_OFFSET

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed jtp_in at a new source and called
			 * jtp_lex().  If so, then we have to assure
			 * consistency between YY_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.
			 */
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = jtp_in;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* Note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_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 ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state(  );

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * yy_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).
			 */

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = (yytext_ptr) + YY_MORE_ADJ;

			if ( yy_next_state )
				{
				/* Consume the NUL. */
				yy_cp = ++(yy_c_buf_p);
				yy_current_state = yy_next_state;
				goto yy_match;
				}

			else
				{
				yy_cp = (yy_c_buf_p);
				goto yy_find_action;
				}
			}

		else switch ( yy_get_next_buffer(  ) )
			{
			case EOB_ACT_END_OF_FILE:
				{
				(yy_did_buffer_switch_on_eof) = 0;

				if ( jtp_wrap( ) )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * jtp_text, we can now set up
					 * yy_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * YY_NULL, it'll still work - another
					 * YY_NULL will get returned.
					 */
					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

				else
					{
					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				(yy_c_buf_p) =
					(yytext_ptr) + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				(yy_c_buf_p) =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

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

/* yy_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 yy_get_next_buffer (void)
{
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	register char *source = (yytext_ptr);
	register int number_to_move, i;
	int ret_val;

	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( (yy_c_buf_p) - (yytext_ptr) - YY_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) ((yy_c_buf_p) - (yytext_ptr)) - 1;

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

	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;

	else
		{
			int num_to_read =
			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */

			/* just a shorter name for the current buffer */
			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;

			int yy_c_buf_p_offset =
				(int) ((yy_c_buf_p) - b->yy_ch_buf);

			if ( b->yy_is_our_buffer )
				{
				int new_size = b->yy_buf_size * 2;

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

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

			if ( ! b->yy_ch_buf )
				YY_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];

			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
						number_to_move - 1;

			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

		/* Read in more data. */
		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
			(yy_n_chars), (size_t) num_to_read );

		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	if ( (yy_n_chars) == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			jtp_restart(jtp_in  );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
				YY_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
		/* Extend the array by 50%, plus the number we really need. */
		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) jtp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
	}

	(yy_n_chars) += number_to_move;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;

	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];

	return ret_val;
}

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

    static yy_state_type yy_get_previous_state (void)
{
	register yy_state_type yy_current_state;
	register char *yy_cp;
    
	yy_current_state = (yy_start);

	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
		{
		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			(yy_last_accepting_state) = yy_current_state;
			(yy_last_accepting_cpos) = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 456 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
		}

	return yy_current_state;
}

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *	next_state = yy_try_NUL_trans( current_state );
 */
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
	register int yy_is_jam;
    	register char *yy_cp = (yy_c_buf_p);

	register YY_CHAR yy_c = 1;
	if ( yy_accept[yy_current_state] )
		{
		(yy_last_accepting_state) = yy_current_state;
		(yy_last_accepting_cpos) = yy_cp;
		}
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 456 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 455);

	return yy_is_jam ? 0 : yy_current_state;
}

#ifndef YY_NO_INPUT
#ifdef __cplusplus
    static int yyinput (void)
#else
    static int input  (void)
#endif

{
	int c;
    
	*(yy_c_buf_p) = (yy_hold_char);

	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_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 ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			/* This was really a NUL. */
			*(yy_c_buf_p) = '\0';

		else
			{ /* need more input */
			int offset = (yy_c_buf_p) - (yytext_ptr);
			++(yy_c_buf_p);

			switch ( yy_get_next_buffer(  ) )
				{
				case EOB_ACT_LAST_MATCH:
					/* This happens because yy_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. */
					jtp_restart(jtp_in );

					/*FALLTHROUGH*/

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

					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
#ifdef __cplusplus
					return yyinput();
#else
					return input();
#endif
					}

				case EOB_ACT_CONTINUE_SCAN:
					(yy_c_buf_p) = (yytext_ptr) + offset;
					break;
				}
			}
		}

	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
	*(yy_c_buf_p) = '\0';	/* preserve jtp_text */
	(yy_hold_char) = *++(yy_c_buf_p);

	if ( c == '\n' )
		   
    jtp_lineno++;
;

	return c;
}
#endif	/* ifndef YY_NO_INPUT */

/** Immediately switch to a different input stream.
 * @param input_file A readable stream.
 * 
 * @note This function does not reset the start condition to @c INITIAL .
 */
    void jtp_restart  (FILE * input_file )
{
    
	if ( ! YY_CURRENT_BUFFER ){
        jtp_ensure_buffer_stack ();
		YY_CURRENT_BUFFER_LVALUE =
            jtp__create_buffer(jtp_in,YY_BUF_SIZE );
	}

	jtp__init_buffer(YY_CURRENT_BUFFER,input_file );
	jtp__load_buffer_state( );
}

/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
    void jtp__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		jtp_pop_buffer_state();
	 *		jtp_push_buffer_state(new_buffer);
     */
	jtp_ensure_buffer_stack ();
	if ( YY_CURRENT_BUFFER == new_buffer )
		return;

	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	jtp__load_buffer_state( );

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

static void jtp__load_buffer_state  (void)
{
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
	jtp_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
	(yy_hold_char) = *(yy_c_buf_p);
}

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE jtp__create_buffer  (FILE * file, int  size )
{
	YY_BUFFER_STATE b;
    
	b = (YY_BUFFER_STATE) jtp_alloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in jtp__create_buffer()" );

	b->yy_buf_size = size;

	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) jtp_alloc(b->yy_buf_size + 2  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in jtp__create_buffer()" );

	b->yy_is_our_buffer = 1;

	jtp__init_buffer(b,file );

	return b;
}

/** Destroy the buffer.
 * @param b a buffer created with jtp__create_buffer()
 * 
 */
    void jtp__delete_buffer (YY_BUFFER_STATE  b )
{
    
	if ( ! b )
		return;

	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;

	if ( b->yy_is_our_buffer )
		jtp_free((void *) b->yy_ch_buf  );

	jtp_free((void *) b  );
}

#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
    
/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
 * such as during a jtp_restart() or at EOF.
 */
    static void jtp__init_buffer  (YY_BUFFER_STATE  b, FILE * file )

{
	int oerrno = errno;
    
	jtp__flush_buffer(b );

	b->yy_input_file = file;
	b->yy_fill_buffer = 1;

    /* If b is the current buffer, then jtp__init_buffer was _probably_
     * called from jtp_restart() or through yy_get_next_buffer.
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }

        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
    
	errno = oerrno;
}

/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 * 
 */
    void jtp__flush_buffer (YY_BUFFER_STATE  b )
{
    	if ( ! b )
		return;

	b->yy_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->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;

	b->yy_buf_pos = &b->yy_ch_buf[0];

	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;

	if ( b == YY_CURRENT_BUFFER )
		jtp__load_buffer_state( );
}

/** Pushes the new state onto the stack. The new state becomes
 *  the current state. This function will allocate the stack
 *  if necessary.
 *  @param new_buffer The new state.
 *  
 */
void jtp_push_buffer_state (YY_BUFFER_STATE new_buffer )
{
    	if (new_buffer == NULL)
		return;

	jtp_ensure_buffer_stack();

	/* This block is copied from jtp__switch_to_buffer. */
	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	/* Only push if top exists. Otherwise, replace top. */
	if (YY_CURRENT_BUFFER)
		(yy_buffer_stack_top)++;
	YY_CURRENT_BUFFER_LVALUE = new_buffer;

	/* copied from jtp__switch_to_buffer. */
	jtp__load_buffer_state( );
	(yy_did_buffer_switch_on_eof) = 1;
}

/** Removes and deletes the top of the stack, if present.
 *  The next element becomes the new top.
 *  
 */
void jtp_pop_buffer_state (void)
{
    	if (!YY_CURRENT_BUFFER)
		return;

	jtp__delete_buffer(YY_CURRENT_BUFFER );
	YY_CURRENT_BUFFER_LVALUE = NULL;
	if ((yy_buffer_stack_top) > 0)
		--(yy_buffer_stack_top);

	if (YY_CURRENT_BUFFER) {
		jtp__load_buffer_state( );
		(yy_did_buffer_switch_on_eof) = 1;
	}
}

/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
static void jtp_ensure_buffer_stack (void)
{
	int num_to_alloc;
    
	if (!(yy_buffer_stack)) {

		/* First allocation is just for 2 elements, since we don't know if this
		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
		 * immediate realloc on the next call.
         */
		num_to_alloc = 1;
		(yy_buffer_stack) = (struct yy_buffer_state**)jtp_alloc
								(num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in jtp_ensure_buffer_stack()" );
								  
		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
				
		(yy_buffer_stack_max) = num_to_alloc;
		(yy_buffer_stack_top) = 0;
		return;
	}

	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){

		/* Increase the buffer to prepare for a possible push. */
		int grow_size = 8 /* arbitrary grow size */;

		num_to_alloc = (yy_buffer_stack_max) + grow_size;
		(yy_buffer_stack) = (struct yy_buffer_state**)jtp_realloc
								((yy_buffer_stack),
								num_to_alloc * sizeof(struct yy_buffer_state*)
								);
		if ( ! (yy_buffer_stack) )
			YY_FATAL_ERROR( "out of dynamic memory in jtp_ensure_buffer_stack()" );

		/* zero only the new slots.*/
		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
		(yy_buffer_stack_max) = num_to_alloc;
	}
}

/** Setup the input buffer state to scan directly from a user-specified character buffer.
 * @param base the character buffer
 * @param size the size in bytes of the character buffer
 * 
 * @return the newly allocated buffer state object. 
 */
YY_BUFFER_STATE jtp__scan_buffer  (char * base, yy_size_t  size )
{
	YY_BUFFER_STATE b;
    
	if ( size < 2 ||
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
		/* They forgot to leave room for the EOB's. */
		return 0;

	b = (YY_BUFFER_STATE) jtp_alloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in jtp__scan_buffer()" );

	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
	b->yy_buf_pos = b->yy_ch_buf = base;
	b->yy_is_our_buffer = 0;
	b->yy_input_file = 0;
	b->yy_n_chars = b->yy_buf_size;
	b->yy_is_interactive = 0;
	b->yy_at_bol = 1;
	b->yy_fill_buffer = 0;
	b->yy_buffer_status = YY_BUFFER_NEW;

	jtp__switch_to_buffer(b  );

	return b;
}

/** Setup the input buffer state to scan a string. The next call to jtp_lex() will
 * scan from a @e copy of @a str.
 * @param yystr a NUL-terminated string to scan
 * 
 * @return the newly allocated buffer state object.
 * @note If you want to scan bytes that may contain NUL values, then use
 *       jtp__scan_bytes() instead.
 */
YY_BUFFER_STATE jtp__scan_string (yyconst char * yystr )
{
    
	return jtp__scan_bytes(yystr,strlen(yystr) );
}

/** Setup the input buffer state to scan the given bytes. The next call to jtp_lex() will
 * scan from a @e copy of @a bytes.
 * @param yybytes the byte buffer to scan
 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE jtp__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
{
	YY_BUFFER_STATE b;
	char *buf;
	yy_size_t n;
	int i;
    
	/* Get memory for full buffer, including space for trailing EOB's. */
	n = _yybytes_len + 2;
	buf = (char *) jtp_alloc(n  );
	if ( ! buf )
		YY_FATAL_ERROR( "out of dynamic memory in jtp__scan_bytes()" );

	for ( i = 0; i < _yybytes_len; ++i )
		buf[i] = yybytes[i];

	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;

	b = jtp__scan_buffer(buf,n );
	if ( ! b )
		YY_FATAL_ERROR( "bad buffer in jtp__scan_bytes()" );

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

	return b;
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

static void yy_fatal_error (yyconst char* msg )
{
    	(void) fprintf( stderr, "%s\n", msg );
	exit( YY_EXIT_FAILURE );
}

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

#undef yyless
#define yyless(n) \
	do \
		{ \
		/* Undo effects of setting up jtp_text. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
		jtp_text[jtp_leng] = (yy_hold_char); \
		(yy_c_buf_p) = jtp_text + yyless_macro_arg; \
		(yy_hold_char) = *(yy_c_buf_p); \
		*(yy_c_buf_p) = '\0'; \
		jtp_leng = yyless_macro_arg; \
		} \
	while ( 0 )

/* Accessor  methods (get/set functions) to struct members. */

/** Get the current line number.
 * 
 */
int jtp_get_lineno  (void)
{
        
    return jtp_lineno;
}

/** Get the input stream.
 * 
 */
FILE *jtp_get_in  (void)
{
        return jtp_in;
}

/** Get the output stream.
 * 
 */
FILE *jtp_get_out  (void)
{
        return jtp_out;
}

/** Get the length of the current token.
 * 
 */
int jtp_get_leng  (void)
{
        return jtp_leng;
}

/** Get the current token.
 * 
 */

char *jtp_get_text  (void)
{
        return jtp_text;
}

/** Set the current line number.
 * @param line_number
 * 
 */
void jtp_set_lineno (int  line_number )
{
    
    jtp_lineno = line_number;
}

/** Set the input stream. This does not discard the current
 * input buffer.
 * @param in_str A readable stream.
 * 
 * @see jtp__switch_to_buffer
 */
void jtp_set_in (FILE *  in_str )
{
        jtp_in = in_str ;
}

void jtp_set_out (FILE *  out_str )
{
        jtp_out = out_str ;
}

int jtp_get_debug  (void)
{
        return jtp__flex_debug;
}

void jtp_set_debug (int  bdebug )
{
        jtp__flex_debug = bdebug ;
}

static int yy_init_globals (void)
{
        /* Initialization is the same as for the non-reentrant scanner.
     * This function is called from jtp_lex_destroy(), so don't allocate here.
     */

    /* We do not touch jtp_lineno unless the option is enabled. */
    jtp_lineno =  1;
    
    (yy_buffer_stack) = 0;
    (yy_buffer_stack_top) = 0;
    (yy_buffer_stack_max) = 0;
    (yy_c_buf_p) = (char *) 0;
    (yy_init) = 0;
    (yy_start) = 0;

/* Defined in main.c */
#ifdef YY_STDINIT
    jtp_in = stdin;
    jtp_out = stdout;
#else
    jtp_in = (FILE *) 0;
    jtp_out = (FILE *) 0;
#endif

    /* For future reference: Set errno on error, since we are called by
     * jtp_lex_init()
     */
    return 0;
}

/* jtp_lex_destroy is for both reentrant and non-reentrant scanners. */
int jtp_lex_destroy  (void)
{
    
    /* Pop the buffer stack, destroying each element. */
	while(YY_CURRENT_BUFFER){
		jtp__delete_buffer(YY_CURRENT_BUFFER  );
		YY_CURRENT_BUFFER_LVALUE = NULL;
		jtp_pop_buffer_state();
	}

	/* Destroy the stack itself. */
	jtp_free((yy_buffer_stack) );
	(yy_buffer_stack) = NULL;

    /* Reset the globals. This is important in a non-reentrant scanner so the next time
     * jtp_lex() is called, initialization will occur. */
    yy_init_globals( );

    return 0;
}

/*
 * Internal utility routines.
 */

#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
	register int i;
	for ( i = 0; i < n; ++i )
		s1[i] = s2[i];
}
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
	register int n;
	for ( n = 0; s[n]; ++n )
		;

	return n;
}
#endif

void *jtp_alloc (yy_size_t  size )
{
	return (void *) malloc( size );
}

void *jtp_realloc  (void * ptr, yy_size_t  size )
{
	/* 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 );
}

void jtp_free (void * ptr )
{
	free( (char *) ptr );	/* see jtp_realloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

#line 255 "gw_template_parser.l"



/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

int jtp_wrap(void)
{
    return 1;
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

void jtp_error(gw_template_t *jt, const char *str)
{
    fprintf(stderr,"Parse Error %s (line %i)\n",str,jtp_lineno);
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

void gw_template_set_value_str (gw_template_t *jt,
        gw_template_var_t var, 
        const char *val)
{
    char *tmp;
    char *num;
    int  i;
    
    if ( val==NULL )
    {
        fprintf(stderr,"Warning!, Variable value not defined at line %i\n", jtp_lineno);
        return;
    }
    
    switch (var)
    {
        case EXECUTABLE:
            strncpy(jt->executable,val,GW_JT_STR);
            break;
        
        case ARGUMENTS:
            strncpy(jt->arguments,val,GW_JT_STR);
            break;
        
        case PRE_WRAPPER:
            strncpy(jt->pre_wrapper,val,GW_JT_STR);
            break;
        
        case PRE_WRAPPER_ARGUMENTS:
            strncpy(jt->pre_wrapper_arguments,val,GW_JT_STR);
            break;
        
        case RANK:
            strncpy(jt->rank,val,GW_JT_STR);
            break;
        
        case REQUIREMENTS:
            strncpy(jt->requirements,val,GW_JT_STR);
            break;
        
        case STDERR_FILE:
            strncpy(jt->stderr_file,val,GW_JT_STR);
            break;
        
        case STDIN_FILE:
            strncpy(jt->stdin_file,val,GW_JT_STR);
            break;
        
        case STDOUT_FILE:
            strncpy(jt->stdout_file,val,GW_JT_STR);
            break;
        
        case CHECKPOINT_URL:
            strncpy(jt->checkpoint_url,val,GW_JT_STR);
            break;
        
        case WRAPPER:
            if (val[0] != '/')
                snprintf(jt->wrapper,GW_JT_STR,"%s/%s", GW_LOCATION, val);
            else
                strncpy(jt->wrapper,val,GW_JT_STR);
            break;
            
        case MONITOR:
            if (val[0] != '/')
                snprintf(jt->monitor,GW_JT_STR,"%s/%s", GW_LOCATION, val);
            else
                strncpy(jt->monitor,val,GW_JT_STR);
            break;
            
        case JOB_DEPENDENCIES:
            tmp = strdup(val);
            i = 0;
            jt->job_deps[0] = -1;
            
            num = strtok (tmp," ");
            
            while ( (num != NULL) && (i<(GW_JT_DEPS -1)) )
            {
                jt->job_deps[i++] = atoi(num);
                num = strtok (NULL," ");
            }
            
            jt->job_deps[i] = -1;
            free(tmp);
            break;

        case TYPE:
            if (strcasecmp(val,"mpi") == 0)
                jt->type = GW_JOB_TYPE_MPI;
            else if (strcasecmp(val,"multiple") == 0)
                jt->type = GW_JOB_TYPE_MULTIPLE;
            else if (strcasecmp(val,"single") == 0)
                jt->type = GW_JOB_TYPE_SINGLE;
            else
                fprintf(stderr,"Bad job type \"%s\", line %i\n",val,jtp_lineno);
            break;

        case NAME:
            strncpy(jt->name,val,GW_JT_STR);
            break;

        default:
            fprintf(stderr,"Unexpected error setting str variable, line %i\n",jtp_lineno);
            break;
    }
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

void gw_template_set_value_int (gw_template_t *jt,
        gw_template_var_t var,
        int val)
{
    switch (var)
    {
        case CPULOAD_THRESHOLD:
            jt->cpuload_threshold = val;
            break;

        case NUMBER_OF_RETRIES:
            jt->number_of_retries = val;
            break;
        
        case RESCHEDULE_ON_FAILURE:
            jt->reschedule_on_failure = val;
            break;
        
        case RESCHEDULING_INTERVAL:
            jt->rescheduling_interval = val;
            break;
        
        case RESCHEDULING_THRESHOLD:
            jt->rescheduling_threshold = val;
            break;

        case CHECKPOINT_INTERVAL:
            jt->checkpoint_interval = val;
            break;

        case SUSPENSION_TIMEOUT:
            jt->suspension_timeout = val;
            break;
        
        case NP:
            jt->np = val;
            break;
        
        default:
            fprintf(stderr,"Unexpected error setting int variable, line %i\n",jtp_lineno);
            break;
    }
}

/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int gw_template_parser (gw_template_t *jt)
{
    int rc;
    char template_file[PATH_MAX];
    
    pthread_mutex_lock(&jtp_mutex);

    GW_LOCATION = getenv("GW_LOCATION");   
    
    if (GW_LOCATION == NULL )
    {
        fprintf(stderr,"GW_LOCATION is not defined\n");
        pthread_mutex_unlock(&jtp_mutex);        
        return -1;
    }

    /* Default job template parsing */         

    sprintf(template_file,"%s/" GW_ETC_DIR "/job_template.default",GW_LOCATION);

    jtp_in = fopen (template_file, "r");

    if (jtp_in == NULL)
    {
        fprintf(stderr,"Error opening default template file (%s)\n",template_file);
    }
    else
    {    
        jtp_lineno = 0;
        rc = yylex_jt(jt);
    
        fclose(jtp_in);

        if ( rc != 0 )
        {
            pthread_mutex_unlock(&jtp_mutex);        
            return rc;
        }
    }

    /* Job template parsing */
    
    if(strcmp(jt->file,"stdin")==0)
		jtp_in = stdin;
	else
	{
	    sprintf(template_file,"%s/%s",jt->job_home,jt->file);            
    	jtp_in = fopen (template_file, "r");
	}



    if (jtp_in == NULL)
    {
        fprintf(stderr,"Error opening job template file (%s)\n",template_file);
        pthread_mutex_unlock(&jtp_mutex);        
        return -1;
    }
    
    jtp_lineno = 0;
    rc = yylex_jt(jt);

    fclose(jtp_in);
    
    pthread_mutex_unlock(&jtp_mutex);    
    return rc;
}

