home / experts / javascript / column62 |
|
Compilation Units and PragmasWMLScript is a compiled language and uses Compilation Units and Pragmas. A certain application may include separate scripts that were individually and independently compiled. A compilation unit can call functions that are defined in another compilation unit. WMLScript uses pragmas to identify other compilation units that it uses. The
The sequence of operations that take place here is fairly intuitive. The Once the file is found, the function call Another type of pragma is the access control pragma. Every compilation unit can have only one access control pragma. The access control pragram specify which URLs can call the external functions in the access-controlled compilation unit. The syntax of access control pragma may be specified in any one of the following forms:
The referring compilation unit's URL must match the access control specification. A URL consists of a domain name and a path. The referring compilation unit's domain name is matched with the access domain specification, while the compilation unit's path is matched with the access path specification. The domain matching is guided by two principles. First, they are suffix matched, i.e. matching is done from right to left. Secondly, entire sub-domain elements mush match. Given the following access control for a compilation unit:
The following URLs would be allowed to call the external function in the access-controlled compilation unit above:
But the following URLs would not be allowed to call the external functions:
As you can notice, the access path is prefix-matched, i.e. from left to right. The same principles hold here as well, including that entire sub elements must be matched. The path The third type of pragmas is the meta information pragma. It conveys information between different players of the wireless communication: originating servers, connecting servers, and user agents. The name meta pragma may be used by the originating servers for different kind of information. Here is an example:
The HTTP equiv meta pragma is used to specify HTTP header information for those mediating servers that transfer the compilation unit. Here is an example:
And finally, the user agent should also be able to receive information from the server. Here is an example:
Next: How to read the Mortgage example |
Produced by Yehuda Shiran and Tomer Shiran
Created: May 22, 2000
Revised: May 22, 2000
URL: http://www.webreference.com/js/column62/4.html