Skip to content
Snippets Groups Projects
Select Git revision
  • debian/0.9-1
  • debian/master default protected
  • pristine-tar
  • upstream
  • upstream/0.9
  • debian/0.8-1
  • upstream/0.8
  • debian/0.7-2
  • debian/0.7-1
  • upstream/0.7
  • debian/0.6-2
  • debian/0.6-1
  • upstream/0.6
13 results

changelog

Blame
  • To find the state of this project's repository at the time of any of these versions, check out the tags.
    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";