aboutsummaryrefslogtreecommitdiffstats
path: root/libical/scripts/mkderivedvalues.pl
diff options
context:
space:
mode:
Diffstat (limited to 'libical/scripts/mkderivedvalues.pl')
-rwxr-xr-xlibical/scripts/mkderivedvalues.pl223
1 files changed, 0 insertions, 223 deletions
diff --git a/libical/scripts/mkderivedvalues.pl b/libical/scripts/mkderivedvalues.pl
deleted file mode 100755
index e7ede34ae7..0000000000
--- a/libical/scripts/mkderivedvalues.pl
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/usr/bin/perl
-
-use lib '.';
-
-require 'readvaluesfile.pl';
-
-use Getopt::Std;
-getopts('chi:');
-
- #Options
- # c -> generate c code file
- # h-> generate header file
-
- # Open with value-types.txt
-
-my %h = read_values_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>){
- print;
- }
-}
-
-
- # 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',
- X=>'string'
- );
-
-
-if($opt_h){
-
- # First print out the value enumerations
- $idx = 5000;
- print "typedef enum icalvalue_kind {\n";
- print " ICAL_ANY_VALUE=$idx,\n";
-
- foreach $value (keys %h) {
-
- $idx++;
- my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
-
- next if $value eq "NO";
-
- print " ICAL_${ucv}_VALUE=$idx,\n";
- }
-
- $idx++;
- print " ICAL_NO_VALUE=$idx\n} icalvalue_kind ;\n\n";
-
- # Now create enumerations for property values
- $idx = 10000;
-
- print "#define ICALPROPERTY_FIRST_ENUM $idx\n\n";
-
- foreach $value (sort keys %h) {
-
- next if !$value;
-
- next if $value eq 'NO' or $prop eq 'ANY';
-
- my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
- my @enums = @{$h{$value}->{'enums'}};
-
- if(@enums){
-
- my ($c_autogen,$c_type) = @{$h{$value}->{'C'}};
- print "typedef $c_type {\n";
- my $first = 1;
-
- unshift(@enums,"X");
-
- push(@enums,"NONE");
-
- foreach $e (@enums) {
- if (!$first){
- print ",\n";
- } else {
- $first = 0;
- }
-
- my $uce = join("",map {uc(lc($_));} split(/-/,$e));
-
- print " ICAL_${ucv}_${uce} = $idx";
-
- $idx++;
- }
-
- $c_type =~ s/enum //;
-
- print "\n} $c_type;\n\n";
- }
- }
-
- print "#define ICALPROPERTY_LAST_ENUM $idx\n\n";
-
-}
-
-
-if($opt_c){
-
- # print out the value to string map
-
- print "static struct icalvalue_kind_map value_map[]={\n";
-
- foreach $value (keys %h) {
-
- $idx++;
- my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
-
- next if $value eq "NO";
-
- print " {ICAL_${ucv}_VALUE,\"$value\"},\n";
- }
-
-
- print " {ICAL_NO_VALUE,\"\"}\n};";
-
-}
-
-
-foreach $value (keys %h) {
-
- my $autogen = $h{$value}->{C}->[0];
- my $type = $h{$value}->{C}->[1];
-
- 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 = "icalmemory_strdup(v);\n\n if (impl->data.v_string == 0){\n errno = ENOMEM;\n }\n";
- } else {
- $assign = "v;";
- }
-
- my $union_data;
-
- if(@{$h{$value}->{'enums'}}){
- $union_data = 'enum';
-
- } elsif (exists $union_map{$uc} ){
- $union_data=$union_map{$uc};
- } else {
- $union_data = $lc;
- }
-
- if ($opt_c && $autogen) {
-
- print "\n\n\
-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;\n";
-
- if( $union_data eq 'string') {
-
- print " if(impl->data.v_${union_data}!=0) {free((void*)impl->data.v_${union_data});}\n";
- }
-
-
- print "\n impl->data.v_$union_data = $assign \n }\n";
-
- print "$type\ icalvalue_get_${lc}(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";
-
-
- } elsif($opt_h && $autogen) {
-
- print "\n /* $value */ \
-icalvalue* icalvalue_new_${lc}($type v); \
-$type icalvalue_get_${lc}(icalvalue* value); \
-void icalvalue_set_${lc}(icalvalue* value, ${type} v);\n\n";
-
- }
-
-}
-
-
-if ($opt_h){
- print "#endif /*ICALVALUE_H*/\n";
- }
-
-
- __END__
-
td>Add astro/garmindev: Garmin device drivers for QLandkarteGT.rakuco2013-05-195-0/+65 * KDE/FreeBSD team presents KDE SC 4.10.3 ports!makc2013-05-193-5/+4 * - Update to 5939amdmi32013-05-142-3/+3 * Remove unnecessary conditional.lme2013-05-141-4/+0 * Update to 0.074.tobez2013-05-132-3/+3 * - Add missing sharedmime to the list of USE_KDE4 components. It will bemakc2013-05-131-1/+1 * Fix package list.ehaupt2013-05-121-8/+6 * Rectify USE_TEX to support both of teTeX and TeXLive.hrs2013-05-121-1/+1 * Update to 1.79.00lme2013-05-112-3/+7 * Remove *_DEPENDS from ports which depend on teTeX and add USE_TEX=tetexhrs2013-05-061-2/+1 * Fix build on current by respecting CFLAGSbapt2013-05-041-1/+3 * - update astro/gpsd to 3.9rm2013-05-039-66/+43 * In preparation of removing devel/libusb (expires 2013-04-30), remove itrene2013-04-302-23/+6 * Rely on bsdtar to autodetermine the format of the distfiles when possiblebapt2013-04-292-16/+2 * - Fix USE_ICONV leftovers missed in the previous updatemva2013-04-281-1/+0 * Fix instructions in pkg-message.rene2013-04-272-2/+2 * - Convert USE_ICONV=yes to USES=iconvmva2013-04-272-3/+2 * - Update to 0.19sunpoet2013-04-272-9/+12 * - Convert USE_GETTEXT to USES (part 4)ak2013-04-262-3/+2 * - Cleanup Makefile headersunpoet2013-04-261-8/+1 * - Convert USE_GETTEXT to USES (part 3)ak2013-04-253-3/+3 * Update to 6.4.4crees2013-04-252-5/+4 * - Update to version 0.12.1danfe2013-04-243-20/+110 * - Convert USE_GETTEXT to USES (part 1)ak2013-04-242-4/+2 * - Rescue WRKSRCsunpoet2013-04-231-1/+1 * Finish converting the whole ports tree to USES=pkgconfigbapt2013-04-231-1/+1 * - Remove lang/tcl83 and x11-toolkits/tk83 (expired)gahr2013-04-232-2/+2 * Convert all a categories to USE=pkgconfigbapt2013-04-234-6/+5 * - Update to 6.0.3.2197, adding a fix [1] for 9.x crashes.nox2013-04-213-348/+54 * Some cleanups:rene2013-04-161-9/+2 * - Update to digiKam and Kipi Plugins ports to 3.1.0makc2013-04-093-66/+4 * For perl@ owned ports:eadler2013-03-29