aboutsummaryrefslogtreecommitdiffstats
path: root/libical/scripts/mkrestrictiontable.pl
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-02-18 02:02:37 +0800
committerSeth Alves <alves@src.gnome.org>2000-02-18 02:02:37 +0800
commit788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b (patch)
treef5f14715c1c0aede7eb872eda7166cd3ddcd7e3b /libical/scripts/mkrestrictiontable.pl
parentb39cda14b7678b925a6e3e645b60fb9858fdfaf6 (diff)
downloadgsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.tar
gsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.tar.gz
gsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.tar.bz2
gsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.tar.lz
gsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.tar.xz
gsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.tar.zst
gsoc2013-evolution-788bcf6373185aa29f8e2f83ad48cb10bf6e8a9b.zip
Initial revision
svn path=/trunk/; revision=1823
Diffstat (limited to 'libical/scripts/mkrestrictiontable.pl')
-rwxr-xr-xlibical/scripts/mkrestrictiontable.pl86
1 files changed, 86 insertions, 0 deletions
diff --git a/libical/scripts/mkrestrictiontable.pl b/libical/scripts/mkrestrictiontable.pl
new file mode 100755
index 0000000000..c91f3d0bc4
--- /dev/null
+++ b/libical/scripts/mkrestrictiontable.pl
@@ -0,0 +1,86 @@
+#!/usr/bin/perl
+
+use Getopt::Std;
+getopts('i:');
+
+# the argument should be the path to the restriction datafile, usually
+# design-data/restrictions.csv
+open(F,"$ARGV[0]") || die "Can't open restriction data file $ARGV[0]:$!";
+
+# Write the file inline by copying everything before a demarcation
+# line, and putting the generated data after the demarcation
+
+if ($opt_i) {
+
+ open(IN,$opt_i) || die "Can't open input file $opt_i";
+
+ while(<IN>){
+
+ if (/Do not edit/){
+ last;
+ }
+
+ print;
+
+ }
+
+ print "/* Everything below this line is machine generated. Do not edit. */\n";
+
+
+ close IN;
+}
+
+print "icalrestriction_property_record icalrestriction_property_records[] = {\n";
+
+while(<F>)
+{
+
+ chop;
+
+ s/\#.*$//;
+
+ my($method,$targetcomp,$prop,$subcomp,$restr,$sub) = split(/,/,$_);
+
+ next if !$method;
+
+ if(!$sub) {
+ $sub = "0";
+ }
+
+ if($prop ne "NONE"){
+ print(" \{ICAL_METHOD_${method},ICAL_${targetcomp}_COMPONENT,ICAL_${prop}_PROPERTY,ICAL_RESTRICTION_${restr},$sub\},\n");
+ }
+
+}
+
+
+print " {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE}\n";
+
+print "};\n";
+
+print "icalrestriction_component_record icalrestriction_component_records[] = {\n";
+
+
+close(F);
+open(F,"$ARGV[0]") || die "Can't open restriction data file $ARGV[0]:$!";
+
+while(<F>)
+{
+
+ chop;
+
+ s/\#.*$//;
+
+ my($method,$targetcomp,$prop,$subcomp,$restr) = split(/,/,$_);
+
+ next if !$method;
+
+
+ if($subcomp ne "NONE"){
+ print(" \{ICAL_METHOD_${method},ICAL_${targetcomp}_COMPONENT,ICAL_${subcomp}_COMPONENT,ICAL_RESTRICTION_${restr}\},\n");
+ }
+
+}
+
+print " {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE}\n";
+print "};\n";