diff options
author | Hans Petter <hansp@src.gnome.org> | 2003-09-12 06:04:44 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-09-12 06:04:44 +0800 |
commit | 697761cc337aa77a47140c8df50ed84bc25e23f6 (patch) | |
tree | b785830f72e9938cceaa016a419c7b6d9892bada /libical/scripts | |
parent | 733d77e657516f9a59b5c1a7b62acb87b03ec86f (diff) | |
download | gsoc2013-evolution-697761cc337aa77a47140c8df50ed84bc25e23f6.tar.gz gsoc2013-evolution-697761cc337aa77a47140c8df50ed84bc25e23f6.tar.zst gsoc2013-evolution-697761cc337aa77a47140c8df50ed84bc25e23f6.zip |
Import new libical from mainline HEAD and make appropriate changes to
Evolution.
svn path=/trunk/; revision=22538
Diffstat (limited to 'libical/scripts')
-rw-r--r-- | libical/scripts/.cvsignore | 7 | ||||
-rwxr-xr-x | libical/scripts/mkderivedcomponents.pl | 2 | ||||
-rwxr-xr-x | libical/scripts/mkderivedparameters.pl | 75 | ||||
-rwxr-xr-x | libical/scripts/mkderivedproperties.pl | 92 | ||||
-rwxr-xr-x | libical/scripts/mkderivedvalues.pl | 33 | ||||
-rw-r--r-- | libical/scripts/mkinclude.sh | 39 | ||||
-rwxr-xr-x | libical/scripts/mkneticali.pl | 99 | ||||
-rwxr-xr-x | libical/scripts/mkrestrictionrecords.pl | 2 | ||||
-rwxr-xr-x | libical/scripts/mkrestrictiontable.pl | 2 | ||||
-rw-r--r-- | libical/scripts/readvaluesfile.pl | 3 |
10 files changed, 266 insertions, 88 deletions
diff --git a/libical/scripts/.cvsignore b/libical/scripts/.cvsignore index b840c21800..bbc8ba00d1 100644 --- a/libical/scripts/.cvsignore +++ b/libical/scripts/.cvsignore @@ -1,2 +1,5 @@ -Makefile.in -Makefile
\ No newline at end of file +Makefile +.deps +.libs +*.lo +*.la diff --git a/libical/scripts/mkderivedcomponents.pl b/libical/scripts/mkderivedcomponents.pl index ac4e472250..31743c3ba3 100755 --- a/libical/scripts/mkderivedcomponents.pl +++ b/libical/scripts/mkderivedcomponents.pl @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/env perl use Getopt::Std; getopts('chspi:'); diff --git a/libical/scripts/mkderivedparameters.pl b/libical/scripts/mkderivedparameters.pl index 89f25306a5..5439509aa8 100755 --- a/libical/scripts/mkderivedparameters.pl +++ b/libical/scripts/mkderivedparameters.pl @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/env perl require "readvaluesfile.pl"; @@ -18,27 +18,24 @@ if ($opt_i) { open(IN,$opt_i) || die "Can't open input file $opt_i"; while(<IN>){ - - if (/Do not edit/){ - last; - } - - print; + if (/<insert_code_here>/){ + insert_code(); + } else { + print; + } } if($opt_p){ - print "# Everything below this line is machine generated. Do not edit. \n"; + 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"; } } - -# Write parameter string map -if ($opt_c){ -} +sub insert_code +{ # Write parameter enumerations and datatypes @@ -108,21 +105,28 @@ if($opt_h){ if ($opt_c){ - # Create the icalparameter_value to icalvalue_kind conversion table - print "struct icalparameter_value_kind_map value_kind_map[] = {\n"; + # Create the icalparameter_value to icalvalue_kind conversion table + my $count = 0; + my $out; + foreach $enum (@{$params{'VALUE'}->{'enums'}}){ next if $enum eq 'NO' or $enum eq 'ERROR'; $uc = join("",map {uc(lc($_));} split(/-/,$enum)); - print " {ICAL_VALUE_${uc},ICAL_${uc}_VALUE},\n"; + $out.=" {ICAL_VALUE_${uc},ICAL_${uc}_VALUE},\n"; + $count++; } - + + $count+=2; + print "static struct icalparameter_value_kind_map value_kind_map[$count] = {\n"; + print $out; print " {ICAL_VALUE_X,ICAL_X_VALUE},\n"; print " {ICAL_VALUE_NONE,ICAL_NO_VALUE}\n};\n\n"; #Create the parameter Name map - print "static struct icalparameter_kind_map parameter_map[] = { \n"; + $out=""; + $count=0; foreach $param (sort keys %params) { next if !$param; @@ -132,18 +136,18 @@ if ($opt_c){ my $lc = join("",map {lc($_);} split(/-/,$param)); my $uc = join("",map {uc(lc($_));} split(/-/,$param)); - - print " {ICAL_${uc}_PARAMETER,\"$param\"},\n"; + $count++; + $out.=" {ICAL_${uc}_PARAMETER,\"$param\"},\n"; } - + $count+=1; + print "static struct icalparameter_kind_map parameter_map[$count] = { \n"; + print $out; print " { ICAL_NO_PARAMETER, \"\"}\n};\n\n"; # Create the parameter value map - - print "static struct icalparameter_map icalparameter_map[] = {\n"; - print "{ICAL_ANY_PARAMETER,0,\"\"},\n"; - + $out =""; + $count=0; foreach $param (sort keys %params) { next if !$param; @@ -159,12 +163,17 @@ if ($opt_c){ foreach $e (@enums){ my $uce = join("",map {uc(lc($_));} split(/-/,$e)); - print " {ICAL_${uc}_PARAMETER,ICAL_${uc}_${uce},\"$e\"},\n"; + $count++; + $out.=" {ICAL_${uc}_PARAMETER,ICAL_${uc}_${uce},\"$e\"},\n"; } } } + $count+=3; + print "static struct icalparameter_map icalparameter_map[] = {\n"; + print "{ICAL_ANY_PARAMETER,0,\"\"},\n"; + print $out; print " {ICAL_NO_PARAMETER,0,\"\"}};\n\n"; } @@ -186,20 +195,18 @@ foreach $param (keys %params){ if ($type=~/char/ ) { - $charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return ($type)((struct icalparameter_impl*)param)->string;"; + $charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return param->string;"; - $set_code = "if (((struct icalparameter_impl*)param)->string != 0)\n" . - " free((void *) ((struct icalparameter_impl*)param)->string);\n" . - " ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);"; + $set_code = "((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);"; $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");"; $pointer_check_v = "icalerror_check_arg_rv( (v!=0),\"v\");"; } else { - $xrange =" if ( ((struct icalparameter_impl*)param)->string != 0){\n return ICAL_${uc}_X;\n }\n" if !exists $no_xname{$uc}; + $xrange =" if (param->string != 0){\n return ICAL_${uc}_X;\n }\n" if !exists $no_xname{$uc}; - $charorenum= "icalerror_check_arg( (param!=0), \"param\");\n$xrange\nreturn ($type)((struct icalparameter_impl*)param)->data;"; + $charorenum= "icalerror_check_arg( (param!=0), \"param\");\n$xrange\nreturn ($type)(param->data);"; $pointer_check = "icalerror_check_arg_rz(v >= ICAL_${uc}_X,\"v\");\n icalerror_check_arg_rz(v < ICAL_${uc}_NONE,\"v\");"; @@ -234,7 +241,7 @@ icalparameter* icalparameter_new_${lc}($type v) return (icalparameter*) impl; } -${type} icalparameter_get_${lc}(icalparameter* param) +${type} icalparameter_get_${lc}(const icalparameter* param) { icalerror_clear_errno(); $charorenum @@ -256,7 +263,7 @@ EOM print <<EOM; /* $param */ icalparameter* icalparameter_new_${lc}($type v); -${type} icalparameter_get_${lc}(icalparameter* value); +${type} icalparameter_get_${lc}(const icalparameter* value); void icalparameter_set_${lc}(icalparameter* value, ${type} v); EOM @@ -321,3 +328,5 @@ print <<EOM; EOM } + +} diff --git a/libical/scripts/mkderivedproperties.pl b/libical/scripts/mkderivedproperties.pl index 8bd808e7f5..59ec4b6430 100755 --- a/libical/scripts/mkderivedproperties.pl +++ b/libical/scripts/mkderivedproperties.pl @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/env perl require "readvaluesfile.pl"; @@ -12,6 +12,8 @@ getopts('chspmi:'); %valuemap = read_values_file($ARGV[1]); +$include_vanew = 1; + # Write the file inline by copying everything before a demarcation # line, and putting the generated data after the demarcation @@ -21,17 +23,14 @@ if ($opt_i) { while(<IN>){ - if (/Do not edit/){ - last; - } - - print; - + if (/<insert_code_here>/){ + insert_code(); + } else { + print; + } + } - - print "/* Everything below this line is machine generated. Do not edit. */\n"; - - + } sub fudge_data { @@ -56,12 +55,19 @@ sub fudge_data { } +sub insert_code { + # Create the property map data if($opt_c){ - print "static struct icalproperty_map property_map[] = {\n"; + + my @props = sort keys %propmap; + my $count = scalar(@props); - foreach $prop (sort keys %propmap) { + + print "static struct icalproperty_map property_map[$count] = {\n"; + + foreach $prop (@props) { next if !$prop; @@ -79,10 +85,9 @@ if($opt_c){ print "{ICAL_${uc}_PROPERTY,\"\",ICAL_NO_VALUE}};\n\n"; - - print "static struct icalproperty_enum_map enum_map[] = {\n"; - $idx = 10000; + $count = 1; + my $out = ""; foreach $value (sort keys %valuemap) { @@ -109,14 +114,20 @@ if($opt_c){ $str = ""; } - print " {ICAL_${ucv}_PROPERTY,ICAL_${ucv}_${uce},\"$str\" }, /*$idx*/\n"; + $out.=" {ICAL_${ucv}_PROPERTY,ICAL_${ucv}_${uce},\"$str\" }, /*$idx*/\n"; $idx++; + $count++; } } } + + $count++; + print "static struct icalproperty_enum_map enum_map[$count] = {\n"; + print $out; print " {ICAL_NO_PROPERTY,0,\"\"}\n};\n\n"; + } @@ -163,13 +174,9 @@ foreach $prop (sort keys %propmap) { 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; -} + + if ($include_vanew) { + print<<EOM; icalproperty* icalproperty_vanew_${lc}($type v, ...){ va_list args; struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); $pointer_check @@ -180,7 +187,17 @@ icalproperty* icalproperty_vanew_${lc}($type v, ...){ return (icalproperty*)impl; } EOM +} + 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; +} +EOM # Allow DTSTART, DTEND, DUE, EXDATE and RECURRENCE-ID to take DATE values. if ($lc eq "dtstart" || $lc eq "dtend" || $lc eq "due" || $lc eq "exdate" || $lc eq "recurrenceid") { @@ -197,35 +214,35 @@ void icalproperty_set_${lc}(icalproperty* prop, $type v){ } EOM } else { + print<<EOM; 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); + icalproperty_set_value(prop,icalvalue_new_${lcvalue}(v)); } EOM - } - - print<<EOM; -$type icalproperty_get_${lc}(icalproperty* prop){ - icalvalue *value; + } + print<<EOM; +$type icalproperty_get_${lc}(const icalproperty* prop){ icalerror_check_arg( (prop!=0),"prop"); - value = icalproperty_get_value(prop); - return icalvalue_get_${lcvalue}(value); + return icalvalue_get_${lcvalue}(icalproperty_get_value(prop)); } EOM + } elsif ($opt_h) { # Generate C Header file - } elsif ($opt_h) { # Generate C Header file print "\ /* $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);"; +$type icalproperty_get_${lc}(const icalproperty* prop);"; + +if ($include_vanew){ + print "icalproperty* icalproperty_vanew_${lc}($type v, ...);\n"; +} + } @@ -238,3 +255,4 @@ if ($opt_h){ print "\n\n#endif /*ICALPROPERTY_H*/\n" } +} diff --git a/libical/scripts/mkderivedvalues.pl b/libical/scripts/mkderivedvalues.pl index 5009419eac..308a2c8ac0 100755 --- a/libical/scripts/mkderivedvalues.pl +++ b/libical/scripts/mkderivedvalues.pl @@ -24,11 +24,18 @@ if ($opt_i) { open(IN,$opt_i) || die "Can't open input file $opt_i"; while(<IN>){ - print; - } -} + if (/<insert_code_here>/){ + insert_code(); + } else { + print; + } + + } +} +sub insert_code +{ # Map type names to the value in the icalvalue_impl data union */ %union_map = ( @@ -122,7 +129,8 @@ if($opt_c){ # print out the value to string map - print "static struct icalvalue_kind_map value_map[]={\n"; + my $count = scalar(keys %h) + 1; + print "static struct icalvalue_kind_map value_map[$count]={\n"; foreach $value (keys %h) { @@ -157,10 +165,8 @@ foreach $value (keys %h) { if ($type =~ /char/){ $assign = "icalmemory_strdup(v);\n\n if (impl->data.v_string == 0){\n errno = ENOMEM;\n }\n"; - $check_arg = "icalerror_check_arg_rz( (value!=0),\"value\");"; } else { $assign = "v;"; - $check_arg = "icalerror_check_arg( (value!=0),\"value\");"; } my $union_data; @@ -196,10 +202,12 @@ void icalvalue_set_${lc}(icalvalue* value, $type v) {\ } - print "\n impl->data.v_$union_data = $assign \n }\n"; + print "\n\ + impl->data.v_$union_data = $assign \n\ + icalvalue_reset_kind(impl);\n}\n"; - print "$type\ icalvalue_get_${lc}(icalvalue* value)\ {\n\ - $check_arg\ + print "$type\ icalvalue_get_${lc}(const icalvalue* value)\ {\n\ + icalerror_check_arg( (value!=0),\"value\");\ icalerror_check_value_type(value, ICAL_${uc}_VALUE);\ return ((struct icalvalue_impl*)value)->data.v_${union_data};\n}\n"; @@ -208,7 +216,7 @@ void icalvalue_set_${lc}(icalvalue* value, $type v) {\ print "\n /* $value */ \ icalvalue* icalvalue_new_${lc}($type v); \ -$type icalvalue_get_${lc}(icalvalue* value); \ +$type icalvalue_get_${lc}(const icalvalue* value); \ void icalvalue_set_${lc}(icalvalue* value, ${type} v);\n\n"; } @@ -220,6 +228,5 @@ if ($opt_h){ print "#endif /*ICALVALUE_H*/\n"; } - - __END__ - + +} diff --git a/libical/scripts/mkinclude.sh b/libical/scripts/mkinclude.sh new file mode 100644 index 0000000000..a77c8d74a8 --- /dev/null +++ b/libical/scripts/mkinclude.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# +# Given a list of headers, combine them into one, excluding certain lines +# +OUTFILE="/dev/stdout" +COMBINEDHEADERS="" +EXCLUDES="" + +while [ $# -gt 0 ] +do + case $1 in + -o) OUTFILE=$2; shift;; + -e) EXCLUDES="$EXCLUDES $2"; shift;; + *) COMBINEDHEADERS="$COMBINEDHEADERS $1"; + esac + shift +done + +echo '#ifdef __cplusplus' > $OUTFILE +echo 'extern "C" {' >> $OUTFILE +echo '#endif' >> $OUTFILE +echo '/*' >> $OUTFILE +echo " \$Id\$" >> $OUTFILE +echo '*/' >> $OUTFILE +cat $COMBINEDHEADERS >> file.temp1 +for exclude in $EXCLUDES +do + cp file.temp1 file.temp2 + egrep -v "$exclude" file.temp2 > file.temp1 +done +cat file.temp1 >> $OUTFILE +rm -f file.temp1 +rm -f file.temp2 +echo '#ifdef __cplusplus' >> $OUTFILE +echo '};' >> $OUTFILE +echo '#endif' >> $OUTFILE + + diff --git a/libical/scripts/mkneticali.pl b/libical/scripts/mkneticali.pl new file mode 100755 index 0000000000..937de49908 --- /dev/null +++ b/libical/scripts/mkneticali.pl @@ -0,0 +1,99 @@ +#!/usr/local/bin/perl + +$pr = 1; +$ignore = 0; + + +print<<EOM; +/* -*- Mode: C -*-*/ +/*====================================================================== + FILE: ical.i + + (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 + + Contributions from: + Graham Davison (g.m.davison\@computer.org) + + ======================================================================*/ + +%module Net__ICal + +%{ +#include "ical.h" + +#include <sys/types.h> /* for size_t */ +#include <time.h> + +%} + +EOM + +foreach $f (@ARGV) +{ + @f = split(/\//,$f); + $fn = pop(@f); + + $fn=~/pvl/ && next; + $fn=~/sspm/ && next; + $fn=~/cstp/ && next; + $fn=~/csdb/ && next; + $fn=~/vcal/ && next; + $fn=~/yacc/ && next; + $fn=~/lex/ && next; + + print "\n/**********************************************************************\n"; + + print "\t$fn\n"; + print "**********************************************************************/\n\n"; + + + open F, $f; + + while(<F>){ + + s/^#.*//; + + s/\/\*.*\*\///; + + /^\/\// && next; + + next if /^$/; + + if(/\/\*/){ $pr = 0;} + + /icalparser_parse\(/ and $ignore = 1; + /vanew/ and $ignore = 1; + /_stub/ and $ignore = 1; + /_response/ and $ignore = 1; + /line_gen_func/ and $ignore = 1; + /extern/ and $ignore = 1; + /sspm/ and $ignore = 1; + /icalrecur/ and $ignore = 1; + + if ($pr == 1 && $ignore == 0){ + print ; + } + + + if(/\*\//){ $pr = 1;} + + if (/\;/){ $ignore = 0; } + + } + +} + + diff --git a/libical/scripts/mkrestrictionrecords.pl b/libical/scripts/mkrestrictionrecords.pl index e2c62ae748..dd28d77708 100755 --- a/libical/scripts/mkrestrictionrecords.pl +++ b/libical/scripts/mkrestrictionrecords.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Version: 1.0 # Script last updated: 30May1999 GMD diff --git a/libical/scripts/mkrestrictiontable.pl b/libical/scripts/mkrestrictiontable.pl index e1e1a0ca53..e02c55b2f9 100755 --- a/libical/scripts/mkrestrictiontable.pl +++ b/libical/scripts/mkrestrictiontable.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use Getopt::Std; getopts('i:'); diff --git a/libical/scripts/readvaluesfile.pl b/libical/scripts/readvaluesfile.pl index d5e2d36fd8..cb40db84ff 100644 --- a/libical/scripts/readvaluesfile.pl +++ b/libical/scripts/readvaluesfile.pl @@ -13,6 +13,7 @@ sub read_values_file { s/#.*$//g; s/\"//g; + s/\r//g; next if ! $_; @@ -69,6 +70,7 @@ sub read_properties_file { s/#.*$//g; s/\"//g; + s/\r//g; next if ! $_; @@ -100,6 +102,7 @@ sub read_parameters_file { s/#.*$//g; s/\"//g; + s/\r//g; next if ! $_; |