Skip to content
Snippets Groups Projects
Select Git revision
  • 7dec8b3721b40ecdcf921418e20f8e8ca7b2e1cf
  • wk2/unstable default
  • fix-raspi-issues-v2-oracular
  • fix-raspi-issues-v2-noble
  • fix-raspi-issues-v2
  • fix-raspi-issues
  • wpe/unstable
  • wpewebkit-2.44
  • berto/wk2/bookworm
  • berto/wk2/bullseye
  • webkitgtk-2.44
  • wk2/experimental
  • wpewebkit-2.42
  • webkitgtk-2.42
  • webkitgtk-2.40
  • wpewebkit-2.40
  • buster
  • webkitgtk-2.38
  • wpewebkit-2.38
  • wpewebkit-2.36
  • webkitgtk-2.36
  • wpe/debian/2.44.1-1
  • wpe/upstream/2.44.1
  • debian/2.44.1-1
  • upstream/2.44.1
  • debian/2.44.0-2
  • debian/2.44.0-1
  • upstream/2.44.0
  • debian/2.43.4-2
  • debian/2.42.5-2
  • wpe/debian/2.42.5-1.2
  • wpe/debian/2.42.5-2_exp
  • wpe/debian/2.42.5-1.1
  • debian/2.42.5-1_deb11u1
  • debian/2.42.5-1_deb12u1
  • wpe/debian/2.42.5-1
  • wpe/upstream/2.42.5
  • debian/2.42.5-1
  • upstream/2.42.5
  • debian/2.43.4-1
  • upstream/2.43.4
41 results

create_hash_table

Blame
  • Forked from WebKit / webkit
    Source project has a limited visibility.
    create_hash_table 10.11 KiB
    #! /usr/bin/perl -w
    #
    # Static Hashtable Generator
    #
    # (c) 2000-2002 by Harri Porten <porten@kde.org> and
    #                  David Faure <faure@kde.org>
    # Modified (c) 2004 by Nikolas Zimmermann <wildfox@kde.org>
    # Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
    #
    # This library is free software; you can redistribute it and/or
    # modify it under the terms of the GNU Lesser General Public
    # License as published by the Free Software Foundation; either
    # version 2 of the License, or (at your option) any later version.
    #
    # This library is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    # Lesser General Public License for more details.
    #
    # You should have received a copy of the GNU Lesser General Public
    # License along with this library; if not, write to the Free Software
    # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    #
    
    use strict;
    
    my $file = $ARGV[0];
    shift;
    my $includelookup = 0;
    
    # Use -i as second argument to make it include "Lookup.h"
    $includelookup = 1 if (defined($ARGV[0]) && $ARGV[0] eq "-i");
    
    # Use -n as second argument to make it use the third argument as namespace parameter ie. -n KDOM
    my $useNameSpace = $ARGV[1] if (defined($ARGV[0]) && $ARGV[0] eq "-n");
    
    print STDERR "Creating hashtable for $file\n";
    open(IN, $file) or die "No such file $file";
    
    my @keys = ();
    my @attrs = ();
    my @values = ();
    my @hashes = ();
    my @table = ();
    my @links = ();
    
    my $hasSetter = "false";
    
    my $inside = 0;
    my $name;
    my $pefectHashSize;
    my $compactSize;
    my $compactHashSizeMask;
    my $banner = 0;
    sub calcPerfectHashSize();
    sub calcCompactHashSize();
    sub output();
    sub jsc_ucfirst($);
    sub hashValue($);
    
    while (<IN>) {
        chomp;
        s/^\s+//;
        next if /^\#|^$/; # Comment or blank line. Do nothing.
        if (/^\@begin/ && !$inside) {
            if (/^\@begin\s*([:_\w]+)\s*\d*\s*$/) {
                $inside = 1;
                $name = $1;
            } else {
                print STDERR "WARNING: \@begin without table name, skipping $_\n";