summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/fe/mcpp_tao_yyinput.h
blob: ade25f68a3e6ad99b1b2a2d9a43cfa78b5098e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/** $Id$
 * @file mcpp_yyinput.h
 * @author William R. Otte <wotte@dre.vanderbilt.edu>
 * 
 * Provides a YY_INPUT macro which enables lexing from an in-memory buffer
 * instead of a file.
 */

#ifndef MCPP_YYINPUT_H
#define MCPP_YYINPUT_H

extern char *tao_preproc_buffer;
extern size_t tao_preproc_buffer_length;

size_t tao_preproc_buffer_pos = 0;

#define TAO_YY_INPUT(buf,result,max_size)                           \
  {                                                                 \
    result = 0      ;                                               \
    while ((tao_preproc_buffer_pos < tao_preproc_buffer_length) &&  \
          (result < max_size))                                      \
      {                                                             \
        buf[result] = tao_preproc_buffer[tao_preproc_buffer_pos];   \
        ++tao_preproc_buffer_pos;                                   \
        ++result;                                                   \
      }                                                             \
    if (result == 0) result = TAO_YY_NULL;}                         \

#endif /* MCPP_YYINPUT_H */