summaryrefslogtreecommitdiff
path: root/src/mcpp-source.h
blob: 9a7973ac10fe578578c96f758fcfac26de7e1498 (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
30
31
32
33
34
35
#ifndef __MCPU_CPP_SOURCE_H__
#define __MCPU_CPP_SOURCE_H__ 1

#include <defs.h>
#include <mcpp-text.h>

#define MCPU_CPP_NON_UCS2_SENTINEL 0xd800

typedef struct mcpu_source mcpu_source;
struct mcpu_source
{
  char      *filename;
  mcpu_text  text;
  mcpu_text  logical_line;
  size_t    *splice_offsets;
  size_t     splice_count;
  size_t     splice_capacity;
  size_t     offset;
  unsigned   line;
};

void mcpu_source_init( mcpu_source *source );
void mcpu_source_free( mcpu_source *source );
int  mcpu_source_open( mcpu_source *source, const char *filename );
int  mcpu_source_open_stream( mcpu_source *source, FILE *stream,
                              const char *name );
int  mcpu_source_valid_ucs2( const __mpu_char16_t *text, size_t length );
int  mcpu_source_next_line( mcpu_source *source,
                            const __mpu_char16_t **line,
                            size_t *length,
                            unsigned *line_number,
                            unsigned *next_line_number,
                            int *spliced );

#endif /* __MCPU_CPP_SOURCE_H__ */