var.ops - Variable Ops
These operations deal with both lexical and global variables,
as well as the symbol tables that contain them.
Operations to create,
modify and delete lexical variables.
- new_pad(in INT)
- Create a new lexical scope pad with static nesting depth $1 and push it onto the lexical scope stack.
Static depths 0 through $1 - 1,
inclusive,
are copied from the current static nesting.
- new_pad(out PMC,
in INT)
- Create a new lexical scope pad with static nesting depth $2 and store it in $1 (do NOT push on the stack).
Static depths 0 through $2 - 1,
inclusive,
are copied from the current static nesting.
- push_pad(in PMC)
- Push the scratchpad in $1 onto the lexical scope stack.
- pop_pad()
- Pop the current lexical scope pad off the stack
- pop_pad(out PMC)
- Pop the current lexical scope pad off the stack and store it in $1
- peek_pad(out PMC)
- Store the current lexical scope pad (i.e.
the one at the top of the lexical pad stack) in $1.
- store_lex(in STR,
in PMC)
- Store object $2 as lexical symbol $1.
$1 must have already been created at some static depth.
- store_lex(in INT,
in STR,
in PMC)
- Store object $3 as lexical $2 at depth $1.
If [$1,
$2] does not exist,
it will be created.
If $1 is negative,
count out from the current lexical scope; otherwise,
count in from the outermost scope.
So store_lex -1,
....
will operate on the current pad.
Lexicals can be retrieved by index too: the index is generated in storage order.
- store_lex(in INT,
in INT,
in PMC)
- Store object $3 at lexical position $2 at depth $1.
If [$1,
$2] does not exist,
it will be created.
If $1 is negative,
count out from the current lexical scope; otherwise,
count in from the outermost scope.
So store_lex -1,
....
will operate on the current pad.
Lexicals stored by index can only be retrieved by this index.
- find_lex(out PMC,
in STR)
- Find the lexical variable named $2 (at any depth) and store it in $1.
- find_lex(out PMC,
in INT,
in STR)
- Find the lexical variable named $3 at depth $2 and store it in $1.
If $2 is negative,
then count out from the current lexical scope; otherwise,
count up from the outermost scope.
- find_lex(out PMC,
in INT)
- Find the lexical number $2 at the topmost pad.
- find_lex(out PMC,
in INT,
in INT)
- Find the lexical variable at position $3 at depth $2 and store it in $1.
If $2 is negative,
then count out from the current lexical scope; otherwise,
count up from the outermost scope.
Operations to modify global variables
- store_global(in STR,
in PMC)
- Store global $2 as global symbol $1
- store_global(in STR,
in STR,
in PMC)
- Store global $3 as global symbol $2 in namespace $1.
If namespace $1 doesn't exist it is created.
- store_global(in PMC,
in STR,
in PMC)
- Store global $3 as global symbol $2 in namespace $1.
- find_global(out PMC,
in STR)
- Find the global named $2 and store it in $1.
If the global doesn't exist either throws an exception or sets $1 to undef,
depending on current errors settings,
s.
errorson.
- find_global(out PMC,
in STR,
in STR)
- Find the global named $3 in namespace $2 and store it in $1.
If the global doesn't exist either throws an exception or sets $1 to undef,
depending on current errors settings,
s.
errorson.
- If $3 is NULL the namespace hash for namespace $2 is returned.
- find_global(out PMC,
in PMC,
in STR)
- Find the global named $3 in the namespace specified by $2 and store it in $1.
If the global doesn't exist either throws an exception or sets $1 to undef,
depending on current errors settings,
s.
errorson.
Copyright (C) 2001-2004 The Perl Foundation.
All rights reserved.
This program is free software.
It is subject to the same license as the Parrot interpreter itself.