+++ /dev/null
-#################################################################################################
-#################################################################################################
-#################################################################################################
-# Stylesheet hash check subrutines
-#################################################################################################
-#################################################################################################
-#################################################################################################
-
-#################################################################################################
-# sub addcheckvalues
-# Usage: addcheckvalues($key,$uri);
-# Returns: error message or 0 if no errors found
-# Do: check if key and uri are already loaded
-# Used by: addvalues
-# Uses : err_replace
-#################################################################################################
-sub addcheckvalues
-{
- my $ac_key = shift(@_);
- my $ac_uri = shift(@_);
- if (exists $stylesheet_hash{$ac_key})
- {
- return err_replace($error{"add_dup_key"},$ac_key,$ac_uri,"");
- }
- elsif (exists $by_name{$ac_uri})
- {
- return err_replace($error{"add_dup_value"},$ac_key,$ac_uri,$by_name{$ac_key});
- }
- else { return 0; }
-}
-#################################################################################################
-
-#################################################################################################
-# sub recheckvalues
-# Usage: recheckvalues($key);
-# Returns: error message or 0 if no errors found
-# Do: check if key are loaded
-# Used by: remove, reloadvalues
-# Uses : err_replace
-#################################################################################################
-sub recheckvalues
-{
- my $re_key = shift(@_);
- if (not exists $stylesheet_hash{$re_key})
- {
- return err_replace($error{"re_inv_key"},$re_key,"","");
- }
- else { return 0; }
-}
-#################################################################################################
-
-#################################################################################################
-# sub applycheckvalues
-# Usage: applycheckvalues(\@keys);
-# Returns: error message or 0 if no errors found
-# Do: check if keys in @keys are loaded
-# Used by: remove, reloadvalues
-# Uses : err_replace
-#################################################################################################
-sub applycheckvalues
-{
- my $applykeys_ptr = shift(@_);
- foreach $applykey (@$applykeys_ptr)
- {
- if (not exists $stylesheet_hash{$applykey})
- {
- return err_replace($error{"apply_inv_key"},$applykey,"","");
- }
- }
- return 0;
-}
-#################################################################################################
-
-#################################################################################################
-#################################################################################################
-#################################################################################################
-# Stylesheet hash modify subrutines
-#################################################################################################
-#################################################################################################
-#################################################################################################
-
-#################################################################################################
-# sub addvalues
-# Usage: if add_halt_on_errors is ON addvalues($key,$uri,@added);
-# else addvalues($key,$uri)
-# Returns: error message or 0 on success,
-# if add_halt_on_errors is ON return all the added keys on @added
-# Do: add the values to the stylesheet hash
-# Used by: add
-# Uses : addcheckvalues, loadstyle
-#################################################################################################
-sub addvalues
-{
- my $av_key = shift(@_);
- my $av_uri = shift(@_);
- my $av_stylesheet; #parsed stylesheet to be placed in hash
- if (my $err = addcheckvalues($av_key,$av_uri)) { return $err; }
- elsif (my $err = loadstyle($av_key, $av_uri, $av_stylesheet)) { return $err; }
- else
- {
- $stylesheet_hash{$av_key}[0]=$av_uri;
- $stylesheet_hash{$av_key}[1]=$av_stylesheet;
- $by_name{$av_uri}=$av_key;
- return 0;
- }
-}
-#################################################################################################
-
-#################################################################################################
-# sub removevalues
-# Usage: removevalues($key);
-# Returns: message
-# Do: remove the key specified and relative values from the stylesheet hash
-# Used by: remove, do_remove
-# Uses : ok_replace
-#################################################################################################
-sub removevalues
-{
- my $cr_key = shift(@_);
- my $cr_uri = $stylesheet_hash{$cr_key}[0];
- delete $stylesheet_hash{$cr_key};
- delete $by_name{$cr_uri};
- return ok_replace("$s_remove\n",$cr_key,$cr_uri);
-}
-#################################################################################################
-
-#################################################################################################
-# sub reloadvalues
-# Usage: if add_halt_on_errors is ON reloadvalues($key.\%reloaded);
-# else reloadvalues($key);
-# Returns: error message or 0 on success,
-# if add_halt_on_errors is ON return the old stylesheets in %reloaded
-# Do: reload the stlylesheet with the key specified
-# Used by: do_reload
-# Uses : recheckvalues, loadstyle
-#################################################################################################
-sub reloadvalues
-{
- my $rv_key = shift(@_);
- my $rv_uri = $stylesheet_hash{$rv_key}[0];
- my $rv_stylesheet; #parsed stylesheet to be placed in hash
- if (my $err = recheckvalues($rv_key)) { return $err; }
- elsif (my $err = loadstyle($rv_key, $rv_uri, $rv_stylesheet)) { return $err; }
- else
- {
- $stylesheet_hash{$rv_key}[1] = $rv_stylesheet;
- return 0;
- }
-}
-#################################################################################################