Packageshell
Classpublic class Program
InheritanceProgram Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The Program class represents the currently running application.



Public Properties
 PropertyDefined By
  AVM-only environ : Array
[static] [read-only] Get a list of all environment variables value-pair accessible by the program.
Program
  AVM-only findShell : Function = null
[static] The function to execute by default to find a shell command.
Program
  AVM-only freeMemory : Number
[static] [read-only] Part of totalMemory we aren't using.
Program
  AVM-only onExit : Function = null
[static] The function to execute by default when the AVM terminate.
Program
  AVM-only pid : int
[static] [read-only] Returns the current process id.
Program
  AVM-only privateMemory : Number
[static] [read-only] Process wide size of resident private memory.
Program
  AVM-only shell : String
[static] [read-only] Returns the default shell.
Program
  AVM-only totalMemory : Number
[static] [read-only] Amount of real memory we've aqcuired from the OS.
Program
  AVM-only workingDirectory : String
[static] Allows to get or set the current working directory of the application.
Program
Public Methods
 MethodDefined By
 Inherited
_init():*
[static]
_init
  
AVM-only abort():void
[static] Abort the program execution.
Program
  
AVM-only atExit(f:Function):void
[static] Add a function to run when the AVM terminate.
Program
  
AVM-only disposeXML(xml:XML):void
[static] Makes the specified XML object immediately available for garbage collection.
Program
  
AVM-only exec(command:String):int
[static] Executes the specified command line and returns the status code.
Program
  
AVM-only exit(status:int = -1):void
[static] Terminates the program execution.
Program
  
[static] Initiate a garbage collection (future versions will not return before completed).
Program
  
[static] Returns the number of nano seconds that have elapsed since the AMV+ started.
Program
  
[static] Returns the number of milliseconds that have elapsed since the AMV+ started.
Program
 Inherited
AS3
 Inherited
init():*
[static]
init
 Inherited
AS3
  
AVM-only open(command:String):String
[static] Executes the specified command line and returns the output.
Program
  
AVM-only pauseForGCIfCollectionImminent(imminence:Number = 0.75):void
[static] Suggest to the garbage collector that if collector's imminence exceeds imminence parameter then the collector should finish the incremental collection cycle.
Program
 Inherited
AS3
  
[static] Queue a garbage collection request.
Program
  
[static] Waits and returns all the characters entered by the user.
Program
  
[static] TODO
Program
  
[static] Store the function to execute when the AVM terminate.
Program
  
AVM-only setShell(path:String):void
[static] Allows to define a custom shell
Program
  
AVM-only sleep(ms:int):void
[static] Do nothing in this process for some time.
Program
  
AVM-only trace(a:Array):void
[static] Writes arguments to the command line and returns to the line.
Program
  
AVM-only write(s:String):void
[static] Writes a string to the command line.
Program
  
AVM-only writeLine(s:String):void
[static] Writes a string to the command line and returns to the line.
Program
Protected Methods
 MethodDefined By
 Inherited
[static]
protected
 Inherited
_setPropertyIsEnumerable(o:*, V:String, enumerable:Boolean):void
[static]
protected
Public Constants
 ConstantDefined By
  AVM-only argv : Array
[static] Contains the arguments passed to the program.
Program
  AVM-only filename : String = "unknown"
[static] Returns the program filename.
Program
 Inheritedlength : int = 1
[static]
length
  AVM-only startupDirectory : String = "unknown"
[static] The original directory when the application started.
Program
Property Detail
AVM-only environproperty
environ:Array  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Get a list of all environment variables value-pair accessible by the program.


Implementation
    public static function get environ():Array
AVM-only findShellproperty 
AVM2 static var findShell:Function = null

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The function to execute by default to find a shell command.

This is setup by the boot system.

AVM-only freeMemoryproperty 
freeMemory:Number  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Part of totalMemory we aren't using.


Implementation
    public static function get freeMemory():Number
AVM-only onExitproperty 
AVM2 static var onExit:Function = null

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The function to execute by default when the AVM terminate.

This is setup by the boot system.

AVM-only pidproperty 
pid:int  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the current process id.


Implementation
    public static function get pid():int
