gecko-dev/xpcom/ds/moz.build
Eric Rahm 65313fd340 Bug 1380154 - Part 1: Add the Chromium DAFSA generator. r=njn
This imports Chromium's `make_dafsa.py` script [1]. It takes in a gperf
formatted file (note: gperf is *not* required) and converts that to a compact
binary representation of the string data in the form of a deterministic
acyclic finite state automaton (DAFSA) [2].

The only change made to the script was to make it handle the arguments our
file generation script passes in to the `main` function.

It also imports the logic for traversing the DAFSA [3] almost verbatim in
`Dafsa.cpp`. A thin wrapper was added so that we can reuse the DAFSA structure
for multiple tables.

The only change made to the original logic was to swap in mozilla style
assertions and rename the not found constant from `kNotFound` to
`Dafsa::kKeyNotFound` in order to avoid a collision with `kNotFound` defined in
our nsString code.

[1] 6ba04a9056/tools/dafsa/make_dafsa.py
[2] https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton
[3] a2a90a35aa/net/base/registry_controlled_domains/registry_controlled_domain.cc (72)

MozReview-Commit-ID: Eion9POHZm5
2017-07-17 16:09:42 -07:00

131 lines
3.0 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIArray.idl',
'nsIArrayExtensions.idl',
'nsIAtom.idl',
'nsIAtomService.idl',
'nsIHashable.idl',
'nsIINIParser.idl',
'nsIMutableArray.idl',
'nsIObserver.idl',
'nsIObserverService.idl',
'nsIPersistentProperties2.idl',
'nsIProperties.idl',
'nsIProperty.idl',
'nsIPropertyBag.idl',
'nsIPropertyBag2.idl',
'nsISerializable.idl',
'nsISimpleEnumerator.idl',
'nsIStringEnumerator.idl',
'nsISupportsIterators.idl',
'nsISupportsPrimitives.idl',
'nsIVariant.idl',
'nsIWritablePropertyBag.idl',
'nsIWritablePropertyBag2.idl',
]
if CONFIG['OS_ARCH'] == 'WINNT':
XPIDL_SOURCES += [
'nsIWindowsRegKey.idl',
]
EXPORTS += ['nsWindowsRegKey.h']
SOURCES += [
'nsWindowsRegKey.cpp'
]
XPIDL_MODULE = 'xpcom_ds'
EXPORTS += [
'nsArray.h',
'nsArrayEnumerator.h',
'nsArrayUtils.h',
'nsAtomService.h',
'nsBaseHashtable.h',
'nsCharSeparatedTokenizer.h',
'nsCheapSets.h',
'nsClassHashtable.h',
'nsCOMArray.h',
'nsCRT.h',
'nsDataHashtable.h',
'nsDeque.h',
'nsEnumeratorUtils.h',
'nsExpirationTracker.h',
'nsHashKeys.h',
'nsHashPropertyBag.h',
'nsInterfaceHashtable.h',
'nsJSThingHashtable.h',
'nsMathUtils.h',
'nsPointerHashKeys.h',
'nsQuickSort.h',
'nsRefPtrHashtable.h',
'nsStaticAtom.h',
'nsStaticNameTable.h',
'nsStringEnumerator.h',
'nsSupportsPrimitives.h',
'nsTArray-inl.h',
'nsTArray.h',
'nsTArrayForwardDeclare.h',
'nsTHashtable.h',
'nsTObserverArray.h',
'nsTPriorityQueue.h',
'nsVariant.h',
'nsWhitespaceTokenizer.h',
'PLDHashTable.h',
]
EXPORTS.mozilla += [
'ArenaAllocator.h',
'ArenaAllocatorExtensions.h',
'ArrayIterator.h',
'Dafsa.h',
'IncrementalTokenizer.h',
'Observer.h',
'StickyTimeDuration.h',
'Tokenizer.h',
]
UNIFIED_SOURCES += [
'Dafsa.cpp',
'IncrementalTokenizer.cpp',
'nsArray.cpp',
'nsArrayEnumerator.cpp',
'nsArrayUtils.cpp',
'nsAtomService.cpp',
'nsAtomTable.cpp',
'nsCOMArray.cpp',
'nsCRT.cpp',
'nsDeque.cpp',
'nsEnumeratorUtils.cpp',
'nsHashPropertyBag.cpp',
'nsINIParserImpl.cpp',
'nsObserverList.cpp',
'nsObserverService.cpp',
'nsPersistentProperties.cpp',
'nsProperties.cpp',
'nsQuickSort.cpp',
'nsStaticNameTable.cpp',
'nsStringEnumerator.cpp',
'nsSupportsPrimitives.cpp',
'nsTArray.cpp',
'nsTObserverArray.cpp',
'nsVariant.cpp',
'PLDHashTable.cpp',
'Tokenizer.cpp',
]
EXTRA_COMPONENTS += [
'nsINIProcessor.js',
'nsINIProcessor.manifest',
]
LOCAL_INCLUDES += [
'../io',
]
FINAL_LIBRARY = 'xul'