1#!/usr/bin/perl
2
3# Version: 1.0
4# Script last updated: 30May1999 GMD
5# Change log:
6# <none>
7
8
9# usually open params-in-prop.txt
10open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!";
11
12print <<EOM;
13/*
14  ======================================================================
15  File: parameterrestrictions.c
16
17 (C) COPYRIGHT 1999 Graham Davison
18 mailto:g.m.davison\@computer.org
19
20 The contents of this file are subject to the Mozilla Public License
21 Version 1.0 (the "License"); you may not use this file except in
22 compliance with the License. You may obtain a copy of the License at
23 http://www.mozilla.org/MPL/
24
25 Software distributed under the License is distributed on an "AS IS"
26 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
27 the License for the specific language governing rights and
28 limitations under the License.
29
30
31 ======================================================================*/
32
33/*
34 * THIS FILE IS MACHINE GENERATED DO NOT EDIT
35 */
36
37
38int icalrestriction_is_parameter_allowed(icalproperty_kind prop,icalparameter_kind param)
39{
40	switch (prop)
41	{
42EOM
43
44while(<F>)
45{
46	chop;
47
48	# split line by whitespace
49	my @v = split(/\s+/,$_);
50	# property is first item on line
51	my $prop = shift @v;
52	my $prop_name = $prop;
53	if (substr($prop,0,1) eq "X") { $prop = "X"; }
54	$prop = join("",split(/-/,$prop));
55
56print <<EOM;
57
58		/* ${prop_name} */
59		case ICAL_${prop}_PROPERTY:
60			switch (param)
61			{
62EOM
63
64	foreach $param (@v)
65	{
66		$param = join("",split(/-/,$param));
67		print "\t\t\t\tcase ICAL_${param}_PARAMETER:\n";
68	}
69
70print <<EOM;
71					return 1;
72				default:
73					return 0;
74			}
75
76EOM
77
78}
79
80print <<EOM;
81	}
82
83	return 0;
84}
85EOM
86