From 788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 17 Feb 2000 18:02:37 +0000 Subject: Initial revision svn path=/trunk/; revision=1823 --- libical/scripts/mkrestrictionrecords.pl | 109 ++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 libical/scripts/mkrestrictionrecords.pl (limited to 'libical/scripts/mkrestrictionrecords.pl') diff --git a/libical/scripts/mkrestrictionrecords.pl b/libical/scripts/mkrestrictionrecords.pl new file mode 100755 index 0000000000..e2c62ae748 --- /dev/null +++ b/libical/scripts/mkrestrictionrecords.pl @@ -0,0 +1,109 @@ +#!/usr/bin/perl + +# Version: 1.0 +# Script last updated: 30May1999 GMD +# Change log: +# + +# usually open restrictions.csv +open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!"; + +print <) +{ + chop; + + # split line at commas + my ($method,$component,$property,$subcomponent,$restriction)=split(/\,/,$_); + + # + #put in code to generate comments here! + # + if ($method ne $last_method) + { + $need_header = 1; + $last_method = $method; + } + if ($component ne $last_component) + { + $need_header = 1; + $last_component = $component; + } + + if ($need_header) + { + print "\n\t/* METHOD: ${method}, COMPONENT: ${component} */\n"; + $need_header = 0; + } + + foreach $item ($component,$property,$subcomponent,$restriction) + { + # handle special cases. + if ($item eq "NONE") + { $item = "NO"; } + else { if (substr($item,0,1) eq "X") + { $item = "X"; }} + + # strip out dashes + $item = join("",split(/-/,$item)); + } + # strip leading V from component names + $component =~ s/^(V?)(\w+?)((SAVINGS)?)((TIME)?)$/$2/; + $subcomponent =~ s/^V(\w+)/$1/; + + print "\t\{ICAL_METHOD_${method},ICAL_${component}_COMPONENT,"; + print "ICAL_${property}_PROPERTY,ICAL_${subcomponent}_COMPONENT,"; + print "ICAL_RESTRICTION_${restriction}\},\n"; + +} + +print <