【正文】
And they described the theory and the realization of the Easy Embedded Browser, especially the parser of HTML, and the support to JavaScript. At first, the thesis outlines the history of advanced household devices, embedded systems and embedded browser over them. Then we introduced several embedded browser under embedded systems, present embedded browser, illustrated the background of this thesis, and pointed out that the peculiarity of browser on embedded systems, that is, lightness, less resource requirement, quicker response, high reliability and easy configuration. In chapter 2, we introduced the work that the author did before developing this project, including materials researching, platform and GUI choosing, and introduced the main opponents of Easy Embedded Browser simply and the functions supported by it. In chapter 3, we introduced some technical details of implementing an embedded browser, including the interrelated technologies and standards of embedded browser, CSS , JavaScript, programming in Linux and the pilers and debuggers, GNU make and makefile, and GUI development with GTK. In chapter 4, we described the principle of the HTML parser. It?s is an important part. And it will directly influence the display of the web. We played the emphasis on the development of Parser Easy Token, including the posing and the function of easy token, data structure, algorithm, the disposal of HTML tags and the flow of the program. We programmed in C. In chapter 5, we presented the realization of the support to JavaScript, including the development platform of JavaScript, JavaScript Engine, the bination of JavaScript and the browser, and the response to messages. We also presented the problems that occurred in this part and gave out the resolutions of them. In chapter 6, we introduced the flow and the structure of Easy Embedded Browser, and the main modules separately. Through paring to IE, we pointed out the advantage and disadvantage of Easy Embedded Browser. At last, we made conclusions of the whole project and presented the prospect of it and the further work in the future. Key words: embedded browser web site browse III Linux GTK 三峽大學學位論文原創(chuàng)性聲明 本人鄭重聲明:所呈交的學位論文,是本人在導師的指導下,獨立進行研究工作 所取得的成果,除文中已經(jīng)注明引用的內(nèi)容外,本論文不含任何其他個人或集體已經(jīng) 發(fā)表或撰寫過的作品成果。它是瀏覽器程序 中的重要部分,解析效果的好壞將直接影響到網(wǎng)頁的顯示。 三峽大學 碩士學位論文 基于 Linux的嵌入式瀏覽器的設計與實現(xiàn) 姓名:陳卉娥 申請學位級別:碩士 專業(yè):計算機應用 指導教師:曾維魯 20200501 內(nèi) 容 摘 要 本文主要介紹了作者在 “基于 Linux 的嵌入式瀏覽器的設計與實現(xiàn) ”課題中所作 的一些研究、實踐工作。第四章詳細介紹了 HTML 解析部分的原理。最后,進行了課題小結,并簡述了課題 的發(fā)展前景和未來的研究方向。 作者的研究目標是建立一個基于 Linux 操作系統(tǒng)的嵌入式瀏覽器。它不同于 PC,通常簡單易用、成本低廉、用于信息訪問和信息獲 取,針對不 同的需求而設計,有很強的聯(lián)網(wǎng)功能,代表了消費類電子產(chǎn)品與計算機通 訊的結合。 嵌入式系統(tǒng)是以應用為中心,以計算機技術為基礎,并且軟硬件可裁剪,適用于 應用系統(tǒng)對功能、可靠性、成本、體積、功耗有嚴格要求的專用計算機系統(tǒng) [6]。 而嵌入式 OS 就是在嵌入式系統(tǒng)扮演 “靈魂 ”角色的系統(tǒng)軟件。 4)提供各種設備驅(qū)動接口。 同其他網(wǎng)絡應用一樣,這里也采用客戶 / 服務器模式。 瀏覽器是一個交互程序。當用戶用鼠標選定了一個項,瀏覽器 通過當前的光標位置和存儲的位置信息來決定哪個項被用戶選定。 5 常見的嵌入式瀏覽器 目前嵌入式操作系統(tǒng)主要有三類 , 即 Win CE、 Palm OS 及嵌入式 Linux 等。 3) PocketAlbum1. 0 版權:自由; 大?。?14. 4 KB; 使用對象: PalmPilot; 功能:是一個照片瀏覽器,可以改變照片的對比度,以及刪除圖像等。所以,它的功能非常強大(支持 CSS和動態(tài) XHTML),但錯 誤較多,故不穩(wěn)定。 3)分析系統(tǒng)資源消耗及運行效率,就其可 用性、可靠性進行研究。 開發(fā)嵌 入式瀏覽器,是一項復雜的工程,涉及到很多技術,像 HTML,CSS 和 JavaScript 等,這些在第三章有專門介紹,此處不予贅述。 2)布局 本文中的布局應理解為界面輸出前的預演和處理位置等信息的算法,而不是具體 的畫圖和界面輸出。 4) JavaScript 支持 實際上 JavaScript 的編譯器是開放源碼的,而且全世界通用,包括 IE、 Mozilla、 Netscape 等瀏覽器都使用相同的 JavaScript 的編譯器,但為何其對 JavaScript 的支持 不盡相同呢,這是因為 JavaScript 在瀏覽器里主要是用于操縱界面元素和與瀏覽器內(nèi) 部命令進行結合。 本章小結 本章先從總體上介紹了作者在本課題設計前期所作的工作,包括資料搜集,開發(fā) 平臺和 GUI 的選取,然后對作者設計的瀏覽器 ——Easy Embedded Browser 各功能部 件進行簡介,最后指出了 Easy Embedded Browser 所支持的功能。一個 HTML 元素通常由三部分組 成:開始標簽( Start tag),形如 elementname;內(nèi)容( content);結束標簽( end tag), 形如 /elementname。xH; ”形式,兩種形式 都以 “amp。 TAG 名和 屬性是大小寫無關的。 HTML 瀏覽器時根據(jù) HTML 的規(guī)范來確定語義包含關系。 樣式規(guī)則組成如下: 選擇符 {屬性:值 } 單一選擇符的復合樣式聲明應該用分號隔開: 選擇符 {屬性 1:值 1;屬性 2:值 2} 以下是一段定義了 H1 和 H2 元素的顏色和字體大小屬性: HEAD TITLECSS 例子 /TITLE STYLE TYPE=“text/css” H1{fontsize:xlarge; color: red} H2{fontsize:large。它是通過嵌入或調(diào)入在標準的 HTML語言中實現(xiàn)的。因此,許多功能可以來自于腳本環(huán)境中對象的方法 與腳本的相互作用。 比如按下鼠標、移動窗口 、選擇菜單等都可以視為事件。 Java 是一種比 JavaScript 更復雜許 多的程序語言,而 JavaScript 則是相當容易了解的語言。 System V 接口描述 (SVID)是描述 ATamp。 Glibc 基 于如下標準: ISO C:C 編程語言的國際標準,即 ANSI C,POSIX,Berkeley Unix, SVID,XPG。 Linux 上的編譯器和調(diào)試器 1) Linux 上的 C/C++ 編譯器和調(diào)試器 [1] 運行 gcc/egcs: Linux 中最重要的軟件開發(fā)工具是 GCC。因 此,通常使用 g++ 命令來完成 C++ 程序的編譯和連接,該程序會自動調(diào)用 gcc 實 現(xiàn)編譯。 指定額外的頭文件搜索路徑 DIRECTORY。 進一步優(yōu)化。 3) gdb GNU 的調(diào)試器稱為 gdb,該程序是一個交互式工具,工作在字符模式。由于庫是在運行 的時候被調(diào)入,因此這個選項是必需的, shared 選項告訴編譯器產(chǎn)生共享庫代碼。 18 默認情況 下, GNU make 工具在當前工作目錄中按如下順序搜索 makefile: GNUmakefile,makefile,Makefile。通常, makefile 中定義有 clean 目標, 可用來清除編譯過程中的中間文件,例如: clean: rm f *.o 運行 make clean 時,將執(zhí)行 rm f *.o 命令,最終刪除所有編譯過程中產(chǎn)生的所 有中間文件。 以指定的 FILE 文件作為 makefile。 假定文件 FILE 已經(jīng)被修改。 20 include gtk/ 圖 一個用 GTK 創(chuàng)建的窗口 int main( int argc, char *argv[] ) { GtkWidget *window。 } 你可以用 gcc 編譯上面的程序: gcc o base `pkgconfig cflags libs gtk+` 所有程序應該包含 gtk/,其中聲明了變量、函數(shù)以及數(shù)據(jù)結構等,這些東西 會在你的程序中使用。 下面兩行程序會創(chuàng)建并顯示一個窗口 window = gtk_window_new (GTK_WINDOW_TOPLEVEL)。當程序運行到這 里, GTK 會 “睡著 ”等待 X 事件 (如按鈕或鍵盤按下 )、超時 (timeouts)或文件 IO 通知發(fā)生。 HTML 解析的過程主要有兩部分:分詞過程和分析、處理過程。 Easy Token 可以正確解析 的全部元素,該解析器實際是通用的,還可用于 XML、 WML 的詞法分析,只需替換元素名稱即可。 curPosition。 EasyTokenContext 是用于存儲當前待分析網(wǎng)頁全局屬性的數(shù)據(jù)結構,其中 TokenList 是核心的元素節(jié)點鏈表。 //節(jié)點類型,如定義的 HTML_BODY, HTML_TXT 等。 3)如果遇到回車、空格,則跳過。對此的改