comparison place.c @ 185:16b4451e34b8

Add the ability to output line numbers, sort of. It is enabled with the intentionally undocumented -p option (similar to -P but reversed sense) and it might be vaguely useful but only prints the line number when the file changes and may not get the line numbers right.
author David A. Holland
date Fri, 12 Jun 2015 03:59:36 -0400
parents a2f047301c15
children 1d2bad7151f9
comparison
equal deleted inserted replaced
184:d359d9b86327 185:16b4451e34b8
100 } 100 }
101 return place->file->dir; 101 return place->file->dir;
102 } 102 }
103 103
104 static 104 static
105 bool
106 place_eq(const struct place *a, const struct place *b)
107 {
108 if (a->type != b->type) {
109 return false;
110 }
111 if (a->file != b->file) {
112 return false;
113 }
114 if (a->line != b->line || a->column != b->column) {
115 return false;
116 }
117 return true;
118 }
119
120 static
121 struct placefile * 105 struct placefile *
122 placefile_find(const struct place *incfrom, const char *name) 106 placefile_find(const struct place *incfrom, const char *name)
123 { 107 {
124 unsigned i, num; 108 unsigned i, num;
125 struct placefile *pf; 109 struct placefile *pf;
217 } 201 }
218 assert(0); 202 assert(0);
219 return NULL; 203 return NULL;
220 } 204 }
221 205
206 bool
207 place_samefile(const struct place *a, const struct place *b)
208 {
209 if (a->type != b->type) {
210 return false;
211 }
212 if (a->file != b->file) {
213 return false;
214 }
215 return true;
216 }
217
218 bool
219 place_eq(const struct place *a, const struct place *b)
220 {
221 if (!place_samefile(a, b)) {
222 return false;
223 }
224 if (a->line != b->line || a->column != b->column) {
225 return false;
226 }
227 return true;
228 }
229
222 static 230 static
223 void 231 void
224 place_printfrom(const struct place *p) 232 place_printfrom(const struct place *p)
225 { 233 {
226 const struct place *from; 234 const struct place *from;