X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=helm%2Fhxsp%2Fsplitted%2F4.hash.p.pl;fp=helm%2Fhxsp%2Fsplitted%2F4.hash.p.pl;h=0000000000000000000000000000000000000000;hp=e3b1fc140f5554b4b3a366562d8a195b25bebd5a;hb=1696761e4b8576e8ed81caa905fd108717019226;hpb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1 diff --git a/helm/hxsp/splitted/4.hash.p.pl b/helm/hxsp/splitted/4.hash.p.pl deleted file mode 100644 index e3b1fc140..000000000 --- a/helm/hxsp/splitted/4.hash.p.pl +++ /dev/null @@ -1,150 +0,0 @@ -################################################################################################# -################################################################################################# -################################################################################################# -# 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; - } -} -#################################################################################################