Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

node_io.C

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00014 
00015 #include "node.h"
00016 #include "util_io.h"
00017 
00018 #ifndef TOOLBOX
00019 
00020 // Initialize all static node data here (?)
00021 
00022 node * node::root           = NULL;
00023 
00024 void node::print_static(ostream& s)             // default = cerr
00025 {
00026     s << "root = " << root << endl;
00027 }
00028 
00029 istream& node::scan_dyn_story(istream& s)
00030 {
00031     char input_line[MAX_INPUT_LINE_LENGTH];
00032 
00033     // On entry, we have just read the "(Dynamics" [or "(D"] line
00034     // signifying the start of dyn_story input.  Keep reading and
00035     // storing until we encounter the corresponding closing
00036     // [END_DYNAMICS] line.
00037 
00038     while (get_line(s,input_line), !matchbracket(END_DYNAMICS, input_line)) {
00039 
00040         char keyword[MAX_INPUT_LINE_LENGTH];
00041         const char *val = getequals(input_line, keyword);
00042 
00043         if (0) {   // trick to keep the else if() statements homogeneous
00044 
00045             }else if(!strcmp("m",keyword)){
00046                 mass = strtod(val, NULL);
00047             }else{
00048                 add_story_line(dyn_story, input_line);
00049             }
00050     }
00051     return s;
00052 }
00053 
00054 ostream& node::print_dyn_story(ostream& s,
00055                                bool print_xreal,        // default = true
00056                                int short_output)        // default = 0
00057 {
00058     // Modifications by Steve (5/01) to streamline output.
00059 
00060     put_real_number(s, "  m  =  ", mass);
00061 
00062     return s;
00063 }
00064 
00065 #else
00066 
00067 main(int argc, char** argv)
00068 {
00069     check_help();
00070 
00071     node * b;
00072     while (b = get_node(cin)){
00073         put_node(cout,*b);
00074         pp2(b);
00075     }
00076     cerr << "Normal exit\n";
00077 }
00078 #endif

Generated at Sun Feb 24 09:57:10 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001