CompileProcess.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003 The Pentagram team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #include "pent_include.h"
00020 
00021 #include "CompileProcess.h"
00022 #include "CoreApp.h"
00023 
00024 #include "CompileUnit.h"
00025 #include "FileSystem.h"
00026 
00027 // p_dynamic_cast stuff
00028 DEFINE_RUNTIME_CLASSTYPE_CODE(CompileProcess,Process);
00029 
00030 CompileProcess::CompileProcess(FileSystem *filesystem) : termCounter(10)
00031 {
00032         cu = new CompileUnit(filesystem);
00033 }
00034 
00035 
00036 CompileProcess::~CompileProcess()
00037 {
00038 }
00039 
00040 bool CompileProcess::run(const uint32 /*framenum*/)
00041 {
00042         if (flags & PROC_SUSPENDED)
00043                 return false;
00044 
00045         if(cu->state()!=CompileUnit::CSTATE_FINISHED)
00046                 cu->parse();
00047 
00048         if(cu->state()==CompileUnit::CSTATE_FAIL && cu->expect()!=LLC_XFAIL)
00049                 CoreApp::get_instance()->ForceQuit();
00050 
00051         if(cu->state()==CompileUnit::CSTATE_FINISHED)
00052         {
00053                 if(!(cu->expect()==LLC_XPASS || cu->expect()==LLC_NONE))
00054                 {
00055                         pout << "Error: Parse failed where expected to succeed." << std::endl;
00056                         pout << cu->expect() << std::endl;
00057                 }
00058                 
00059                 if(cu->compileComplete())
00060                         terminate(); //FIXME: Needs to handle multiple files and such...
00061                 else
00062                         cu->parse();
00063                 //CoreApp::get_instance()->ForceQuit();
00064         }
00065         
00066         //if(termCounter==0)
00067         //      CoreApp::get_instance()->ForceQuit();
00068 
00069         //pout << "Countdown to Term...: " << termCounter << std::endl;
00070         termCounter--;
00071 
00072         // if we need to redraw the screen (aka, we've done something), we need to return true;
00073         return false;
00074 }
00075 

Generated on Fri Jul 27 22:27:11 2007 for pentagram by  doxygen 1.4.7