Fix a few bugs for --pure-binary (padding was not done, PC was not increased)
[xorcyst.git] / loc.h
blobf986e5708492bbcbddbe2750e15ab16bba1023cb
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 const char *yy_current_filename();
38 typedef struct YYLTYPE location;
40 /* Initialize LOC. */
41 # define LOCATION_RESET(Loc) \
42 (Loc).first_column = (Loc).first_line = 1; \
43 (Loc).last_column = (Loc).last_line = 1; \
44 (Loc).file = yy_current_filename();
46 /* Advance of NUM lines. */
47 # define LOCATION_LINES(Loc, Num) \
48 (Loc).last_column = 1; \
49 (Loc).last_line += Num; \
50 (Loc).file = (Loc).file;
52 /* Restart: move the first cursor to the last position. */
53 # define LOCATION_STEP(Loc) \
54 (Loc).first_column = (Loc).last_column; \
55 (Loc).first_line = (Loc).last_line; \
56 (Loc).file = (Loc).file;
58 /* Output LOC on the stream OUT. */
59 # define LOCATION_PRINT(Out, Loc) \
60 fprintf (Out, "%d", (Loc).first_line)
62 # define LOCATION_PRINT(Out, Loc) \
63 if ((Loc).first_line != (Loc).last_line) \
64 fprintf (Out, "%d.%d-%d.%d", \
65 (Loc).first_line, (Loc).first_column, \
66 (Loc).last_line, (Loc).last_column - 1); \
67 else if ((Loc).first_column < (Loc).last_column - 1) \
68 fprintf (Out, "%d.%d-%d", (Loc).first_line, \
69 (Loc).first_column, (Loc).last_column - 1); \
70 else \
71 fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column)
74 #endif /* !LOC_H */