GnuCOBOL  2.0
A free COBOL compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
pplex.c File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include "config.h"
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "cobc.h"
#include "ppparse.h"
Include dependency graph for pplex.c:

Data Structures

struct  yy_buffer_state
 
struct  yy_trans_info
 
struct  copy_info
 
struct  plex_stack
 

Macros

#define YY_INT_ALIGNED   short int
 
#define yy_create_buffer   pp_create_buffer
 
#define yy_delete_buffer   pp_delete_buffer
 
#define yy_flex_debug   pp_flex_debug
 
#define yy_init_buffer   pp_init_buffer
 
#define yy_flush_buffer   pp_flush_buffer
 
#define yy_load_buffer_state   pp_load_buffer_state
 
#define yy_switch_to_buffer   pp_switch_to_buffer
 
#define yyin   ppin
 
#define yyleng   ppleng
 
#define yylex   pplex
 
#define yylineno   pplineno
 
#define yyout   ppout
 
#define yyrestart   pprestart
 
#define yytext   pptext
 
#define yywrap   ppwrap
 
#define yyalloc   ppalloc
 
#define yyrealloc   pprealloc
 
#define yyfree   ppfree
 
#define FLEX_SCANNER
 
#define YY_FLEX_MAJOR_VERSION   2
 
#define YY_FLEX_MINOR_VERSION   5
 
#define YY_FLEX_SUBMINOR_VERSION   37
 
#define FLEX_BETA
 
#define FLEXINT_H
 
#define INT8_MIN   (-128)
 
#define INT16_MIN   (-32767-1)
 
#define INT32_MIN   (-2147483647-1)
 
#define INT8_MAX   (127)
 
#define INT16_MAX   (32767)
 
#define INT32_MAX   (2147483647)
 
#define UINT8_MAX   (255U)
 
#define UINT16_MAX   (65535U)
 
#define UINT32_MAX   (4294967295U)
 
#define yyconst
 
#define YY_NULL   0
 
#define YY_SC_TO_UI(c)   ((unsigned int) (unsigned char) c)
 
#define BEGIN   (yy_start) = 1 + 2 *
 
#define YY_START   (((yy_start) - 1) / 2)
 
#define YYSTATE   YY_START
 
#define YY_STATE_EOF(state)   (YY_END_OF_BUFFER + state + 1)
 
#define YY_NEW_FILE   pprestart(ppin )
 
#define YY_END_OF_BUFFER_CHAR   0
 
#define YY_BUF_SIZE   16384
 
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
#define YY_TYPEDEF_YY_BUFFER_STATE
 
#define YY_TYPEDEF_YY_SIZE_T
 
#define EOB_ACT_CONTINUE_SCAN   0
 
#define EOB_ACT_END_OF_FILE   1
 
#define EOB_ACT_LAST_MATCH   2
 
#define YY_LESS_LINENO(n)
 
#define yyless(n)
 
#define unput(c)   yyunput( c, (yytext_ptr) )
 
#define YY_STRUCT_YY_BUFFER_STATE
 
#define YY_BUFFER_NEW   0
 
#define YY_BUFFER_NORMAL   1
 
#define YY_BUFFER_EOF_PENDING   2
 
#define YY_CURRENT_BUFFER
 
#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]
 
#define YY_FLUSH_BUFFER   pp_flush_buffer(YY_CURRENT_BUFFER )
 
#define yy_new_buffer   pp_create_buffer
 
#define yy_set_interactive(is_interactive)
 
#define yy_set_bol(at_bol)
 
#define YY_AT_BOL()   (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
#define yytext_ptr   pptext
 
#define YY_DO_BEFORE_ACTION
 
#define YY_NUM_RULES   156
 
#define YY_END_OF_BUFFER   157
 
#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
 
#define YY_READ_BUF_SIZE   32768
 
#define YY_BUF_SIZE   32768
 
#define YY_SKIP_YYWRAP
 
#define ppwrap()   1
 
#define PPLEX_BUFF_LEN   512
 
#define YY_INPUT(buf, result, max_size)   result = ppinput (buf, max_size);
 
#define ECHO   fputs (pptext, ppout)
 
#define YY_USER_INIT
 
#define YY_NO_UNISTD_H   1
 
#define COB_IN_PPLEX   1
 
#define PLEX_COND_DEPTH   16
 
#define INITIAL   0
 
#define COPY_STATE   1
 
#define PSEUDO_STATE   2
 
#define SOURCE_DIRECTIVE_STATE   3
 
#define DEFINE_DIRECTIVE_STATE   4
 
#define SET_DIRECTIVE_STATE   5
 
#define TURN_DIRECTIVE_STATE   6
 
#define IF_DIRECTIVE_STATE   7
 
#define ELSE_DIRECTIVE_STATE   8
 
#define ENDIF_DIRECTIVE_STATE   9
 
#define YY_EXTRA_TYPE   void *
 
#define yyterminate()   return YY_NULL
 
#define YY_START_STACK_INCR   25
 
#define YY_FATAL_ERROR(msg)   yy_fatal_error( msg )
 
#define YY_DECL_IS_OURS   1
 
#define YY_DECL   int pplex (void)
 
#define YY_USER_ACTION
 
#define YY_BREAK   break;
 
#define YY_RULE_SETUP
 
#define YY_EXIT_FAILURE   2
 
#define yyless(n)
 
#define YYTABLES_NAME   "yytables"
 

Typedefs

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
 
typedef struct yy_buffer_stateYY_BUFFER_STATE
 
typedef size_t yy_size_t
 
typedef unsigned char YY_CHAR
 
typedef int yy_state_type
 

Functions

void pprestart (FILE *input_file)
 Immediately switch to a different input stream. More...
 
void pp_switch_to_buffer (YY_BUFFER_STATE new_buffer)
 Switch to a different input buffer. More...
 
YY_BUFFER_STATE pp_create_buffer (FILE *file, int size)
 Allocate and initialize an input buffer state. More...
 
void pp_delete_buffer (YY_BUFFER_STATE b)
 Destroy the buffer. More...
 
void pp_flush_buffer (YY_BUFFER_STATE b)
 Discard all buffered characters. More...
 
void pppush_buffer_state (YY_BUFFER_STATE new_buffer)
 Pushes the new state onto the stack. More...
 
void pppop_buffer_state (void)
 Removes and deletes the top of the stack, if present. More...
 
static void ppensure_buffer_stack (void)
 
static void pp_load_buffer_state (void)
 
static void pp_init_buffer (YY_BUFFER_STATE b, FILE *file)
 
YY_BUFFER_STATE pp_scan_buffer (char *base, yy_size_t size)
 
YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str)
 
YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes, yy_size_t len)
 
void * ppalloc (yy_size_t)
 
void * pprealloc (void *, yy_size_t)
 
void ppfree (void *)
 
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[])
 
static int ppinput (char *, const size_t)
 
static void ppecho (const char *, const cob_u32_t, const int)
 
static void switch_to_buffer (const int, const char *, const YY_BUFFER_STATE)
 
static void check_listing (const char *, const unsigned int)
 
static void skip_to_eol (void)
 
static void display_to_eol (void)
 
static void check_comments (const char *, const char *)
 
static int yy_init_globals (void)
 Get the current token. More...
 
int pplex_destroy (void)
 
static void yyunput (int c, char *buf_ptr)
 
static int input (void)
 
static void yy_push_state (int new_state)
 
static void yy_pop_state (void)
 
int pplex (void)
 
 if (!(yy_init))
 
 while (1)
 
static void yyunput (int c, register char *yy_bp)
 
static void yy_fatal_error (yyconst char *msg)
 
void pp_set_replace_list (struct cb_replace_list *list, const cob_u32_t is_pushpop)
 
int ppopen (const char *name, struct cb_replace_list *replacing_list)
 
int ppcopy (const char *name, const char *lib, struct cb_replace_list *replace_list)
 
void ppparse_error (const char *msg)
 
void plex_clear_vars (void)
 
void plex_clear_all (void)
 
void plex_call_destroy (void)
 
void plex_action_directive (const unsigned int cmdtype, const unsigned int is_true)
 
static struct cb_text_listpp_text_list_add (struct cb_text_list *list, const char *text, const size_t size)
 

Variables

yy_size_t ppleng
 
FILE * ppin = (FILE *) 0
 
FILE * ppout = (FILE *) 0
 
static size_t yy_buffer_stack_top = 0
 index of top of stack. More...
 
static size_t yy_buffer_stack_max = 0
 capacity of stack. More...
 
static YY_BUFFER_STATEyy_buffer_stack = 0
 Stack as an array. More...
 
static char yy_hold_char
 
static yy_size_t yy_n_chars
 
static char * yy_c_buf_p = (char *) 0
 
static int yy_init = 0
 
static int yy_start = 0
 
static int yy_did_buffer_switch_on_eof
 
int pplineno = 1
 
char * pptext
 
static yyconst flex_int16_t yy_accept [1082]
 
static yyconst flex_int32_t yy_ec [256]
 
static yyconst flex_int32_t yy_meta [74]
 
static yyconst flex_int16_t yy_base [1183]
 
static yyconst flex_int16_t yy_def [1183]
 
static yyconst flex_int16_t yy_nxt [5374]
 
static yyconst flex_int16_t yy_chk [5374]
 
static yy_state_type yy_last_accepting_state
 
static char * yy_last_accepting_cpos
 
int pp_flex_debug = 0
 
static char * plexbuff1 = NULL
 
static char * plexbuff2 = NULL
 
static size_t newline_count = 0
 
static size_t within_comment = 0
 
static size_t inside_bracket = 0
 
static size_t consecutive_quotation = 0
 
static size_t need_continuation = 0
 
static size_t buffer_overflow = 0
 
static size_t comment_allowed
 
static unsigned int plex_skip_input = 0
 
static unsigned int plex_nest_depth = 0
 
static int quotation_mark = 0
 
static int listing_line = 0
 
static int requires_listing_line
 
static int requires_new_line = 0
 
static struct cb_replace_listcurrent_replace_list = NULL
 
static struct cb_replace_listsave_current_replace = NULL
 
static struct cb_replace_listbase_replace_list = NULL
 
static struct cb_text_listtext_queue = NULL
 
static struct copy_infocopy_stack = NULL
 
static struct plex_stack plex_cond_stack [PLEX_COND_DEPTH]
 
static int yy_start_stack_ptr = 0
 
static int yy_start_stack_depth = 0
 
static int * yy_start_stack = NULL
 
 YY_DECL
 The main scanner function which does all the work. More...
 
register char * yy_cp
 
register char * yy_bp
 
register int yy_act
 

Macro Definition Documentation

#define BEGIN   (yy_start) = 1 + 2 *

Referenced by while(), yy_pop_state(), and yy_push_state().

#define COB_IN_PPLEX   1
#define COPY_STATE   1

Referenced by while().

#define DEFINE_DIRECTIVE_STATE   4

Referenced by while().

#define ECHO   fputs (pptext, ppout)

Referenced by while().

#define ELSE_DIRECTIVE_STATE   8

Referenced by while().

#define ENDIF_DIRECTIVE_STATE   9

Referenced by while().

#define EOB_ACT_CONTINUE_SCAN   0

Referenced by input(), while(), and yy_get_next_buffer().

#define EOB_ACT_END_OF_FILE   1

Referenced by input(), while(), and yy_get_next_buffer().

#define EOB_ACT_LAST_MATCH   2

Referenced by input(), while(), and yy_get_next_buffer().

#define FLEX_BETA
#define FLEX_SCANNER
#define FLEXINT_H
#define IF_DIRECTIVE_STATE   7

Referenced by while().

#define INITIAL   0

Referenced by while().

#define INT16_MAX   (32767)
#define INT16_MIN   (-32767-1)
#define INT32_MAX   (2147483647)
#define INT32_MIN   (-2147483647-1)
#define INT8_MAX   (127)
#define INT8_MIN   (-128)
#define PLEX_COND_DEPTH   16

Referenced by plex_action_directive().

#define PPLEX_BUFF_LEN   512

Referenced by ppinput().

#define ppwrap ( )    1

Referenced by input(), and while().

#define PSEUDO_STATE   2

Referenced by while().

#define REJECT   reject_used_but_not_detected
#define SET_DIRECTIVE_STATE   5

Referenced by while().

#define SOURCE_DIRECTIVE_STATE   3

Referenced by while().

#define TURN_DIRECTIVE_STATE   6

Referenced by while().

#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define UINT8_MAX   (255U)
#define unput (   c)    yyunput( c, (yytext_ptr) )

Referenced by display_to_eol(), skip_to_eol(), and while().

#define YY_AT_BOL ( )    (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

Referenced by while(), and yy_get_previous_state().

#define YY_BREAK   break;

Referenced by while().

#define YY_BUF_SIZE   16384

Referenced by if(), ppopen(), pprestart(), and yyrestart().

#define YY_BUF_SIZE   32768
#define YY_BUFFER_EOF_PENDING   2

Referenced by yy_get_next_buffer().

#define YY_BUFFER_NEW   0

Referenced by pp_flush_buffer(), and while().

#define YY_BUFFER_NORMAL   1

Referenced by while().

#define yy_create_buffer   pp_create_buffer
#define YY_DECL   int pplex (void)
#define YY_DECL_IS_OURS   1
#define yy_delete_buffer   pp_delete_buffer
#define YY_DO_BEFORE_ACTION
Value:
ppleng = (size_t) (yy_cp - yy_bp); \
*yy_cp = '\0'; \

Referenced by while().

#define YY_END_OF_BUFFER   157

Referenced by while().

#define YY_END_OF_BUFFER_CHAR   0
#define YY_EXIT_FAILURE   2

