~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/config/make-atom-strings.pl

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! perl
 
2
# This Source Code Form is subject to the terms of the Mozilla Public
 
3
# License, v. 2.0. If a copy of the MPL was not distributed with this
 
4
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
5
 
 
6
 
 
7
# Converts a list of atoms in the form:
 
8
# // OUTPUT_CLASS=<classname>
 
9
# // MACRO_NAME=<macro>
 
10
# <macroname>(atomName, "String")
 
11
# <macroname>(atomName2, "String2")
 
12
#
 
13
# into a file suitable for gperf using static atoms
 
14
#
 
15
# usage:
 
16
# make-atom-strings < file.h > file.gperf
 
17
#
 
18
# the lines in the C++ comments define two variables:
 
19
# OUTPUT_CLASS is the class who has all the atoms as members
 
20
# MACRO_NAME is the macro to look for in the rest of the file
 
21
#
 
22
# for example
 
23
# // OUTPUT_CLASS=nsHTMLAtoms
 
24
# // MACRO_NAME=HTML_ATOM
 
25
# HTML_ATOM(a, "a")
 
26
# HTML_ATOM(body, "body")
 
27
#
 
28
# etc...
 
29
#
 
30
# this will generate a file that looks like:
 
31
# struct nsStaticAtom ( const char* mValue; nsIAtom** aAtom; }
 
32
# %%
 
33
# "a", &nsHTMLAtoms::a
 
34
# "body", &nsHTMLAtoms::body
 
35
#
 
36
# etc...
 
37
#
 
38
# the output can be plugged into gperf to generate a perfect hash
 
39
 
 
40
print "struct nsStaticAtom {const char* mValue; nsIAtom** aAtom; };\n";
 
41
print "%%\n";
 
42
 
 
43
my $classname, $macroname;
 
44
 
 
45
while (<>) {
 
46
  chop;
 
47
  if (/OUTPUT_CLASS=(\S+)/) {
 
48
    $classname=$1;
 
49
  } elsif (/MACRO_NAME=(\S+)/) {
 
50
    $macroname=$1;
 
51
  }
 
52
  elsif ($classname && $macroname &&
 
53
         /$macroname\((\S+),\s*\"(.*?)\"\s*\)/) {
 
54
    my ($str, $atom) = ($2, $1);
 
55
    print "\"$str\", (nsIAtom**)&${classname}::$atom\n";
 
56
  }
 
57
}