File: elx.h

package info (click to toggle)
viewcvs 0.9.2%2Bcvs.1.0.dev.2004.07.28-4.1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,452 kB
  • ctags: 1,355
  • sloc: python: 10,100; cpp: 840; ansic: 763; yacc: 526; sh: 163; makefile: 115
file content (54 lines) | stat: -rw-r--r-- 1,340 bytes parent folder | download | duplicates (3)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef ELX_H
#define ELX_H

#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


#define ELX_COMMENT     'C'     /* a comment */
#define ELX_STRING      'S'     /* a string constant */
#define ELX_KEYWORD     'K'     /* a language keyword */
#define ELX_GLOBAL_FDEF 'F'     /* function defn in global (visible) scope */
#define ELX_LOCAL_FDEF  'L'     /* function defn in local (hidden) scope */
#define ELX_METHOD_DEF  'M'     /* method definition */
#define ELX_FUNC_REF    'R'     /* function reference / call */

#define ELX_DEFINES_SYM(c) ((c) == ELX_GLOBAL_FDEF || (c) == ELX_LOCAL_FDEF \
                            || (c) == ELX_METHOD_DEF)


typedef struct
{
    /* input filename */
    const char *input_fn;

    /* output filenames: element extractions, and symbols */
    const char *elx_fn;
    const char *sym_fn;

    /* file pointers for each of the input/output files */
    FILE *input_fp;
    FILE *elx_fp;
    FILE *sym_fp;

} elx_context_t;

elx_context_t *elx_process_args(int argc, const char **argv);

void elx_open_files(elx_context_t *ec);
void elx_close_files(elx_context_t *ec);


void elx_issue_token(elx_context_t *ec,
                     char which, int start, int len,
                     const char *symbol);


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* ELX_H */