00001 /************************************************************************************* 00002 * MechSys - A C++ library to simulate (Continuum) Mechanical Systems * 00003 * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com> * 00004 * Copyright (C) 2005 Raul Dario Durand Farfan <raul.durand at gmail.com> * 00005 * * 00006 * This file is part of MechSys. * 00007 * * 00008 * MechSys is free software; you can redistribute it and/or modify it under the * 00009 * terms of the GNU General Public License as published by the Free Software * 00010 * Foundation; either version 2 of the License, or (at your option) any later * 00011 * version. * 00012 * * 00013 * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY * 00014 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 00015 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License along with * 00018 * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, * 00019 * Fifth Floor, Boston, MA 02110-1301, USA * 00020 *************************************************************************************/ 00021 00022 #include <string> 00023 #include <iostream> 00024 00025 #include "util/array.h" 00026 #include "util/exception.h" 00027 #include "util/fileparser.h" 00028 00029 using std::cout; 00030 using std::endl; 00031 00032 int main(int argc, char **argv) try 00033 { 00034 // Open file 00035 FileParser FP(String("tlpar.att")); 00036 //int A; 00037 std::string B,C,D,E; 00038 Array<double> F; 00039 std::string str_line = FP.GetCurrentLine(); FP.Advance(); 00040 00041 LineParser LP(String("ux=1 uy=2 uz=3")); 00042 Array<std::string> Lvalue; 00043 Array<double> Rvalue; 00044 if (!LP.BreakExpressions(Lvalue, Rvalue)) 00045 std::cout << "BreakExpressions failed\n"; 00046 else 00047 for (size_t i=0; i<Lvalue.size(); ++i) 00048 std::cout << Lvalue[i] << " = " << Rvalue[i] << std::endl; 00049 00050 return 0; 00051 } 00052 catch (Exception * e) 00053 { 00054 e->Cout(); 00055 if (e->IsFatal()) exit(1); 00056 delete e; 00057 }