// --------------------------------------------------------------------------- // - Ifile.cpp - // - afnix cross debugger - instrumented file class implementation - // --------------------------------------------------------------------------- // - This program is free software; you can redistribute it and/or modify - // - it provided that this copyright notice is kept intact. - // - - // - This program is distributed in the hope that it will be useful, but - // - without any warranty; without even the implied warranty of - // - merchantability or fitness for a particular purpose. In no event shall - // - the copyright holder be liable for any direct, indirect, incidental or - // - special damages arising in any way out of the use of this software. - // --------------------------------------------------------------------------- // - copyright (c) 1999-2007 amaury darsch - // --------------------------------------------------------------------------- #include "Ifile.hpp" #include "Runnable.hpp" #include "Exception.hpp" namespace afnix { // this procedure add a form in the line map table if and only if // the line is not binded static void add_form (QuarkTable& lmap, Form* form) { if (form == nilp) return; // get the line number and check long lnum = form->getlnum (); if (lmap.exists (lnum) == true) return; lmap.add (lnum, form); } // this procedure take a form, traverse it for other form and add them // in the line map - of course, the first form wins static void map_form (QuarkTable& lmap, Form* form) { // add this top level form add_form (lmap, form); // start to traverse the form Cons* cons = form; while (cons != nilp) { // get the car and map it to a form Form* car = dynamic_cast