prefix bytecodeproc with xasm_
[xorcyst.git] / loc.h
blob67bfb3de918af649e445f1705ba70943f1f5f0e5
1 /*
2 * $Id: loc.h,v 1.3 2007/08/10 20:21:26 khansen Exp $
3 * $Log: loc.h,v $
4 * Revision 1.3 2007/08/10 20:21:26 khansen
5 * *** empty log message ***
7 * Revision 1.2 2007/07/22 13:35:20 khansen
8 * convert tabs to whitespaces
10 * Revision 1.1 2004/06/30 07:56:29 kenth
11 * Initial revision
15 /**
16 * Definitions for flex location tracking.
19 #ifndef LOC_H
20 #define LOC_H
22 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
23 typedef struct YYLTYPE
25 int first_line;
26 int first_column;
27 int last_line;
28 int last_column;
29 const char *file;
30 } YYLTYPE;
31 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
32 # define YYLTYPE_IS_DECLARED 1
33 # define YYLTYPE_IS_TRIVIAL 1
34 #endif
36 #ifndef YYRHSLOC
37 # define YYRHSLOC(Rhs, K) ((Rhs)[K])
38 #endif
39 #ifndef YYLLOC_DEFAULT
40 # define YYLLOC_DEFAULT(Current, Rhs, N) \
41 do \
42 if (N) \
43 { \
44 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
45 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
46 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
47 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
48 (Current).file = YYRHSLOC (Rhs, 1).file; \
49 } \
50 else \
51 { \
52 (Current).first_line = (Current).last_line = \
53 YYRHSLOC (Rhs, 0).last_line; \
54 (Current).first_column = (Current).last_column = \
55 YYRHSLOC (Rhs, 0).last_column; \
56 (Current).file = YYRHSLOC (Rhs, 0).file; \
57 } \
58 while (0)
59 #endif
61 const char *yy_current_filename();
63 typedef struct YYLTYPE location;
65 /* Initialize LOC. */
66 # define LOCATION_RESET(Loc) \
67 (Loc).first_column = (Loc).first_line = 1; \
68 (Loc).last_column = (Loc).last_line = 1; \
69 (Loc).file = yy_current_filename();
71 /* Advance of NUM lines. */
72 # define LOCATION_LINES(Loc, Num) \
73 (Loc).last_column = 1; \
74 (Loc).last_line += Num; \
75 (Loc).file = (Loc).file;
77 /* Restart: move the first cursor to the last position. */
78 # define LOCATION_STEP(Loc) \
79 (Loc).first_column = (Loc).last_column; \
80 (Loc).first_line = (Loc).last_line; \
81 (Loc).file = (Loc).file;
83 /* Output LOC on the stream OUT. */
84 # define LOCATION_PRINT(Out, Loc) \
85 fprintf (Out, "%d", (Loc).first_line)
87 # define LOCATION_PRINT(Out, Loc) \
88 if ((Loc).first_line != (Loc).last_line) \
89 fprintf (Out, "%d.%d-%d.%d", \
90 (Loc).first_line, (Loc).first_column, \
91 (Loc).last_line, (Loc).last_column - 1); \
92 else if ((Loc).first_column < (Loc).last_column - 1) \
93 fprintf (Out, "%d.%d-%d", (Loc).first_line, \
94 (Loc).first_column, (Loc).last_column - 1); \
95 else \
96 fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column)
99 #endif /* !LOC_H */