Referenced by yy_fatal_error().

#define YY_EXTRA_TYPE   void *
int yy_flex_debug   pp_flex_debug
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   37
#define yy_flush_buffer   pp_flush_buffer
#define YY_FLUSH_BUFFER   pp_flush_buffer(YY_CURRENT_BUFFER )
#define yy_init_buffer   pp_init_buffer
#define YY_INPUT (   buf,
  result,
  max_size 
)    result = ppinput (buf, max_size);

Referenced by yy_get_next_buffer().

#define YY_INT_ALIGNED   short int
#define YY_LESS_LINENO (   n)
#define yy_load_buffer_state   pp_load_buffer_state
#define YY_MORE_ADJ   0
#define yy_new_buffer   pp_create_buffer
#define YY_NEW_FILE   pprestart(ppin )

Referenced by input(), and while().

#define YY_NO_UNISTD_H   1
#define YY_NULL   0

Referenced by ppinput().

#define YY_NUM_RULES   156
#define YY_READ_BUF_SIZE   32768

Referenced by yy_get_next_buffer().

#define YY_RESTORE_YY_MORE_OFFSET

Referenced by while().

#define YY_RULE_SETUP
Value:
if ( ppleng > 0 ) \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
(pptext[ppleng - 1] == '\n'); \
YY_USER_ACTION

Referenced by while().

#define YY_SC_TO_UI (   c)    ((unsigned int) (unsigned char) c)

Referenced by while(), and yy_get_previous_state().

#define yy_set_bol (   at_bol)
Value:
{ \
if ( ! YY_CURRENT_BUFFER ){\
ppensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
pp_create_buffer(ppin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define yy_set_interactive (   is_interactive)
Value:
{ \
if ( ! YY_CURRENT_BUFFER ){ \
ppensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
pp_create_buffer(ppin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define YY_SKIP_YYWRAP
#define YY_START   (((yy_start) - 1) / 2)

Referenced by while(), and yy_push_state().

#define YY_START_STACK_INCR   25

Referenced by yy_push_state().

#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#define YY_STATE_EOF (   state)    (YY_END_OF_BUFFER + state + 1)

Referenced by while().

#define YY_STRUCT_YY_BUFFER_STATE
#define yy_switch_to_buffer   pp_switch_to_buffer
#define YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_SIZE_T
#define YY_USER_ACTION
#define YY_USER_INIT
Value:
if (!plexbuff1) { \
plexbuff1 = cobc_malloc ((size_t)COB_SMALL_BUFF); \
} \
if (!plexbuff2) { \
plexbuff2 = cobc_malloc ((size_t)COB_SMALL_BUFF); \
} \
requires_listing_line = 1; \
comment_allowed = 1;

Referenced by if().

#define yyconst
#define yyfree   ppfree
int yyleng   ppleng
#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up pptext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
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 pptext again */ \
} \
while ( 0 )
#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up pptext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
pptext[ppleng] = (yy_hold_char); \
(yy_c_buf_p) = pptext + yyless_macro_arg; \
*(yy_c_buf_p) = '\0'; \
ppleng = yyless_macro_arg; \
} \
while ( 0 )
#define yylex   pplex
int yylineno   pplineno
#define yymore ( )    yymore_used_but_not_detected
FILE * yyout   ppout
#define yyrealloc   pprealloc
#define yyrestart   pprestart
#define YYSTATE   YY_START
#define YYTABLES_NAME   "yytables"
#define yyterminate ( )    return YY_NULL

Referenced by while().

char * yytext   pptext
#define yywrap   ppwrap

Typedef Documentation

typedef short int flex_int16_t
typedef int flex_int32_t
typedef signed char flex_int8_t
typedef unsigned short int flex_uint16_t
typedef unsigned int flex_uint32_t
typedef unsigned char flex_uint8_t
typedef unsigned char YY_CHAR
typedef size_t yy_size_t
typedef int yy_state_type

Function Documentation

static void check_comments ( const char *  keyword,
const char *  text 
)
static

References cb_verify(), ppecho(), ppleng, and skip_to_eol().

Referenced by while().

5275 {
5276  /* Treated as comments when in Identification Division */
5277  if (comment_allowed) {
5278  cb_verify (cb_author_paragraph, keyword);
5279  /* Skip comments until the end of line */
5280  within_comment = 1;
5281  skip_to_eol ();
5282  } else {
5283  ppecho (text, 0, ppleng);
5284  }
5285 }
static void check_listing ( const char *  text,
const unsigned int  comment 
)
static

References CB_FORMAT_FIXED, cb_listing_file, cb_source_format, cobc_gen_listing, and cb_text_list::text.

Referenced by ppecho(), and while().

5289 {
5290  const char *s;
5291  char c;
5292 
5293  /* Check for listing */
5294  if (!cb_listing_file) {
5295  /* Nothing to do */
5296  return;
5297  }
5298  if (!text) {
5299  return;
5300  }
5301  if (cobc_gen_listing > 1) {
5302  /* Passed to cobxref */
5303  fputs (text, cb_listing_file);
5304  return;
5305  }
5306  if (comment) {
5307  c = '*';
5308  } else {
5309  c = ' ';
5310  }
5311 
5312  if (requires_listing_line) {
5313  if (requires_new_line) {
5314  requires_new_line = 0;
5315  putc ('\n', cb_listing_file);
5316  }
5317  fprintf (cb_listing_file, "%6d%c", ++listing_line, c);
5318  }
5319 
5321  strlen (text) > 6) {
5322  s = &text[6];
5323  } else {
5324  s = text;
5325  }
5326  fputs (s, cb_listing_file);
5327  if (strchr (text, '\n')) {
5329  } else {
5331  }
5332 }
static void display_to_eol ( void  )
static

References input(), and unput.

Referenced by while().

5254 {
5255  int c;
5256 
5257  while ((c = input ()) != EOF) {
5258  if (c == '\n') {
5259  break;
5260  }
5261  if (!plex_skip_input) {
5262  putchar (c);
5263  }
5264  }
5265  if (!plex_skip_input) {
5266  putchar ('\n');
5267  }
5268  if (c != EOF) {
5269  unput (c);
5270  }
5271 }
if ( yy_init)

References pp_create_buffer(), pp_load_buffer_state(), ppensure_buffer_stack(), ppin, ppout, YY_BUF_SIZE, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init, yy_start, and YY_USER_INIT.

Referenced by check_picture_item(), cob_cmp_alnum(), cob_linage_write_opt(), cob_sys_system(), cob_unstring_into(), output_initialize_literal(), process_assemble(), and yyunput().

2350  {
2351  (yy_init) = 1;
2352 
2353 #ifdef YY_USER_INIT
2354  YY_USER_INIT;
2355 #endif
2356 
2357  if ( ! (yy_start) )
2358  (yy_start) = 1; /* first start state */
2359 
2360  if ( ! ppin )
2361  ppin = stdin;
2362 
2363  if ( ! ppout )
2364  ppout = stdout;
2365 
2366  if ( ! YY_CURRENT_BUFFER ) {
2370  }
2371 
2373  }
static int input ( void  )
static

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, ppin, pprestart(), ppwrap, yy_c_buf_p, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, YY_END_OF_BUFFER_CHAR, yy_get_next_buffer(), yy_hold_char, yy_n_chars, YY_NEW_FILE, and yytext_ptr.

Referenced by display_to_eol(), and skip_to_eol().

3865 {
3866  int c;
3867 
3868  *(yy_c_buf_p) = (yy_hold_char);
3869 
3870  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3871  {
3872  /* yy_c_buf_p now points to the character we want to return.
3873  * If this occurs *before* the EOB characters, then it's a
3874  * valid NUL; if not, then we've hit the end of the buffer.
3875  */
3876  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3877  /* This was really a NUL. */
3878  *(yy_c_buf_p) = '\0';
3879 
3880  else
3881  { /* need more input */
3882  yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
3883  ++(yy_c_buf_p);
3884 
3885  switch ( yy_get_next_buffer( ) )
3886  {
3887  case EOB_ACT_LAST_MATCH:
3888  /* This happens because yy_g_n_b()
3889  * sees that we've accumulated a
3890  * token and flags that we need to
3891  * try matching the token before
3892  * proceeding. But for input(),
3893  * there's no matching to consider.
3894  * So convert the EOB_ACT_LAST_MATCH
3895  * to EOB_ACT_END_OF_FILE.
3896  */
3897 
3898  /* Reset buffer status. */
3899  pprestart(ppin );
3900 
3901  /*FALLTHROUGH*/
3902 
3903  case EOB_ACT_END_OF_FILE:
3904  {
3905  if ( ppwrap( ) )
3906  return EOF;
3907 
3908  if ( ! (yy_did_buffer_switch_on_eof) )
3909  YY_NEW_FILE;
3910 #ifdef __cplusplus
3911  return yyinput();
3912 #else
3913  return input();
3914 #endif
3915  }
3916 
3917  case EOB_ACT_CONTINUE_SCAN:
3918  (yy_c_buf_p) = (yytext_ptr) + offset;
3919  break;
3920  }
3921  }
3922  }
3923 
3924  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
3925  *(yy_c_buf_p) = '\0'; /* preserve pptext */
3926  (yy_hold_char) = *++(yy_c_buf_p);
3927 
3928  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
3929 
3930  return c;
3931 }
void plex_action_directive ( const unsigned int  cmdtype,
const unsigned int  is_true 
)

References _, cb_plex_error(), cb_source_line, plex_stack::cmd, COBC_ABORT, cobc_abort_pr(), plex_stack::cond, plex_stack::line, PLEX_ACT_ELIF, PLEX_ACT_ELSE, PLEX_ACT_END, PLEX_ACT_IF, PLEX_COND_DEPTH, plex_cond_stack, plex_nest_depth, and plex_stack::skip.

4563 {
4564  unsigned int n;
4565 
4566  /* Action IF/ELSE/END-IF/ELIF */
4567  switch (cmdtype) {
4568  case PLEX_ACT_IF:
4569  /* Push stack - First occurrence is dummy */
4570  if (++plex_nest_depth >= PLEX_COND_DEPTH) {
4571  cobc_abort_pr (_("Directive nest depth exceeded - %d"),
4572  PLEX_COND_DEPTH);
4573  COBC_ABORT ();
4574  }
4576  /* Intersection with previous - first is always 0 */
4577  n = plex_cond_stack[plex_nest_depth - 1].skip | !is_true;
4581  plex_skip_input = n;
4582  return;
4583  case PLEX_ACT_ELSE:
4584  /* Must have an associated IF/ELIF */
4585  if (!plex_nest_depth ||
4586  plex_cond_stack[plex_nest_depth].cmd != 1) {
4588  _("ELSE directive without matching IF/ELIF"));
4589  return;
4590  }
4592  /* Reverse any IF/ELIF condition */
4596  /* Intersection with previous */
4598  return;
4599  case PLEX_ACT_END:
4600  /* Must have an associated IF/ELIF/ELSE */
4601  if (!plex_nest_depth ||
4604  _("END-IF directive without matching IF/ELIF/ELSE"));
4605  return;
4606  }
4611  /* Pop stack - set skip to previous */
4612  plex_nest_depth--;
4614  return;
4615  case PLEX_ACT_ELIF:
4616  /* Must have an associated IF/ELIF */
4617  if (!plex_nest_depth ||
4618  plex_cond_stack[plex_nest_depth].cmd != 1) {
4620  _("ELIF directive without matching IF/ELIF"));
4621  return;
4622  }
4624  if (plex_cond_stack[plex_nest_depth].cond) {
4625  /* Previous IF or one of previous ELIF was true */
4626  /* Set to skip */
4627  n = 1U;
4628  } else if (is_true) {
4629  /* Condition is true */
4631  n = 0;
4632  } else {
4633  /* Set to skip */
4634  n = 1U;
4635  }
4637  /* Intersection with previous */
4639  return;
4640  default:
4641  cobc_abort_pr (_("Invalid internal case - %u"),
4642  cmdtype);
4643  COBC_ABORT ();
4644  }
4645 }
void plex_call_destroy ( void  )

References pplex_destroy().

Referenced by preprocess().

4557 {
4558  (void)pplex_destroy ();
4559 }
void plex_clear_all ( void  )

References cobc_free(), and NULL.

Referenced by main().

4544 {
4545  if (plexbuff1) {
4546  cobc_free (plexbuff1);
4547  plexbuff1 = NULL;
4548  }
4549  if (plexbuff2) {
4550  cobc_free (plexbuff2);
4551  plexbuff2 = NULL;
4552  }
4553 }
void plex_clear_vars ( void  )

References plex_cond_stack.

Referenced by preprocess().

4533 {
4534  /* Reset variables */
4535  plex_skip_input = 0;
4536  plex_nest_depth = 0;
4537  memset (plex_cond_stack, 0, sizeof(plex_cond_stack));
4539  comment_allowed = 1;
4540 }
YY_BUFFER_STATE pp_create_buffer ( FILE *  file,
int  size 
)

Allocate and initialize an input buffer state.

Parameters
fileA readable stream.
sizeThe character buffer size in bytes. When in doubt, use YY_BUF_SIZE.
Returns
the allocated buffer state.

References pp_init_buffer(), ppalloc(), yy_buffer_state::yy_buf_size, yy_buffer_state::yy_ch_buf, YY_FATAL_ERROR, and yy_buffer_state::yy_is_our_buffer.

Referenced by if(), ppopen(), and pprestart().

