• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/perl
2
3print <<HEAD
4/***************************************************************************
5 *                                  _   _ ____  _
6 *  Project                     ___| | | |  _ \| |
7 *                             / __| | | | |_) | |
8 *                            | (__| |_| |  _ <| |___
9 *                             \___|\___/|_| \_\_____|
10 *
11 * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
12 *
13 * This software is licensed as described in the file COPYING, which
14 * you should have received as part of this distribution. The terms
15 * are also available at https://curl.se/docs/copyright.html.
16 *
17 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
18 * copies of the Software, and permit persons to whom the Software is
19 * furnished to do so, under the terms of the COPYING file.
20 *
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
23 *
24 ***************************************************************************/
25
26/* This source code is generated by optiontable.pl - DO NOT EDIT BY HAND */
27
28#include "curl_setup.h"
29#include "easyoptions.h"
30
31/* all easy setopt options listed in alphabetical order */
32struct curl_easyoption Curl_easyopts[] = {
33HEAD
34    ;
35
36my $lastnum=0;
37
38while(<STDIN>) {
39    if(/^ *CURLOPT\(([^,]*), ([^,]*), (\d+)\)/) {
40        my($opt, $type, $num)=($1,$2,$3);
41        my $name;
42        my $ext = $type;
43
44        if($opt =~ /OBSOLETE/) {
45            # skip obsolete options
46            next;
47        }
48
49        if($opt =~ /^CURLOPT_(.*)/) {
50            $name=$1;
51        }
52        $ext =~ s/CURLOPTTYPE_//;
53        $ext =~ s/CBPOINT/CBPTR/;
54        $ext =~ s/POINT\z//;
55        $type = "CURLOT_$ext";
56
57        $opt{$name} = $opt;
58        $type{$name} = $type;
59        push @names, $name;
60        if($num < $lastnum) {
61            print STDERR "ERROR: $opt has bad number\n";
62            exit 2;
63        }
64        else {
65            $lastnum = $num;
66        }
67    }
68
69    # alias for an older option
70    # old = new
71    if(/^#define (CURLOPT_[^ ]*) *(CURLOPT_\S*)/) {
72        my ($o, $n)=($1, $2);
73        # skip obsolete ones
74        if($n !~ /OBSOLETE/) {
75            $o =~ s/^CURLOPT_//;
76            $n =~ s/^CURLOPT_//;
77            $alias{$o} = $n;
78            push @names, $o,
79        }
80    }
81}
82
83
84for my $name (sort @names) {
85    my $oname = $name;
86    my $a = $alias{$name};
87    my $flag = "0";
88    if($a) {
89        $name = $alias{$name};
90        $flag = "CURLOT_FLAG_ALIAS";
91    }
92    $o = sprintf("  {\"%s\", %s, %s, %s},\n",
93                 $oname, $opt{$name}, $type{$name}, $flag);
94    if(length($o) < 80) {
95        print $o;
96    }
97    else {
98        printf("  {\"%s\", %s,\n   %s, %s},\n",
99                 $oname, $opt{$name}, $type{$name}, $flag);
100    }
101}
102
103print <<FOOT
104  {NULL, CURLOPT_LASTENTRY, 0, 0} /* end of table */
105};
106
107#ifdef DEBUGBUILD
108/*
109 * Curl_easyopts_check() is a debug-only function that returns non-zero
110 * if this source file is not in sync with the options listed in curl/curl.h
111 */
112int Curl_easyopts_check(void)
113{
114  return (CURLOPT_LASTENTRY != ($lastnum + 1));
115}
116#endif
117FOOT
118    ;
119