diff options
Diffstat (limited to 'libical/scripts')
-rwxr-xr-x | libical/scripts/mkderivedcomponents.pl | 143 | ||||
-rwxr-xr-x | libical/scripts/mkderivedparameters.pl | 272 | ||||
-rwxr-xr-x | libical/scripts/mkderivedproperties.pl | 286 | ||||
-rwxr-xr-x | libical/scripts/mkderivedvalues.pl | 303 | ||||
-rwxr-xr-x | libical/scripts/mkparameterrestrictions.pl | 85 | ||||
-rwxr-xr-x | libical/scripts/mkrestrictionrecords.pl | 109 | ||||
-rwxr-xr-x | libical/scripts/mkrestrictiontable.pl | 86 |
7 files changed, 0 insertions, 1284 deletions
diff --git a/libical/scripts/mkderivedcomponents.pl b/libical/scripts/mkderivedcomponents.pl deleted file mode 100755 index 3599a8d465..0000000000 --- a/libical/scripts/mkderivedcomponents.pl +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/local/bin/perl - -use Getopt::Std; -getopts('chsp'); - - -# ARG 0 is components.txt -open(PV,"$ARGV[0]") || die "Can't open components file $ARGV[0]:$!"; - -my @components; - -while (<PV>){ - - chop; - - push(@components,$_); - -} - -close PV; - -if ($opt_c or $opt_h){ - -print <<EOM; -/* -*- Mode: C -*- - ====================================================================== - FILE: icalderivedproperties.{c,h} - CREATOR: eric 09 May 1999 - - \044Id:\044 - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - -/* - * THIS FILE IS MACHINE GENERATED DO NOT EDIT - */ - -#include <stdarg.h> /* for va_arg functions */ - -EOM - -} - -if ($opt_p){ - -print <<EOM; - -EOM - -} - - -foreach $comp (@components) { - - next if !$comp; - - my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$comp)); - my $lc = lc($ucf); - my $uc = uc($lc); - - if($opt_c) { # Make C source - print<<EOM; - -/* $comp */ - -icalcomponent* icalcomponent_new_${lc}() -{ - return (icalcomponent*)icalcomponent_new_impl(ICAL_${uc}_COMPONENT); -} - -icalcomponent* icalcomponent_vanew_${lc}(...) -{ - va_list args; - struct icalcomponent_impl *impl = icalcomponent_new_impl(ICAL_${uc}_component); - - va_start(args,v); - icalcomponent_add_properties(impl, args); - va_end(args); - - return (icalcomponent*)impl; -} - -EOM - - - } elsif ($opt_h) { # Make a C header - print<<EOM; - -/* $comp */ -icalcomponent* icalcomponent_new_${lc}(); -icalcomponent* icalcomponent_vanew_${lc}(...); -EOM - -} elsif ($opt_s) { # Make something for a switch statement - -print <<EOM; -case ICAL_${uc}_PROPERTY: -EOM - -} elsif ($opt_p) { # make perl source - -print <<EOM; - -# $comp -package Net::ICal::Component::${ucf}; -\@ISA=qw(Net::ICal::Component); - -sub new -{ - my \$package = shift; - my \$c = Net::ICal::icalcomponent_new(\$Net::ICal::ICAL_${uc}_COMPONENT); - - my \$self = Net::ICal::Component::new_from_ref(\$c); - Net::ICal::Component::_add_elements(\$self,\\\@_); - - bless \$self, \$package; - - return \$self; - -} -EOM - -} - - - -} - - diff --git a/libical/scripts/mkderivedparameters.pl b/libical/scripts/mkderivedparameters.pl deleted file mode 100755 index d91bab4cb3..0000000000 --- a/libical/scripts/mkderivedparameters.pl +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/local/bin/perl - -use Getopt::Std; -getopts('chspi:'); - -%no_xname = (RELATED=>1,RANGE=>1,RSVP=>1,XLICERRORTYPE=>1,XLICCOMPARETYPE=>1); - -# Usually, open param-c-types.txt -open(F,"$ARGV[0]") || die "Can't open C parameter types 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"; - -} - - - -if (($opt_c or $opt_h) and !$opt_i) { - -print <<EOM; -/* -*- Mode: C -*- - ====================================================================== - FILE: icalderivedparameters.{c,h} - CREATOR: eric 09 May 1999 - - \044Id: mkderivedparameters.pl,v 1.1 1999/05/14 07:04:31 eric Exp eric \044 - \044Locker: eric \044 - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - -/* - * THIS FILE IS MACHINE GENERATED DO NOT EDIT - */ - - -EOM - -} - -if ($opt_p and !$opt_i){ - -print <<EOM; -# -*- Mode: Perl -*- -# ====================================================================== -# \044Id:\044 -# -# (C) COPYRIGHT 1999 Eric Busboom -# http://www.softwarestudio.org -# -# The contents of this file are subject to the Mozilla Public License -# Version 1.0 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and -# limitations under the License. -# -# The original author is Eric Busboom -# The original code is derivedparams.h -# -# ======================================================================*/ - -EOM - -} - - -while(<F>){ - - chop; - my ($param,$type) = split(/\s{2,}/,$_); - - my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$param)); - - my $lc = lc($ucf); - my $uc = uc($lc); - - my $lctype = lc($type); - - - my $charorenum; - my $set_code; - my $pointer_check; - my $new_pointer_check; - - $new_pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");" if $type=~/char/; - - - if ($type=~/char/ ) { - - $charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return ((struct icalparameter_impl*)param)->string;"; - - $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");"; - - $set_code = "((struct icalparameter_impl*)param)->string = strdup(v);" - - } else { - - $xrange =" if ( ((struct icalparameter_impl*)param)->string != 0){\n return ICAL_${uc}_XNAME;\n }\n" if !exists $no_xname{$uc}; - - $charorenum=<<EOM; - icalerror_check_arg( (param!=0), \"param\"); -$xrange - return ((struct icalparameter_impl*)param)->data.v_${lc}; -EOM - - $pointer_check = "icalerror_check_arg( (v!=0),\"v\");"; - - $set_code = "((struct icalparameter_impl*)param)->data.v_${lc} = v;"; - - $print_code = "switch (impl->data.v_${lc}) {\ncase ICAL_${uc}_: {\n}\ncase ICAL_${uc}_XNAME: /* Fall Through */\n}\n"; - - } - - - - if ($opt_c) { - - print <<EOM; -/* $param */ -icalparameter* icalparameter_new_${lc}($type v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - $new_pointer_check - impl = icalparameter_new_impl(ICAL_${uc}_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_${lc}((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -${type} icalparameter_get_${lc}(icalparameter* param) -{ - icalerror_clear_errno(); -$charorenum -} - -void icalparameter_set_${lc}(icalparameter* param, ${type} v) -{ - $new_pointer_check - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - $set_code -} - -EOM - - } elsif( $opt_h) { - - print <<EOM; -/* $param */ -icalparameter* icalparameter_new_${lc}($type v); -${type} icalparameter_get_${lc}(icalparameter* value); -void icalparameter_set_${lc}(icalparameter* value, ${type} v); - -EOM - -} elsif ($opt_s) { - -next if $type =~ /char/; - -print<<EOM; -case ICAL_${uc}_PARAMETER: -{ - $print_code -} -EOM - -} - - if ($opt_p) { - - print <<EOM; - -# $param - -package ICal::Parameter::${ucf}; -\@ISA=qw(ICal::Parameter); - -sub new -{ - my \$self = []; - my \$package = shift; - my \$value = shift; - - bless \$self, \$package; - - my \$p = ICal::icalparameter_new(\$ICal::ICAL_${uc}_PARAMETER); - - \$self->[0] = \$p; - - if (\$value) { - \$self->set(\$value); - } - - - return \$self; -} - -sub get -{ - my \$self = shift; - my \$impl = \$self->_impl(); - - return ICal::icalparameter_as_ical_string(\$impl); - -} - -sub set -{ - - my \$self = shift; - my \$v = shift; - - my \$impl = \$self->_impl(); - - ICal::icalparameter_set_${lc}(\$impl,\$v) unless !\$v; -} - -EOM - -} - -} - -if ($opt_h){ - -print <<EOM; -#endif ICALPARAMETER_H -EOM -} diff --git a/libical/scripts/mkderivedproperties.pl b/libical/scripts/mkderivedproperties.pl deleted file mode 100755 index f3c94f2cfd..0000000000 --- a/libical/scripts/mkderivedproperties.pl +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/local/bin/perl - -use Getopt::Std; -getopts('chsypmi:'); - -# ARG 0 is prop-to-value -open(PV,"$ARGV[0]") || die "Can't open prop to value file $ARGV[0]:$!"; - - -while (<PV>){ - - chop; - my @v = split(/\s+/,$_); - - my $prop = shift @v; - my $value = shift @v; - my $comment = join(" ",@v); - - $propmap{$prop} = $value; -} - -close PV; - -# ARG 1 is value-c-types.txt -open(F,"$ARGV[1]") || die "Can't open C parameter types file $ARGV[1 ]:$!"; - -while (<F>){ - - chop; - my @v = split(/\t+/,$_); - - my $value = shift @v; - my $type = shift @v; - my $comment = join(" ",@v); - - $valuemap{$value} = $type; - -} - -close F; - -# 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"; - -} - - -if ( ($opt_h or $opt_s) and !$opt_i ){ - -print <<EOM; -/* -*- Mode: C -*- - ====================================================================== - FILE: icalderivedproperties.{c,h} - CREATOR: eric 09 May 1999 - - \044Id:\044 - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - -/* - * THIS FILE IS MACHINE GENERATED. DO NOT EDIT - */ - - -EOM - -} - - -if ($opt_p and !$opt_i){ - -print <<EOM; - -EOM - -} - -foreach $prop (keys %propmap) { - - next if !$prop; - - my $value = $propmap{$prop}; - - if (!$value){ - die "Can't find value for property \"$prop\"\n"; - } - - my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$prop)); - my $lc = lc($ucf); - my $uc = uc($lc); - - my $ucfvalue = join("",map {ucfirst(lc($_));} split(/-/,$value)); - my $lcvalue = lc($ucfvalue); - my $ucvalue = uc($lcvalue); - - my $type = $valuemap{$value}; - - my $pointer_check; - if ($type =~ /\*/){ - $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");\n" if $type =~ /\*/; - } elsif ( $type eq "void" ){ - $pointer_check = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/; - - } - - my $set_pointer_check = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/; - - if($opt_c) { # Generate C source - print<<EOM; - -/* $prop */ - -icalproperty* icalproperty_new_${lc}($type v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); - $pointer_check - - icalproperty_set_${lc}((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_${lc}($type v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); - $pointer_check - - icalproperty_set_${lc}((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_${lc}(icalproperty* prop, $type v) -{ - icalvalue *value; - - $set_pointer_check - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_${lcvalue}(v); - - icalproperty_set_value(prop,value); - -} - -$type icalproperty_get_${lc}(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_${lcvalue}(value); -} -EOM - - - } elsif ($opt_h) { # Generate C Header file - print<<EOM; - -/* $prop */ -icalproperty* icalproperty_new_${lc}($type v); -icalproperty* icalproperty_vanew_${lc}($type v, ...); -void icalproperty_set_${lc}(icalproperty* prop, $type v); -$type icalproperty_get_${lc}(icalproperty* prop); -EOM - -} elsif ($opt_s) { # Generate case in a switch statement - -print <<EOM; -case ICAL_${uc}_PROPERTY: -EOM - - -} elsif ($opt_p) { # Generate perl code - -print <<EOM; - -package Net::ICal::Property::${ucf}; -use Net::ICal::Property; -\@ISA=qw(Net::ICal::Property); -sub new -{ - my \$package = shift; - - my \$p = Net::ICal::icalproperty_new(\$Net::ICal::ICAL_${uc}_PROPERTY); - my \$self = Net::ICal::Property::new_from_ref(\$p); - - \$self->_add_elements(\\\@_); - - return bless \$self, \$package; -} - -sub set_value -{ - my \$self = shift; - my \$v = shift; - - my \$impl = \$self->_impl(); - - - if ( ref \$v && Net::ICal::icalvalue_isa_value(\$v->_impl())){ - Net::ICal::icalproperty_set_value(\$impl,\$v->_impl); - } else { - my \$value = Net::ICal::icalvalue_new_from_string(\$Net::ICal::ICAL_${ucvalue}_VALUE,\$v); - die if !\$impl; - Net::ICal::icalproperty_set_value(\$impl,\$value) unless !\$value; - } - -} - -sub get_value -{ - my \$self = shift; - my \$impl = \$self->_impl(); - - if (defined \$impl){ - my \$value = Net::ICal::icalproperty_get_value(\$impl); - return "" if !\$value; - return Net::ICal::icalvalue_as_ical_string(\$value); - } else { - return ""; - } -} - -EOM - -} elsif ($opt_m) { # Generate a map - -print "\'${uc}\' => \'Net::ICal::Property::${ucf},\'\n"; - -} - -} # This brace terminates the main loop - - - -# Add things to the end of the output. - -if ($opt_p) -{ - print "1;\n"; -} - -if ($opt_h){ - -print <<EOM; -#endif ICALPROPERTY_H -EOM -} - diff --git a/libical/scripts/mkderivedvalues.pl b/libical/scripts/mkderivedvalues.pl deleted file mode 100755 index a0909a6d94..0000000000 --- a/libical/scripts/mkderivedvalues.pl +++ /dev/null @@ -1,303 +0,0 @@ -#!/usr/bin/perl - - -use Getopt::Std; -getopts('chspi:'); - -#Options -# c -> generate c code file -# h-> generate header file -# s -> generate switch statement - -# Open with value-c-types.txt - - -open(F,"$ARGV[0]") || die "Can't open values 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"; - -} - - -if (($opt_c || $opt_h) and !$opt_i) { -print <<EOM; -/* -*- Mode: C -*- - ====================================================================== - FILE: icalderivedvalues.{c,h} - CREATOR: eric 09 May 1999 - - \044Id:\044 - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - ======================================================================*/ - -/* - * THIS FILE IS MACHINE GENERATED DO NOT EDIT - */ - - - -EOM -} - -if ($opt_p and !$opt_i){ - -print <<EOM; -# -*- Mode: Perl -*- -# ====================================================================== -# \044Id:\044 -# -# (C) COPYRIGHT 1999 Eric Busboom -# http://www.softwarestudio.org -# -# The contents of this file are subject to the Mozilla Public License -# Version 1.0 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and -# limitations under the License. -# -# The original author is Eric Busboom -# The original code is derivedvalues.h -# -# ======================================================================*/ - -EOM - -} - -# Map type names to the value in the icalvalue_impl data union */ - -%union_map = ( - BOOLEAN => 'int', - CALADDRESS=>'string', - DATE=>'time', - DATETIME=>'time', - DATETIMEDATE=>'time', - DATETIMEPERIOD=>'period', - DURATION=>'duration', - INTEGER=>'int', - TEXT=>'string', - URI=>'string', - UTCOFFSET=>'int', - QUERY=>'string', - BINARY=>'string' - ); - -while(<F>) -{ - - chop; - my @v = split(/\t+/,$_); - - my $value = shift @v; - my $type = shift @v; - my $comment = join(" ",@v); - - my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$value)); - - my $lc = lc($ucf); - my $uc = uc($lc); - - my $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");\n" if $type =~ /\*/; - my $pointer_check_rv = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/; - - my $assign; - - if ($type =~ /char/){ - $assign = "strdup(v);\n\n if (impl->data.v_string == 0){\n errno = ENOMEM;\n }\n"; - } else { - $assign = "v;"; - } - - my $union_data; - - if (exists $union_map{$uc} ){ - $union_data=$union_map{$uc}; - } else { - $union_data = $lc; - } - - if ($opt_c) { -print <<EOM; - -icalvalue* -icalvalue_new_${lc} ($type v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_${uc}_VALUE); - - $pointer_check - icalvalue_set_${lc}((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_${lc}(icalvalue* value, $type v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - $pointer_check_rv - icalerror_check_value_type(value, ICAL_${uc}_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_${union_data} = $assign -} - -$type -icalvalue_get_${lc}(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_${uc}_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_${union_data}; -} - -EOM - -} elsif($opt_h) { - - print <<EOM; -/* $value $comment */ -icalvalue* icalvalue_new_${lc}($type v); -$type icalvalue_get_${lc}(icalvalue* value); -void icalvalue_set_${lc}(icalvalue* value, ${type} v); - -EOM - -} elsif ($opt_s) { - -if ( $ud{$union_data}++ == 0) { - -print<<EOM; -char* icalvalue_${union_data}_as_ical_string(icalvalue* value) { - - $type data; - char temp[1024]; - char *str; - icalerror_check_arg( (value!=0),"value"); - data = ((struct icalvalue_impl*)value)->data.v_${union_data} - - str = strdup(temp); - - return str; -} - -EOM - -} -} elsif ($opt_p) { # Generate perl code - -print <<EOM; - -package ICal::Value::${ucf}; -use ICal::Value; -\@ISA=qw(ICal::Value); -sub new -{ - my \$self = []; - my \$package = shift; - my \$value = shift; - - bless \$self, \$package; - - my \$p; - - if (\$value){ - \$p = ICal::icalvalue_new_from_string(\$ICal::ICAL_${uc}_VALUE,\$value); - } else { - \$p = ICal::icalvalue_new(\$ICal::ICAL_${uc}_VALUE); - } - - \$self->[0] = \$p; - - return \$self; -} - -sub set -{ - my \$self = shift; - my \$v = shift; - - my \$impl = \$self->_impl(); - - if (\$v) { - my \$new_value = ICal::icalvalue_new_from_string(\$ICal::ICAL_${uc}_VALUE,\$v); - if (\$new_value){ - ICal::icalvalue_free(\$self->[0]); - \$self->[0] = \$new_value; - } - - } - -} - -sub get -{ - my \$self = shift; - my \$impl = \$self->[0]; - - if (defined \$impl){ - - return ICal::icalvalue_as_ical_string(\$impl); - - } -} - -EOM -} - - - -} - -if ($opt_p) -{ - print "1;\n"; -} - - -if ($opt_h){ - -print <<EOM; -#endif ICALVALUE_H -EOM -} - - -__END__ - diff --git a/libical/scripts/mkparameterrestrictions.pl b/libical/scripts/mkparameterrestrictions.pl deleted file mode 100755 index 2c57eb4ca5..0000000000 --- a/libical/scripts/mkparameterrestrictions.pl +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/perl - -# Version: 1.0 -# Script last updated: 30May1999 GMD -# Change log: -# <none> - - -# usually open params-in-prop.txt -open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!"; - -print <<EOM; -/* - ====================================================================== - File: parameterrestrictions.c - - (C) COPYRIGHT 1999 Graham Davison - mailto:g.m.davison\@computer.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - -/* - * THIS FILE IS MACHINE GENERATED DO NOT EDIT - */ - - -int icalrestriction_is_parameter_allowed(icalproperty_kind prop,icalparameter_kind param) -{ - switch (prop) - { -EOM - -while(<F>) -{ - chop; - - # split line by whitespace - my @v = split(/\s+/,$_); - # property is first item on line - my $prop = shift @v; - my $prop_name = $prop; - if (substr($prop,0,1) eq "X") { $prop = "X"; } - $prop = join("",split(/-/,$prop)); - -print <<EOM; - - /* ${prop_name} */ - case ICAL_${prop}_PROPERTY: - switch (param) - { -EOM - - foreach $param (@v) - { - $param = join("",split(/-/,$param)); - print "\t\t\t\tcase ICAL_${param}_PARAMETER:\n"; - } - -print <<EOM; - return 1; - default: - return 0; - } - -EOM - -} - -print <<EOM; - } - - return 0; -} -EOM diff --git a/libical/scripts/mkrestrictionrecords.pl b/libical/scripts/mkrestrictionrecords.pl deleted file mode 100755 index e2c62ae748..0000000000 --- a/libical/scripts/mkrestrictionrecords.pl +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/perl - -# Version: 1.0 -# Script last updated: 30May1999 GMD -# Change log: -# <none> - -# usually open restrictions.csv -open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!"; - -print <<EOM; -/* - ====================================================================== - File: restrictionrecords.c - - (C) COPYRIGHT 1999 Graham Davison - mailto:g.m.davison\@computer.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - - -/* - * THIS FILE IS MACHINE GENERATED DO NOT EDIT - */ - - -typedef struct icalrestriction_record { - icalproperty_method method; - icalcomponent_kind component; - icalproperty_kind property; - icalcomponent_kind subcomponent; - icalrestriction_kind restriction; -} icalrestriction_record; - - -icalrestriction_record icalrestriction_records[] = -{ -EOM - -my $last_method = ""; -my $last_component = ""; -my $last_property = ""; -my $need_header = 0; - -while(<F>) -{ - 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 <<EOM; - - /* END */ - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} -}; -EOM diff --git a/libical/scripts/mkrestrictiontable.pl b/libical/scripts/mkrestrictiontable.pl deleted file mode 100755 index c91f3d0bc4..0000000000 --- a/libical/scripts/mkrestrictiontable.pl +++ /dev/null @@ -1,86 +0,0 @@ -#!/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"; |