SoFunction
Updated on 2025-04-14

WMLScript script programming


5.3 Pre-compiled
Precompilation of WML Script is mainly used to control the behavior of the compiler during the compilation stage. As compilation headers are generally specified at the beginning of the file and before the function declaration, WML Script stipulates that all precompiled headers are specified with the specified precompilation attribute.
In most programming, our relatively long-term precompilation behavior mainly involves external file declarations, access rights and meta information settings.
5.3.1 External files
We know that using URL addresses can locate a WML Script file. Use this URL address; in WML Script programming, we can call the external files of WML Script through precompilation. The declaration method of the precompilation header of the external file is use url, and its syntax format is as follows:
use url external file name "URL" address
In this way, we can use the external file declared by the precompiled header in the programming of the current file, so that the functions of the external file can be called. Its syntax format is:
External file name #function name (parameter list);
For example, we want to call the check() function in the otherScript external file in the current WML Script program, and we know that the URL address of the OtherScript file is /app/script. Therefore, we can use the use url to declare this external file:
use url OtherScript"/script"
Then, we can call the check() function in OtherScript in the program:
function test(par1,par2)
{
return OtherScript#check(par1,parr2);
};
The process of invoking execution is as follows:
(1) Find the URL address of the WML Script external file;
(2) The current function loads an external file from the specified URL address value;
(3) Detect the content of the external file and execute the check() function in it.
ure url The external file name specified by the precompiled header must be unique in the current program. The user cannot specify external files with the same name with different URL addresses, otherwise chaos will occur when calling the external file.
In addition, the URL address in the use url precompiled header can also be a relative URL address. The starting position of the relative URL is the location where the current program file is located, and it is positioned based on the URL.
If the characters in the URL address contain escaped characters, WML Script will escape according to the escape requirements. However, when the program is compiled, the compiler does not escape them, but completes it when the program is executed, checking the validity of the URL format and URL address.
5.3 Pre-compiled
Precompilation of WML Script is mainly used to control the behavior of the compiler during the compilation stage. As compilation headers are generally specified at the beginning of the file and before the function declaration, WML Script stipulates that all precompiled headers are specified with the specified precompilation attribute.
In most programming, our relatively long-term precompilation behavior mainly involves external file declarations, access rights and meta information settings.
5.3.1 External files
We know that using URL addresses can locate a WML Script file. Use this URL address; in WML Script programming, we can call the external files of WML Script through precompilation. The declaration method of the precompilation header of the external file is use url, and its syntax format is as follows:
use url external file name "URL" address
In this way, we can use the external file declared by the precompiled header in the programming of the current file, so that the functions of the external file can be called. Its syntax format is:
External file name #function name (parameter list);
For example, we want to call the check() function in the otherScript external file in the current WML Script program, and we know that the URL address of the OtherScript file is /app/script. Therefore, we can use the use url to declare this external file:
use url OtherScript"/script"
Then, we can call the check() function in OtherScript in the program:
function test(par1,par2)
{
return OtherScript#check(par1,parr2);
};
The process of invoking execution is as follows:
(1) Find the URL address of the WML Script external file;
(2) The current function loads an external file from the specified URL address value;
(3) Detect the content of the external file and execute the check() function in it.
ure url The external file name specified by the precompiled header must be unique in the current program. The user cannot specify external files with the same name with different URL addresses, otherwise chaos will occur when calling the external file.
In addition, the URL address in the use url precompiled header can also be a relative URL address. The starting position of the relative URL is the location where the current program file is located, and it is positioned based on the URL.
If the characters in the URL address contain escaped characters, WML Script will escape according to the escape requirements. However, when the program is compiled, the compiler does not escape them, but completes it when the program is executed, checking the validity of the URL format and URL address.