(三语)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语言的安装


分享到:


相關文章: