KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Typedefs | Functions | Variables
splitter.cc File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <unistd.h>

Macros

#define YY_INT_ALIGNED   short int
 
#define yy_create_buffer   splitter_create_buffer
 
#define yy_delete_buffer   splitter_delete_buffer
 
#define yy_flex_debug   splitter_flex_debug
 
#define yy_init_buffer   splitter_init_buffer
 
#define yy_flush_buffer   splitter_flush_buffer
 
#define yy_load_buffer_state   splitter_load_buffer_state
 
#define yy_switch_to_buffer   splitter_switch_to_buffer
 
#define yyin   splitterin
 
#define yyleng   splitterleng
 
#define yylex   splitterlex
 
#define yylineno   splitterlineno
 
#define yyout   splitterout
 
#define yyrestart   splitterrestart
 
#define yytext   splittertext
 
#define yywrap   splitterwrap
 
#define yyalloc   splitteralloc
 
#define yyrealloc   splitterrealloc
 
#define yyfree   splitterfree
 
#define FLEX_SCANNER
 
#define YY_FLEX_MAJOR_VERSION   2
 
#define YY_FLEX_MINOR_VERSION   5
 
#define YY_FLEX_SUBMINOR_VERSION   35
 
#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   splitterrestart(splitterin )
 
#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 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_TYPEDEF_YY_SIZE_T
 
#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   splitter_flush_buffer(YY_CURRENT_BUFFER )
 
#define yy_new_buffer   splitter_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 splitterwrap(n)   1
 
#define YY_SKIP_YYWRAP
 
#define yytext_ptr   splittertext
 
#define YY_DO_BEFORE_ACTION
 
#define YY_NUM_RULES   12
 
#define YY_END_OF_BUFFER   13
 
#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_INPUT(buffer, count, size)   (count = splitterTransfer(buffer, size))
 
#define INITIAL   0
 
#define YY_EXTRA_TYPE   void *
 
#define YY_READ_BUF_SIZE   8192
 
#define ECHO   do { if (fwrite( splittertext, splitterleng, 1, splitterout )) {} } while (0)
 
#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 splitterlex (void)
 
#define YY_USER_ACTION
 
#define YY_BREAK   break;
 
#define YY_RULE_SETUP   YY_USER_ACTION
 
#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_state * YY_BUFFER_STATE
 
typedef size_t yy_size_t
 
typedef unsigned char YY_CHAR
 
typedef int yy_state_type
 

Functions

void splitterrestart (FILE *input_file)
 
void splitter_switch_to_buffer (YY_BUFFER_STATE new_buffer)
 
YY_BUFFER_STATE splitter_create_buffer (FILE *file, int size)
 
void splitter_delete_buffer (YY_BUFFER_STATE b)
 
void splitter_flush_buffer (YY_BUFFER_STATE b)
 
void splitterpush_buffer_state (YY_BUFFER_STATE new_buffer)
 
void splitterpop_buffer_state (void)
 
YY_BUFFER_STATE splitter_scan_buffer (char *base, yy_size_t size)
 
YY_BUFFER_STATE splitter_scan_string (yyconst char *yy_str)
 
YY_BUFFER_STATE splitter_scan_bytes (yyconst char *bytes, int len)
 
void * splitteralloc (yy_size_t)
 
void * splitterrealloc (void *, yy_size_t)
 
void splitterfree (void *)
 
int splitterlex_destroy (void)
 
int splitterget_debug (void)
 
void splitterset_debug (int debug_flag)
 
YY_EXTRA_TYPE splitterget_extra (void)
 
void splitterset_extra (YY_EXTRA_TYPE user_defined)
 
FILE * splitterget_in (void)
 
void splitterset_in (FILE *in_str)
 
FILE * splitterget_out (void)
 
void splitterset_out (FILE *out_str)
 
int splitterget_leng (void)
 
char * splitterget_text (void)
 
int splitterget_lineno (void)
 
void splitterset_lineno (int line_number)
 
int splitterlex (void)
 
 if (!(yy_init))
 
 while (1)
 
int isatty (int)
 
void unitSplit (const char *inputBuffer, unsigned int inputSize, std::vector< std::string > &output)
 

Variables

int splitterleng
 
FILE * splitterin = (FILE *) 0
 
FILE * splitterout = (FILE *) 0
 
int splitterlineno = 1
 
char * splittertext
 
int splitter_flex_debug = 0
 
 YY_DECL
 
register char * yy_cp
 
register char * yy_bp
 
register int yy_act
 

Macro Definition Documentation