AVM-only privateMemoryproperty 
privateMemory:Number  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Process wide size of resident private memory.


Implementation
    public static function get privateMemory():Number
AVM-only shellproperty 
shell:String  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the default shell.


Implementation
    public static function get shell():String
AVM-only totalMemoryproperty 
totalMemory:Number  [read-only]

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Amount of real memory we've aqcuired from the OS.


Implementation
    public static function get totalMemory():Number
AVM-only workingDirectoryproperty 
workingDirectory:String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Allows to get or set the current working directory of the application.


Implementation
    public static function get workingDirectory():String
    public static function set workingDirectory(value:String):void
Method Detail
AVM-only abort()method
public static function abort():void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Abort the program execution.

This is an abnormal program exit, atexit functions will not run.

AVM-only atExit()method 
public static function atExit(f:Function):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Add a function to run when the AVM terminate.

TODO at normal program termination.

Parameters

f:Function — The function to execute.

AVM-only disposeXML()method 
public static function disposeXML(xml:XML):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Makes the specified XML object immediately available for garbage collection.

Parameters

xml:XML

AVM-only exec()method 
public static function exec(command:String):int

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Executes the specified command line and returns the status code.

Parameters

command:String

Returns
int

Example
Usage
         import shell.Program;
         
         var exitcode:int = Program.exec( "command -with -args" );
         
         trace( "exit code: " + exitcode );
         
AVM-only exit()method 
public static function exit(status:int = -1):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Terminates the program execution.

Will exits the VM with the Operating System code specified by status.

Parameters

status:int (default = -1)

AVM-only forceFullCollection()method 
public static function forceFullCollection():void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Initiate a garbage collection (future versions will not return before completed).

AVM-only getNanosecondTimer()method 
public static function getNanosecondTimer():Number

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the number of nano seconds that have elapsed since the AMV+ started.

Returns
Number
AVM-only getTimer()method 
public static function getTimer():uint

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the number of milliseconds that have elapsed since the AMV+ started.

Returns
uint
AVM-only open()method 
public static function open(command:String):String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Executes the specified command line and returns the output.

Parameters

command:String

Returns
String

Example
Usage
         import shell.Program;
         
         var output:String = Program.open( "command -with -args" );
         
         trace( "output:\n" + output );
         
AVM-only pauseForGCIfCollectionImminent()method 
public static function pauseForGCIfCollectionImminent(imminence:Number = 0.75):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Suggest to the garbage collector that if collector's imminence exceeds imminence parameter then the collector should finish the incremental collection cycle. Doing so may incur a pause.

Parameters

imminence:Number (default = 0.75) — A number between 0 and 1 where 0 means less imminent and 1 means most imminent

AVM-only queueCollection()method 
public static function queueCollection():void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Queue a garbage collection request.

AVM-only readLine()method 
public static function readLine():String

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Waits and returns all the characters entered by the user.

Returns
String
AVM-only selfCheck()method 
AVM2 static function selfCheck():Boolean

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

TODO

Returns
Boolean
AVM-only setExitListener()method 
AVM2 static function setExitListener(f:Function):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Store the function to execute when the AVM terminate.

TODO

Parameters

f:Function — The function to execute.

AVM-only setShell()method 
AVM2 static function setShell(path:String):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Allows to define a custom shell

Parameters

path:String

AVM-only sleep()method 
public static function sleep(ms:int):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Do nothing in this process for some time.

Parameters

ms:int — A timeout value in milliseconds. Negative values are taken to be zero.

AVM-only trace()method 
public static function trace(a:Array):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes arguments to the command line and returns to the line.

Parameters

a:Array

AVM-only write()method 
public static function write(s:String):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes a string to the command line.

Parameters

s:String

AVM-only writeLine()method 
public static function writeLine(s:String):void

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Writes a string to the command line and returns to the line.

Parameters

s:String

Constant Detail
AVM-only argvConstant
public static const argv:Array

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Contains the arguments passed to the program.

AVM-only filenameConstant 
public static const filename:String = "unknown"

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Returns the program filename.

AVM-only startupDirectoryConstant 
public static const startupDirectory:String = "unknown"

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

The original directory when the application started.