if (!(include_filename.charAt(0)=='/' || include_filename.charAt(0)=='\\' || (include_filename.length()>1 && include_filename.charAt(1)==':'))) include_filename = com.cosylab.vdct.util.StringUtils.replaceFileName(fileName, include_filename);
File file = paths.search4File(include_filename); inctokenizer = getStreamTokenizer(file.getAbsolutePath()); if (inctokenizer!=null) processMacros(templateInstance, inctokenizer, include_filename, new PathSpecification(file.getParentFile().getAbsolutePath()));
public static void processMacros(DBTemplateInstance templateInstance, StreamTokenizer tokenizer, String fileName) throws Exception {	String name;	String value;	String include_filename;	StreamTokenizer inctokenizer = null;		if (templateInstance!=null)		/********************** macros area *************************/			while (tokenizer.nextToken() != tokenizer.TT_EOF) 		if (tokenizer.ttype == tokenizer.TT_WORD) 			if (tokenizer.sval.equals(ENDSTR)) break;			else if (tokenizer.sval.startsWith(DBConstants.commentString)) 				processComment(null, tokenizer, fileName);				// !!! no comments are preserved in macro part			else if (tokenizer.sval.equalsIgnoreCase(MACRO)) {				// read name				tokenizer.nextToken();				if ((tokenizer.ttype == tokenizer.TT_WORD) ||					(tokenizer.ttype == DBConstants.quoteChar)) name=tokenizer.sval;				else throw (new DBParseException("Invalid macro name...", tokenizer, fileName));									// read value				tokenizer.nextToken();				if (tokenizer.ttype == DBConstants.quoteChar) value=tokenizer.sval;				else throw (new DBParseException("Invalid macro value...", tokenizer, fileName));				//System.out.println("\tmacro("+name+", \""+value+"\")");				templateInstance.addProperty(name, value);			}			else if (tokenizer.sval.equalsIgnoreCase(INCLUDE)) {				// read incude_filename				tokenizer.nextToken();				if (tokenizer.ttype == DBConstants.quoteChar) include_filename=tokenizer.sval;				else throw (new DBParseException("Invalid include filename...", tokenizer, fileName));				// if not absulute fileName, do not use relative path				if (!(include_filename.charAt(0)=='/' || include_filename.charAt(0)=='\\' || (include_filename.length()>1 && include_filename.charAt(1)==':')))					include_filename = com.cosylab.vdct.util.StringUtils.replaceFileName(fileName, include_filename);				inctokenizer = getStreamTokenizer(include_filename);				if (inctokenizer!=null) processMacros(templateInstance, inctokenizer, include_filename);			}								/***********************************************************/}