当前位置:文档之家› PFC手册fish翻译中英文.讲义

PFC手册fish翻译中英文.讲义

2 FISH REFERENCE2.1 Introduction and Overview简介和概述This section contains a detailed reference to the FISH language. Following the introduction, Section2.2 describes the rules of the language and how variables and functions are used. Section 2.3explains FISH statements and Section 2.4 describes how the FISH language links with PFC2D. Pre-defined FISH variables, functions and arrays are described in Section 2.5.这部分包含FISH语言的详细参考。

接下来,2.2描述语言规则及如何运用变量和函数。

2.3解释FISH 陈述。

2.4描述FISH语言如何与PFC联系在一起。

2.5讲述如何预定义FISH变量、函数和数列。

FISH is a programming language embedded within PFC2D that enables the user to define new variables and functions. These functions may be used to extend PFC2D’s usefulness or add use r defined features. For example, new variables may be plotted or printed, special particle generators may be implemented, servo-control may be applied to a numerical test, unusual distributions of properties may be specified, and parameter studies may be automated.FISH是PFC内置的一种编程语言,用户可以自定义变量和函数。

这些函数可用来扩展PFC的功能,或者增加用户定义的特征。

例如:输出或者打印新的变量、实现特殊的颗粒生成、数值测试中中应用伺服控制、定义特殊的颗粒分布以及自动研究参数。

FISH is a “compiler” (rather than an “interpreter”). Programs entered via a PFC2D data file are translated into a list of instructions (in “pseudo-code”) stored in PFC2D’s memory space; the original source program is not retained by PFC2D. Whenever a FISH function is invoked, its compiled pseudo-code is executed. The use of compiled code — rather than interpreted source code —enables programs to run much faster. However, unlike a compiler, variable names and values are available for printing at any time; values may be modified by the user by using PFC2D’s SET command.FISH是一个编程员,而不是一个翻译员。

通过PFC数据文件输入的程序转化成一连串命令(以“pseudo 指令”的形式)储存在PFC的存储空间。

PFC没有保留初始源程序。

无论何时援引FISH函数,其编好的pseudo 指令执行。

编好的指令—不是翻译好的源指令—的作用是使得程序更快的运行。

然而,不像编程员那样,FISH在任何时间都可以打印变量的名字和数值,用户可以通过PFC中的SET命令修改数值。

FISH programs are simply embedded in a normal PFC2D data file — lines following the word DEFINE are processed as a FISH function; the function terminates when the word END is encountered. Functions may invoke other functions, which may invoke others, and so on. The order in which functions are defined does not matter, as long as they are all defined before they are used (e.g., invoked by a PFC2D command). Since the compiled form of a FISH function is stored in PFC2D’s memory space, the SAVE command saves the function and the current values of associated variables.FISH程序简单的包含在正常的PFC数据文件里—DIFINE 后边的命令行按FISH函数处理;函数以遇到END为结尾。

函数也许会援引其他函数,其它函数亦会援引其他函数等等。

函数定义的顺序没有影响。

因为FISH函数的程序形式储存在PFC的存储空间,SAVE命令会存储函数及相关变量的当值。

A summary of FISH language and intrinsic names is provided in Section 2 in the Command and FISH Reference Summary.在Command and FISH Reference Summary.的第二章提供FISH语言及其内在名字的总结。

2.2 FISH Language Rules, Variables and FunctionsFISH语言规则,变量及函数2.2.1 Lines 命令行FISH programs can be embedded in a normal PFC2D data file or may be entered directly from the keyboard. Lines following the word DEFINE are taken to be statements of a FISH function; the function terminates when the word END is encountered. A valid line of FISH code must take one of the following forms.FISH程序包含在普通的PFC数据文件中或者直接从键盘键入。

DIFINE 后边的命令行按FISH函数处理;函数以遇到END为结尾。

FISH的有效命令行必须是下述格式中的一种。

1. The line starts with a statement, such as IF, LOOP, etc. (see Section2.3).2. The line contains one or more names of user-defined FISH functions, separatedby spaces — e.g.,fun 1 fun 2 fun 3where the names correspond to functions written by the user. These functionsare executed in order. The functions need not be defined prior to their referenceon a line of FISH code (i.e., forward references are allowed).3. The line consists of an assignment statement (i.e., the expression on the rightof the = sign is evaluated and the value given to the variable or function nameon the left of the = sign).4. The line consists of a PFC2D command, provided that the line is embedded in asection of FISH code delimited by the COMMAND –ENDCOMMAND statements(see Section 2.3.3).5. The line is blank or starts with a semicolon.1.命令用IF,LOOP等开始。

(见2.3)2.如果一行包含一个或更多用户定义FISH函数的名字,以空格号隔开。

例如fun_1 fun_2 fun_3名字与用户所写的函数相对应,这些函数有序执行。

一行FISH指令中,函数没有必要比其参考前定义。

(即允许参考在前面)3.命令行包含指派声明(例如等号右边的数学式被运算且其值赋予给等号左边的函数名称或是变量)4.命令行由PFC命令组成,通过COMMAND—ENDCOMMAND 分隔FISH 指令。

命令行包含在FISH指令的一部分里面。

5.命令行以分号开始或者结束。

FISH variables, function names and statements must be spelled out in full; they cannot be truncated, as in PFC2D commands. No continuation lines are allowed; intermediate variables may be used to split complex expressions. FISH is “case-insensitive” by default — i.e., it makes no distinction between upper case and lowercase letters; all names are converted to lowercase letters. (Note that this can be changed with the command SET case sensitivity on.) Spaces are significant (unlike inFORTRAN) and serve to separate variables, keywords, and so on; no embedded blanks are allowed in variable or function names. Extra spaces may be used to improve readability—for example, by indenting loops and conditional clauses. Any characters following a semicolon ( ; ) are ignored; comments may be embedded in a FISH program by preceding them with a semicolon. Blank lines may be embedded in a FISH program.函数的变量,函数名称或者声明必须完整拼写,在PFC命令中不能缩写。

相关主题