#define BEGIN   (yy_start) = 1 + 2 *
#define ECHO   do { if (fwrite( splittertext, splitterleng, 1, splitterout )) {} } while (0)
#define EOB_ACT_CONTINUE_SCAN   0
#define EOB_ACT_END_OF_FILE   1
#define EOB_ACT_LAST_MATCH   2
#define FLEX_BETA
#define FLEX_SCANNER
#define FLEXINT_H
#define INITIAL   0
#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 REJECT   reject_used_but_not_detected
#define splitterwrap (   n)    1
#define UINT16_MAX   (65535U)
#define UINT32_MAX   (4294967295U)
#define UINT8_MAX   (255U)
#define unput (   c)    yyunput( c, (yytext_ptr) )
#define YY_AT_BOL ( )    (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
#define YY_BREAK   break;
#define YY_BUF_SIZE   16384
#define YY_BUFFER_EOF_PENDING   2
#define YY_BUFFER_NEW   0
#define YY_BUFFER_NORMAL   1
#define yy_create_buffer   splitter_create_buffer
#define YY_CURRENT_BUFFER
Value:
( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
#define YY_CURRENT_BUFFER_LVALUE   (yy_buffer_stack)[(yy_buffer_stack_top)]
#define YY_DECL   int splitterlex (void)
#define YY_DECL_IS_OURS   1
#define yy_delete_buffer   splitter_delete_buffer
#define YY_DO_BEFORE_ACTION
Value:
splitterleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
register char * yy_bp
Definition: splitter.cc:763
int splitterleng
Definition: splitter.cc:302
register char * yy_cp
Definition: splitter.cc:763
#define yytext_ptr
Definition: splitter.cc:376
#define YY_END_OF_BUFFER   13
#define YY_END_OF_BUFFER_CHAR   0
#define YY_EXIT_FAILURE   2
#define YY_EXTRA_TYPE   void *
#define YY_FATAL_ERROR (   msg)    yy_fatal_error( msg )
#define yy_flex_debug   splitter_flex_debug
#define YY_FLEX_MAJOR_VERSION   2
#define YY_FLEX_MINOR_VERSION   5
#define YY_FLEX_SUBMINOR_VERSION   35
#define yy_flush_buffer   splitter_flush_buffer
#define YY_FLUSH_BUFFER   splitter_flush_buffer(YY_CURRENT_BUFFER )
#define yy_init_buffer   splitter_init_buffer
#define YY_INPUT (   buffer,
  count,
  size 
)    (count = splitterTransfer(buffer, size))
#define YY_INT_ALIGNED   short int
#define YY_LESS_LINENO (   n)
#define yy_load_buffer_state   splitter_load_buffer_state
#define YY_MORE_ADJ   0
#define yy_new_buffer   splitter_create_buffer
#define YY_NEW_FILE   splitterrestart(splitterin )
#define YY_NULL   0
#define YY_NUM_RULES   12
#define YY_READ_BUF_SIZE   8192
#define YY_RESTORE_YY_MORE_OFFSET
#define YY_RULE_SETUP   YY_USER_ACTION
#define YY_SC_TO_UI (   c)    ((unsigned int) (unsigned char) c)
#define yy_set_bol (   at_bol)
Value:
{ \
splitterensure_buffer_stack (); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
if(!(yy_init))
Definition: splitter.cc:771
FILE * splitterin
Definition: splitter.cc:367
#define YY_CURRENT_BUFFER_LVALUE
Definition: splitter.cc:297
#define YY_BUF_SIZE
Definition: splitter.cc:170
#define YY_CURRENT_BUFFER
Definition: splitter.cc:290
YY_BUFFER_STATE splitter_create_buffer(FILE *file, int size)
Definition: splitter.cc:1475
#define yy_set_interactive (   is_interactive)
Value:
{ \
splitterensure_buffer_stack (); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
if(!(yy_init))
Definition: splitter.cc:771
FILE * splitterin
Definition: splitter.cc:367
#define YY_CURRENT_BUFFER_LVALUE
Definition: splitter.cc:297
#define YY_BUF_SIZE
Definition: splitter.cc:170
#define YY_CURRENT_BUFFER
Definition: splitter.cc:290
YY_BUFFER_STATE splitter_create_buffer(FILE *file, int size)
Definition: splitter.cc:1475
#define YY_SKIP_YYWRAP
#define YY_START   (((yy_start) - 1) / 2)
#define YY_START_STACK_INCR   25
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#define YY_STATE_EOF (   state)    (YY_END_OF_BUFFER + state + 1)
#define YY_STRUCT_YY_BUFFER_STATE
#define yy_switch_to_buffer   splitter_switch_to_buffer
#define YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_SIZE_T
#define YY_USER_ACTION
#define yyalloc   splitteralloc
#define yyconst
#define yyfree   splitterfree
#define yyin   splitterin
#define yyleng   splitterleng
#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up splittertext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up splittertext again */ \
} \
while ( 0 )
#define YY_LESS_LINENO(n)
Definition: splitter.cc:191
register char * yy_bp
Definition: splitter.cc:763
#define YY_DO_BEFORE_ACTION
Definition: splitter.cc:386
#define YY_MORE_ADJ
Definition: splitter.cc:547
register char * yy_cp
Definition: splitter.cc:763
while(1)
Definition: splitter.cc:797
#define YY_RESTORE_YY_MORE_OFFSET
Definition: splitter.cc:548
#define yyless (   n)
Value:
do \
{ \
/* Undo effects of setting up splittertext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
splittertext[splitterleng] = (yy_hold_char); \
(yy_c_buf_p) = splittertext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
splitterleng = yyless_macro_arg; \
} \
while ( 0 )
char * splittertext
Definition: splitter.cc:549
#define YY_LESS_LINENO(n)
Definition: splitter.cc:191
int splitterleng
Definition: splitter.cc:302
while(1)
Definition: splitter.cc:797
#define yylex   splitterlex
#define yylineno   splitterlineno
#define yymore ( )    yymore_used_but_not_detected
#define yyout   splitterout
#define yyrealloc   splitterrealloc
#define yyrestart   splitterrestart
#define YYSTATE   YY_START
#define YYTABLES_NAME   "yytables"
#define yyterminate ( )    return YY_NULL
#define yytext   splittertext
#define yytext_ptr   splittertext
#define yywrap   splitterwrap

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

Function Documentation

if ( yy_init)
int isatty ( int  )
YY_BUFFER_STATE splitter_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.
void splitter_delete_buffer ( YY_BUFFER_STATE  b)

Destroy the buffer.

Parameters
ba buffer created with splitter_create_buffer()
void splitter_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.
YY_BUFFER_STATE splitter_scan_buffer ( char *  base,
yy_size_t  size 
)

Setup the input buffer state to scan directly from a user-specified character buffer.

Parameters
basethe character buffer
sizethe size in bytes of the character buffer
Returns
the newly allocated buffer state object.
YY_BUFFER_STATE splitter_scan_bytes ( yyconst char *  yybytes,
int  _yybytes_len 
)

Setup the input buffer state to scan the given bytes. The next call to splitterlex() will scan from a copy of bytes.

Parameters
yybytesthe byte buffer to scan
_yybytes_lenthe number of bytes in the buffer pointed to by bytes.
Returns
the newly allocated buffer state object.
YY_BUFFER_STATE splitter_scan_string ( yyconst char *  yystr)

Setup the input buffer state to scan a string. The next call to splitterlex() will scan from a copy of str.

Parameters
yystra NUL-terminated string to scan
Returns
the newly allocated buffer state object.
Note
If you want to scan bytes that may contain NUL values, then use splitter_scan_bytes() instead.
void splitter_switch_to_buffer ( YY_BUFFER_STATE  new_buffer)

Switch to a different input buffer.

Parameters
new_bufferThe new input buffer.
void * splitteralloc ( yy_size_t  size)
void splitterfree ( void *  ptr)
int splitterget_debug ( void  )
YY_EXTRA_TYPE splitterget_extra ( void  )
FILE * splitterget_in ( void  )

Get the input stream.

int splitterget_leng ( void  )

Get the length of the current token.

int splitterget_lineno ( void  )

Get the current line number.

FILE * splitterget_out ( void  )

Get the output stream.

char * splitterget_text ( void  )

Get the current token.

int splitterlex ( void  )
int splitterlex_destroy ( void  )
void splitterpop_buffer_state ( void  )

Removes and deletes the top of the stack, if present. The next element becomes the new top.

void splitterpush_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.
void * splitterrealloc ( void *  ptr,
yy_size_t  size 
)
void splitterrestart ( 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 .
void splitterset_debug ( int  debug_flag)
void splitterset_extra ( YY_EXTRA_TYPE  user_defined)
void splitterset_in ( FILE *  in_str)

Set the input stream. This does not discard the current input buffer.

Parameters
in_strA readable stream.
See Also
splitter_switch_to_buffer
void splitterset_lineno ( int  line_number)

Set the current line number.

Parameters
line_number
void splitterset_out ( FILE *  out_str)
void unitSplit ( const char *  inputBuffer,
unsigned int  inputSize,
std::vector< std::string > &  output 
)
while ( )

Variable Documentation

int splitter_flex_debug = 0
FILE * splitterin = (FILE *) 0
int splitterleng
int splitterlineno = 1
FILE * splitterout = (FILE *) 0
char * splittertext
register int yy_act
register char * yy_bp
register char* yy_cp
YY_DECL
Initial value:
{
register yy_state_type yy_current_state
int yy_state_type
Definition: splitter.cc:369

The main scanner function which does all the work.