=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/asir.texi,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- OpenXM/src/asir-doc/parts/asir.texi 2000/01/26 01:37:32 1.4 +++ OpenXM/src/asir-doc/parts/asir.texi 2000/09/23 07:53:24 1.5 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.3 1999/12/21 02:47:31 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.4 2000/01/26 01:37:32 noro Exp $ \BJP @node ユーザ言語 Asir,,, Top @chapter ユーザ言語 Asir @@ -254,6 +254,7 @@ comprehensible than use of structure like C programs. * return 文:: * if 文:: * ループ break return continue:: +* 構造体定義:: * さまざまな式:: * プリプロセッサ:: * オプション指定:: @@ -267,6 +268,7 @@ comprehensible than use of structure like C programs. * return statement:: * if statement:: * loop break return continue:: +* structure definition:: * various expressions:: * preprocessor:: * option:: @@ -988,6 +990,46 @@ statement, and the termination condition will be evalu @code{while} statement. \E @end itemize + +\BJP +@node 構造体定義,,, ユーザ定義函数の書き方 +@subsection 構造体定義 +\E +\BEG +@node structure definition,,, Writing user defined functions +@subsection structure definition +\E + +\BJP +構造体とは, 各成分の要素が名前でアクセスできる固定長配列と思ってよい. +各構造体は名前で区別される. 構造体は, @code{struct} 文により宣言される. +ある型の構造体は, 組み込み関数 @code{newstruct} により生成される. +構造体の各メンバは, 演算子 @code{->} によりアクセスする. +メンバが構造体の場合, @code{->} による指定は入れ子にできる. +\E + +\BEG +A structure data type is a fixed length array and each component of the array +is accessed by its name. Each type of structure is distinguished by its name. +A structure data type is declared by @code{struct} statement. +A structure object is generated by a builtin function @code{newstruct}. +Each member of a structure is accessed by an operatator @code{->}. +If a member of a structure is again a structure, then the specification +by @code{->} can be nested. +\E + +@example +[1] struct rat @{num,denom@}; +0 +[2] A = newstruct(rat); +@{0,0@} +[3] A->num = 1; +1 +[4] A->den = 2; +2 +[5] A; +@{1,2@} +@end example \BJP @node さまざまな式,,, ユーザ定義函数の書き方