NAME
sys.ops - System Interaction Opcodes
DESCRIPTION
Operations that allow the user to interact with the system.
- spawnw(out INT, in STR) Spawn a subprocess whose program name and arguments are contained in the string $2 and wait for it to finish. The return status, which is very system-dependent, goes in $1.
- spawnw(out INT, invar PMC) Spawn a subprocess whose program name and arguments are contained in the array $2 and wait for it to finish. The return status, which is very system-dependent, goes in $1.TT #847:
- err(out INT) Store the system error code in $1.
- err(out STR) Store the system error message in $1.
- err(out STR, in INT) Get the system error message for the system error code $2 and store it in $1.
- time(out INT) Puts the current system time (represented as a whole number of seconds) in $1.
- time(out NUM) Puts the current system time (represented as a number of seconds, with microseconds) in $1.
- gmtime(out STR, in INT) Take the integer, which represents GMT epoch-seconds, and turn it into a formatted string.
- localtime(out STR, in INT) Take the integer, which represents GMT epoch-seconds, and turn it into a formatted string. The time is adjusted to localtime before formatting.
- decodetime(out PMC, in INT) Take the integer, which represents GMT epoch-seconds, and return an Array PMC which represents the decoded time. The array elements are (include "tm.pasm" for the constants):
- 0, .TM_SEC Seconds (0-60)
- 1, .TM_MIN Minutes (0-59)
- 2, .TM_HOUR Hours (0-23)
- 3, .TM_MDAY Day of month (1-31)
- 4, .TM_MON Month of year (1-12) (Note, actual month, not month - 1)
- 5, .TM_YEAR Year (note, actual year. The year 2004 comes back as 2004, not 104)
- 6, .TM_WDAY Day of week. Sunday is day 0
- 7, .TM_YDAY Day of year (0-365)
- 8, .TM_ISDST Daylight savings/summer time in effect
- decodelocaltime(out PMC, in INT) Take the passed in integer, which represents GMT epoch-seconds, and return an array as in decodetime. The time is first shifted to localtime before decoding.
- sysinfo(out STR, in INT)
- sysinfo(out INT, in INT) Return system information. The values it returns depends on what you ask. They are:
- 1 The size of a platform integer
- 2 The size of a platform float
- 3 The size of a platform pointer. (Largest possible data pointer)
- 4 The OS name This is something like "OS X", "MacOS", "Windows", or "VMS".
- 5 The OS version string This is the current (hopefully) OS Version. For OSes that have plain version numbers it will be the version number. For OSes that name their versions, it will be the version name.On HP/UX, this may be something like 11.2, while on Windows it may be "95", "98", "2000", "NT", "ME", or "XP".
- 6 The OS version number string On OSes that don't name themselves, this will be the same as what's returned in the OS version string. On OSes that do name themselves, this will be a more specific version number. In all cases it is OS dependent.
- 7 The CPU architecture The name of the CPU family, such as "VAX", "Alpha", "PPC", or "x86".
- 8 The CPU model The model name of the current system's CPU. This is something like "EV68", "Athlon", or "Pentium III".
- sleep(in INT)
- sleep(in NUM) Sleep for $1 seconds.
- sizeof(out INT, in INT) Get the size of native datatype $2 in $1.
spawnw()
should itself handle splitting up command-line arguments,
rather than depending on the shell to do so in potentially unsafe manner.
See https://trac.parrot.org/parrot/ticket/847.TT #848: spawnw()
should return something less system-dependent,
and more object-like.
See https://trac.parrot.org/parrot/ticket/848.
COPYRIGHT
Copyright (C) 2001-2009, Parrot Foundation.
LICENSE
This program is free software. It is subject to the same license as the Parrot interp itself.