-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Release' into feature/XSharpCompiler
- Loading branch information
Showing
163 changed files
with
3,627 additions
and
3,259 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?xml-stylesheet type="text/xsl" href="../helpproject.xsl" ?> | ||
<topic template="Default" lasteditedby="robert" version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../helpproject.xsd"> | ||
<topic template="Default" modified="2024-06-10T20:35:42.672+08:00" lasteditedby="Design" version="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../helpproject.xsd"> | ||
<title>ARRAY (FoxPro)</title> | ||
<body> | ||
<header> | ||
<para styleclass="Heading1">ARRAY (FoxPro)</para> | ||
</header> | ||
<para styleclass="Normal">The FoxPro dialect in X# has its own Array type. This type is not declared with an AS keyword, but the array type is derived from the context.<br/>The following lines of code all generate a FoxPro compatible array:</para> | ||
<para styleclass="Normal"></para> | ||
<para styleclass="Code Example"><text style="font-weight:bold; font-style:normal; color:#ff0000;">LOCAL</text><text style="font-weight:normal; font-style:normal; color:#000000;"> </text><text style="font-weight:bold; font-style:normal; color:#ff0000;">ARRAY</text><text style="font-weight:normal; font-style:normal; color:#000000;"> aTest(1,2)      </text><text style="font-weight:bold; font-style:italic; color:#339966;">// LOCAL ARRAY</text><br/><text style="font-weight:bold; font-style:normal; color:#ff0000;">PUBLIC</text><text style="font-weight:normal; font-style:normal; color:#000000;"> </text><text style="font-weight:bold; font-style:normal; color:#ff0000;">ARRAY</text><text style="font-weight:normal; font-style:normal; color:#000000;"> aPublicArray[10]   </text><text style="font-weight:bold; font-style:italic; color:#339966;">// PUBLIC ARRAY</text><br/><text style="font-weight:bold; font-style:normal; color:#ff0000;">DIMENSION</text><text style="font-weight:normal; font-style:normal; color:#000000;"> AnotherArray(3,4)   </text><text style="font-weight:bold; font-style:italic; color:#339966;">// DIMENSION with parentheses , but angled brackets are supported too</text><br/><text style="font-weight:bold; font-style:normal; color:#ff0000;">DECLARE</text><text style="font-weight:normal; font-style:normal; color:#000000;"> ThirdArray[10]      </text><text style="font-weight:bold; font-style:italic; color:#339966;">// DIMENSION with angled brackets, but parentheses are supported too</text></para> | ||
<para styleclass="Normal">The elements of a Foxpro compatible array are all USUAL.<br/>FoxPro arrays cannot be dynamically sized with AAdd(). To resize them you need to add a DIMENSION statement with new dimensions.</para> | ||
<para styleclass="Normal">Internally FoxPro arrays are single dimensional arrays. But you can also (re)dimension them as two dimensional. <br/>So the 3rd array in this example can also be treated as a single dimensional array of 12 elements.</para> | ||
<para styleclass="Normal">X# 中的 FoxPro 方言有自己的 Array 类型。这种类型不是用 AS 关键字声明的,而是根据上下文推导出数组类型。</para> | ||
<para styleclass="Normal"></para> | ||
<para styleclass="Normal">We advise to use angled brackets to access elements of a FoxPro array. This is not ambiguous and the compiler can resolve that at compile time.</para> | ||
<para styleclass="Normal">If you want to use parentheses to access FoxPro array elements you need to enable the <link displaytype="text" defaultstyle="true" type="topiclink" href="opt-fox2">/fox </link>compiler option. This compiler option also enables the behavior that assigning a single value to a FoxPro array will result in assigning that value to all elements in the array.</para> | ||
<para styleclass="Normal">以下代码行都生成兼容 FoxPro 的数组:</para> | ||
<para styleclass="Code Example"><text style="font-weight:bold; font-style:normal; color:#ff0000;">LOCAL</text><text style="font-weight:normal; font-style:normal; color:#000000;"> </text><text style="font-weight:bold; font-style:normal; color:#ff0000;">ARRAY</text><text style="font-weight:normal; font-style:normal; color:#000000;"> aTest(1,2)      </text><text style="font-weight:bold; font-style:italic; color:#339966;">// LOCAL ARRAY</text><br/><text style="font-weight:bold; font-style:normal; color:#ff0000;">PUBLIC</text><text style="font-weight:normal; font-style:normal; color:#000000;"> </text><text style="font-weight:bold; font-style:normal; color:#ff0000;">ARRAY</text><text style="font-weight:normal; font-style:normal; color:#000000;"> aPublicArray[10]   </text><text style="font-weight:bold; font-style:italic; color:#339966;">// PUBLIC ARRAY</text><br/><text style="font-weight:bold; font-style:normal; color:#ff0000;">DIMENSION</text><text style="font-weight:normal; font-style:normal; color:#000000;"> AnotherArray(3,4)   </text><text style="font-weight:bold; font-style:italic; color:#339966;">// DIMENSION 也支持方括号</text><br/><text style="font-weight:bold; font-style:normal; color:#ff0000;">DECLARE</text><text style="font-weight:normal; font-style:normal; color:#000000;"> ThirdArray[10]      </text><text style="font-weight:bold; font-style:italic; color:#339966;">// DECLARE 使用方括号,但也支持使用括号</text></para> | ||
<para styleclass="Normal">FoxPro 兼容数组的元素都是 USUAL 类型的。<br/>FoxPro 数组不能使用 AAdd() 动态调整大小。要调整它们的大小,需要使用 DIMENSION 语句和新的维度。</para> | ||
<para styleclass="Normal">在内部,FoxPro 数组是单维数组。但也可以将它们重新定义为二维数组。<br/>因此,这个示例中的第三个数组也可以被视为包含 12 个元素的单维数组。</para> | ||
<para styleclass="Normal"></para> | ||
<para styleclass="Normal">Internally FoxPro arrays are implemented as a class that derives from the generic XBase array type.</para> | ||
<para styleclass="Normal">So all functions in the X# runtime that take an array as parameter will also accept a FoxPro array.<br/>When there is different behavior between the FoxPro implementation of a function or the Xbase implementation then this will be handled at runtime.</para> | ||
<para styleclass="Heading3">Implementation</para> | ||
<para styleclass="Normal">The ARRAY type is implemented in the class XSharp.__FoxArray. </para> | ||
<para styleclass="Normal">The Usualtype of ARRAY has the value 5</para> | ||
<para styleclass="Normal">建议使用尖括号来访问 FoxPro 数组的元素。这样不会产生歧义,编译器可以在编译时解析。</para> | ||
<para styleclass="Normal">如果想要使用括号来访问 FoxPro 数组元素,需要启用 <link displaytype="text" defaultstyle="true" type="topiclink" href="opt-fox2">/fox</link>  编译选项。此编译选项还会启用将单个值分配给 FoxPro 数组的所有元素的行为。</para> | ||
<para styleclass="Normal"></para> | ||
<para styleclass="Normal">在内部,FoxPro 数组是作为从通用 XBase 数组类型派生的类实现的。</para> | ||
<para styleclass="Normal">因此,X# 运行时中接受数组作为参数的所有函数也将接受 FoxPro 数组。<br/>当函数的 FoxPro 实现与 Xbase 实现之间存在不同行为时,这将在运行时处理。</para> | ||
<para styleclass="Normal"></para> | ||
<para styleclass="Heading3">实现</para> | ||
<para styleclass="Normal">ARRAY 类型在类 XSharp.__FoxArray 中实现。</para> | ||
<para styleclass="Normal"></para> | ||
<para styleclass="Normal">ARRAY 的 Usualtype 值为 5</para> | ||
</body> | ||
</topic> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.