4002 {
4003  YY_BUFFER_STATE b;
4004 
4005  b = (YY_BUFFER_STATE) ppalloc(sizeof( struct yy_buffer_state ) );
4006  if ( ! b )
4007  YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
4008 
4009  b->yy_buf_size = size;
4010 
4011  /* yy_ch_buf has to be 2 characters longer than the size given because
4012  * we need to put in 2 end-of-buffer characters.
4013  */
4014  b->yy_ch_buf = (char *) ppalloc(b->yy_buf_size + 2 );
4015  if ( ! b->yy_ch_buf )
4016  YY_FATAL_ERROR( "out of dynamic memory in pp_create_buffer()" );
4017 
4018  b->yy_is_our_buffer = 1;
4019 
4020  pp_init_buffer(b,file );
4021 
4022  return b;
4023 }
void pp_delete_buffer ( YY_BUFFER_STATE  b)

Destroy the buffer.

Parameters
ba buffer created with pp_create_buffer()

References ppfree(), yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, and yy_buffer_state::yy_is_our_buffer.

Referenced by pplex_destroy(), pppop_buffer_state(), and while().

4030 {
4031 
4032  if ( ! b )
4033  return;
4034 
4035  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
4037 
4038  if ( b->yy_is_our_buffer )
4039  ppfree((void *) b->yy_ch_buf );
4040 
4041  ppfree((void *) b );
4042 }
void pp_flush_buffer ( YY_BUFFER_STATE  b)

Discard all buffered characters.

On the next scan, YY_INPUT will be called.

Parameters
bthe buffer state to be flushed, usually YY_CURRENT_BUFFER.

References pp_load_buffer_state(), yy_buffer_state::yy_at_bol, yy_buffer_state::yy_buf_pos, YY_BUFFER_NEW, yy_buffer_state::yy_buffer_status, yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER, YY_END_OF_BUFFER_CHAR, and yy_buffer_state::yy_n_chars.

Referenced by pp_init_buffer().

4077 {
4078  if ( ! b )
4079  return;
4080 
4081  b->yy_n_chars = 0;
4082 
4083  /* We always need two end-of-buffer characters. The first causes
4084  * a transition to the end-of-buffer state. The second causes
4085  * a jam in that state.
4086  */
4089 
4090  b->yy_buf_pos = &b->yy_ch_buf[0];
4091 
4092  b->yy_at_bol = 1;
4094 
4095  if ( b == YY_CURRENT_BUFFER )
4097 }
static void pp_init_buffer ( YY_BUFFER_STATE  b,
FILE *  file 
)
static

References file, pp_flush_buffer(), yy_buffer_state::yy_bs_column, yy_buffer_state::yy_bs_lineno, YY_CURRENT_BUFFER, yy_buffer_state::yy_fill_buffer, yy_buffer_state::yy_input_file, and yy_buffer_state::yy_is_interactive.

Referenced by pp_create_buffer(), and pprestart().

4050 {
4051  int oerrno = errno;
4052 
4053  pp_flush_buffer(b );
4054 
4055  b->yy_input_file = file;
4056  b->yy_fill_buffer = 1;
4057 
4058  /* If b is the current buffer, then pp_init_buffer was _probably_
4059  * called from pprestart() or through yy_get_next_buffer.
4060  * In that case, we don't want to reset the lineno or column.
4061  */
4062  if (b != YY_CURRENT_BUFFER){
4063  b->yy_bs_lineno = 1;
4064  b->yy_bs_column = 0;
4065  }
4066 
4067  b->yy_is_interactive = 0;
4068 
4069  errno = oerrno;
4070 }
static void pp_load_buffer_state ( void  )
static
YY_BUFFER_STATE pp_scan_buffer ( char *  base,
yy_size_t  size 
)
YY_BUFFER_STATE pp_scan_bytes ( yyconst char *  bytes,
yy_size_t  len 
)
YY_BUFFER_STATE pp_scan_string ( yyconst char *  yy_str)
void pp_set_replace_list ( struct cb_replace_list list,
const cob_u32_t  is_pushpop 
)

References base_replace_list, cb_replace_list::last, cb_replace_list::next, NULL, and cb_replace_list::prev.

4376 {
4377  /* Handle REPLACE verb */
4378  if (!list) {
4379  /* REPLACE [LAST] OFF */
4380  if (!is_pushpop) {
4382  return;
4383  }
4384  if (!base_replace_list) {
4385  return;
4386  }
4388  return;
4389  }
4390  /* REPLACE [ALSO] ... */
4391  if (base_replace_list && is_pushpop) {
4392  list->last->next = base_replace_list;
4393  list->prev = base_replace_list;
4394  } else {
4395  list->prev = NULL;
4396  }
4397  base_replace_list = list;
4398 }
void pp_switch_to_buffer ( YY_BUFFER_STATE  new_buffer)

Switch to a different input buffer.

Parameters
new_bufferThe new input buffer.

References pp_load_buffer_state(), ppensure_buffer_stack(), yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, yy_hold_char, and yy_n_chars.

Referenced by switch_to_buffer().

3957 {
3958 
3959  /* TODO. We should be able to replace this entire function body
3960  * with
3961  * pppop_buffer_state();
3962  * pppush_buffer_state(new_buffer);
3963  */
3965  if ( YY_CURRENT_BUFFER == new_buffer )
3966  return;
3967 
3968  if ( YY_CURRENT_BUFFER )
3969  {
3970  /* Flush out information for old buffer. */
3971  *(yy_c_buf_p) = (yy_hold_char);
3972  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3973  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3974  }
3975 
3976  YY_CURRENT_BUFFER_LVALUE = new_buffer;
3978 
3979  /* We don't actually know whether we did this switch during
3980  * EOF (ppwrap()) processing, but the only time this flag
3981  * is looked at is after ppwrap() is called, so it's safe
3982  * to go ahead and always set it.
3983  */
3985 }
static struct cb_text_list* pp_text_list_add ( struct cb_text_list list,
const char *  text,
const size_t  size 
)
staticread

References cobc_plex_malloc(), cb_text_list::last, cb_text_list::next, p, and cb_text_list::text.

Referenced by ppecho().

5070 {
5071  struct cb_text_list *p;
5072  void *tp;
5073 
5074  p = cobc_plex_malloc (sizeof (struct cb_text_list));
5075  tp = cobc_plex_malloc (size + 1);
5076  memcpy (tp, text, size);
5077  p->text = tp;
5078  if (!list) {
5079  p->last = p;
5080  return p;
5081  }
5082  list->last->next = p;
5083  list->last = p;
5084  return list;
5085 }
void * ppalloc ( yy_size_t  size)

Referenced by pp_create_buffer(), ppensure_buffer_stack(), and yy_push_state().

4345 {
4346  return (void *) malloc( size );
4347 }
int ppcopy ( const char *  name,
const char *  lib,
struct cb_replace_list replace_list 
)

References _, cb_error(), cb_extension_list, cb_include_list, COB_SMALL_MAX, cb_text_list::next, plexbuff1, ppopen(), R_OK, and cb_text_list::text.

4485 {
4486  struct cb_text_list *il;
4487  struct cb_text_list *el;
4488  const char *s;
4489 
4490  /* Locate and open COPY file */
4491  if (lib) {
4492  snprintf (plexbuff1, (size_t)COB_SMALL_MAX, "%s/%s", lib, name);
4493  s = plexbuff1;
4494  } else {
4495  s = name;
4496  }
4497 
4498  /* Find the file */
4499  if (access (s, R_OK) == 0) {
4500  return ppopen (s, replace_list);
4501  }
4502 
4503  for (el = cb_extension_list; el; el = el->next) {
4504  snprintf (plexbuff2, (size_t)COB_SMALL_MAX, "%s%s", s, el->text);
4505  if (access (plexbuff2, R_OK) == 0) {
4506  return ppopen (plexbuff2, replace_list);
4507  }
4508  }
4509 
4510  if (*s != '/') {
4511  for (il = cb_include_list; il; il = il->next) {
4512  for (el = cb_extension_list; el; el = el->next) {
4513  snprintf (plexbuff2, (size_t)COB_SMALL_MAX,
4514  "%s/%s%s", il->text, name, el->text);
4515  if (access (plexbuff2, R_OK) == 0) {
4516  return ppopen (plexbuff2, replace_list);
4517  }
4518  }
4519  }
4520  }
4521  cb_error ("%s: %s", name, _("No such file or directory"));
4522  return -1;
4523 }
static void ppecho ( const char *  text,
const cob_u32_t  alt_space,
const int  textlen 
)
static

References base_replace_list, cb_listing_file, CB_REPLACE_LEADING, CB_REPLACE_TRAILING, check_listing(), cobc_free(), cobc_strdup(), cb_replace_list::last, cb_replace_list::lead_trail, cb_replace_list::new_text, cb_text_list::next, cb_replace_list::next, NULL, cb_replace_list::old_text, pp_text_list_add(), ppout, pptext, cb_text_list::text, and text_queue.

Referenced by check_comments(), and while().

5089 {
5090  struct cb_replace_list *r;
5091  struct cb_replace_list *save_ptr;
5092  const struct cb_text_list *lno;
5093  struct cb_text_list *queue;
5094  struct cb_text_list *save_queue;
5095  const char *s;
5096  char *temp_ptr;
5097  size_t size;
5098  size_t size2;
5099 
5100  /* Check for replacement text before outputting */
5101  if (alt_space) {
5102  s = pptext;
5103  } else {
5104  s = text;
5105  }
5106 
5107  if (text_queue == NULL && (text[0] == ' ' || text[0] == '\n')) {
5108  /* No replacement */
5109  fwrite (text, (size_t)textlen, (size_t)1, ppout);
5110  if (cb_listing_file) {
5111  check_listing (s, 0);
5112  }
5113  return;
5114  }
5116  /* Ouput queue */
5117  for (; text_queue; text_queue = text_queue->next) {
5118  fputs (text_queue->text, ppout);
5119  }
5120  fwrite (text, (size_t)textlen, (size_t)1, ppout);
5121  if (cb_listing_file) {
5122  check_listing (s, 0);
5123  }
5124  return;
5125  }
5126  if (!current_replace_list) {
5128  save_ptr = NULL;
5129  } else {
5131  save_ptr = current_replace_list->last;
5132  }
5133 
5134  /* Do replacement */
5135  text_queue = pp_text_list_add (text_queue, text, (size_t)textlen);
5136 
5137  save_queue = NULL;
5138  size = 0;
5139  size2 = 0;
5140  for (r = current_replace_list; r; r = r->next) {
5141  queue = text_queue;
5142  /* The LEADING/TRAILING code looks peculiar as we use */
5143  /* variables after breaking out of the loop BUT */
5144  /* ppparse.y guarantees that we have only one token */
5145  /* and therefore only one iteration of this loop */
5146  for (lno = r->old_text; lno; lno = lno->next) {
5147  if (lno->text[0] == ' ' || lno->text[0] == '\n') {
5148  continue;
5149  }
5150  while (queue && (queue->text[0] == ' ' ||
5151  queue->text[0] == '\n')) {
5152  queue = queue->next;
5153  }
5154  if (queue == NULL) {
5155  /* Partial match */
5156  if (!save_ptr) {
5158  } else {
5159  save_ptr->next = NULL;
5160  }
5161  return;
5162  }
5163  if (r->lead_trail == CB_REPLACE_LEADING) {
5164  /* Check leading text */
5165  size = strlen (lno->text);
5166  if (strncasecmp (lno->text, queue->text, size)) {
5167  /* No match */
5168  break;
5169  }
5170  save_queue = queue;
5171  } else if (r->lead_trail == CB_REPLACE_TRAILING) {
5172  /* Check trailing text */
5173  size = strlen (lno->text);
5174  size2 = strlen (queue->text);
5175  if (size2 < size) {
5176  /* No match */
5177  break;
5178  }
5179  size2 -= size;
5180  if (strncasecmp (lno->text, queue->text + size2, size)) {
5181  /* No match */
5182  break;
5183  }
5184  save_queue = queue;
5185  } else if (strcasecmp (lno->text, queue->text)) {
5186  /* No match */
5187  break;
5188  }
5189  queue = queue->next;
5190  }
5191  if (lno == NULL) {
5192  /* Match */
5193  if (r->lead_trail == CB_REPLACE_TRAILING) {
5194  /* Non-matched part of original text */
5195  fprintf (ppout, "%*.*s", (int)size2, (int)size2,
5196  save_queue->text);
5197  if (cb_listing_file) {
5198  temp_ptr = cobc_strdup (save_queue->text);
5199  *(temp_ptr + size2) = 0;
5200  check_listing (temp_ptr, 0);
5201  cobc_free (temp_ptr);
5202  }
5203  }
5204  for (lno = r->new_text; lno; lno = lno->next) {
5205  fputs (lno->text, ppout);
5206  if (cb_listing_file) {
5207  check_listing (lno->text, 0);
5208  }
5209  }
5210  if (r->lead_trail == CB_REPLACE_LEADING) {
5211  /* Non-matched part of original text */
5212  fputs (save_queue->text + size, ppout);
5213  if (cb_listing_file) {
5214  check_listing (save_queue->text + size, 0);
5215  }
5216  }
5217  text_queue = queue;
5218  continue;
5219  }
5220  }
5221 
5222  /* No match */
5223  for (; text_queue; text_queue = text_queue->next) {
5224  fputs (text_queue->text, ppout);
5225  if (cb_listing_file) {
5227  }
5228  }
5229  if (!save_ptr) {
5231  } else {
5232  save_ptr->next = NULL;
5233  }
5234 }
static void ppensure_buffer_stack ( void  )
static

References ppalloc(), pprealloc(), yy_buffer_stack, yy_buffer_stack_max, yy_buffer_stack_top, and YY_FATAL_ERROR.

Referenced by if(), pp_switch_to_buffer(), pppush_buffer_state(), and pprestart().

