(三語)Red語言的安裝

* 本系列是“2+1”三語學編程系列,三語是英文、中文加計算機語言;即用英語來學習編程語言,並以中文為輔助;

* 用英語來理解和學習計算機語言是最好的方式,這一系列的文章力求幫助大家在計算機語言上和英語閱讀能力上都有所提升;

* 推薦的閱讀的方法是:先原文,適當看解析閱讀,實在不行再看雙語對照。

* 解析中英語單詞的音標使用Dictcom和IPA雙音標標註,如果需要了解Dictcom音標,請參看我們的《dictionary.com所用的音標體系》一文。


(三語)Red語言的安裝


我們介紹過,Red語言是一門小巧玲瓏,但又功能不弱的輕量級編程語言。所謂的輕量級,是指整個語言的編寫相對更貼近一般人類的思路,貼近高級語言因而書寫便捷,編程和運行環境非常簡單,實際上只有一個可執行文件。而功能不弱,體現在下面幾個地方:跨平臺、即支持解釋運行又支持編譯運行、內置的語言級別上支持圖形界面(GUI)開發、方便的網絡編程能力(例如發郵件、抓取網頁等往往一條語句就可以實現)。


Red語言的安裝也是很簡單的,下面我們來看看英語的安裝說明,用英語來進行思維和學習是我們推薦的,尤其是在學習計算機語言時,不提高自己的英語閱讀能力是很難在編程開發領域達到較高的水準的。我們儘量能夠在參看註釋的情況下獨立看懂原文,如果實在有困難,再去看譯文不遲,這樣長期堅持後,你的科技英語水平將會突飛猛進。


【原文】


Installing Red locally


Here is a step by step guide of how to install Red locally:

  1. Download the correct Red binary version for your computer from here (takes only a few seconds, it's less than 1MB). Save into a suitable folder.
  2. For Windows users, run it by double-clicking on the Red binary file. It will then automatically build the Red GUI-console. Next time you double-click on the file, the GUI-console will automatically open.
  3. For Linux/OSX users, you need to open a terminal app to be able to run Red. Once you have opened the terminal app, change to the directory in which you saved Red. Now do a: chmod u+x <red-binary> which will make sure that Red can be run on your computer. After that simply run Red using ./<red-binary>. This will build the Red console. Next time you run Red, the console will automatically open./<red-binary>/<red-binary>

Done! No installer, no setup, no dependencies(*)! What, that's all? Yes, there was a time when software used to be done right, that's what we aim at bringing back. ;-)


【解析閱讀】


Installing Red locally
—— Installing 原型:install 動詞現在進行式或動名詞 [ in-'stawl ][ɪn'stɔːl] vt. 安裝
—— locally 副詞 [ 'loh-kuh-lee ]['ləʊkəli] adv. 在本地;地方性地;局部地
—— Red [ red ][red] adj. 紅色的 n. 紅色。這裡指Red語言。



Here is a step by step guide of how to install Red locally:


—— step 名詞 [ step ][step] n. 步驟;臺階;舞步;步伐 v. 踏;以步測量
—— guide 名詞 [ gahyd ][ɡaɪd] n. 嚮導;導遊;指南;指導者 vt. 指導;引導;為 ... 領路 vi. 作導遊
—— install 動詞原形 [ in-'stawl ][ɪn'stɔːl] vt. 安裝;安置;使 ... 就職



