00001 /*************************************************************************** 00002 * Copyright (C) 2003 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #include "microinfo.h" 00012 #include "microlibrary.h" 00013 00014 #include <kdebug.h> 00015 #include <kstaticdeleter.h> 00016 00017 #include "picinfo12bit.h" 00018 #include "picinfo14bit.h" 00019 #include "picinfo16bit.h" 00020 00021 #include "micropackage.h" 00022 00023 MicroLibrary * MicroLibrary::m_pSelf = 0; 00024 static KStaticDeleter<MicroLibrary> staticMicroLibraryDeleter; 00025 00026 MicroLibrary * MicroLibrary::self() 00027 { 00028 if ( !m_pSelf ) 00029 staticMicroLibraryDeleter.setObject( m_pSelf, new MicroLibrary() ); 00030 return m_pSelf; 00031 } 00032 00033 MicroLibrary::MicroLibrary() 00034 { 00035 addMicroInfo( new PicInfo12C508() ); 00036 addMicroInfo( new PicInfo12C509() ); 00037 addMicroInfo( new PicInfo16C54 () ); 00038 addMicroInfo( new PicInfo16C55() ); 00039 addMicroInfo( new PicInfo16C61() ); 00040 addMicroInfo( new PicInfo16C62() ); 00041 addMicroInfo( new PicInfo16C63() ); 00042 addMicroInfo( new PicInfo16C64() ); 00043 addMicroInfo( new PicInfo16F627() ); 00044 addMicroInfo( new PicInfo16F628() ); 00045 addMicroInfo( new PicInfo16C65() ); 00046 addMicroInfo( new PicInfo16C71() ); 00047 addMicroInfo( new PicInfo16C72() ); 00048 addMicroInfo( new PicInfo16C73() ); 00049 addMicroInfo( new PicInfo16C712() ); 00050 addMicroInfo( new PicInfo16C716() ); 00051 addMicroInfo( new PicInfo16C74() ); 00052 addMicroInfo( new PicInfo16C84() ); 00053 addMicroInfo( new PicInfo16CR83() ); 00054 addMicroInfo( new PicInfo16F83() ); 00055 addMicroInfo( new PicInfo16CR84() ); 00056 addMicroInfo( new PicInfo16F84() ); 00057 addMicroInfo( new PicInfo16F873() ); 00058 addMicroInfo( new PicInfo16F874() ); 00059 addMicroInfo( new PicInfo16F877() ); 00060 addMicroInfo( new PicInfo17C752() ); 00061 addMicroInfo( new PicInfo17C756() ); 00062 addMicroInfo( new PicInfo17C762() ); 00063 addMicroInfo( new PicInfo17C766() ); 00064 addMicroInfo( new PicInfo18C242() ); 00065 addMicroInfo( new PicInfo18C252() ); 00066 addMicroInfo( new PicInfo18C442() ); 00067 addMicroInfo( new PicInfo18C452() ); 00068 addMicroInfo( new PicInfo18F442() ); 00069 addMicroInfo( new PicInfo18F452() ); 00070 } 00071 00072 MicroLibrary::~MicroLibrary() 00073 { 00074 const MicroInfoList::iterator end = m_microInfoList.end(); 00075 for ( MicroInfoList::iterator it = m_microInfoList.begin(); it != end; ++it ) 00076 { 00077 delete *it; 00078 *it = 0; 00079 } 00080 } 00081 00082 MicroInfo * const MicroLibrary::microInfoWithID( QString id ) 00083 { 00084 id = id.upper(); 00085 const MicroInfoList::iterator end = m_microInfoList.end(); 00086 for ( MicroInfoList::iterator it = m_microInfoList.begin(); it != end; ++it ) 00087 { 00088 if ( (*it)->id() == id ) return *it; 00089 } 00090 00091 return 0; 00092 } 00093 00094 void MicroLibrary::addMicroInfo( MicroInfo *microInfo ) 00095 { 00096 if (microInfo) 00097 m_microInfoList += microInfo; 00098 } 00099 00100 QStringList MicroLibrary::microIDs( unsigned asmSet, unsigned gpsimSupport, unsigned flowCodeSupport, unsigned microbeSupport ) 00101 { 00102 QStringList ids; 00103 00104 const MicroInfoList::iterator end = m_microInfoList.end(); 00105 for ( MicroInfoList::iterator it = m_microInfoList.begin(); it != end; ++it ) 00106 { 00107 MicroInfo * info = *it; 00108 if ( (info->instructionSet()->set() & asmSet) && 00109 (info->gpsimSupport() & gpsimSupport) && 00110 (info->flowcodeSupport() & flowCodeSupport) && 00111 (info->microbeSupport() & microbeSupport) ) 00112 ids << info->id(); 00113 } 00114 return ids; 00115 }
1.5.1