4155 {
4156  yy_size_t num_to_alloc;
4157 
4158  if (!(yy_buffer_stack)) {
4159 
4160  /* First allocation is just for 2 elements, since we don't know if this
4161  * scanner will even need a stack. We use 2 instead of 1 to avoid an
4162  * immediate realloc on the next call.
4163  */
4164  num_to_alloc = 1;
4166  (num_to_alloc * sizeof(struct yy_buffer_state*)
4167  );
4168  if ( ! (yy_buffer_stack) )
4169  YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
4170 
4171  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
4172 
4173  (yy_buffer_stack_max) = num_to_alloc;
4174  (yy_buffer_stack_top) = 0;
4175  return;
4176  }
4177 
4178  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
4179 
4180  /* Increase the buffer to prepare for a possible push. */
4181  int grow_size = 8 /* arbitrary grow size */;
4182 
4183  num_to_alloc = (yy_buffer_stack_max) + grow_size;
4185  ((yy_buffer_stack),
4186  num_to_alloc * sizeof(struct yy_buffer_state*)
4187  );
4188  if ( ! (yy_buffer_stack) )
4189  YY_FATAL_ERROR( "out of dynamic memory in ppensure_buffer_stack()" );
4190 
4191  /* zero only the new slots.*/
4192  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
4193  (yy_buffer_stack_max) = num_to_alloc;
4194  }
4195 }
void ppfree ( void *  ptr)

Referenced by pp_delete_buffer(), and pplex_destroy().

4362 {
4363  free( (char *) ptr ); /* see pprealloc() for (char *) cast */
4364 }
static int ppinput ( char *  buff,
const size_t  max_size 
)
static

References _, CB_FORMAT_FIXED, CB_FORMAT_FREE, cb_plex_error(), cb_plex_warning(), cb_source_format, likely, newline_count, ppin, PPLEX_BUFF_LEN, unlikely, and YY_NULL.

4662 {
4663  char *bp;
4664  size_t gotcr;
4665  size_t line_overflow;
4666  size_t continuation;
4667  int ipchar;
4668  int i;
4669  int n;
4670  int coln;
4671 
4672  /* Read line(s) */
4673 
4674  continuation = 0;
4675 start:
4676  if (unlikely(buffer_overflow ||
4677  (newline_count + PPLEX_BUFF_LEN) >= max_size)) {
4678  if (need_continuation || continuation) {
4680  _("Buffer overrun - Too much continuation lines"));
4681  return YY_NULL;
4682  }
4683  if (newline_count < max_size) {
4684  memset (buff, '\n', newline_count);
4685  buff[newline_count] = 0;
4686  ipchar = (int)newline_count;
4687  newline_count = 0;
4688  buffer_overflow = 0;
4689  return ipchar;
4690  }
4691  buffer_overflow = 1;
4692  ipchar = max_size - 1;
4693  memset (buff, '\n', (size_t)ipchar);
4694  buff[ipchar] = 0;
4695  newline_count -= ipchar;
4696  return ipchar;
4697  }
4698  gotcr = 0;
4699  line_overflow = 0;
4700  ipchar = 0;
4701  for (n = 0; ipchar != '\n';) {
4702  if (unlikely(n == PPLEX_BUFF_LEN)) {
4703  if (line_overflow != 2) {
4704  line_overflow = 1;
4705  }
4706  }
4707  ipchar = getc (ppin);
4708  if (unlikely(ipchar == EOF)) {
4709  if (n > 0) {
4710  /* No end of line at end of file */
4711  break;
4712  }
4713  if (newline_count == 0) {
4714  return YY_NULL;
4715  }
4716  memset (buff, '\n', newline_count);
4717  buff[newline_count] = 0;
4718  ipchar = (int)newline_count;
4719  newline_count = 0;
4720  return ipchar;
4721  }
4722 #ifndef COB_EBCDIC_MACHINE
4723  if (unlikely(ipchar == 0x1A && !n)) {
4724  continue;
4725  }
4726 #endif
4727  if (unlikely(gotcr)) {
4728  gotcr = 0;
4729  if (ipchar != '\n') {
4730  if (likely(line_overflow == 0)) {
4731  buff[n++] = '\r';
4732  } else {
4733  line_overflow = 2;
4734  }
4735  }
4736  }
4737  if (unlikely(ipchar == '\r')) {
4738  gotcr = 1;
4739  continue;
4740  }
4741  if (unlikely(ipchar == '\t')) {
4742  if (likely(line_overflow == 0)) {
4743  buff[n++] = ' ';
4744  while (n % cb_tab_width != 0) {
4745  buff[n++] = ' ';
4746  }
4747  if (unlikely(n > PPLEX_BUFF_LEN)) {
4748  n = PPLEX_BUFF_LEN;
4749  }
4750  }
4751  continue;
4752  }
4753  if (likely(line_overflow == 0)) {
4754  buff[n++] = (char)ipchar;
4755  } else if ((char)ipchar != ' ' && (char)ipchar != '\n') {
4756  line_overflow = 2;
4757  }
4758  }
4759 
4760  if (buff[n - 1] != '\n') {
4761  /* FIXME: cb_source_line is one too low when CB_FORMAT_FREE is used
4762  [but only during ppinput() in pplex.l ?] - Workaround for now:
4763  Temporary newline_count + 1
4764  */
4766  if (line_overflow == 0) {
4768  _("Line not terminated by a newline"));
4769  } else if (line_overflow == 2) {
4771  _("Source text exceeds %d bytes, will be truncated"), PPLEX_BUFF_LEN);
4772  }
4773  } else {
4774  if (line_overflow == 0) {
4776  _("Line not terminated by a newline"));
4777  } else if (line_overflow == 2) {
4779  _("Source text exceeds %d bytes, will be truncated"), PPLEX_BUFF_LEN);
4780  }
4781  }
4782  buff[n++] = '\n';
4783  }
4784  buff[n] = 0;
4785 
4787  if (n < 8) {
4788  /* Line too short */
4789  newline_count++;
4790  goto start;
4791  }
4792 
4793  if (cb_flag_mfcomment) {
4794  if (buff[0] == '*' || buff[0] == '/') {
4795  newline_count++;
4796  goto start;
4797  }
4798  }
4799 
4800  /* Check if text is longer than cb_text_column */
4801  if (n > cb_text_column + 1) {
4802  /* Show warning if it is not whitespace
4803  (postponed after checking for comments by setting
4804  line_overflow to first column that leads to
4805  "source text too long")
4806  */
4807  if (cb_warn_column_overflow && line_overflow == 0) {
4808  for (coln = cb_text_column; coln < n; ++coln) {
4809  if (buff[coln] != ' ' && buff[coln] != '\n') {
4810  line_overflow = coln;
4811  break;
4812  }
4813  }
4814  } else {
4815  line_overflow = 0;
4816  }
4817  /* Remove it */
4818  buff[cb_text_column] = '\n';
4819  buff[cb_text_column + 1] = 0;
4820  n = cb_text_column + 1;
4821  } else {
4822  line_overflow = 0;
4823  }
4824 
4825  memset (buff, ' ', (size_t)6);
4826  /* Note we allow directive lines to start at column 7 */
4827  bp = &buff[6];
4828  } else {
4829  bp = buff;
4830  }
4831 
4832  /* Check for directives/floating comment at first non-space of line */
4833  ipchar = 0;
4834  i = 0;
4835  for (; *bp; bp++) {
4836  if (*bp != ' ') {
4837  if ((*bp == '$' && !(cb_source_format == CB_FORMAT_FIXED && i == 0)) ||
4838  (*bp == '>' && bp[1] == '>' ) ) {
4839  /* Directive */
4840  ipchar = 1;
4841  } else if ((*bp == '*' && bp[1] == '>' ) ||
4842  (cb_flag_acucomment && *bp == '|') ) {
4843  /* Float comment */
4844  newline_count++;
4845  goto start;
4846  }
4847  break;
4848  }
4849  i = 1;
4850  }
4851  if (ipchar) {
4852  /* Directive - pass complete line with NL to ppparse */
4853  if (newline_count) {
4854  /* Move including NL and NULL byte */
4855  memmove (buff + newline_count, buff, (size_t)(n + 1));
4856  memset (buff, '\n', newline_count);
4857  n += newline_count;
4858  newline_count = 0;
4859  }
4860  return n;
4861  }
4862 
4863  if (plex_skip_input) {
4864  /* Skipping input */
4865  newline_count++;
4866  goto start;
4867  }
4868 
4869  /* Return when free format (no floating comments removed!) */
4871  within_comment = 0;
4872  if (newline_count) {
4873  memmove (buff + newline_count, buff, (size_t)(n + 1));
4874  memset (buff, '\n', newline_count);
4875  n += newline_count;
4876  newline_count = 0;
4877  }
4878  return n;
4879  }
4880 
4881  /* Fixed format */
4882 
4883  /* Check the indicator (column 7) */
4884  if (cb_flag_acucomment && buff[6] == '$') {
4885  buff[6] = '*';
4886  }
4887  switch (buff[6]) {
4888  case ' ':
4889  break;
4890  case '-':
4891  if (unlikely(within_comment)) {
4893  _("Invalid continuation in comment entry"));
4894  newline_count++;
4895  goto start;
4896  }
4897  continuation = 1;
4898  break;
4899  case 'd':
4900  case 'D':
4901  /* Debugging line */
4902  if (cb_flag_debugging_line) {
4903  break;
4904  }
4905  newline_count++;
4906  goto start;
4907  case '*':
4908  case '/':
4909  /* Comment line */
4910  newline_count++;
4911  goto start;
4912  default:
4913  /* Invalid indicator */
4915  _("Invalid indicator '%c' at column 7"), buff[6]);
4916  newline_count++;
4917  return YY_NULL;
4918  }
4919 
4920  /* Skip comments that follow after AUTHORS, etc. */
4921  if (unlikely(within_comment)) {
4922  /* Check all of "Area A" */
4923  for (ipchar = 7; ipchar < (n - 1) && ipchar < 11; ++ipchar) {
4924  if (buff[ipchar] != ' ') {
4925  ipchar = 0;
4926  break;
4927  }
4928  }
4929  if (ipchar) {
4930  newline_count++;
4931  goto start;
4932  }
4933  within_comment = 0;
4934  }
4935 
4936  /* Skip blank lines */
4937  for (i = 7; buff[i] == ' '; ++i) {
4938  ;
4939  }
4940 
4941  if (buff[i] == '\n') {
4942  newline_count++;
4943  goto start;
4944  }
4945 
4946  buff[6] = ' ';
4947  bp = buff + 7;
4948 
4949  if (unlikely(continuation)) {
4950  /* Line continuation */
4951  need_continuation = 0;
4952  for (; *bp == ' '; ++bp) {
4953  ;
4954  }
4955  /* Validate concatenation */
4956  if (consecutive_quotation) {
4957  if (bp[0] == quotation_mark && bp[1] == quotation_mark) {
4958  bp++;
4959  } else {
4961  _("Invalid line continuation"));
4962  return YY_NULL;
4963  }
4964  quotation_mark = 0;
4966  } else if (quotation_mark) {
4967  /* Literal concatenation */
4968  if (*bp == quotation_mark) {
4969  bp++;
4970  } else {
4972  _("Invalid line continuation"));
4973  return YY_NULL;
4974  }
4975  }
4976  } else {
4977  /* Normal line */
4978  if (need_continuation) {
4980  _("Continuation character expected"));
4981  need_continuation = 0;
4982  }
4983  quotation_mark = 0;
4985  }
4986 
4987  /* Check if string literal is to be continued */
4988  for (i = bp - buff; buff[i] != '\n'; ++i) {
4989  /* Pick up floating comment and force loop exit */
4990  if (!quotation_mark && ((buff[i] == '*' && buff[i + 1] == '>') ||
4991  (cb_flag_acucomment && buff[i] == '|') ) ) {
4992  /* remove indicator "source text too long" if the column
4993  leading to the indicator comes after the floating comment
4994  */
4995  if (i < cb_text_column) {
4996  line_overflow = 0;
4997  }
4998  /* Set to null, 'i' is predecremented further below */
4999  buff[i] = 0;
5000  break;
5001  } else if (buff[i] == '\'' || buff[i] == '"') {
5002  if (quotation_mark == 0) {
5003  /* Literal start */
5004  quotation_mark = buff[i];
5005  } else if (quotation_mark == buff[i]) {
5006  if (i == cb_text_column - 1) {
5007  /* Consecutive quotation */
5009  } else {
5010  /* Literal end */
5011  quotation_mark = 0;
5012  }
5013  }
5014  }
5015  }
5016 
5017  if (unlikely(quotation_mark)) {
5018  /* Expecting continuation */
5019  if (!consecutive_quotation) {
5020  need_continuation = 1;
5021  }
5022  for (; i < cb_text_column;) {
5023  buff[i++] = ' ';
5024  }
5025  buff[i] = 0;
5026  } else {
5027  /* Truncate trailing spaces, including the newline */
5028  for (i--; i >= 0 && buff[i] == ' '; i--) {
5029  ;
5030  }
5031  if (i < 0) {
5032  /* Empty line after removing floating comment */
5033  newline_count++;
5034  goto start;
5035  }
5036  if (buff[i] == '\'' || buff[i] == '\"') {
5037  buff[++i] = ' ';
5038  }
5039  buff[i + 1] = 0;
5040  }
5041 
5042  /* Show warning if text is longer than cb_text_column
5043  and not whitespace (postponed here) */
5044  if (line_overflow != 0) {
5046  _("Source text after column %d"),
5047  cb_text_column);
5048  }
5049 
5050  if (unlikely(continuation)) {
5051  gotcr = strlen (bp);
5052  memmove (buff, bp, gotcr + 1);
5053  newline_count++;
5054  } else {
5055  /* Insert newlines at the start of the buffer */
5056  gotcr = strlen (buff);
5057  if (newline_count != 0) {
5058  memmove (buff + newline_count, buff, gotcr + 1);
5059  memset (buff, '\n', newline_count);
5060  gotcr += newline_count;
5061  }
5062  newline_count = 1;
5063  }
5064  return (int)gotcr;
5065 }
int pplex ( void  )
int pplex_destroy ( void  )

