plugins/net.sf.sveditor.core.tests/src/net/sf/sveditor/core/tests/TestNullIndexCacheFactory.java
fCacheList = new ArrayList<TestNullIndexCache>();
public TestNullIndexCacheFactory()
plugins/net.sf.sveditor.core.tests/src/net/sf/sveditor/core/tests/content_assist/ContentAssistIndex.java
return "ContentAssistIndex";
String getLogName()
plugins/net.sf.sveditor.core.tests/src/net/sf/sveditor/core/tests/content_assist/TestContentAssistClass.java
String testname = "testContentAssistSuperSuperClass";
		LogHandle log = LogFactory.getLogHandle(testname);
		String doc1 =
			"class base;\n" +
			"	int		AAAA;\n" +
			"	int		AABB;\n" +
			"endclass\n" +
			"\n" +
			"class super_1 extends base;\n" +
			"	int		BBBB;\n" +
			"	int		BBCC;\n" +
			"endclass\n" +
			"\n" +
			"class super_2 extends super_1;\n" +
			"	int		CCCC;\n" +
			"	int		CCDD;\n" +
			"endclass\n" +
			"\n" +
			"class my_class extends super_2;\n" +
			"\n" +
			"	function void build();\n" +
			"		super.<<MARK>>\n" +
			"	endfunction" +
			"endclass\n" +
			"\n"
			;
		SVCorePlugin.getDefault().enableDebug(false);
				
		TextTagPosUtils tt_utils = new TextTagPosUtils(new StringInputStream(doc1));
		ISVDBFileFactory factory = SVCorePlugin.createFileFactory(null);
		
		List<SVDBMarker> markers = new ArrayList<SVDBMarker>();
		SVDBFile file = factory.parse(tt_utils.openStream(), testname, markers);
		StringBIDITextScanner scanner = new StringBIDITextScanner(tt_utils.getStrippedData());
		
		/*
		for (ISVDBItemBase it : file.getChildren()) {
			log.debug("    it: " + it.getType() + " " + SVDBItem.getName(it));
void testContentAssistSuperSuperClass()
plugins/net.sf.sveditor.core.tests/src/net/sf/sveditor/core/tests/index/cache/TestIndexCache.java
String testname = "testFileCacheBasicsUVM";
		BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle());
		File tmp_dir = TestUtils.createTempDir();
		final File db_dir = new File(tmp_dir, "db");
		File test_dir = new File(tmp_dir, "test");
		SVCorePlugin.getDefault().enableDebug(false);
		CoreReleaseTests.clearErrors();
		LogHandle log = LogFactory.getLogHandle(testname);
		
		assertTrue(db_dir.mkdirs());
		assertTrue(test_dir.mkdirs());
		
		utils.unpackBundleZipToFS("/uvm.zip", test_dir);		
		File uvm = new File(test_dir, "uvm");
		
		IProject project_dir = TestUtils.createProject("uvm", uvm);

		SVDBIndexRegistry rgy = new SVDBIndexRegistry();
		SVCorePlugin.getDefault().setSVDBIndexRegistry(rgy);
		ISVDBIndexCacheFactory f = new ISVDBIndexCacheFactory() {
			public ISVDBIndexCache createIndexCache(String project_name,
					String base_location) {
				SVDBDirFS fs = new SVDBDirFS(db_dir);
				ISVDBIndexCache cache = new SVDBFileIndexCache(fs);
				return cache;
void testFileCacheBasicsUVM()
List<ISVDBIndexCache> cache_list
plugins/net.sf.sveditor.core.tests/src/net/sf/sveditor/core/tests/index/cache/TestIndexCache.java
void compactCache(List<ISVDBIndexCache> cache_list)
plugins/net.sf.sveditor.core.tests/src/net/sf/sveditor/core/tests/parser/TestParseClassBodyItems.java
String testname = "testRandomizeLocalVarRef";
		String content =
			"class myclass;\n" +
			"	typedef enum bit {\n" +
			"		ON,\n" +
			"		OFF\n" +
			"
void testRandomizeLocalVarRef()
it instanceof ISVDBNamedItem
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/content_assist/AbstractCompletionProcessor.java
if (matcher.match((ISVDBNamedItem)it, ctxt.fLeaf)) {
							addProposal(it, ctxt.fLeaf, ctxt.fStart, ctxt.fLeaf.length());
else if (it instanceof ISVDBNamedItem)
SVDBItemType type  String id
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/expr/SVDBIdentifierExpr.java
super(type);
		
		fId = id;
public SVDBIdentifierExpr(SVDBItemType type, String id)
ILogHandle handle
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/AbstractSVDBIndex.java
fDebugEn = handle.isEnabled();
void logLevelChanged(ILogHandle handle)

			SVDBFileTree 					file 
			Map<String  SVDBFileTree>		working_set
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/AbstractSVDBIndex.java
fCache, working_set);
				if (fDebugEn) {
					fLog.debug("Searching for \"" + leaf + "\" in global (ret="
							+ ret + ")");
IPreProcMacroProvider createPreProcMacroProvider(
			SVDBFileTree 					file,
			Map<String, SVDBFileTree>		working_set)
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexCollectionMgr.java
for (ISVDBIndex i : getIndexList()) {
			i.dispose();
void dispose()
String ref
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexCollectionMgr.java
if (!fProjectRefs.contains(ref)) {
			fProjectRefs.add(ref);
void addProjectRef(String ref)
ISVDBProjectRefProvider p
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexCollectionMgr.java
fProjectRefProvider = p;
void setProjectRefProvider(ISVDBProjectRefProvider p)
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexCollectionMgr.java
return fProjectRefProvider;
ISVDBProjectRefProvider getProjectRefProvider()

			List<SVDBDeclCacheItem>			ret 
			String							name 
			ISVDBFindNameMatcher			matcher 
			Set<SVDBIndexCollectionMgr>		already_searched 
			boolean							search_local
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexCollectionMgr.java
if (!already_searched.contains(this)) {
			already_searched.add(this);
void findGlobalScopeDeclProjRef(
			List<SVDBDeclCacheItem>			ret,
			String							name,
			ISVDBFindNameMatcher			matcher,
			Set<SVDBIndexCollectionMgr>		already_searched,
			boolean							search_local)
List<ISVDBIndex> index_l : fFileSearchOrder
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexCollectionMgr.java
for (ISVDBIndex index : index_l) {
					List<SVDBDeclCacheItem> tmp = index.findGlobalScopeDecl(
							new NullProgressMonitor(), name, matcher);
					ret.addAll(tmp);
indexes
			for (List<ISVDBIndex> index_l : fFileSearchOrder)
Set<String> file_list  ISVDBIndex index
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBIndexItemIterator.java
Set<String> set_t = new HashSet<String>(file_list);
		fFilePathIterator = set_t.iterator();
				if (file == null) {
					continue;
public SVDBIndexItemIterator(Set<String> file_list, ISVDBIndex index)
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBLibIndex.java
return "SVDBLibIndex";
String getLogName()
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/SVDBSourceCollectionIndex.java
return "SourceCollectionIndex";
String getLogName()
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fSVDBPreProcFile = new SoftReference<SVDBFile>(null);
			fSVDBFileTree = new SoftReference<SVDBFileTree>(null);
			fSVDBFile = new SoftReference<SVDBFile>(null);
			fMarkers = new SoftReference<List<SVDBMarker>>(null);
			fLastModified = -1;
public CacheFileInfo()
String target_dir  String file_path  SVDBFile file
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fTargetDir = target_dir;
			fFilePath = file_path;
			fFile = file;
			fType = SVDB_FILE;
public WriteBackInfo(String target_dir, String file_path, SVDBFile file)
String target_dir  String file_path  SVDBFileTree file
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fTargetDir = target_dir;
			fFilePath = file_path;
			fFileTree = file;
			fType = SVDB_FILE_TREE;
public WriteBackInfo(String target_dir, String file_path, SVDBFileTree file)
String target_dir  String file_path  List<SVDBMarker> markers
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fTargetDir = target_dir;
			fFilePath = file_path;
			fMarkers = markers;
			fType = MARKERS;
public WriteBackInfo(String target_dir, String file_path, List<SVDBMarker> markers)
ISVDBFS fs
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fFileCache = new HashMap<String, SVDBFileIndexCache.CacheFileInfo>();
		fDebugEn = fLog.isEnabled();
		fLog.addLogLevelListener(this);
		fPersistenceRdrSet = new ArrayList<IDBReader>(); 
		fPersistenceWriterSet = new ArrayList<IDBWriter>();
		fWriteBackQueue = new ArrayList<SVDBFileIndexCache.WriteBackInfo>();
		if (fNumWriteBackThreads > 0) {
			fWriteBackThread = new Thread[fNumWriteBackThreads];
			for (int i=0; i<fWriteBackThread.length; i++) {
				fWriteBackThread[i] = new Thread(new Runnable() {
					public void run() {
						writeBackWorker();
public SVDBFileIndexCache(ISVDBFS fs)
ILogHandle handle
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fDebugEn = handle.isEnabled();
void logLevelChanged(ILogHandle handle)
String path  boolean create
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
synchronized (fFileCache) {
			if (!fFileCache.containsKey(path)) {
				if (create) {
					CacheFileInfo file = new CacheFileInfo();
					fFileCache.put(path, file);
					return file;
CacheFileInfo getCacheFileInfo(String path, boolean create)
true
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
synchronized (fWriteBackQueue) {
				if (fWriteBackQueue.size() == 0) {
					break;
complete
		while (true)
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
IDBReader reader = null;
			reader = new SVDBPersistenceRW();
	private void freeReader(IDBReader reader) {
	private IDBWriter allocWriter() {
		IDBWriter writer = null;
			writer = new SVDBPersistenceRW();
	private void freeWriter(IDBWriter writer) {
	private void writeBackPreProcFile(String path, SVDBFile file) {
		
		String target_dir = computePathDir(path);
		String file_path = target_dir + "/preProcFile";
	
		if (fNumWriteBackThreads > 0) {
			WriteBackInfo info = new WriteBackInfo(target_dir, file_path, file);
			synchronized (fWriteBackQueue) {
				// First, go through and look for any duplicates
				for (int i=0; i<fWriteBackQueue.size(); i++) {
					if (fWriteBackQueue.get(i).fType == WriteBackInfo.SVDB_FILE &&
							fWriteBackQueue.get(i).fTargetDir.equals(target_dir) &&
							fWriteBackQueue.get(i).fFilePath.equals(file_path)) {
						fWriteBackQueue.remove(i);
						i--;
IDBReader allocReader()
String path  SVDBFile file
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
String target_dir = computePathDir(path);
		String file_path = target_dir + "/file";
		
		if (fNumWriteBackThreads > 0) {
			WriteBackInfo info = new WriteBackInfo(target_dir, file_path, file);
			synchronized (fWriteBackQueue) {
				fWriteBackQueue.add(info);
				fWriteBackQueue.notify();
void writeBackFile(String path, SVDBFile file)
String path  SVDBFileTree file_tree
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
String target_dir = computePathDir(path);
		String file_path = target_dir + "/fileTreeMap";

		if (fNumWriteBackThreads > 0) {
			WriteBackInfo info = new WriteBackInfo(target_dir, file_path, file_tree);
			synchronized (fWriteBackQueue) {
				// First, go through and look for any duplicates
				for (int i=0; i<fWriteBackQueue.size(); i++) {
					if (fWriteBackQueue.get(i).fType == WriteBackInfo.SVDB_FILE_TREE &&
							fWriteBackQueue.get(i).fTargetDir.equals(target_dir) &&
							fWriteBackQueue.get(i).fFilePath.equals(file_path)) {
						fWriteBackQueue.remove(i);
						i--;
void writeBackFileTree(String path, SVDBFileTree file_tree)
String path  List<SVDBMarker> markers
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
String target_dir = computePathDir(path);
		String file_path  = target_dir + "/markers";

		if (fNumWriteBackThreads > 0) {
			WriteBackInfo info = new WriteBackInfo(target_dir, file_path, markers);
			synchronized (fWriteBackQueue) {
				fWriteBackQueue.add(info);
				fWriteBackQueue.notify();
void writeBackMarkerList(String path, List<SVDBMarker> markers)
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
while (true) {
			WriteBackInfo info = null;
			
			synchronized (fWriteBackQueue) {
				while (fWriteBackQueue.size() == 0) {
					try {
						fWriteBackQueue.wait();
void writeBackWorker()
String target_dir  String file_path  SVDBFile file
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
IDBWriter writer = allocWriter();
		
		fSVDBFS.mkdirs(target_dir);
		try {
			RandomAccessFile out = fSVDBFS.openChannelWrite(file_path);
			
			writer.init(out);
			writer.writeObject(file.getClass(), file);
			writer.close();
			fSVDBFS.closeChannel(out);
void writeBackFileWorker(String target_dir, String file_path, SVDBFile file)
String target_dir  String file_path  SVDBFileTree file_tree
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fSVDBFS.mkdirs(target_dir);
		
		IDBWriter writer = allocWriter();
		
		try {
			RandomAccessFile out = fSVDBFS.openChannelWrite(file_path);
			writer.init(out);
			synchronized (file_tree) {
				writer.writeObject(file_tree.getClass(), file_tree);
void writeBackFileTreeWorker(String target_dir, String file_path, SVDBFileTree file_tree)
String target_dir  String file_path  List<SVDBMarker> markers
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fSVDBFS.mkdirs(target_dir);

		IDBWriter writer = allocWriter();
		try {
			RandomAccessFile out = fSVDBFS.openChannelWrite(file_path);
			writer.init(out);
			writer.writeItemList(markers);
			writer.close();
			fSVDBFS.closeChannel(out);
void writeBackMarkerListWorker(String target_dir, String file_path, List<SVDBMarker> markers)
String path
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/project/SVDBProjectData.java
IWorkspace ws = ResourcesPlugin.getWorkspace();
		IWorkspaceRoot root = ws.getRoot();
		SVDBIndexCollectionMgr mgr = null;
		SVDBProjectManager p_mgr = SVCorePlugin.getDefault().getProjMgr(); 
		
		IProject p = root.getProject(path);
		if (p != null) {
			SVDBProjectData p_data = p_mgr.getProjectData(p);
			if (p_data != null) {
				mgr = p_data.getProjectIndexMgr();
SVDBIndexCollectionMgr resolveProjectRef(String path)
fProject != null
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/project/SVDBProjectData.java
IProject refs[] = null;
			try {
				refs = fProject.getReferencedProjects();
project
		if (fProject != null)
String ref
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/project/SVProjectFileWrapper.java
SVDBPath p = new SVDBPath(ref);
		fProjectReferences.add(p);
		fArgFilePaths.clear();
		fProjectReferences.clear();
void addProjectRef(String ref)

			ISVDBIndexCache 				cache 
			Map<String  SVDBFileTree>		working_set
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/scanner/FileContextSearchMacroProvider.java
fWorkingSet = working_set;
					SVDBFileTree ib; 
					if (fWorkingSet.containsKey(ib_s)) {
						ib = fWorkingSet.get(ib_s);
public FileContextSearchMacroProvider(
			ISVDBIndexCache 				cache,
			Map<String, SVDBFileTree>		working_set)
it instanceof ISVDBNamedItem
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/content_assist/AbstractCompletionProcessor.java
if (matcher.match((ISVDBNamedItem)it, ctxt.fLeaf)) {
						addProposal(it, ctxt.fLeaf, ctxt.fStart, ctxt.fLeaf.length());
else if (it instanceof ISVDBNamedItem)
SVDBFileTree file
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/AbstractSVDBIndex.java
fCache);
				fLog.debug("Searching for \"" + leaf + "\" in global (ret="
						+ ret + ")");
				fLog.debug("IncludeFileProvider not set");
		fLog.debug("Processed pre-proc file");
			
			if (ft_root == null) {
IPreProcMacroProvider createPreProcMacroProvider(SVDBFileTree file)
ISVDBFS fs
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
fSVDBFS = fs;
		fFileList = new ArrayList<String>();
		fLastModifiedMap = new HashMap<String, Long>(fCacheSize);
		fPreProcFileMap = new WeakHashMap<String, SVDBFile>(fCacheSize);
		fFileTreeMap = new WeakHashMap<String, SVDBFileTree>(fCacheSize);
		fFileMap = new WeakHashMap<String, SVDBFile>(fCacheSize);
		fMarkerMap = new WeakHashMap<String, List<SVDBMarker>>(fCacheSize);
		fLog = LogFactory.getLogHandle("SVDBFileIndexCache");
		fPersistenceRdrSet = new ArrayList<SVDBPersistenceReader>(); 
		fPersistenceWriterSet = new ArrayList<SVDBPersistenceWriter>();

	public SVDBFileIndexCache(ISVDBFS fs, int cache_sz) {
		fFileList = new ArrayList<String>();
		fLastModifiedMap = new HashMap<String, Long>();
		fPreProcFileMap = new WeakHashMap<String, SVDBFile>(cache_sz);
		fFileTreeMap = new WeakHashMap<String, SVDBFileTree>(cache_sz);
		fFileMap = new WeakHashMap<String, SVDBFile>(cache_sz);
		fMarkerMap = new WeakHashMap<String, List<SVDBMarker>>(cache_sz);
		debug("Create Cache: " + fs.getRoot());
		fLog.debug("clear");
		fFileList.clear();
		fLastModifiedMap.clear();
		fPreProcFileMap.clear();
		fFileTreeMap.clear();
		fFileMap.clear();
		fMarkerMap.clear();
		synchronized (fFileList) {
			if (!fFileList.contains(path)) {
				fFileList.add(path);
		if (fMarkerMap.containsKey(path)) {
			fMarkerMap.remove(path);
public SVDBFileIndexCache(ISVDBFS fs)
String path  List<SVDBMarker> marker_list
plugins/net.sf.sveditor.core/src/net/sf/sveditor/core/db/index/cache/SVDBFileIndexCache.java
SVDBPersistenceWriter writer = allocWriter();
		try {
			RandomAccessFile out = fSVDBFS.openChannelWrite(path);
			writer.init(out);
			writer.writeItemList(marker_list);
			writer.close();
			fSVDBFS.closeChannel(out);
void writeMarkerList(String path, List<SVDBMarker> marker_list)