=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/asir.texi,v retrieving revision 1.16 retrieving revision 1.20 diff -u -p -r1.16 -r1.20 --- OpenXM/src/asir-doc/parts/asir.texi 2004/07/04 00:16:43 1.16 +++ OpenXM/src/asir-doc/parts/asir.texi 2020/09/08 09:16:57 1.20 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.15 2004/07/03 15:50:34 ohara Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.19 2014/03/11 01:46:19 takayama Exp $ \BJP @node ユーザ言語 Asir,,, Top @chapter ユーザ言語 Asir @@ -402,9 +402,9 @@ each element is again a vector which contains ${_I}C_J$ @end tex @end iftex -@ifinfo +@ifnottex ICJ -@end ifinfo +@end ifnottex \JP を要素とする配列である. \EG as its elements. @@ -1556,6 +1556,8 @@ def demo() @{ モジュールは入れ子にはできない. モジュールの中だけで使う大域変数は @code{static} で宣言する. この変数はモジュールの外からは参照もできないし変更もできない. +@code{static} 変数はすべての関数定義の前に宣言しないといけない. +パーサーがワンパスのため, 宣言のない変数は自動的に局所変数とみなされるからである. モジュールの外の大域変数は @code{extern} で宣言する. \E \BEG @@ -1566,7 +1568,10 @@ and A variable of a module is declared with the key word @code{static}. The static variables cannot be refered nor changed out of the module, but it can be refered and changed in any functions in the module. -A global variable which can be refered and changed at any place +The @code{static} variables must be declared before the definitions of functions, +because the one-path parser of asir automatically assume variables as local variables +if there is no declaration for them. +A global variable which can be refered and changed in or out of the module is declared with the key word @code{extern}. \E @@ -1632,7 +1637,7 @@ The below is an example of demand loading. \E @example -if (!module_definep("stack")) load("stack.rr") $ +if (!module_definedp("stack")) load("stack.rr") $ @end example \BJP @@ -1682,6 +1687,38 @@ def demo() @{ module stack; /* The body of the module stack */ endmodule; +@end example + +\BJP +モジュールの中からトップレベルで定義されている関数を呼ぶには, +下の例のように @code{::} を用いる. +\E +\BEG +In order to call functions defined in the top level from the inside +of a module, we use @code{::} as in the example below. +\E +@example +def afo() @{ + S = "afo, afo"; + return S; +@} +module abc; +localf foo,afo $ + +def foo() @{ + G = ::afo(); + return G; +@} +def afo() @{ + return "afo, afo in abc"; +@} +endmodule; +end$ + +[1200] abc.foo(); +afo, afo +[1201] abc.afo(); +afo, afo in abc @end example @table @t