References NULL, pp_delete_buffer(), ppfree(), pppop_buffer_state(), yy_buffer_stack, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_init_globals(), and yy_start_stack.

Referenced by plex_call_destroy().

4296 {
4297 
4298  /* Pop the buffer stack, destroying each element. */
4299  while(YY_CURRENT_BUFFER){
4303  }
4304 
4305  /* Destroy the stack itself. */
4306  ppfree((yy_buffer_stack) );
4307  (yy_buffer_stack) = NULL;
4308 
4309  /* Destroy the start condition stack. */
4310  ppfree((yy_start_stack) );
4311  (yy_start_stack) = NULL;
4312 
4313  /* Reset the globals. This is important in a non-reentrant scanner so the next time
4314  * pplex() is called, initialization will occur. */
4315  yy_init_globals( );
4316 
4317  return 0;
4318 }
int ppopen ( const char *  name,
struct cb_replace_list replacing_list 
)

References _, copy_info::buffer, cb_error(), cb_source_file, cb_source_format, cb_source_line, cobc_malloc(), cobc_strdup(), copy_stack, current_replace_list, copy_info::dname, errorcount, copy_info::file, cb_replace_list::last, copy_info::line, cb_replace_list::next, copy_info::next, p, pp_create_buffer(), ppin, copy_info::quotation_mark, quotation_mark, copy_info::replacing, replacing_list, copy_info::source_format, switch_to_buffer(), YY_BUF_SIZE, and YY_CURRENT_BUFFER.

Referenced by ppcopy(), and preprocess().

4402 {
4403  struct copy_info *p;
4404  char *s;
4405  char *dname;
4406 
4407 #ifdef _WIN32
4408  unsigned char bom[4];
4409 #endif
4410 
4411  if (ppin) {
4412  for (; newline_count > 0; newline_count--) {
4413  ungetc ('\n', ppin);
4414  }
4415  }
4416 
4417  /* Open copy/source file */
4418 #ifdef __OS400__
4419  ppin = fopen (name, "r");
4420 #else
4421  ppin = fopen (name, "rb");
4422 #endif
4423  if (!ppin) {
4424  if (cb_source_file) {
4425  cb_error ("%s: %s", name,
4426  _("No such file or directory"));
4427  } else {
4428  fflush (stderr);
4429  fprintf (stderr, "%s: %s", name,
4430  _("No such file or directory"));
4431  fflush (stderr);
4432  errorcount++;
4433  }
4434  return -1;
4435  }
4436 #ifdef _WIN32
4437  /* Check for BOM */
4438  if (fread (bom, 3, 1, ppin) == 1) {
4439  if (bom[0] != 0xEF || bom[1] != 0xBB || bom[2] != 0xBF) {
4440  rewind (ppin);
4441  }
4442  } else {
4443  rewind (ppin);
4444  }
4445 #endif
4446 
4447  /* Preserve the current buffer */
4448  p = cobc_malloc (sizeof (struct copy_info));
4449  p->file = cb_source_file;
4451 
4452  /* Save variables */
4454  p->line = cb_source_line;
4457 
4458  p->next = copy_stack;
4459  copy_stack = p;
4460 
4461  /* Set replacing list */
4462  if (replacing_list) {
4463  if (current_replace_list) {
4464  replacing_list->last->next = current_replace_list;
4465  replacing_list->last = current_replace_list->last;
4466  }
4468  }
4469 
4470  dname = cobc_strdup (name);
4471  p->dname = dname;
4472  for (s = dname; *s; ++s) {
4473  if (*s == '\\') {
4474  *s = '/';
4475  }
4476  }
4477 
4478  /* Switch to new buffer */
4480  return 0;
4481 }
void ppparse_error ( const char *  msg)

References cb_plex_error().

4527 {
4529 }
void pppop_buffer_state ( void  )

Removes and deletes the top of the stack, if present.

The next element becomes the new top.

References NULL, pp_delete_buffer(), pp_load_buffer_state(), yy_buffer_stack_top, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, and yy_did_buffer_switch_on_eof.

Referenced by pplex_destroy().

4136 {
4137  if (!YY_CURRENT_BUFFER)
4138  return;
4139 
4142  if ((yy_buffer_stack_top) > 0)
4143  --(yy_buffer_stack_top);
4144 
4145  if (YY_CURRENT_BUFFER) {
4148  }
4149 }
void pppush_buffer_state ( YY_BUFFER_STATE  new_buffer)

Pushes the new state onto the stack.

The new state becomes the current state. This function will allocate the stack if necessary.

Parameters
new_bufferThe new state.

References NULL, pp_load_buffer_state(), ppensure_buffer_stack(), yy_buffer_stack_top, yy_c_buf_p, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, yy_hold_char, and yy_n_chars.

4106 {
4107  if (new_buffer == NULL)
4108  return;
4109 
4111 
4112  /* This block is copied from pp_switch_to_buffer. */
4113  if ( YY_CURRENT_BUFFER )
4114  {
4115  /* Flush out information for old buffer. */
4116  *(yy_c_buf_p) = (yy_hold_char);
4117  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
4118  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
4119  }
4120 
4121  /* Only push if top exists. Otherwise, replace top. */
4122  if (YY_CURRENT_BUFFER)
4123  (yy_buffer_stack_top)++;
4124  YY_CURRENT_BUFFER_LVALUE = new_buffer;
4125 
4126  /* copied from pp_switch_to_buffer. */
4129 }
void * pprealloc ( void *  ptr,
yy_size_t  size 
)

Referenced by ppensure_buffer_stack(), yy_get_next_buffer(), and yy_push_state().

4350 {
4351  /* The cast to (char *) in the following accommodates both
4352  * implementations that use char* generic pointers, and those
4353  * that use void* generic pointers. It works with the latter
4354  * because both ANSI C and C++ allow castless assignment from
4355  * any pointer type to void*, and deal with argument conversions
4356  * as though doing an assignment.
4357  */
4358  return (void *) realloc( (char *) ptr, size );
4359 }
void pprestart ( FILE *  input_file)

Immediately switch to a different input stream.

Parameters
input_fileA readable stream.
Note
This function does not reset the start condition to INITIAL .

References pp_create_buffer(), pp_init_buffer(), pp_load_buffer_state(), ppensure_buffer_stack(), ppin, YY_BUF_SIZE, YY_CURRENT_BUFFER, and YY_CURRENT_BUFFER_LVALUE.

Referenced by input(), and yy_get_next_buffer().

3940 {
3941 
3942  if ( ! YY_CURRENT_BUFFER ){
3946  }
3947 
3948  pp_init_buffer(YY_CURRENT_BUFFER,input_file );
3950 }
static void skip_to_eol ( void  )
static

References input(), and unput.

Referenced by check_comments(), and while().

5238 {
5239  int c;
5240 
5241  /* Skip bytes to end of line */
5242  while ((c = input ()) != EOF) {
5243  if (c == '\n') {
5244  break;
5245  }
5246  }
5247  if (c != EOF) {
5248  unput (c);
5249  }
5250 }
static void switch_to_buffer ( const int  line,
const char *  file,
const YY_BUFFER_STATE  buffer 
)
static

References cb_source_file, cb_source_line, cobc_plex_strdup(), line, pp_switch_to_buffer(), and ppout.

Referenced by ppopen(), and while().

4651 {
4652  /* Reset file/line */
4653  cb_source_line = line;
4655  fprintf (ppout, "#line %d \"%s\"\n", line, file);
4656  /* Switch buffer */
4657  pp_switch_to_buffer (buffer);
4658 }
while ( )

References _, ALSO, AS, BEGIN, copy_info::buffer, BY, cb_error(), CB_FORMAT_FREE, cb_plex_warning(), cb_source_format, cb_source_line, cb_verify(), check_comments(), check_listing(), CHECKING, cobc_free(), cobc_plex_strdup(), CONSTANT, COPY, copy_stack, COPY_STATE, DEFINE_DIRECTIVE, DEFINE_DIRECTIVE_STATE, DEFINED, display_to_eol(), copy_info::dname, DOT, ECHO, ELIF_DIRECTIVE, ELSE_DIRECTIVE, ELSE_DIRECTIVE_STATE, ENDIF_DIRECTIVE, ENDIF_DIRECTIVE_STATE, EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, EQ, EQEQ, EQUAL, copy_info::file, FIXED, FOLDCOPYNAME, FORMAT, FREE, GE, GREATER, GT, IF_DIRECTIVE, IF_DIRECTIVE_STATE, IN, INITIAL, IS, LAST, LE, LEADING, LESS, copy_info::line, plex_stack::line, LITERAL, LOCATION, LT, NE, copy_info::next, NOFOLDCOPYNAME, NOT, NULL, OF, OFF, ON, OR, OVERRIDE, p, PARAMETER, plex_cond_stack, plex_nest_depth, pp_delete_buffer(), ppecho(), ppin, ppleng, pplval, ppwrap, PRINTING, PSEUDO_STATE, copy_info::quotation_mark, REPLACE, REPLACING, copy_info::replacing, YYSTYPE::s, SET, SET_DIRECTIVE, SET_DIRECTIVE_STATE, skip_to_eol(), SOURCE_DIRECTIVE, SOURCE_DIRECTIVE_STATE, copy_info::source_format, SOURCEFORMAT, SUPPRESS, switch_to_buffer(), TERMINATOR, THAN, TO, TOKEN, TRAILING, TURN_DIRECTIVE, TURN_DIRECTIVE_STATE, unput, VARIABLE, warningopt, WITH, YY_AT_BOL, YY_BREAK, YY_BUFFER_NEW, YY_BUFFER_NORMAL, yy_c_buf_p, yy_cp, YY_CURRENT_BUFFER, YY_CURRENT_BUFFER_LVALUE, yy_did_buffer_switch_on_eof, YY_DO_BEFORE_ACTION, YY_END_OF_BUFFER, YY_FATAL_ERROR, yy_get_next_buffer(), yy_get_previous_state(), yy_hold_char, yy_last_accepting_cpos, yy_last_accepting_state, YY_MORE_ADJ, yy_n_chars, YY_NEW_FILE, yy_pop_state(), yy_push_state(), YY_RESTORE_YY_MORE_OFFSET, YY_RULE_SETUP, YY_SC_TO_UI, YY_START, yy_start, YY_STATE_EOF, yy_try_NUL_trans(), yyterminate, and yytext_ptr.

