Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

stackrep.cpp

Go to the documentation of this file.
00001 // +-------------------------------------------------------------------------+
00002 // |               I__n__t__e__L__i__b           0.6.10 development          |
00003 // | Copyright (c) Andrey Vikt. Stolyarov <crocodil_AT_croco.net> 2000-2007. |
00004 // |                                                                         |
00005 // | This is free software. The library part is available under              |
00006 // |                               GNU LESSER GENERAL PUBLIC LICENSE v.2.1.  |
00007 // | GNU LGPL v2.1 is found in docs/gnu_gpl2.txt,  or at  http://www.gnu.org |
00008 // |     Please see also docs/readme.txt and visit http://www.intelib.org    |
00009 // |                                                                         |
00010 // | !!! THERE IS NO WARRANTY OF ANY KIND, NEITHER EXPRESSED NOR IMPLIED !!! |
00011 // +-------------------------------------------------------------------------+
00012 
00013 
00014 
00015 
00016 #include <stdio.h> // for snprintf
00017 #include "../sexpress/sexpress.hpp"
00018 #include "../sexpress/sstring.hpp"
00019 
00020 SString stack_representation(SReference stack)
00021 {
00022     if(!stack.GetPtr()) return "# No stack available\n";
00023     SString s("# Stack:\n");
00024     int f = 0;
00025     for(SReference r=stack; !r.IsEmptyList(); r=r.Cdr()) {
00026          char buf[20];
00027          snprintf(buf, sizeof(buf), "#%d:    ", f++);
00028          s += buf;
00029          s += r.Car()->TextRepresentation();
00030          s += "\n";
00031     }
00032     s += "\n";
00033     return s;
00034 }

Generated on Tue Dec 18 00:39:46 2007 for InteLib by  doxygen 1.4.1