enum { TAG=1, VALUE, TEXT, COMMENT, SCRIPT}; int opened_font_counter=0; int mode; dword source_buf_end; void SourceBufAdd(dword _mode, src) { dword font_found_pointer, src_orig = src; if (_mode) mode = _mode; strcpy(source_buf_end, src); source_buf_end += strlen(source_buf_end); if (font_found_pointer = strstr(src, "")) { opened_font_counter--; src = font_found_pointer+2; } src = src_orig; if (font_found_pointer = strstr(src, ""); } dword ShowSource(dword _bufdata, _in_bufsize) { dword i, j; bool activate_script_mode = false; dword source_buf_start; opened_font_counter=0; source_buf_start = malloc(_in_bufsize*5); source_buf_end = source_buf_start; SourceBufAdd(TEXT, "View Source
");

	for (i=_bufdata; i<_bufdata+_in_bufsize; i++) switch (ESBYTE[i])
	{
		case '<':
			if (!strncmp(i+1,"!--", 3)) SourceBufAdd(COMMENT, "<");
			else if (SCRIPT == mode) {
				if (!strncmp(i+1,"/script>", 8)) {
					CloseAllOpenedFonts(NULL);
					SourceBufAdd(TAG, "<");
				}
				else SourceBufAdd(NULL, "<");
			}
			else if (COMMENT == mode) {
				SourceBufAdd(NULL, "<");
			}
			else if (TEXT == mode) {
				if (!strncmp(i+1,"script", 6)) activate_script_mode = true;
				SourceBufAdd(TAG, "<");
			}
			break;
		case '>':
			if (TAG == mode) && (activate_script_mode) {
				activate_script_mode = false;
				SourceBufAdd(SCRIPT, ">");
			}
			else if (VALUE == mode) CloseAllOpenedFonts(TEXT);
			else if (COMMENT == mode) && (!strncmp(i-2,"--", 2)) {
				SourceBufAdd(TEXT, ">");
				CloseAllOpenedFonts(TEXT);
			}
			else if (COMMENT == mode) || (SCRIPT == mode) SourceBufAdd(NULL, ">");
			else if (TAG == mode) SourceBufAdd(TEXT, ">");
			break;
		case '&':
			SourceBufAdd(NULL, "&");
			break;
		case '\"':
		case '\'':
			if (TAG == mode) SourceBufAdd(VALUE, """);
			else if (VALUE == mode) SourceBufAdd(TAG, """);
			else SourceBufAdd(NULL, """);
			break;
		default:
			ESBYTE[source_buf_end] = ESBYTE[i];
			source_buf_end++;
	}
	ESBYTE[source_buf_end] = 0;
	LoadInternalPage(source_buf_start, source_buf_end-source_buf_start);
	free(source_buf_start);
}