2376  {
2377  yy_cp = (yy_c_buf_p);
2378 
2379  /* Support of pptext. */
2380  *yy_cp = (yy_hold_char);
2381 
2382  /* yy_bp points to the position in yy_ch_buf of the start of
2383  * the current run.
2384  */
2385  yy_bp = yy_cp;
2386 
2387  yy_current_state = (yy_start);
2388  yy_current_state += YY_AT_BOL();
2389 yy_match:
2390  do
2391  {
2392  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
2393  if ( yy_accept[yy_current_state] )
2394  {
2395  (yy_last_accepting_state) = yy_current_state;
2397  }
2398  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2399  {
2400  yy_current_state = (int) yy_def[yy_current_state];
2401  if ( yy_current_state >= 1082 )
2402  yy_c = yy_meta[(unsigned int) yy_c];
2403  }
2404  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2405  ++yy_cp;
2406  }
2407  while ( yy_current_state != 1081 );
2409  yy_current_state = (yy_last_accepting_state);
2410 
2411 yy_find_action:
2412  yy_act = yy_accept[yy_current_state];
2413 
2415 
2416 do_action: /* This label is used only to access EOF actions. */
2417 
2418  switch ( yy_act )
2419  { /* beginning of action switch */
2420  case 0: /* must back up */
2421  /* undo the effects of YY_DO_BEFORE_ACTION */
2422  *yy_cp = (yy_hold_char);
2424  yy_current_state = (yy_last_accepting_state);
2425  goto yy_find_action;
2426 
2427 case 1:
2429 #line 177 "pplex.l"
2430 {
2431  #if 0 /* RXWRXW - Directive state */
2432  if (YY_START != DIRECTIVE_STATE && YY_START != SET_DIRECTIVE_STATE) {
2433  ppecho (" ", 0, 1);
2434  }
2435  #endif
2436 }
2437  YY_BREAK
2438 case 2:
2440 #line 185 "pplex.l"
2441 {
2442  /* Define here to preempt next debug rule below */
2444  return DEFINE_DIRECTIVE;
2445 }
2446  YY_BREAK
2447 case 3:
2449 #line 191 "pplex.l"
2450 {
2451  /* Define here to preempt next debug rule below */
2452  display_to_eol ();
2453 }
2454  YY_BREAK
2455 case 4:
2457 #line 196 "pplex.l"
2458 {
2459  /* OC extension for floating debug line */
2460  /* Remove line if debugging lines not activated */
2461  /* Otherwise ignore the directive part of the line */
2462  if (!cb_flag_debugging_line) {
2463  skip_to_eol ();
2464  }
2465 }
2466  YY_BREAK
2467 case 5:
2469 #line 205 "pplex.l"
2470 {
2472  return SOURCE_DIRECTIVE;
2473 }
2474  YY_BREAK
2475 case 6:
2477 #line 210 "pplex.l"
2478 {
2479  /* OC extension */
2481  return SET_DIRECTIVE;
2482 }
2483  YY_BREAK
2484 case 7:
2486 #line 216 "pplex.l"
2487 {
2489  return TURN_DIRECTIVE;
2490 }
2491  YY_BREAK
2492 case 8:
2494 #line 221 "pplex.l"
2495 {
2497  return IF_DIRECTIVE;
2498 }
2499  YY_BREAK
2500 case 9:
2501 #line 227 "pplex.l"
2502 case 10:
2504 #line 227 "pplex.l"
2505 {
2507  return ELIF_DIRECTIVE;
2508 }
2509  YY_BREAK
2510 case 11:
2512 #line 232 "pplex.l"
2513 {
2515  return ELSE_DIRECTIVE;
2516 }
2517  YY_BREAK
2518 case 12:
2520 #line 237 "pplex.l"
2521 {
2523  return ENDIF_DIRECTIVE;
2524 }
2525  YY_BREAK
2526 case 13:
2528 #line 242 "pplex.l"
2529 {
2530  if (warningopt) {
2531  cb_plex_warning (newline_count, _("Ignoring LEAP-SECOND directive"));
2532  }
2533  skip_to_eol ();
2534 }
2535  YY_BREAK
2536 case 14:
2537 /* rule 14 can match eol */
2539 #line 249 "pplex.l"
2540 {
2541  cb_plex_warning (newline_count, _("Ignoring empty directive"));
2542  unput ('\n');
2543 }
2544  YY_BREAK
2545 case 15:
2547 #line 254 "pplex.l"
2548 {
2549  char *s;
2550 
2551  s = strchr (pptext, '>');
2552  cb_plex_warning (newline_count, _("Ignoring invalid directive - '%s'"), s);
2553  skip_to_eol ();
2554 }
2555  YY_BREAK
2556 case 16:
2558 #line 262 "pplex.l"
2559 {
2560  cb_plex_warning (newline_count, _("Ignoring invalid directive"));
2561  skip_to_eol ();
2562 }
2563  YY_BREAK
2564 case 17:
2566 #line 267 "pplex.l"
2567 {
2568  display_to_eol ();
2569 }
2570  YY_BREAK
2571 case 18:
2573 #line 271 "pplex.l"
2574 {
2576  return SET_DIRECTIVE;
2577 }
2578  YY_BREAK
2579 case 19:
2581 #line 276 "pplex.l"
2582 {
2584  return IF_DIRECTIVE;
2585 }
2586  YY_BREAK
2587 case 20:
2588 #line 282 "pplex.l"
2589 case 21:
2591 #line 282 "pplex.l"
2592 {
2594  return ELIF_DIRECTIVE;
2595 }
2596  YY_BREAK
2597 case 22:
2599 #line 287 "pplex.l"
2600 {
2602  return ELSE_DIRECTIVE;
2603 }
2604  YY_BREAK
2605 case 23:
2607 #line 292 "pplex.l"
2608 {
2610  return ENDIF_DIRECTIVE;
2611 }
2612  YY_BREAK
2613 case 24:
2615 #line 297 "pplex.l"
2616 {
2617  char *s;
2618 
2619  s = strchr (pptext, '$');
2620  cb_plex_warning (newline_count, _("Ignoring invalid directive - '%s'"), s);
2621  skip_to_eol ();
2622 }
2623  YY_BREAK
2624 case 25:
2626 #line 305 "pplex.l"
2627 {
2628  /* Allow $ in column 7 for acucomment in fixed format */
2630  cb_plex_warning (newline_count, _("Spurious '$' detected - ignoring"));
2631  skip_to_eol ();
2632  }
2633 }
2634  YY_BREAK
2635 case 26:
2637 #line 313 "pplex.l"
2638 {
2639  cb_plex_warning (newline_count, _("Spurious '$' detected - ignoring"));
2640  skip_to_eol ();
2641 }
2642  YY_BREAK
2643 case 27:
2645 #line 318 "pplex.l"
2646 {
2647  cb_plex_warning (newline_count, _("PROCESS statement ignored"));
2648  skip_to_eol ();
2649 }
2650  YY_BREAK
2651 case 28:
2653 #line 323 "pplex.l"
2654 {
2656  return COPY;
2657 }
2658  YY_BREAK
2659 case 29:
2661 #line 328 "pplex.l"
2662 {
2664  return COPY;
2665 }
2666  YY_BREAK
2667 case 30:
2669 #line 333 "pplex.l"
2670 {
2672  return REPLACE;
2673 }
2674  YY_BREAK
2675 case 31:
2676 #line 339 "pplex.l"
2677 case 32:
2679 #line 339 "pplex.l"
2680 {
2681  /* Allow comment sentences/paragraphs */
2682  comment_allowed = 1;
2683  ppecho (pptext, 0, ppleng);
2684 }
2685  YY_BREAK
2686 case 33:
2688 #line 345 "pplex.l"
2689 {
2690  /* Allow comment sentences/paragraphs */
2691  comment_allowed = 1;
2692  ppecho (pptext, 0, ppleng);
2693 }
2694  YY_BREAK
2695 case 34:
2697 #line 351 "pplex.l"
2698 {
2699  /* Disallow comment sentences/paragraphs */
2700  comment_allowed = 0;
2701  ppecho (pptext, 0, ppleng);
2702 }
2703  YY_BREAK
2704 case 35:
2706 #line 357 "pplex.l"
2707 {
2708  /* Disallow comment sentences/paragraphs */
2709  comment_allowed = 0;
2710  ppecho (pptext, 0, ppleng);
2711 }
2712  YY_BREAK
2713 case 36:
2715 #line 363 "pplex.l"
2716 { check_comments ("AUTHOR", pptext); }
2717  YY_BREAK
2718 case 37:
2720 #line 364 "pplex.l"
2721 { check_comments ("DATE-WRITTEN", pptext); }
2722  YY_BREAK
2723 case 38:
2725 #line 365 "pplex.l"
2726 { check_comments ("DATE-MODIFIED", pptext); }
2727  YY_BREAK
2728 case 39:
2730 #line 366 "pplex.l"
2731 { check_comments ("DATE-COMPILED", pptext); }
2732  YY_BREAK
2733 case 40:
2735 #line 367 "pplex.l"
2736 { check_comments ("INSTALLATION", pptext); }
2737  YY_BREAK
2738 case 41:
2740 #line 368 "pplex.l"
2741 { check_comments ("REMARKS", pptext); }
2742  YY_BREAK
2743 case 42:
2745 #line 369 "pplex.l"
2746 { check_comments ("SECURITY", pptext); }
2747  YY_BREAK
2748 case 43:
2749 #line 372 "pplex.l"
2750 case 44:
2751 #line 373 "pplex.l"
2752 case 45:
2753 #line 374 "pplex.l"
2754 case 46:
2756 #line 374 "pplex.l"
2757 {
2758  /* These words are comments in various COBOL dialects */
2759  if (cb_verify (cb_eject_statement, pptext)) {
2760  /* Ignore */
2761  } else {
2762  ECHO;
2763  check_listing (pptext, 0);
2764  }
2765 }
2766  YY_BREAK
2767 case 47:
2768 #line 385 "pplex.l"
2769 case 48:
2771 #line 385 "pplex.l"
2772 {
2773  /* Pick up early - Also activates debugging lines */
2774  cb_flag_debugging_line = 1;
2775  ppecho (pptext, 0, ppleng);
2776 }
2777  YY_BREAK
2778 case 49:
2779 /* rule 49 can match eol */
2781 #line 391 "pplex.l"
2782 {
2783  ppecho ("\n", 0, 1);
2784  cb_source_line++;
2785 }
2786  YY_BREAK
2787 case 50:
2789 #line 396 "pplex.l"
2790 {
2791  ppecho (" ", 1U, 1);
2792 }
2793  YY_BREAK
2794 case 51:
2796 #line 400 "pplex.l"
2797 {
2798  if (inside_bracket) {
2799  ppecho (", ", 0, 2);
2800  } else {
2801  ppecho (" ", 1U, 1);
2802  }
2803 }
2804  YY_BREAK
2805 case 52:
2807 #line 408 "pplex.l"
2808 {
2809  inside_bracket++;
2810  ppecho ("(", 0, 1);
2811 }
2812  YY_BREAK
2813 case 53:
2815 #line 413 "pplex.l"
2816 {
2817  if (inside_bracket) {
2818  inside_bracket--;
2819  }
2820  ppecho (")", 0, 1);
2821 }
2822  YY_BREAK
2823 case 54:
2824 #line 421 "pplex.l"
2825 case 55:
2826 #line 422 "pplex.l"
2827 case 56:
2828 #line 423 "pplex.l"
2829 case 57:
2831 #line 423 "pplex.l"
2832 {
2833  ppecho (pptext, 0, ppleng);
2834 }
2835  YY_BREAK
2836 
2837 case 58:
2838 /* rule 58 can match eol */
2840 #line 428 "pplex.l"
2841 {
2842  BEGIN INITIAL;
2843  unput ('\n');
2844  return TERMINATOR;
2845  }
2846  YY_BREAK
2847 case 59:
2849 #line 433 "pplex.l"
2850 { return FORMAT; }
2851  YY_BREAK
2852 case 60:
2854 #line 434 "pplex.l"
2855 { return IS; }
2856  YY_BREAK
2857 case 61:
2859 #line 435 "pplex.l"
2860 { return FIXED; }
2861  YY_BREAK
2862 case 62:
2864 #line 436 "pplex.l"
2865 { return FREE; }
2866  YY_BREAK
2867 case 63:
2869 #line 437 "pplex.l"
2870 { /* ignore */ }
2871  YY_BREAK
2872 case 64:
2874 #line 438 "pplex.l"
2875 { }
2876  YY_BREAK
2877 
2878 
2879 case 65:
2880 /* rule 65 can match eol */
2882 #line 442 "pplex.l"
2883 {
2884  BEGIN INITIAL;
2885  unput ('\n');
2886  return TERMINATOR;
2887  }
2888  YY_BREAK
2889 case 66:
2891 #line 447 "pplex.l"
2892 {
2893  return CONSTANT;
2894  }
2895  YY_BREAK
2896 case 67:
2898 #line 450 "pplex.l"
2899 {
2900  return AS;
2901  }
2902  YY_BREAK
2903 case 68:
2905 #line 453 "pplex.l"
2906 {
2907  return OFF;
2908  }
2909  YY_BREAK
2910 case 69:
2912 #line 456 "pplex.l"
2913 {
2914  return OVERRIDE;
2915  }
2916  YY_BREAK
2917 case 70:
2919 #line 459 "pplex.l"
2920 {
2921  return PARAMETER;
2922  }
2923  YY_BREAK
2924 case 71:
2925 #line 463 "pplex.l"
2926 case 72:
2928 #line 463 "pplex.l"
2929 {
2931  return LITERAL;
2932  }
2933  YY_BREAK
2934 case 73:
2936 #line 467 "pplex.l"
2937 {
2939  return VARIABLE;
2940  }
2941  YY_BREAK
2942 case 74:
2944 #line 471 "pplex.l"
2945 { /* ignore */ }
2946  YY_BREAK
2947 case 75:
2949 #line 472 "pplex.l"
2950 { }
2951  YY_BREAK
2952 
2953 
2954 case 76:
2955 /* rule 76 can match eol */
2957 #line 476 "pplex.l"
2958 {
2959  BEGIN INITIAL;
2960  unput ('\n');
2961  return TERMINATOR;
2962  }
2963  YY_BREAK
2964 case 77:
2966 #line 481 "pplex.l"
2967 {
2968  return CONSTANT;
2969  }
2970  YY_BREAK
2971 case 78:
2973 #line 484 "pplex.l"
2974 {
2975  return SOURCEFORMAT;
2976  }
2977  YY_BREAK
2978 case 79:
2979 #line 488 "pplex.l"
2980 case 80:
2982 #line 488 "pplex.l"
2983 {
2984  return FOLDCOPYNAME;
2985  }
2986  YY_BREAK
2987 case 81:
2988 #line 492 "pplex.l"
2989 case 82:
2991 #line 492 "pplex.l"
2992 {
2993  return NOFOLDCOPYNAME;
2994  }
2995  YY_BREAK
2996 case 83:
2998 #line 495 "pplex.l"
2999 {
3000  return AS;
3001  }
3002  YY_BREAK
3003 case 84:
3004 #line 499 "pplex.l"
3005 case 85:
3007 #line 499 "pplex.l"
3008 {
3010  return LITERAL;
3011  }
3012  YY_BREAK
3013 case 86:
3015 #line 503 "pplex.l"
3016 {
3017  pptext[strlen (pptext) - 1] = 0;
3018  pplval.s = cobc_plex_strdup (pptext + 1);
3019  return LITERAL;
3020  }
3021  YY_BREAK
3022 case 87:
3024 #line 508 "pplex.l"
3025 {
3027  return VARIABLE;
3028  }
3029  YY_BREAK
3030 case 88:
3032 #line 512 "pplex.l"
3033 { /* ignore */ }
3034  YY_BREAK
3035 case 89:
3037 #line 513 "pplex.l"
3038 { }
3039  YY_BREAK
3040 
3041 
3042 case 90:
3043 /* rule 90 can match eol */
3045 #line 517 "pplex.l"
3046 {
3047  BEGIN INITIAL;
3048  unput ('\n');
3049  return TERMINATOR;
3050  }
3051  YY_BREAK
3052 case 91:
3054 #line 522 "pplex.l"
3055 {
3056  return ON;
3057  }
3058  YY_BREAK
3059 case 92:
3061 #line 525 "pplex.l"
3062 {
3063  return OFF;
3064  }
3065  YY_BREAK
3066 case 93:
3068 #line 528 "pplex.l"
3069 {
3070  return WITH;
3071  }
3072  YY_BREAK
3073 case 94:
3075 #line 531 "pplex.l"
3076 {
3077  return LOCATION;
3078  }
3079  YY_BREAK
3080 case 95:
3082 #line 534 "pplex.l"
3083 {
3084  return CHECKING;
3085  }
3086  YY_BREAK
3087 case 96:
3088 #line 538 "pplex.l"
3089 case 97:
3091 #line 538 "pplex.l"
3092 {
3094  return LITERAL;
3095  }
3096  YY_BREAK
3097 case 98:
3099 #line 542 "pplex.l"
3100 {
3101  pptext[strlen (pptext) - 1] = 0;
3102  pplval.s = cobc_plex_strdup (pptext + 1);
3103  return LITERAL;
3104  }
3105  YY_BREAK
3106 case 99:
3108 #line 547 "pplex.l"
3109 {
3111  return VARIABLE;
3112  }
3113  YY_BREAK
3114 case 100:
3116 #line 551 "pplex.l"
3117 { /* ignore */ }
3118  YY_BREAK
3119 case 101:
3121 #line 552 "pplex.l"
3122 { }
3123  YY_BREAK
3124 
3125 
3126 case 102:
3127 /* rule 102 can match eol */
3129 #line 556 "pplex.l"
3130 {
3131  BEGIN INITIAL;
3132  unput ('\n');
3133  return TERMINATOR;
3134  }
3135  YY_BREAK
3136 case 103:
3138 #line 561 "pplex.l"
3139 { /* ignore */ }
3140  YY_BREAK
3141 case 104:
3143 #line 562 "pplex.l"
3144 { return IS; }
3145  YY_BREAK
3146 case 105:
3148 #line 563 "pplex.l"
3149 { return NOT; }
3150  YY_BREAK
3151 case 106:
3153 #line 564 "pplex.l"
3154 { return EQUAL; }
3155  YY_BREAK
3156 case 107:
3158 #line 565 "pplex.l"
3159 { return TO; }
3160  YY_BREAK
3161 case 108:
3163 #line 566 "pplex.l"
3164 { return OR; }
3165  YY_BREAK
3166 case 109:
3168 #line 567 "pplex.l"
3169 { return GREATER; }
3170  YY_BREAK
3171 case 110:
3173 #line 568 "pplex.l"
3174 { return LESS; }
3175  YY_BREAK
3176 case 111:
3178 #line 569 "pplex.l"
3179 { return THAN; }
3180  YY_BREAK
3181 case 112:
3183 #line 570 "pplex.l"
3184 { return DEFINED; }
3185  YY_BREAK
3186 case 113:
3188 #line 571 "pplex.l"
3189 { return SET; }
3190  YY_BREAK
3191 case 114:
3193 #line 572 "pplex.l"
3194 { return GE; }
3195  YY_BREAK
3196 case 115:
3198 #line 573 "pplex.l"
3199 { return GT; }
3200  YY_BREAK
3201 case 116:
3203 #line 574 "pplex.l"
3204 { return LE; }
3205  YY_BREAK
3206 case 117:
3208 #line 575 "pplex.l"
3209 { return NE; }
3210  YY_BREAK
3211 case 118:
3213 #line 576 "pplex.l"
3214 { return LT; }
3215  YY_BREAK
3216 case 119:
3218 #line 577 "pplex.l"
3219 { return EQ; }
3220  YY_BREAK
3221 case 120:
3222 #line 579 "pplex.l"
3223 case 121:
3225 #line 579 "pplex.l"
3226 {
3228  return LITERAL;
3229  }
3230  YY_BREAK
3231 case 122:
3233 #line 583 "pplex.l"
3234 {
3236  return VARIABLE;
3237  }
3238  YY_BREAK
3239 case 123:
3241 #line 587 "pplex.l"
3242 { }
3243  YY_BREAK
3244 
3245 
3246 case 124:
3247 /* rule 124 can match eol */
3249 #line 591 "pplex.l"
3250 {
3251  BEGIN INITIAL;
3252  unput ('\n');
3253  return TERMINATOR;
3254  }
3255  YY_BREAK
3256 case 125:
3258 #line 596 "pplex.l"
3259 { /* ignore */ }
3260  YY_BREAK
3261 
3262 
3263 case 126:
3264 /* rule 126 can match eol */
3266 #line 600 "pplex.l"
3267 {
3268  BEGIN INITIAL;
3269  unput ('\n');
3270  return TERMINATOR;
3271  }
3272  YY_BREAK
3273 case 127:
3275 #line 605 "pplex.l"
3276 { /* ignore */ }
3277  YY_BREAK
3278 
3279 
3280 case 128:
3281 /* rule 128 can match eol */
3283 #line 609 "pplex.l"
3284 {
3285  ECHO;
3286  check_listing (pptext, 0);
3287  cb_source_line++;
3288  }
3289  YY_BREAK
3290 case 129:
3292 #line 614 "pplex.l"
3293 { /* ignore */ }
3294  YY_BREAK
3295 case 130:
3297 #line 615 "pplex.l"
3298 { yy_pop_state (); return DOT; }
3299  YY_BREAK
3300 case 131:
3302 #line 616 "pplex.l"
3303 { yy_push_state (PSEUDO_STATE); return EQEQ; }
3304  YY_BREAK
3305 case 132:
3307 #line 617 "pplex.l"
3308 { return '('; }
3309  YY_BREAK
3310 case 133:
3312 #line 618 "pplex.l"
3313 { return ')'; }
3314  YY_BREAK
3315 case 134:
3317 #line 619 "pplex.l"
3318 { return BY; }
3319  YY_BREAK
3320 case 135:
3322 #line 620 "pplex.l"
3323 { return IN; }
3324  YY_BREAK
3325 case 136:
3327 #line 621 "pplex.l"
3328 { return OF; }
3329  YY_BREAK
3330 case 137:
3332 #line 622 "pplex.l"
3333 { return OFF; }
3334  YY_BREAK
3335 case 138:
3337 #line 623 "pplex.l"
3338 { return SUPPRESS; }
3339  YY_BREAK
3340 case 139:
3342 #line 624 "pplex.l"
3343 { return PRINTING; }
3344  YY_BREAK
3345 case 140:
3347 #line 625 "pplex.l"
3348 { return REPLACING; }
3349  YY_BREAK
3350 case 141:
3352 #line 626 "pplex.l"
3353 { return LEADING; }
3354  YY_BREAK
3355 case 142:
3357 #line 627 "pplex.l"
3358 { return TRAILING; }
3359  YY_BREAK
3360 case 143:
3362 #line 628 "pplex.l"
3363 { return ALSO; }
3364  YY_BREAK
3365 case 144:
3367 #line 629 "pplex.l"
3368 { return LAST; }
3369  YY_BREAK
3370 case 145:
3371 #line 631 "pplex.l"
3372 case 146:
3373 #line 632 "pplex.l"
3374 case 147:
3375 #line 633 "pplex.l"
3376 case 148:
3378 #line 633 "pplex.l"
3379 { pplval.s = cobc_plex_strdup (pptext); return TOKEN; }
3380  YY_BREAK
3381 
3382 
3383 case 149:
3384 /* rule 149 can match eol */
3386 #line 637 "pplex.l"
3387 {
3388  ECHO;
3389  check_listing (pptext, 0);
3390  cb_source_line++;
3391  }
3392  YY_BREAK
3393 case 150:
3395 #line 643 "pplex.l"
3396 {
3397  pplval.s = cobc_plex_strdup (" ");
3398  return TOKEN;
3399  }
3400  YY_BREAK
3401 case 151:
3403 #line 648 "pplex.l"
3404 {
3405  yy_pop_state ();
3406  return EQEQ;
3407  }
3408  YY_BREAK
3409 case 152:
3410 #line 654 "pplex.l"
3411 case 153:
3412 #line 655 "pplex.l"
3413 case 154:
3414 #line 656 "pplex.l"
3415 case 155:
3417 #line 656 "pplex.l"
3418 {
3420  return TOKEN;
3421  }
3422  YY_BREAK
3423 
3424 case YY_STATE_EOF(INITIAL):
3425 case YY_STATE_EOF(COPY_STATE):
3426 case YY_STATE_EOF(PSEUDO_STATE):
3427 case YY_STATE_EOF(SOURCE_DIRECTIVE_STATE):
3428 case YY_STATE_EOF(DEFINE_DIRECTIVE_STATE):
3429 case YY_STATE_EOF(SET_DIRECTIVE_STATE):
3430 case YY_STATE_EOF(TURN_DIRECTIVE_STATE):
3431 case YY_STATE_EOF(IF_DIRECTIVE_STATE):
3432 case YY_STATE_EOF(ELSE_DIRECTIVE_STATE):
3433 case YY_STATE_EOF(ENDIF_DIRECTIVE_STATE):
3434 #line 663 "pplex.l"
3435 {
3436  struct copy_info *p;
3437 
3438  p = copy_stack;
3439 
3441 
3442  /* Terminate at the end of all input */
3443  if (p->next == NULL) {
3444  /* Check dangling IF/ELSE */
3445  for (; plex_nest_depth > 0; --plex_nest_depth) {
3447  cb_error (_("Dangling IF/ELSE directive"));
3448  }
3449  plex_nest_depth = 0;
3450  cobc_free (p->dname);
3451  cobc_free (p);
3452  listing_line = 0;
3454  requires_new_line = 0;
3455  need_continuation = 0;
3456  buffer_overflow = 0;
3457  within_comment = 0;
3458  newline_count = 0;
3459  inside_bracket = 0;
3460  comment_allowed = 1;
3464  text_queue = NULL;
3465  copy_stack = NULL;
3466  quotation_mark = 0;
3468  yyterminate ();
3469  }
3470 
3471  /* Close the current file */
3472  fclose (ppin);
3473 
3474  /* Switch to previous buffer */
3475  switch_to_buffer (p->line, p->file, p->buffer);
3476 
3477  /* Restore variables */
3481 
3482  copy_stack = p->next;
3483  cobc_free (p->dname);
3484  cobc_free (p);
3485 }
3486  YY_BREAK
3487 case 156:
3489 #line 715 "pplex.l"
3490 YY_FATAL_ERROR( "flex scanner jammed" );
3491  YY_BREAK
3492 #line 3493 "pplex.c"
3493 
3494  case YY_END_OF_BUFFER:
3495  {
3496  /* Amount of text matched not including the EOB char. */
3497  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
3498 
3499  /* Undo the effects of YY_DO_BEFORE_ACTION. */
3500  *yy_cp = (yy_hold_char);
3502 
3503  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
3504  {
3505  /* We're scanning a new file or input source. It's
3506  * possible that this happened because the user
3507  * just pointed ppin at a new source and called
3508  * pplex(). If so, then we have to assure
3509  * consistency between YY_CURRENT_BUFFER and our
3510  * globals. Here is the right place to do so, because
3511  * this is the first action (other than possibly a
3512  * back-up) that will match for the new input source.
3513  */
3514  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3515  YY_CURRENT_BUFFER_LVALUE->yy_input_file = ppin;
3516  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
3517  }
3518 
3519  /* Note that here we test for yy_c_buf_p "<=" to the position
3520  * of the first EOB in the buffer, since yy_c_buf_p will
3521  * already have been incremented past the NUL character
3522  * (since all states make transitions on EOB to the
3523  * end-of-buffer state). Contrast this with the test
3524  * in input().
3525  */
3526  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3527  { /* This was really a NUL. */
3528  yy_state_type yy_next_state;
3529 
3530  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
3531 
3532  yy_current_state = yy_get_previous_state( );
3533 
3534  /* Okay, we're now positioned to make the NUL
3535  * transition. We couldn't have
3536  * yy_get_previous_state() go ahead and do it
3537  * for us because it doesn't know how to deal
3538  * with the possibility of jamming (and we don't
3539  * want to build jamming into it because then it
3540  * will run more slowly).
3541  */
3542 
3543  yy_next_state = yy_try_NUL_trans( yy_current_state );
3544 
3546 
3547  if ( yy_next_state )
3548  {
3549  /* Consume the NUL. */
3550  yy_cp = ++(yy_c_buf_p);
3551  yy_current_state = yy_next_state;
3552  goto yy_match;
3553  }
3554 
3555  else
3556  {
3558  yy_current_state = (yy_last_accepting_state);
3559  goto yy_find_action;
3560  }
3561  }
3562 
3563  else switch ( yy_get_next_buffer( ) )
3564  {
3565  case EOB_ACT_END_OF_FILE:
3566  {
3568 
3569  if ( ppwrap( ) )
3570  {
3571  /* Note: because we've taken care in
3572  * yy_get_next_buffer() to have set up
3573  * pptext, we can now set up
3574  * yy_c_buf_p so that if some total
3575  * hoser (like flex itself) wants to
3576  * call the scanner after we return the
3577  * YY_NULL, it'll still work - another
3578  * YY_NULL will get returned.
3579  */
3581 
3583  goto do_action;
3584  }
3585 
3586  else
3587  {
3588  if ( ! (yy_did_buffer_switch_on_eof) )
3589  YY_NEW_FILE;
3590  }
3591  break;
3592  }
3593 
3594  case EOB_ACT_CONTINUE_SCAN:
3595  (yy_c_buf_p) =
3596  (yytext_ptr) + yy_amount_of_matched_text;
3597 
3598  yy_current_state = yy_get_previous_state( );
3599 
3600  yy_cp = (yy_c_buf_p);
3602  goto yy_match;
3603 
3604  case EOB_ACT_LAST_MATCH:
3605  (yy_c_buf_p) =
3606  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3607 
3608  yy_current_state = yy_get_previous_state( );
3609 
3610  yy_cp = (yy_c_buf_p);
3612  goto yy_find_action;
3613  }
3614  break;
3615  }
3616 
3617  default:
3619  "fatal flex scanner internal error--no action found" );
3620  } /* end of action switch */
3621  } /* end of scanning one token */
static void yy_fatal_error ( yyconst char  msg[])
static
static void yy_fatal_error ( yyconst char *  msg)
static

