聚星亭

吾笨笨且懒散兮 急须改之而奋进
posts - 74, comments - 166, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

[翻译]AngelScript 实用手册之概述

Posted on 2010-02-26 21:25 besterChen 阅读(4637) 评论(2)  编辑 收藏 引用 所属分类: 英语学习脚本研究

 

       AngelScript 是当作一个引擎而构建的,当应用程序需要注册函数、属性(properties)和任意数据类型的时候,这个脚本可能会派上用场(原文: AngelScript is structured around an engine where the application should register the functions, properties, and even types, that the scripts will be able to use.)。本脚本库依赖于应用程序,它会被编译到应用程序的一个或多个模块之中(原文: The scripts are then compiled into modules, where the application may have one or more modules, depending on the need of the application.)。应用程序也可以通过各式各样的接口来使用configuration集合的每一个模块(原文:The application can also expose a different interface to each module through the use of configuration groups)。当应用程序需要一个多类型的脚本时,例如图形用户界面,人工智能控制等等本脚本库就显得特别有用了(原文: This is especially useful when the application works with multiple types of scripts, e.g. GUI, AI control, etc.)。

 

       脚本的函数、全局变量和类,每个模块都有它自己的作用域范围(原文: Each module has it's own scope of script functions, global variables, and classes)。即使各个模块可能组建于同一个脚本源码,它们之间通常也不会共享(原文: These are normally not shared between modules, even though multiple modules may be built from the same source scripts)。不过模块可以通过绑定函数来相互配合相互影响(原文: However modules may interact with each others through function binding.)。

 

       作为一个脚本,被编译成 字节码 AngelScript同样也提供了一个虚拟机来作为执行这些字节码的脚本环境,AngelScript同样也提供了一个虚拟机来解析脚本的上下文,来将脚本编译成字节码并执行。(原文:As the scripts are compiled into bytecode AngelScript also provides a virtual machine, also known as a script context, for executing the bytecode)。尽管大多数应用程序可能仅需要一个脚本环境,但是应用程序可以在同一时间获取许多脚本上下文(原文:The application can have any number of script context at the same time, though most applications will probably only need one.)。

 

       这个环境支持可执行体的挂起和恢复,因此,这个应用程序可以很容易的执行就好像同时执行脚本和普通程序一样(原文:The contexts support suspending the execution and then resuming it, so the application can easily implement features such as concurrent scripts and co-routines.)。脚本环境为了获取运行时信息业提供了一个接口,这对调试脚本非常有用(原文:The script context also provides an interface for extracting run-time information, useful for debugging scripts.)。

 

       AngelScript的脚本语言是在众所周知的C + +语法之上增加像Java, C#D等更现代语言的语法(原文:The script language is based on the well known syntax of C++ and more modern languages such as Java, C#, and D.)。任何人只要了解一些别的语言,或者其他有着类似语法的脚本语言,像JavascriptActionScript,再用AngelScript会有一种一见如故的感觉(Anyone with some knowledge of those languages, or other script languages with similar syntax, such as Javascript and ActionScript, should feel right at home with AngelScript.)

 

跟许多的脚本语言相反,AngelScript是一个强类型的语言,它允许更快更稳定的执行代码与宿主应用程序之间的交互会减少有类型值所需要的运行时间(原文:Contrary to most script languages, AngelScript is a strongly typed language, which permits faster execution of the code and smoother interaction with the host application as there will be less need for runtime evaluation of the true type of values.)。

        

       AngelScript的内存管理是基于一个用于检测和释放的循环引用对象来增加垃圾回收的引用计数(原文:The memory management in AngelScript is based on reference counting with an incremental garbage collector for detecting and freeing objects with circular references)。这就提供了一个可控环境,除非应用程序冻结垃圾回收机制来申请内存(原文:This provides for a controlled environment without application freezes as the garbage collector steps in to free up memory.)。

 

 

 

                                                                                                            ---------  besterChen

                                                                                                         译于2010226星期五

Feedback

# re: AngelScript 实用手册之概述  回复  更多评论   

2010-02-27 00:14 by C/C++源码论坛 (中国大学生软件开发论坛)
华为C++面试题2010年郑州大学(2010-2-24全套面试题)

转载于 C/C++源码论坛 (中国大学生软件开发论坛) 我们专注C/C++

http://www.cssdn.net/thread-8591-1-1.html">http://www.cssdn.net/thread-8591-1-1.html">http://www.cssdn.net/thread-8591-1-1.html">http://www.cssdn.net/thread-8591-1-1.html

华为C++面试题2010年郑州大学(2010-2-24全套面试题)
笔试地点 中原地区 郑州大学
1. 编写strcat函数(5分)
已知strcat函数的原型是char *strcat (char *strDest, const char *strSrc);
其中strDest 是目的字符串,strSrc 是源字符串。
(1)不调用C++/C 的字符串库函数,请编写函数 strcat
(2)strcat能把strSrc 的内容连接到strDest,为什么还要char * 类型的返回值?
2.使用线程是如何防止出现大的波峰(5)
3.队列和栈有什么区别?(9)
(请至少说出三点)
4、请找出下面代码中的所以错误(5)
说明:以下代码是把一个字符串倒序,如“abcd”倒序后变为“dcba”

1、#include"string.h"
2、main()
3、{
4、 char*src="hello,world";
5、 char* dest=NULL;
6、 int len=strlen(src);
7、 dest=(char*)malloc(len);
8、 char* d=dest;
9、 char* s=src[len];
10、 while(len--!=0)
11、 d++=s--;
12、 printf("%s",dest);
13、 return 0;
14、}
5.C++中为什么用模板类。(5)
(请至少说出三点)
...
...
...

严禁用于商业用途转载 转载请注明出去

C/C++源码论坛 (中国大学生软件开发论坛) 我们专注C/C++
http://www.cssdn.net
回复 更多评论

# re: [翻译]AngelScript 实用手册之概述  回复  更多评论   

2010-02-27 11:59 by 凡客优惠卷
很好1234566

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理