X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FDevice.pm;h=81a989fa7041eab3ebba17313d3922b9d64f4bab;hb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;hp=5549f1160c7f077e7ecefd074d982c05fdc01e84;hpb=fb2bd066c2f8b34addafe48d62550e3033a59431;p=debian%2Famanda diff --git a/perl/Amanda/Device.pm b/perl/Amanda/Device.pm index 5549f11..81a989f 100644 --- a/perl/Amanda/Device.pm +++ b/perl/Amanda/Device.pm @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. @@ -51,7 +51,47 @@ sub this { package Amanda::Device; *IS_WRITABLE_ACCESS_MODE = *Amanda::Devicec::IS_WRITABLE_ACCESS_MODE; -*feature_support_flags_is_valid = *Amanda::Devicec::feature_support_flags_is_valid; + +############# Class : Amanda::Device::queue_fd_t ############## + +package Amanda::Device::queue_fd_t; +use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); +@ISA = qw( Amanda::Device ); +%OWNER = (); +%ITERATORS = (); +*swig_fd_get = *Amanda::Devicec::queue_fd_t_fd_get; +*swig_fd_set = *Amanda::Devicec::queue_fd_t_fd_set; +*swig_errmsg_get = *Amanda::Devicec::queue_fd_t_errmsg_get; +*swig_errmsg_set = *Amanda::Devicec::queue_fd_t_errmsg_set; +sub new { + my $pkg = shift; + my $self = Amanda::Devicec::new_queue_fd_t(@_); + bless $self, $pkg if defined($self); +} + +sub DESTROY { + return unless $_[0]->isa('HASH'); + my $self = tied(%{$_[0]}); + return unless defined $self; + delete $ITERATORS{$self}; + if (exists $OWNER{$self}) { + Amanda::Devicec::delete_queue_fd_t($self); + delete $OWNER{$self}; + } +} + +sub DISOWN { + my $self = shift; + my $ptr = tied(%$self); + delete $OWNER{$ptr}; +} + +sub ACQUIRE { + my $self = shift; + my $ptr = tied(%$self); + $OWNER{$ptr} = 1; +} + ############# Class : Amanda::Device::Device ############## @@ -60,22 +100,6 @@ use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); @ISA = qw( Amanda::Device ); %OWNER = (); %ITERATORS = (); -*swig_file_get = *Amanda::Devicec::Device_file_get; -*swig_file_set = *Amanda::Devicec::Device_file_set; -*swig_block_get = *Amanda::Devicec::Device_block_get; -*swig_block_set = *Amanda::Devicec::Device_block_set; -*swig_in_file_get = *Amanda::Devicec::Device_in_file_get; -*swig_in_file_set = *Amanda::Devicec::Device_in_file_set; -*swig_device_name_get = *Amanda::Devicec::Device_device_name_get; -*swig_device_name_set = *Amanda::Devicec::Device_device_name_set; -*swig_access_mode_get = *Amanda::Devicec::Device_access_mode_get; -*swig_access_mode_set = *Amanda::Devicec::Device_access_mode_set; -*swig_is_eof_get = *Amanda::Devicec::Device_is_eof_get; -*swig_is_eof_set = *Amanda::Devicec::Device_is_eof_set; -*swig_volume_label_get = *Amanda::Devicec::Device_volume_label_get; -*swig_volume_label_set = *Amanda::Devicec::Device_volume_label_set; -*swig_volume_time_get = *Amanda::Devicec::Device_volume_time_get; -*swig_volume_time_set = *Amanda::Devicec::Device_volume_time_set; sub new { my $pkg = shift; my $self = Amanda::Devicec::new_Device(@_); @@ -93,13 +117,14 @@ sub DESTROY { } } +*configure = *Amanda::Devicec::Device_configure; +*error = *Amanda::Devicec::Device_error; +*status_error = *Amanda::Devicec::Device_status_error; +*error_or_status = *Amanda::Devicec::Device_error_or_status; *read_label = *Amanda::Devicec::Device_read_label; *start = *Amanda::Devicec::Device_start; *finish = *Amanda::Devicec::Device_finish; *start_file = *Amanda::Devicec::Device_start_file; -*write_min_size = *Amanda::Devicec::Device_write_min_size; -*write_max_size = *Amanda::Devicec::Device_write_max_size; -*read_max_size = *Amanda::Devicec::Device_read_max_size; *write_block = *Amanda::Devicec::Device_write_block; *write_from_fd = *Amanda::Devicec::Device_write_from_fd; *finish_file = *Amanda::Devicec::Device_finish_file; @@ -110,8 +135,21 @@ sub DESTROY { *property_list = *Amanda::Devicec::Device_property_list; *property_get = *Amanda::Devicec::Device_property_get; *property_set = *Amanda::Devicec::Device_property_set; +*property_set_ex = *Amanda::Devicec::Device_property_set_ex; *recycle_file = *Amanda::Devicec::Device_recycle_file; -*set_startup_properties_from_config = *Amanda::Devicec::Device_set_startup_properties_from_config; +*file = *Amanda::Devicec::Device_file; +*block = *Amanda::Devicec::Device_block; +*in_file = *Amanda::Devicec::Device_in_file; +*device_name = *Amanda::Devicec::Device_device_name; +*access_mode = *Amanda::Devicec::Device_access_mode; +*is_eof = *Amanda::Devicec::Device_is_eof; +*volume_label = *Amanda::Devicec::Device_volume_label; +*volume_time = *Amanda::Devicec::Device_volume_time; +*status = *Amanda::Devicec::Device_status; +*min_block_size = *Amanda::Devicec::Device_min_block_size; +*max_block_size = *Amanda::Devicec::Device_max_block_size; +*block_size = *Amanda::Devicec::Device_block_size; +*volume_header = *Amanda::Devicec::Device_volume_header; sub DISOWN { my $self = shift; my $ptr = tied(%$self); @@ -133,13 +171,13 @@ package Amanda::Device; *ACCESS_READ = *Amanda::Devicec::ACCESS_READ; *ACCESS_WRITE = *Amanda::Devicec::ACCESS_WRITE; *ACCESS_APPEND = *Amanda::Devicec::ACCESS_APPEND; -*READ_LABEL_STATUS_SUCCESS = *Amanda::Devicec::READ_LABEL_STATUS_SUCCESS; -*READ_LABEL_STATUS_DEVICE_MISSING = *Amanda::Devicec::READ_LABEL_STATUS_DEVICE_MISSING; -*READ_LABEL_STATUS_DEVICE_ERROR = *Amanda::Devicec::READ_LABEL_STATUS_DEVICE_ERROR; -*READ_LABEL_STATUS_VOLUME_MISSING = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_MISSING; -*READ_LABEL_STATUS_VOLUME_UNLABELED = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_UNLABELED; -*READ_LABEL_STATUS_VOLUME_ERROR = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_ERROR; -*READ_LABEL_STATUS_FLAGS_MAX = *Amanda::Devicec::READ_LABEL_STATUS_FLAGS_MAX; +*DEVICE_STATUS_SUCCESS = *Amanda::Devicec::DEVICE_STATUS_SUCCESS; +*DEVICE_STATUS_DEVICE_ERROR = *Amanda::Devicec::DEVICE_STATUS_DEVICE_ERROR; +*DEVICE_STATUS_DEVICE_BUSY = *Amanda::Devicec::DEVICE_STATUS_DEVICE_BUSY; +*DEVICE_STATUS_VOLUME_MISSING = *Amanda::Devicec::DEVICE_STATUS_VOLUME_MISSING; +*DEVICE_STATUS_VOLUME_UNLABELED = *Amanda::Devicec::DEVICE_STATUS_VOLUME_UNLABELED; +*DEVICE_STATUS_VOLUME_ERROR = *Amanda::Devicec::DEVICE_STATUS_VOLUME_ERROR; +*DEVICE_STATUS_FLAGS_MAX = *Amanda::Devicec::DEVICE_STATUS_FLAGS_MAX; *PROPERTY_PHASE_BEFORE_START = *Amanda::Devicec::PROPERTY_PHASE_BEFORE_START; *PROPERTY_PHASE_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_BETWEEN_FILE_WRITE; *PROPERTY_PHASE_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_INSIDE_FILE_WRITE; @@ -173,18 +211,11 @@ package Amanda::Device; *SIZE_ACCURACY_UNKNOWN = *Amanda::Devicec::SIZE_ACCURACY_UNKNOWN; *SIZE_ACCURACY_ESTIMATE = *Amanda::Devicec::SIZE_ACCURACY_ESTIMATE; *SIZE_ACCURACY_REAL = *Amanda::Devicec::SIZE_ACCURACY_REAL; -*FEATURE_STATUS_ENABLED = *Amanda::Devicec::FEATURE_STATUS_ENABLED; -*FEATURE_STATUS_DISABLED = *Amanda::Devicec::FEATURE_STATUS_DISABLED; -*FEATURE_SURETY_BAD = *Amanda::Devicec::FEATURE_SURETY_BAD; -*FEATURE_SURETY_GOOD = *Amanda::Devicec::FEATURE_SURETY_GOOD; -*FEATURE_SOURCE_DEFAULT = *Amanda::Devicec::FEATURE_SOURCE_DEFAULT; -*FEATURE_SOURCE_DETECTED = *Amanda::Devicec::FEATURE_SOURCE_DETECTED; -*FEATURE_SOURCE_USER = *Amanda::Devicec::FEATURE_SOURCE_USER; -*FEATURE_SUPPORT_FLAGS_MAX = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_MAX; -*FEATURE_SUPPORT_FLAGS_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_MASK; -*FEATURE_SUPPORT_FLAGS_STATUS_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_STATUS_MASK; -*FEATURE_SUPPORT_FLAGS_SURETY_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_SURETY_MASK; -*FEATURE_SUPPORT_FLAGS_SOURCE_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_SOURCE_MASK; +*PROPERTY_SURETY_BAD = *Amanda::Devicec::PROPERTY_SURETY_BAD; +*PROPERTY_SURETY_GOOD = *Amanda::Devicec::PROPERTY_SURETY_GOOD; +*PROPERTY_SOURCE_DEFAULT = *Amanda::Devicec::PROPERTY_SOURCE_DEFAULT; +*PROPERTY_SOURCE_DETECTED = *Amanda::Devicec::PROPERTY_SOURCE_DETECTED; +*PROPERTY_SOURCE_USER = *Amanda::Devicec::PROPERTY_SOURCE_USER; @EXPORT_OK = (); %EXPORT_TAGS = (); @@ -198,8 +229,7 @@ Amanda::Device - interact with Amanda data-storage devices use Amanda::Device qw( :constants ); my $dev = Amanda::Device->new($device_name); - $dev->set_startup_properties_from_config(); - if ($dev->read_label() == $READ_LABEL_STATUS_SUCCESS) { + if ($dev->read_label() == $DEVICE_STATUS_SUCCESS) { print "Label on $device_name is '$dev->volume_label'\n"; } @@ -211,33 +241,12 @@ Stable =head1 Amanda::Device Objects -=head2 Instance Variables +See the wiki for descriptions of these functions. Note that C instance variables +are represented by accessor functions of the same name. =over -=item C<$file> - -=item C<$block> - -=item C<$in_file> - -=item C<$device_name> - -=item C<$access_mode> - -=item C<$is_eof> - -=item C<$volume_label> - -=item C<$volume_time> - -=back - -=head2 Methods - -See the wiki for descriptions of these functions - -=over +=item C =item C @@ -247,13 +256,7 @@ See the wiki for descriptions of these functions =item C -where C<$jobinfo> is a C (see L) - -=item C - -=item C - -=item C +where C<$jobinfo> is a C (see L) =item C @@ -261,7 +264,7 @@ Note that Perl code is not expected to handle on-device data, so there is currently no way to provide data to this function from Perl. This may change in future revisions. -=item C +=item C where C<$fd> is an integer file descriptor, not a filehandle @@ -273,7 +276,7 @@ where C<$fd> is an integer file descriptor, not a filehandle =item C -=item C +=item C where C<$fd> is an integer file descriptor, not a filehandle @@ -283,19 +286,50 @@ change in future revisions. =item C -returns a list of property names. +returns a list of properties, each represented as a hash: + + { 'access' => $access_flags, + 'name' => $property_name, + 'description' => $property_description } =item C -returns the property as the appropriate Perl type. +returns the property, with the appropriate Perl type, or undef. In array +context, returns the list C<($value, $surety, $source)>. =item C -where $value is of an appropriate type for the given property +=item C + +where C<$value> is of an appropriate type for the given property, C<$surety> is +a C<$PROPERTY_SURETY_*> constant, and C<$source> is a C<$PROPERTY_SOURCE_*> +constant. =item C -=item C +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) + +=item C (accessor function) =back @@ -304,7 +338,7 @@ where $value is of an appropriate type for the given property This module defines a large number of constants. Again, consult the wiki or C for the details on their meaning. These constants are available from the package namespace (e.g., -C), of imported with the C<:constant> +C), or imported with the C<:constant> import tag. =cut @@ -361,17 +395,17 @@ push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw(IS_WRITABLE_ACCESS_MODE); #copy symbols in DeviceAccessMode to constants push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"DeviceAccessMode"}}; -push @EXPORT_OK, qw(ReadLabelStatusFlags_to_strings); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw(ReadLabelStatusFlags_to_strings); +push @EXPORT_OK, qw(DeviceStatusFlags_to_strings); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw(DeviceStatusFlags_to_strings); -my %_ReadLabelStatusFlags_VALUES; +my %_DeviceStatusFlags_VALUES; #Convert a flag value to a list of names for flags that are set. -sub ReadLabelStatusFlags_to_strings { +sub DeviceStatusFlags_to_strings { my ($flags) = @_; my @result = (); - for my $k (keys %_ReadLabelStatusFlags_VALUES) { - my $v = $_ReadLabelStatusFlags_VALUES{$k}; + for my $k (keys %_DeviceStatusFlags_VALUES) { + my $v = $_DeviceStatusFlags_VALUES{$k}; #is this a matching flag? if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) { @@ -387,41 +421,41 @@ sub ReadLabelStatusFlags_to_strings { return @result; } -push @EXPORT_OK, qw($READ_LABEL_STATUS_SUCCESS); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_SUCCESS); +push @EXPORT_OK, qw($DEVICE_STATUS_SUCCESS); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_SUCCESS); -$_ReadLabelStatusFlags_VALUES{"SUCCESS"} = $READ_LABEL_STATUS_SUCCESS; +$_DeviceStatusFlags_VALUES{"SUCCESS"} = $DEVICE_STATUS_SUCCESS; -push @EXPORT_OK, qw($READ_LABEL_STATUS_DEVICE_MISSING); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_DEVICE_MISSING); +push @EXPORT_OK, qw($DEVICE_STATUS_DEVICE_ERROR); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_DEVICE_ERROR); -$_ReadLabelStatusFlags_VALUES{"DEVICE_MISSING"} = $READ_LABEL_STATUS_DEVICE_MISSING; +$_DeviceStatusFlags_VALUES{"DEVICE_ERROR"} = $DEVICE_STATUS_DEVICE_ERROR; -push @EXPORT_OK, qw($READ_LABEL_STATUS_DEVICE_ERROR); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_DEVICE_ERROR); +push @EXPORT_OK, qw($DEVICE_STATUS_DEVICE_BUSY); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_DEVICE_BUSY); -$_ReadLabelStatusFlags_VALUES{"DEVICE_ERROR"} = $READ_LABEL_STATUS_DEVICE_ERROR; +$_DeviceStatusFlags_VALUES{"DEVICE_BUSY"} = $DEVICE_STATUS_DEVICE_BUSY; -push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_MISSING); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_MISSING); +push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_MISSING); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_MISSING); -$_ReadLabelStatusFlags_VALUES{"VOLUME_MISSING"} = $READ_LABEL_STATUS_VOLUME_MISSING; +$_DeviceStatusFlags_VALUES{"VOLUME_MISSING"} = $DEVICE_STATUS_VOLUME_MISSING; -push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_UNLABELED); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_UNLABELED); +push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_UNLABELED); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_UNLABELED); -$_ReadLabelStatusFlags_VALUES{"VOLUME_UNLABELED"} = $READ_LABEL_STATUS_VOLUME_UNLABELED; +$_DeviceStatusFlags_VALUES{"VOLUME_UNLABELED"} = $DEVICE_STATUS_VOLUME_UNLABELED; -push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_ERROR); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_ERROR); +push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_ERROR); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_ERROR); -$_ReadLabelStatusFlags_VALUES{"VOLUME_ERROR"} = $READ_LABEL_STATUS_VOLUME_ERROR; +$_DeviceStatusFlags_VALUES{"VOLUME_ERROR"} = $DEVICE_STATUS_VOLUME_ERROR; -push @EXPORT_OK, qw($READ_LABEL_STATUS_FLAGS_MAX); -push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_FLAGS_MAX); +push @EXPORT_OK, qw($DEVICE_STATUS_FLAGS_MAX); +push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_FLAGS_MAX); -#copy symbols in ReadLabelStatusFlags to constants -push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}; +#copy symbols in DeviceStatusFlags to constants +push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"DeviceStatusFlags"}}; push @EXPORT_OK, qw(PropertyPhaseFlags_to_strings); push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw(PropertyPhaseFlags_to_strings); @@ -732,17 +766,17 @@ $_SizeAccuracy_VALUES{"REAL"} = $SIZE_ACCURACY_REAL; #copy symbols in SizeAccuracy to constants push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"SizeAccuracy"}}; -push @EXPORT_OK, qw(FeatureSupportFlags_to_strings); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw(FeatureSupportFlags_to_strings); +push @EXPORT_OK, qw(PropertySurety_to_strings); +push @{$EXPORT_TAGS{"PropertySurety"}}, qw(PropertySurety_to_strings); -my %_FeatureSupportFlags_VALUES; +my %_PropertySurety_VALUES; #Convert a flag value to a list of names for flags that are set. -sub FeatureSupportFlags_to_strings { +sub PropertySurety_to_strings { my ($flags) = @_; my @result = (); - for my $k (keys %_FeatureSupportFlags_VALUES) { - my $v = $_FeatureSupportFlags_VALUES{$k}; + for my $k (keys %_PropertySurety_VALUES) { + my $v = $_PropertySurety_VALUES{$k}; #is this a matching flag? if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) { @@ -758,61 +792,62 @@ sub FeatureSupportFlags_to_strings { return @result; } -push @EXPORT_OK, qw($FEATURE_STATUS_ENABLED); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_STATUS_ENABLED); - -$_FeatureSupportFlags_VALUES{"STATUS_ENABLED"} = $FEATURE_STATUS_ENABLED; - -push @EXPORT_OK, qw($FEATURE_STATUS_DISABLED); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_STATUS_DISABLED); - -$_FeatureSupportFlags_VALUES{"STATUS_DISABLED"} = $FEATURE_STATUS_DISABLED; +push @EXPORT_OK, qw($PROPERTY_SURETY_BAD); +push @{$EXPORT_TAGS{"PropertySurety"}}, qw($PROPERTY_SURETY_BAD); -push @EXPORT_OK, qw($FEATURE_SURETY_BAD); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SURETY_BAD); +$_PropertySurety_VALUES{"SURETY_BAD"} = $PROPERTY_SURETY_BAD; -$_FeatureSupportFlags_VALUES{"SURETY_BAD"} = $FEATURE_SURETY_BAD; +push @EXPORT_OK, qw($PROPERTY_SURETY_GOOD); +push @{$EXPORT_TAGS{"PropertySurety"}}, qw($PROPERTY_SURETY_GOOD); -push @EXPORT_OK, qw($FEATURE_SURETY_GOOD); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SURETY_GOOD); +$_PropertySurety_VALUES{"SURETY_GOOD"} = $PROPERTY_SURETY_GOOD; -$_FeatureSupportFlags_VALUES{"SURETY_GOOD"} = $FEATURE_SURETY_GOOD; +#copy symbols in PropertySurety to constants +push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"PropertySurety"}}; -push @EXPORT_OK, qw($FEATURE_SOURCE_DEFAULT); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SOURCE_DEFAULT); +push @EXPORT_OK, qw(PropertySource_to_strings); +push @{$EXPORT_TAGS{"PropertySource"}}, qw(PropertySource_to_strings); -$_FeatureSupportFlags_VALUES{"SOURCE_DEFAULT"} = $FEATURE_SOURCE_DEFAULT; +my %_PropertySource_VALUES; +#Convert a flag value to a list of names for flags that are set. +sub PropertySource_to_strings { + my ($flags) = @_; + my @result = (); -push @EXPORT_OK, qw($FEATURE_SOURCE_DETECTED); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SOURCE_DETECTED); + for my $k (keys %_PropertySource_VALUES) { + my $v = $_PropertySource_VALUES{$k}; -$_FeatureSupportFlags_VALUES{"SOURCE_DETECTED"} = $FEATURE_SOURCE_DETECTED; + #is this a matching flag? + if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) { + push @result, $k; + } + } -push @EXPORT_OK, qw($FEATURE_SOURCE_USER); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SOURCE_USER); +#by default, just return the number as a 1-element list + if (!@result) { + return ($flags); + } -$_FeatureSupportFlags_VALUES{"SOURCE_USER"} = $FEATURE_SOURCE_USER; + return @result; +} -push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_MAX); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_MAX); +push @EXPORT_OK, qw($PROPERTY_SOURCE_DEFAULT); +push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_DEFAULT); -push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_MASK); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_MASK); +$_PropertySource_VALUES{"SOURCE_DEFAULT"} = $PROPERTY_SOURCE_DEFAULT; -push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_STATUS_MASK); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_STATUS_MASK); +push @EXPORT_OK, qw($PROPERTY_SOURCE_DETECTED); +push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_DETECTED); -push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_SURETY_MASK); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_SURETY_MASK); +$_PropertySource_VALUES{"SOURCE_DETECTED"} = $PROPERTY_SOURCE_DETECTED; -push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_SOURCE_MASK); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_SOURCE_MASK); +push @EXPORT_OK, qw($PROPERTY_SOURCE_USER); +push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_USER); -push @EXPORT_OK, qw(feature_support_flags_is_valid); -push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw(feature_support_flags_is_valid); +$_PropertySource_VALUES{"SOURCE_USER"} = $PROPERTY_SOURCE_USER; -#copy symbols in FeatureSupportFlags to constants -push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"FeatureSupportFlags"}}; +#copy symbols in PropertySource to constants +push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"PropertySource"}}; # SWIG produces a sub-package for the Device "class", in this case named