References YY_EXIT_FAILURE.

4234 {
4235  (void) fprintf( stderr, "%s\n", msg );
4236  exit( YY_EXIT_FAILURE );
4237 }
static int yy_get_next_buffer ( void  )
static

References EOB_ACT_CONTINUE_SCAN, EOB_ACT_END_OF_FILE, EOB_ACT_LAST_MATCH, ppin, pprealloc(), pprestart(), yy_buffer_state::yy_buf_size, YY_BUFFER_EOF_PENDING, yy_c_buf_p, yy_buffer_state::yy_ch_buf, YY_CURRENT_BUFFER_LVALUE, YY_END_OF_BUFFER_CHAR, YY_FATAL_ERROR, YY_INPUT, yy_buffer_state::yy_is_our_buffer, YY_MORE_ADJ, yy_n_chars, YY_READ_BUF_SIZE, and yytext_ptr.

Referenced by input(), and while().

3632 {
3633  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3634  register char *source = (yytext_ptr);
3635  register int number_to_move, i;
3636  int ret_val;
3637 
3638  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3640  "fatal flex scanner internal error--end of buffer missed" );
3641 
3642  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3643  { /* Don't try to fill the buffer, so this is an EOF. */
3644  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3645  {
3646  /* We matched a single character, the EOB, so
3647  * treat this as a final EOF.
3648  */
3649  return EOB_ACT_END_OF_FILE;
3650  }
3651 
3652  else
3653  {
3654  /* We matched some text prior to the EOB, first
3655  * process it.
3656  */
3657  return EOB_ACT_LAST_MATCH;
3658  }
3659  }
3660 
3661  /* Try to read more data. */
3662 
3663  /* First move last chars to start of buffer. */
3664  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3665 
3666  for ( i = 0; i < number_to_move; ++i )
3667  *(dest++) = *(source++);
3668 
3669  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3670  /* don't do the read, it's not guaranteed to return an EOF,
3671  * just force an EOF
3672  */
3673  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3674 
3675  else
3676  {
3677  yy_size_t num_to_read =
3678  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3679 
3680  while ( num_to_read <= 0 )
3681  { /* Not enough room in the buffer - grow it. */
3682 
3683  /* just a shorter name for the current buffer */
3685 
3686  int yy_c_buf_p_offset =
3687  (int) ((yy_c_buf_p) - b->yy_ch_buf);
3688 
3689  if ( b->yy_is_our_buffer )
3690  {
3691  yy_size_t new_size = b->yy_buf_size * 2;
3692 
3693  if ( new_size <= 0 )
3694  b->yy_buf_size += b->yy_buf_size / 8;
3695  else
3696  b->yy_buf_size *= 2;
3697 
3698  b->yy_ch_buf = (char *)
3699  /* Include room in for 2 EOB chars. */
3700  pprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
3701  }
3702  else
3703  /* Can't grow it, we don't own it. */
3704  b->yy_ch_buf = 0;
3705 
3706  if ( ! b->yy_ch_buf )
3708  "fatal error - scanner input buffer overflow" );
3709 
3710  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
3711 
3712  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3713  number_to_move - 1;
3714 
3715  }
3716 
3717  if ( num_to_read > YY_READ_BUF_SIZE )
3718  num_to_read = YY_READ_BUF_SIZE;
3719 
3720  /* Read in more data. */
3721  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3722  (yy_n_chars), num_to_read );
3723 
3724  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3725  }
3726 
3727  if ( (yy_n_chars) == 0 )
3728  {
3729  if ( number_to_move == YY_MORE_ADJ )
3730  {
3731  ret_val = EOB_ACT_END_OF_FILE;
3732  pprestart(ppin );
3733  }
3734 
3735  else
3736  {
3737  ret_val = EOB_ACT_LAST_MATCH;
3738  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3740  }
3741  }
3742 
3743  else
3744  ret_val = EOB_ACT_CONTINUE_SCAN;
3745 
3746  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3747  /* Extend the array by 50%, plus the number we really need. */
3748  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3749  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
3750  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3751  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3752  }
3753 
3754  (yy_n_chars) += number_to_move;
3757 
3758  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3759 
3760  return ret_val;
3761 }
static yy_state_type yy_get_previous_state ( void  )
static

