aboutsummaryrefslogtreecommitdiffstats
path: root/libical/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'libical/scripts')
-rw-r--r--libical/scripts/.cvsignore1
-rw-r--r--libical/scripts/Makefile.am8
-rwxr-xr-xlibical/scripts/mkderivedcomponents.pl35
-rwxr-xr-xlibical/scripts/mkderivedparameters.pl39
4 files changed, 62 insertions, 21 deletions
diff --git a/libical/scripts/.cvsignore b/libical/scripts/.cvsignore
new file mode 100644
index 0000000000..70845e08eb
--- /dev/null
+++ b/libical/scripts/.cvsignore
@@ -0,0 +1 @@
+Makefile.in
diff --git a/libical/scripts/Makefile.am b/libical/scripts/Makefile.am
new file mode 100644
index 0000000000..fd1b053cb6
--- /dev/null
+++ b/libical/scripts/Makefile.am
@@ -0,0 +1,8 @@
+EXTRA_DIST = \
+mkderivedcomponents.pl \
+mkderivedparameters.pl \
+mkderivedproperties.pl \
+mkderivedvalues.pl \
+mkparameterrestrictions.pl \
+mkrestrictionrecords.pl \
+mkrestrictiontable.pl
diff --git a/libical/scripts/mkderivedcomponents.pl b/libical/scripts/mkderivedcomponents.pl
index 3599a8d465..ac4e472250 100755
--- a/libical/scripts/mkderivedcomponents.pl
+++ b/libical/scripts/mkderivedcomponents.pl
@@ -1,7 +1,7 @@
#!/usr/local/bin/perl
use Getopt::Std;
-getopts('chsp');
+getopts('chspi:');
# ARG 0 is components.txt
@@ -11,6 +11,8 @@ my @components;
while (<PV>){
+ s/#.*//;
+
chop;
push(@components,$_);
@@ -19,7 +21,32 @@ while (<PV>){
close PV;
-if ($opt_c or $opt_h){
+# 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;
+
+ }
+
+ if($opt_i){
+ print "# Everything below this line is machine generated. Do not edit. \n";
+ } else {
+ 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 -*-
@@ -55,7 +82,7 @@ EOM
}
-if ($opt_p){
+if ($opt_p and !$opt_i){
print <<EOM;
@@ -127,7 +154,7 @@ sub new
my \$self = Net::ICal::Component::new_from_ref(\$c);
Net::ICal::Component::_add_elements(\$self,\\\@_);
- bless \$self, \$package;
+ # Self is blessed in new_from_ref
return \$self;
diff --git a/libical/scripts/mkderivedparameters.pl b/libical/scripts/mkderivedparameters.pl
index d91bab4cb3..2b505c878a 100755
--- a/libical/scripts/mkderivedparameters.pl
+++ b/libical/scripts/mkderivedparameters.pl
@@ -25,7 +25,11 @@ if ($opt_i) {
}
- print "/* Everything below this line is machine generated. Do not edit. */\n";
+ if($opt_p){
+ print "# Everything below this line is machine generated. Do not edit. \n";
+ } else {
+ print "/* Everything below this line is machine generated. Do not edit. */\n";
+ }
}
@@ -114,8 +118,13 @@ while(<F>){
my $set_code;
my $pointer_check;
my $new_pointer_check;
+ my $new_pointer_check_v;
+ my $xrange;
- $new_pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");" if $type=~/char/;
+ if ($type=~/char/){
+ $new_pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");";
+ $new_pointer_check_v = "icalerror_check_arg_rv( (v!=0),\"v\");";
+ }
if ($type=~/char/ ) {
@@ -177,7 +186,7 @@ $charorenum
void icalparameter_set_${lc}(icalparameter* param, ${type} v)
{
- $new_pointer_check
+ $new_pointer_check_v
icalerror_check_arg_rv( (param!=0), "param");
icalerror_clear_errno();
@@ -215,8 +224,8 @@ EOM
# $param
-package ICal::Parameter::${ucf};
-\@ISA=qw(ICal::Parameter);
+package Net::ICal::Parameter::${ucf};
+\@ISA=qw(Net::ICal::Parameter);
sub new
{
@@ -226,14 +235,15 @@ sub new
bless \$self, \$package;
- my \$p = ICal::icalparameter_new(\$ICal::ICAL_${uc}_PARAMETER);
-
- \$self->[0] = \$p;
+ my \$p;
if (\$value) {
- \$self->set(\$value);
+ \$p = Net::ICal::icalparameter_new_from_string(\$Net::ICal::ICAL_${uc}_PARAMETER,\$value);
+ } else {
+ \$p = Net::ICal::icalparameter_new(\$Net::ICal::ICAL_${uc}_PARAMETER);
}
+ \$self->[0] = \$p;
return \$self;
}
@@ -243,19 +253,14 @@ sub get
my \$self = shift;
my \$impl = \$self->_impl();
- return ICal::icalparameter_as_ical_string(\$impl);
+ return Net::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;
+ # This is hard to implement, so I've punted for now.
+ die "Set is not implemented";
}
EOM