Download the correct Red binary version for your computer from here (takes only a few seconds, it's less than 1MB).
—— less than 小於;少於;不到;例句:Seven is two less than nine. 9比7少2。
—— correct 形容詞 [ kuh-'rekt ][kə'rekt] adj. 正確的;得體的 v. 改正;糾正
—— binary 形容詞 [ 'bahy-nuh-ree, -ner-ee ]['baɪnəri] adj. 二進位的;二元的 n. 二進制;二元
—— version 名詞 [ 'vur-zhuhn, -shuhn ]['vɜːʃn] n. 版本;說法;譯本;形式
—— computer 名詞 [ kuh m-'pyoo-ter ][kəm'pjuːtə(r)] n. 電腦;計算機
—— 1MB 是指1M字節大小,1M是1024個,在表示硬盤等存儲容量是,也可能指1000個;B是byte的簡寫,即字節,一個字節表示了8個二進制位的數字



Save into a suitable folder.
—— Save 原型:save 動詞原形 [ seyv ][seɪv] v. 救;節省;保存
—— suitable 形容詞 [ 'soo-tuh-buhl ]['suːtəbl] adj. 適宜的;合適的
—— folder 名詞 [ 'fohl-der ]['fəʊldə] n. 文件夾;摺疊者;摺疊式印刷品



For Windows users, run it by double-clicking on the Red binary file.
—— users 原型:user 名詞複數形式 [ 'yoo-zer ]['juːzə] n. 用戶;使用者
—— file 名詞 [ fahyl ][faɪl] n. 檔案;卷宗;文件
—— Windows n. 微軟公司生產的“視窗”操作系統



It will then automatically build the Red GUI-console.
—— automatically 副詞 [ aw-tuh-'mat-ik-lee ][ˌɔːtə'mætɪkli] adv. 自動地;機械地
—— build 動詞原形 [ bild ][bɪld] v. 建造;開發;創建;逐漸增強 n. 體格;身材
—— GUI-console GUI是Graphical User Interface的簡寫,即圖形用戶界面,console是控制檯的意思,GUI-console即圖形控制檯界面



Next time you double-click on the file, the GUI-console will automatically open.
—— double-click 名詞 double-click [ 'duhb-uh l-'klik ]['dʌbl klɪk] 雙擊,即用鼠標雙擊



For Linux/OSX users, you need to open a terminal app to be able to run Red.


—— Linux 誕生於1991 年10 月5 日,是一套免費使用和自由傳播的計算機操作系統,是一個從UNIX發展而來,基於多用戶、多任務、支持多線程和多CPU的操作系統。Linux繼承了Unix以網絡為核心的設計思想,是一個性能穩定的多用戶網絡操作系統。Linux的核心思想之一是:一切都是文件。例句:Check your Linux system for the required space. 檢查您的Linux系統中需要的磁盤空間。
—— OSX 是指蘋果公司的Mac OSX操作系統

—— terminal 形容詞 [ 'tur-muh-nl ]['tɜːmɪnl] n. 末端;終點站;終點;終端機;航站樓 adj. 末端的;終點的;晚期的;(每)學期的
—— app 名詞 [ ap ][æp] abbr. 應用程序(=application)


Once you have opened the terminal app, change to the directory in which you saved Red.
—— in which ... 是which引導的定語從句,表示“在...裡面”,接近於where;例句:He give me a box in which to keep the toy. 他給了我一個裝著玩具的盒子。
—— directory 名詞 [ dih-'rek-tuh-ree, -tree, dahy- ][də'rektəri] n. 目錄;工商名錄;指南 adj. 給予指導的


Now do a: chmod u+x which will make sure that Red can be run on your computer.
—— chmod 名詞 chmod [tʃ'mɒd] n. 改變模式;這是Linux和Mac OS操作系統中的一個命令



After that simply run Red using ./.
—— simply 形容詞 [ 'sim-plee ]['sɪmpli] adv. 簡單地;僅僅;簡直



This will build the Red console.
—— console [ kuh n-'sohl ][kən'səʊl] n. 儀表盤;操控臺;(遊戲)平臺;控制檯



Next time you run Red, the console will automatically open.



Done!



No installer, no setup, no dependencies(*)!
—— installer 名詞 installer [ in-'stawl ][ɪns'tɔːlər] n. 安裝者;[計算機]安裝程序;安裝包
—— setup 名詞 [ 'set-uhp ]['setʌp] n. 裝備;安裝;配置;設置
—— dependencies 名詞複數形式 [ dih-'pen-duh n-see ][dɪ'pendənsɪz] n. 依存;依賴 dependency的複數形式.


What, that's all?


Yes, there was a time when software used to be done right, that's what we aim at bringing back.
—— software 名詞 [ 'sawft-wair, 'soft- ]['sɒftweə] n. 軟件
—— aim [ eym ][eɪm] n. 目標;對準;槍法 vt. 瞄準;針對 vi. 瞄準;旨在;致力
—— bringing 原型:bring 動詞現在進行式或動名詞 [ bring ][brɪŋ] vt. 帶來;促使;引起;勸誘 vi. 產生



;-)
—— 這是文字表情符號,代表微笑的表情


【雙語對照】


Installing Red locally
——在本地安裝Red語言


Here is a step by step guide of how to install Red locally:
——下面是如何在本地安裝Red語言的逐步指南:


Download the correct Red binary version for your computer from here (takes only a few seconds, it's less than 1MB).
——從這裡為您的計算機下載正確的Red語言二進制版本(只需幾秒鐘,小於1MB)。


Save into a suitable folder.
——保存到合適的文件夾中。


For Windows users, run it by double-clicking on the Red binary file.
——對於Windows用戶,雙擊Red語言的二進制文件來運行它。


It will then automatically build the Red GUI-console.
——然後它將自動構建Red語言的圖形界面控制檯。


Next time you double-click on the file, the GUI-console will automatically open.
——下次雙擊該文件時,圖形界面控制檯將自動打開。


For Linux/OSX users, you need to open a terminal app to be able to run Red.
——對於Linux/OSX用戶,需要打開一個終端應用程序才能運行Red。


Once you have opened the terminal app, change to the directory in which you saved Red.
——打開終端應用程序後,請切換到保存Red的目錄。


Now do a: chmod u+x which will make sure that Red can be run on your computer.
——現在執行:chmod u+x以確保Red可以在您的計算機上運行。


After that simply run Red using ./.
——之後,只需使用前綴./運行Red。


This will build the Red console.
——這將編譯Red控制檯。


Next time you run Red, the console will automatically open.
——下次運行Red時,控制檯將自動打開。


Done!
——完成!


No installer, no setup, no dependencies(*)!
——沒有安裝包,不需要配置,沒有任何依賴(*)!


What, that's all?
——什麼,就這些?


Yes, there was a time when software used to be done right, that's what we aim at bringing back.
——是的,曾經有一段時間軟件都是這樣做得很好的,這就是我們致力於要帶回來的東西。


;-)
——(微笑的表情)


【延伸閱讀與擴展解說】


實際上,如果用的是Windows,安裝後需要做一些附加的步驟以便更簡單地使用,下面再專門簡單說一下Windows下的安裝過程。


Red語言的官網是 red-lang.org,直接去下載安裝包(其實就是一個可執行文件)即可,最新的版本是類似0.6.4。


下載後將該文件放在一個目錄下,例如D:\\tools下,即D盤根目錄的tools子目錄下。之後最好將該目錄加入Windows路徑中,以便可以方便地運行它。頭一次運行時會稍微花一點時間進行初始化設置,耐心等它結束即可。


然後我們編寫一個最簡單的Red語言的程序代碼,例如:


<code>Red []

print "We are the world!"/<code>


Red語言代碼必須以“Red[”開始,且只有這裡大小寫是敏感的,其他的地方大小寫是不敏感的。print是將輸出“We are the world!”這些文字。假設我們將這段代碼存入D:\\redprjs\\test\\test.red文件中,然後就可以用red命令來執行它。


另外,Windows版的Red直接運行似乎有問題,會出現類似下面截圖的提示:

(三語)Red語言的安裝

用下圖所示的方法即可正常運行:

(三語)Red語言的安裝

也可以編寫一個批處理文件red.bat放到可以被Windows找到的目錄下,內容是類似:

<code>"d:\\tools\\red\\red.exe" %*/<code>

就可以了,運行效果如下圖所示:


(三語)Red語言的安裝

Red程序將在GUI控制檯中運行,可以看到,正確地輸出了“We are the world!”這一行文字。


我們也可以用加了“-c”開關的red命令來編譯我們的Red代碼生成可執行文件,以後直接就可以運行而無需啟動GUI控制檯,如下圖所示。


(三語)Red語言的安裝


我們也可以寫一個最簡單的圖形界面,將下面的代碼輸入到D:\\redprjs\\test\\testgui.red中。

<code>Red [needs: view]
view [
t1: text "Hello world!" 200
button "換句子" [
t1/text: "We are the world."
]
]/<code>

然後執行它,將會出現如下圖所示的小窗口。


(三語)Red語言的安裝

點擊“換句子”按鈕,句子將會變成“We are the world!”,神奇吧?


(三語)Red語言的安裝


分享到:


相關文章: