Prev: Module memio: In-Memory Streams and Buffers
Module system: System Related Functions
This module provides mainly information about the
m runtime system and the device
m is running on. Its functions are not guaranteed to portable, as they are tied to the
Symbian OS platform.
system.gc
• function gc() → Number
Explicitly request garbage collection, reclaiming unused memory of this process.
system.hal
• function hal(index) → Number
• function hal(index, value) → Number
Obtain device specific information. With one argument, returns the value of attribute number index. With two arguments, sets the the value of attribute number index, and returns the old value.
Throws ErrNotSupported if the attribute cannot be read (or modified).
Please refer to Symbian OS documentation for a complete list of attributes. The following table just lists a few:
| Index | Meaning |
| 5 | Machine UID |
| 11 | CPU frequency in kHz |
| 31 | Display width in pixels |
| 32 | Display height in pixels |
| 35 | Display colors |
| 68 | System language: 1=english, 2=french, 3=german, ... |
| 72 | System drive: 0=A:, 1=B:, 2=C:, ... |
| |
system.lock
• function lock() → Boolean
• function lock(locked) → Boolean
| | |
| Compatibility of function system.lock |
| Sony Ericsson phones | ErrNotSupported |
|
Without argument, returns the current key lock state of the phone: true, if the key lock is enabled, false otherwise.
With one argument, return the current key lock state, and sets the new state: with locked=true, the phones key lock is set on, with locked=false the key lock is cancelled.
system.mem
• function mem() → Number
• function mem(expression) → Number
The first form returns the size of memory for data used by m, and all its processes. This includes the 60 to 100 kBytes of application memory.
The second form returns the size of memory allocated to expression, or what would be reclaimed if expression were no longer used. If expression is an array or a class instance, this includes the memory allocated to all elements and fields of the array, recursively.
print system.mem()
→ 91984
system.gc(); // collect all garbage
print system.mem(array.create(40, 40, 0))
→ 13964
print system.gc() // reclaim array
→ 13956
|
system.reboot
• function reboot() → null
Permissions: Device
Capabilities: extended
| | |
| Compatibility of function system.reboot |
| Sony Ericsson UIQ3 phones and Symbian 5th Edition do not provide an API to reboot the phone. | ErrNotSupported |
| Sony Ericsson UIQ2 phones restart with prompting for the mode and the SIM PIN. They cannot be restarted without user intervention. |
|
Reboots the phone, i.e. restarts it without prompting for the SIM PIN. Note that this function should only be used to reset the phone into a safe state when it stops working properly.
system.shutdown
• function shutdown() → null
Permissions: Device
Capabilities: extended
| | |
| Compatibility of function system.shutdown |
| Symbian 5th Edition do not provide an API to shut down the phone. | ErrNotSupported |
|
Shuts the phone down, i.e. turns it off.
// turn the phone off if it has been idle
// longer than an hour
while true do
if ui.idletime() > 3600 * 1000 then
system.shutdown()
end;
sleep(600 * 1000) // wait for ten minutes
end
|
system.verbosegc
• function verbosegc() → Number
• function verbosegc(level) → Number
Gets and sets the verbosity level of garbage collection:
| 0 | Garbage collection works silently. This is the default. |
| 1 | Whenever garbage collection occurs, a short message with the size of the space reclaimed is printed on the console. |
| 2 | Whenever garbage collection occurs, a long message with the size and number of cells of the space in use and the space reclaimed is printed, together with the total data memory in use by m. |
| |
system.verbosegc(2);
for i=1 to 5 do
a=array.create(100, 100, 0)
end;
→ GC: used=81K/104, freed=0K/0, total=133K
GC: used=162K/205, freed=0K/0, total=214K
GC: used=162K/205, freed=81K/202, total=214K
GC: used=162K/205, freed=81K/202, total=214K
GC:&nbs
|
system Constants
• const appdir = c:\system\apps\mShell\| c:\private\a0002f97\| c:\private\e7e0cab7\
The directory where the application files are stored (of the
m shell, or of the standalone application)
• const caps = basic | extended | certified | all
The capabilities granted to this process by the operating system's security platform. Most m functions and constants require only basic capabilities. The exceptions are marked accordingly. See section * (Reference) for details about capabilities under Symbian OS.
• const dev = Device (version)
The device type and, in parentheses, the manufacturer software version. If the device name is just a hexadecimal number (e.g. 0x101fb2ae), please add a bug report citing this number and indicating the device type.
• const docdir = c:\documents\mShell\| c:\Media files\document\mShell\
The directory where the current m script (or executable) is stored.
• const mdir = c:\system\apps\mShell\| c:\resource\apps\mShell\
The directory where the m resource files are stored.
• const os = Symbian | Symbian 3rd
The operating system of the device.
• const platform = S60 | UIQ
The (Symbian) platform of the device.
Next: Module time: Time and Date Functions© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-LIB-888