Populate %targets out of new_action()

This commit is contained in:
Tom Eastep 2010-12-31 10:36:07 -08:00
parent 6c14c76ab5
commit 1bdaf862d3

View File

@ -158,6 +158,18 @@ sub normalize_action_name( $ ) {
normalize_action( $action, $loglevel, '' ); normalize_action( $action, $loglevel, '' );
} }
#
# Define an Action
#
sub new_action( $$ ) {
my ( $action , $type ) = @_;
$actions{$action} = { actchain => '', active => 0 };
$targets{$action} = $type;
}
# #
# Create and record a log action chain -- Log action chains have names # Create and record a log action chain -- Log action chains have names
# that are formed from the action name by prepending a "%" and appending # that are formed from the action name by prepending a "%" and appending
@ -180,7 +192,7 @@ sub createlogactionchain( $$$$$ ) {
validate_level $level; validate_level $level;
$actionref = new_action $action unless $actionref; $actionref = new_action( $action , ACTION ) unless $actionref;
$chain = substr $chain, 0, 28 if ( length $chain ) > 28; $chain = substr $chain, 0, 28 if ( length $chain ) > 28;
@ -395,16 +407,6 @@ sub isolate_basic_target( $ ) {
$target =~ /^(\w+)[(].*[)]$/ ? $1 : $target; $target =~ /^(\w+)[(].*[)]$/ ? $1 : $target;
} }
#
# Define an Action
#
sub new_action( $ ) {
my $action = $_[0];
$actions{$action} = { actchain => '', active => 0 };
}
# #
# Map pre-3.0 actions to the corresponding Macro invocation # Map pre-3.0 actions to the corresponding Macro invocation
# #
@ -690,7 +692,7 @@ sub process_actions1() {
# #
# Add built-in actions to the target table and create those actions # Add built-in actions to the target table and create those actions
# #
$targets{$_} = ACTION + BUILTIN, new_action( $_ ) for @builtins; $targets{$_} = new_action( $_ , ACTION + BUILTIN ) for @builtins;
for my $file ( qw/actions.std actions/ ) { for my $file ( qw/actions.std actions/ ) {
open_file $file; open_file $file;
@ -712,9 +714,7 @@ sub process_actions1() {
fatal_error "Invalid Action Name ($action)" unless "\L$action" =~ /^[a-z]\w*$/; fatal_error "Invalid Action Name ($action)" unless "\L$action" =~ /^[a-z]\w*$/;
new_action $action; new_action $action, ACTION;
$targets{$action} = ACTION;
my $actionfile = find_file "action.$action"; my $actionfile = find_file "action.$action";