]> granicus.if.org Git - yasm/commitdiff
* linemgr.h (yasm_linemap_traverse_filenames): New function to go through all
authorPeter Johnson <peter@tortall.net>
Sat, 11 Feb 2006 21:33:51 +0000 (21:33 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 11 Feb 2006 21:33:51 +0000 (21:33 -0000)
filenames used by linemgr.
* linemgr.c (yasm_linemap_traverse_filenames): Implement.

svn path=/trunk/yasm/; revision=1373

libyasm/linemgr.c
libyasm/linemgr.h

index e7ca9c485adb942f18138726464baf75f8a4804b..01b10743ea51d9d059e8aa696f9097d09e18ce27 100644 (file)
@@ -240,6 +240,13 @@ yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line,
     *file_line = mapping->file_line + mapping->line_inc*(line-mapping->line);
 }
 
+int
+yasm_linemap_traverse_filenames(yasm_linemap *linemap, /*@null@*/ void *d,
+                               int (*func) (const char *filename, void *d))
+{
+    return HAMT_traverse(linemap->filenames, d, (int (*) (void *, void *))func);
+}
+
 int
 yasm_linemap_get_source(yasm_linemap *linemap, unsigned long line,
                        yasm_bytecode **bcp, const char **sourcep)
index f15074931882eeefa681ae59d9f6ca2c06f64825..fecf621a05aa56334c21543c20bd9b1b9b87e4a0 100644 (file)
@@ -101,4 +101,17 @@ void yasm_linemap_set(yasm_linemap *linemap, /*@null@*/ const char *filename,
 void yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line,
                         /*@out@*/ const char **filename,
                         /*@out@*/ unsigned long *file_line);
+
+/** Traverses all filenames used in a linemap, calling a function on each
+ * filename.
+ * \param linemap      line mapping repository
+ * \param d            data pointer passed to func on each call
+ * \param func         function
+ * \return Stops early (and returns func's return value) if func returns a
+ *        nonzero value; otherwise 0.
+ */
+int yasm_linemap_traverse_filenames
+    (yasm_linemap *linemap, /*@null@*/ void *d,
+     int (*func) (const char *filename, void *d));
+
 #endif