References YY_AT_BOL, yy_c_buf_p, yy_cp, yy_last_accepting_cpos, yy_last_accepting_state, YY_MORE_ADJ, YY_SC_TO_UI, yy_start, and yytext_ptr.

Referenced by while().

3766 {
3767  register yy_state_type yy_current_state;
3768  register char *yy_cp;
3769 
3770  yy_current_state = (yy_start);
3771  yy_current_state += YY_AT_BOL();
3772 
3773  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3774  {
3775  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3776  if ( yy_accept[yy_current_state] )
3777  {
3778  (yy_last_accepting_state) = yy_current_state;
3779  (yy_last_accepting_cpos) = yy_cp;
3780  }
3781  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3782  {
3783  yy_current_state = (int) yy_def[yy_current_state];
3784  if ( yy_current_state >= 1082 )
3785  yy_c = yy_meta[(unsigned int) yy_c];
3786  }
3787  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3788  }
3789 
3790  return yy_current_state;
3791 }
static int yy_init_globals ( void  )
static

Get the current token.

References NULL, ppin, ppout, yy_buffer_stack, yy_buffer_stack_max, yy_buffer_stack_top, yy_c_buf_p, yy_init, yy_start, yy_start_stack, yy_start_stack_depth, and yy_start_stack_ptr.

Referenced by pplex_destroy().

4263 {
4264  /* Initialization is the same as for the non-reentrant scanner.
4265  * This function is called from pplex_destroy(), so don't allocate here.
4266  */
4267 
4268  (yy_buffer_stack) = 0;
4269  (yy_buffer_stack_top) = 0;
4270  (yy_buffer_stack_max) = 0;
4271  (yy_c_buf_p) = (char *) 0;
4272  (yy_init) = 0;
4273  (yy_start) = 0;
4274 
4275  (yy_start_stack_ptr) = 0;
4276  (yy_start_stack_depth) = 0;
4277  (yy_start_stack) = NULL;
4278 
4279 /* Defined in main.c */
4280 #ifdef YY_STDINIT
4281  ppin = stdin;
4282  ppout = stdout;
4283 #else
4284  ppin = (FILE *) 0;
4285  ppout = (FILE *) 0;
4286 #endif
4287 
4288  /* For future reference: Set errno on error, since we are called by
4289  * pplex_init()
4290  */
4291  return 0;
4292 }
static void yy_pop_state ( void  )
static

References BEGIN, and YY_FATAL_ERROR.

Referenced by while().

4222 {
4223  if ( --(yy_start_stack_ptr) < 0 )
4224  YY_FATAL_ERROR( "start-condition stack underflow" );
4225 
4227 }
static void yy_push_state ( int  new_state)
static

References BEGIN, ppalloc(), pprealloc(), YY_FATAL_ERROR, YY_START, yy_start_stack, yy_start_stack_depth, and YY_START_STACK_INCR.

Referenced by while().

4198 {
4200  {
4201  yy_size_t new_size;
4202 
4204  new_size = (yy_start_stack_depth) * sizeof( int );
4205 
4206  if ( ! (yy_start_stack) )
4207  (yy_start_stack) = (int *) ppalloc(new_size );
4208 
4209  else
4210  (yy_start_stack) = (int *) pprealloc((void *) (yy_start_stack),new_size );
4211 
4212  if ( ! (yy_start_stack) )
4213  YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
4214  }
4215 
4217 
4218  BEGIN(new_state);
4219 }
static yy_state_type yy_try_NUL_trans ( yy_state_type  current_state)
static

References yy_c_buf_p, yy_last_accepting_cpos, and yy_last_accepting_state.

Referenced by while().

3799 {
3800  register int yy_is_jam;
3801  register char *yy_cp = (yy_c_buf_p);
3802 
3803  register YY_CHAR yy_c = 1;
3804  if ( yy_accept[yy_current_state] )
3805  {
3806  (yy_last_accepting_state) = yy_current_state;
3807  (yy_last_accepting_cpos) = yy_cp;
3808  }
3809  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3810  {
3811  yy_current_state = (int) yy_def[yy_current_state];
3812  if ( yy_current_state >= 1082 )
3813  yy_c = yy_meta[(unsigned int) yy_c];
3814  }
3815  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3816  yy_is_jam = (yy_current_state == 1081);
3817 
3818  return yy_is_jam ? 0 : yy_current_state;
3819 }
static void yyunput ( int  c,
char *  buf_ptr 
)
static
static void yyunput ( int  c,
register char *  yy_bp 
)
static

References if(), yy_c_buf_p, yy_cp, YY_CURRENT_BUFFER_LVALUE, YY_FATAL_ERROR, yy_hold_char, yy_n_chars, and yytext_ptr.

3822 {
3823  register char *yy_cp;
3824 
3825  yy_cp = (yy_c_buf_p);
3826 
3827  /* undo effects of setting up pptext */
3828  *yy_cp = (yy_hold_char);
3829 
3830  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3831  { /* need to shift things up to make room */
3832  /* +2 for EOB chars. */
3833  register yy_size_t number_to_move = (yy_n_chars) + 2;
3834  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3835  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3836  register char *source =
3837  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3838 
3839  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3840  *--dest = *--source;
3841 
3842  yy_cp += (int) (dest - source);
3843  yy_bp += (int) (dest - source);
3844  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3845  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3846 
3847  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3848  YY_FATAL_ERROR( "flex scanner push-back overflow" );
3849  }
3850 
3851  *--yy_cp = (char) c;
3852 
3853  (yytext_ptr) = yy_bp;
3854  (yy_hold_char) = *yy_cp;
3855  (yy_c_buf_p) = yy_cp;
3856 }

Variable Documentation

struct cb_replace_list* base_replace_list = NULL
static

Referenced by pp_set_replace_list(), and ppecho().

size_t buffer_overflow = 0
static

Referenced by ppinput().

size_t comment_allowed
static

Referenced by check_comments().

size_t consecutive_quotation = 0
static

Referenced by ppinput().

struct copy_info* copy_stack = NULL
static

Referenced by ppopen(), and while().

struct cb_replace_list* current_replace_list = NULL
static

Referenced by ppecho(), and ppopen().

size_t inside_bracket = 0
static
int listing_line = 0
static

Referenced by check_listing().

size_t need_continuation = 0
static

Referenced by ppinput().

size_t newline_count = 0
static

Referenced by ppinput().

struct plex_stack plex_cond_stack[PLEX_COND_DEPTH]
static
unsigned int plex_nest_depth = 0
static

Referenced by plex_action_directive(), and while().

unsigned int plex_skip_input = 0
static

Referenced by display_to_eol(), and ppinput().

char* plexbuff1 = NULL
static

Referenced by ppcopy().

char* plexbuff2 = NULL
static
int pp_flex_debug = 0
FILE* ppin = (FILE *) 0
yy_size_t ppleng

Referenced by check_comments(), and while().

int pplineno = 1
FILE * ppout = (FILE *) 0
char * pptext

Referenced by ppecho().

int quotation_mark = 0
static

Referenced by ppinput(), and ppopen().

int requires_listing_line
static

Referenced by check_listing().

int requires_new_line = 0
static

Referenced by check_listing().

struct cb_replace_list* save_current_replace = NULL
static
struct cb_text_list* text_queue = NULL
static

Referenced by ppecho().

size_t within_comment = 0
static

Referenced by check_comments(), and ppinput().

yyconst flex_int16_t yy_accept[1082]
static
register int yy_act
yyconst flex_int16_t yy_base[1183]
static
register char * yy_bp
YY_BUFFER_STATE* yy_buffer_stack = 0
static

Stack as an array.

Referenced by ppensure_buffer_stack(), pplex_destroy(), and yy_init_globals().

size_t yy_buffer_stack_max = 0
static

capacity of stack.

Referenced by ppensure_buffer_stack(), and yy_init_globals().

size_t yy_buffer_stack_top = 0
static
yyconst flex_int16_t yy_chk[5374]
static
register char* yy_cp
YY_DECL
Initial value:
{
register yy_state_type yy_current_state

The main scanner function which does all the work.

yyconst flex_int16_t yy_def[1183]
static
int yy_did_buffer_switch_on_eof
static
yyconst flex_int32_t yy_ec[256]
static
int yy_init = 0
static

Referenced by if(), and yy_init_globals().

char* yy_last_accepting_cpos
static
yy_state_type yy_last_accepting_state
static
yyconst flex_int32_t yy_meta[74]
static
Initial value:
=
{ 0,
1, 2, 3, 1, 4, 1, 5, 1, 1, 1,
6, 7, 8, 7, 7, 7, 7, 1, 1, 1,
1, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 9
}
yyconst flex_int16_t yy_nxt[5374]
static
int yy_start = 0
static
int* yy_start_stack = NULL
static
int yy_start_stack_depth = 0
static

Referenced by yy_init_globals(), and yy_push_state().

int yy_start_stack_ptr = 0
static

Referenced by yy_init_globals().