00001 /* 00002 00003 Copyright (C) 1996-2012 John W. Eaton 00004 00005 This file is part of Octave. 00006 00007 Octave is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 3 of the License, or (at your 00010 option) any later version. 00011 00012 Octave is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Octave; see the file COPYING. If not, see 00019 <http://www.gnu.org/licenses/>. 00020 00021 */ 00022 00023 #ifdef HAVE_CONFIG_H 00024 #include <config.h> 00025 #endif 00026 00027 #include <iostream> 00028 #include <sstream> 00029 #include <string> 00030 00031 #include "ov-fcn.h" 00032 #include "pt.h" 00033 #include "pt-pr-code.h" 00034 00035 // Hide the details of the string buffer so that we are less likely to 00036 // create a memory leak. 00037 00038 std::string 00039 tree::str_print_code (void) 00040 { 00041 std::ostringstream buf; 00042 00043 tree_print_code tpc (buf); 00044 00045 accept (tpc); 00046 00047 std::string retval = buf.str (); 00048 00049 return retval; 00050 }